Skip to content

Commit

Permalink
feat(webui): reAnalyze library
Browse files Browse the repository at this point in the history
closes #51
  • Loading branch information
gotson committed Jan 6, 2020
1 parent fa65e94 commit b599b72
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
16 changes: 16 additions & 0 deletions komga-webui/src/components/BrowseLibraries.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@
</v-list-item>
</v-list>
</v-menu>

<v-menu offset-y v-if="libraryId !== 0">
<template v-slot:activator="{ on }">
<v-btn icon v-on="on">
<v-icon>mdi-dots-vertical</v-icon>
</v-btn>
</template>
<v-list>
<v-list-item @click="analyze()">
<v-list-item-title>Analyze</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</v-toolbar>

<v-container fluid class="px-6">
Expand Down Expand Up @@ -242,6 +255,9 @@ export default Vue.extend({
} else {
return 'All libraries'
}
},
analyze () {
this.$komgaLibraries.analyzeLibrary(this.libraryId)
}
}
})
Expand Down
12 changes: 12 additions & 0 deletions komga-webui/src/services/komga-libraries.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,16 @@ export default class KomgaLibrariesService {
throw new Error(msg)
}
}

async analyzeLibrary (libraryId: number) {
try {
await this.http.post(`${API_LIBRARIES}/${libraryId}/analyze`)
} catch (e) {
let msg = `An error occurred while trying to analyze library`
if (e.response.data.message) {
msg += `: ${e.response.data.message}`
}
throw new Error(msg)
}
}
}

0 comments on commit b599b72

Please sign in to comment.