Add config interface for tag ignores
parent
3d243252cd
commit
45f20ebfc8
|
|
@ -8,7 +8,7 @@ import TabView from "primevue/tabview";
|
|||
import TabPanel from "primevue/tabpanel";
|
||||
import DataTable from "primevue/datatable";
|
||||
import Column from "primevue/column";
|
||||
import { SzuruSiteConfig, TagCategoryColor, getDefaultTagCategories } from "~/models";
|
||||
import { TagDetails, SzuruSiteConfig, TagCategoryColor, getDefaultTagCategories } from "~/models";
|
||||
import SzurubooruApi from "~/api";
|
||||
|
||||
type StatusType = "success" | "error" | "quiet";
|
||||
|
|
@ -102,6 +102,14 @@ async function importTagCategoriesFromInstance() {
|
|||
}
|
||||
}
|
||||
|
||||
function addTagIgnore() {
|
||||
cfg.value.tagIgnores.push(new TagDetails([""]))
|
||||
}
|
||||
|
||||
function resetTagIgnores() {
|
||||
cfg.value.tagIgnores.splice(0);
|
||||
}
|
||||
|
||||
// For debugging
|
||||
const wnd = window as any;
|
||||
wnd.szc_get_config = () => JSON.parse(JSON.stringify(cfg.value));
|
||||
|
|
@ -311,7 +319,26 @@ wnd.szc_set_config_version = (v = 0) => (cfg.value.version = v);
|
|||
|
||||
<!-- TODO: Tag category colors -->
|
||||
|
||||
<!-- TODO: Tag ignore list -->
|
||||
<div class="grid">
|
||||
<DataTable :value="cfg.tagIgnores" table-class="col-12" style="width: 100%">
|
||||
<Column field="names" :header="'Names'">
|
||||
<template #body="{ data, field }">
|
||||
<input type="text" :name="field" v-model="data[field][0]" />
|
||||
</template>
|
||||
</Column>
|
||||
|
||||
<Column field="remove">
|
||||
<template #body="{ index }">
|
||||
<a class="color-primary cursor-pointer" @click="() => cfg.tagIgnores.splice(index, 1)">Remove</a>
|
||||
</template>
|
||||
</Column>
|
||||
</DataTable>
|
||||
|
||||
<div class="col-12 flex flex-wrap grid grid-nogutter gap-1">
|
||||
<button class="primary" @click="addTagIgnore">Add tag</button>
|
||||
<button class="bg-danger sm:ml-auto" @click="resetTagIgnores">Clear</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- TODO: Category ignore list -->
|
||||
</TabPanel>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { defineStore } from "pinia";
|
||||
import deepMerge from "deepmerge";
|
||||
import {
|
||||
type TagDetails,
|
||||
getDefaultTagCategories,
|
||||
type ScrapedPostDetails,
|
||||
type SetPostUploadInfoData,
|
||||
|
|
@ -40,6 +41,7 @@ export const cfg = useStorageLocal(
|
|||
showInstancePicker: true,
|
||||
},
|
||||
tagCategories: [] as Array<TagCategoryColor>,
|
||||
tagIgnores: [] as Array<TagDetails>,
|
||||
},
|
||||
{
|
||||
mergeDefaults(storageValue, defaults) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue