This commit is contained in:
cuigh 2021-12-17 16:33:24 +08:00
parent 6705bd6d64
commit 94127504ff
2 changed files with 8 additions and 6 deletions

View File

@ -31,7 +31,7 @@
<n-form-item-gi <n-form-item-gi
:label="t('fields.replicas')" :label="t('fields.replicas')"
path="replicas" path="replicas"
v-show="['replicated', 'replicated-job'].includes(model.mode)" v-if="['replicated', 'replicated-job'].includes(model.mode)"
> >
<n-input-number <n-input-number
:placeholder="t('fields.replicas')" :placeholder="t('fields.replicas')"
@ -564,13 +564,13 @@ const showMore = ref(false);
const rules: any = { const rules: any = {
name: requiredRule(), name: requiredRule(),
mounts: customRule((rule: any, value: any[]) => { mounts: customRule((rule: any, value: any[]) => {
return value.every(v => v.source && v.target) return value?.every(v => v.source && v.target)
}, t('tips.mounts_rule')), }, t('tips.mounts_rule')),
configs: customRule((rule: any, value: any[]) => { configs: customRule((rule: any, value: any[]) => {
return value.every(v => v.key && v.path) return value?.every(v => v.key && v.path)
}, t('tips.files_rule')), }, t('tips.files_rule')),
secrets: customRule((rule: any, value: any[]) => { secrets: customRule((rule: any, value: any[]) => {
return value.every(v => v.key && v.path) return value?.every(v => v.key && v.path)
}, t('tips.files_rule')), }, t('tips.files_rule')),
}; };
const mountTypeOptions = [ const mountTypeOptions = [

View File

@ -1,7 +1,7 @@
import { isRef, onMounted, reactive } from "vue" import { isRef, onMounted, reactive } from "vue"
import { t } from "@/locales"; import { t } from "@/locales";
export function useDataTable(loader: Function, filter: Object | Function) { export function useDataTable(loader: Function, filter: Object | Function, autoFetch: boolean = true) {
const state = reactive({ const state = reactive({
loading: false, loading: false,
data: [], data: [],
@ -42,7 +42,9 @@ export function useDataTable(loader: Function, filter: Object | Function) {
fetchData() fetchData()
} }
onMounted(fetchData) if (autoFetch) {
onMounted(fetchData)
}
return { state, pagination, fetchData, changePageSize } return { state, pagination, fetchData, changePageSize }
} }