mirror of
https://github.com/simon987/sist2.git
synced 2025-04-10 14:06:45 +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 {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}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -8,6 +8,7 @@ export default {
|
||||
view: "View",
|
||||
delete: "Delete",
|
||||
runNow: "Index now",
|
||||
runNowFull: "Full re-index",
|
||||
create: "Create",
|
||||
cancel: "Cancel",
|
||||
test: "Test",
|
||||
|
@ -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",
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user