mirror of
https://github.com/simon987/sist2.git
synced 2025-04-19 18:26:43 +00:00
Add button for full reindex, fixes #403
This commit is contained in:
parent
6ade3395d5
commit
ffa7f2ae84
@ -89,9 +89,12 @@ class Sist2AdminApi {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} name
|
* @param {string} name
|
||||||
|
* @param {bool} full
|
||||||
*/
|
*/
|
||||||
runJob(name) {
|
runJob(name, full) {
|
||||||
return axios.get(`${this.baseUrl}/api/job/${name}/run`);
|
return axios.get(`${this.baseUrl}/api/job/${name}/run`, {
|
||||||
|
params: {full}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -8,6 +8,7 @@ export default {
|
|||||||
view: "View",
|
view: "View",
|
||||||
delete: "Delete",
|
delete: "Delete",
|
||||||
runNow: "Index now",
|
runNow: "Index now",
|
||||||
|
runNowFull: "Full re-index",
|
||||||
create: "Create",
|
create: "Create",
|
||||||
cancel: "Cancel",
|
cancel: "Cancel",
|
||||||
test: "Test",
|
test: "Test",
|
||||||
|
@ -6,7 +6,19 @@
|
|||||||
</b-card-title>
|
</b-card-title>
|
||||||
|
|
||||||
<div class="mb-3">
|
<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>
|
<b-button variant="danger" @click="deleteJob()">{{ $t("delete") }}</b-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -69,6 +81,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
loading: true,
|
loading: true,
|
||||||
job: null,
|
job: null,
|
||||||
|
console: console
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -78,8 +91,8 @@ export default {
|
|||||||
update() {
|
update() {
|
||||||
Sist2AdminApi.updateJob(this.getName(), this.job);
|
Sist2AdminApi.updateJob(this.getName(), this.job);
|
||||||
},
|
},
|
||||||
runJob() {
|
runJob(full = false) {
|
||||||
Sist2AdminApi.runJob(this.getName()).then(() => {
|
Sist2AdminApi.runJob(this.getName(), full).then(() => {
|
||||||
this.$bvToast.toast(this.$t("runJobConfirmation"), {
|
this.$bvToast.toast(this.$t("runJobConfirmation"), {
|
||||||
title: this.$t("runJobConfirmationTitle"),
|
title: this.$t("runJobConfirmationTitle"),
|
||||||
variant: "success",
|
variant: "success",
|
||||||
|
@ -169,11 +169,14 @@ def _run_job(job: Sist2Job):
|
|||||||
|
|
||||||
|
|
||||||
@app.get("/api/job/{name:str}/run")
|
@app.get("/api/job/{name:str}/run")
|
||||||
async def run_job(name: str):
|
async def run_job(name: str, full: bool = False):
|
||||||
job = db["jobs"][name]
|
job: Sist2Job = db["jobs"][name]
|
||||||
if not job:
|
if not job:
|
||||||
raise HTTPException(status_code=404)
|
raise HTTPException(status_code=404)
|
||||||
|
|
||||||
|
if full:
|
||||||
|
job.do_full_scan = True
|
||||||
|
|
||||||
_run_job(job)
|
_run_job(job)
|
||||||
|
|
||||||
return "ok"
|
return "ok"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user