Add button for full reindex, fixes #403

This commit is contained in:
simon987 2023-10-20 20:47:15 -04:00 committed by simon987
parent 6ade3395d5
commit ffa7f2ae84
4 changed files with 27 additions and 7 deletions

View File

@ -89,9 +89,12 @@ class Sist2AdminApi {
/**
* @param {string} name
* @param {bool} full
*/
runJob(name) {
return axios.get(`${this.baseUrl}/api/job/${name}/run`);
runJob(name, full) {
return axios.get(`${this.baseUrl}/api/job/${name}/run`, {
params: {full}
});
}
/**

View File

@ -8,6 +8,7 @@ export default {
view: "View",
delete: "Delete",
runNow: "Index now",
runNowFull: "Full re-index",
create: "Create",
cancel: "Cancel",
test: "Test",

View File

@ -6,7 +6,19 @@
</b-card-title>
<div class="mb-3">
<b-button class="mr-1" variant="primary" @click="runJob()" :disabled="!valid">{{ $t("runNow") }}</b-button>
<b-dropdown
split
split-variant="primary"
variant="primary"
:text="$t('runNow')"
class="mr-1"
:disabled="!valid"
@click="runJob()"
>
<b-dropdown-item href="#" @click="runJob(true)">{{ $t("runNowFull") }}</b-dropdown-item>
</b-dropdown>
<b-button variant="danger" @click="deleteJob()">{{ $t("delete") }}</b-button>
</div>
@ -69,6 +81,7 @@ export default {
return {
loading: true,
job: null,
console: console
}
},
methods: {
@ -78,8 +91,8 @@ export default {
update() {
Sist2AdminApi.updateJob(this.getName(), this.job);
},
runJob() {
Sist2AdminApi.runJob(this.getName()).then(() => {
runJob(full = false) {
Sist2AdminApi.runJob(this.getName(), full).then(() => {
this.$bvToast.toast(this.$t("runJobConfirmation"), {
title: this.$t("runJobConfirmationTitle"),
variant: "success",

View File

@ -169,11 +169,14 @@ def _run_job(job: Sist2Job):
@app.get("/api/job/{name:str}/run")
async def run_job(name: str):
job = db["jobs"][name]
async def run_job(name: str, full: bool = False):
job: Sist2Job = db["jobs"][name]
if not job:
raise HTTPException(status_code=404)
if full:
job.do_full_scan = True
_run_job(job)
return "ok"