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
:label="t('fields.replicas')"
path="replicas"
v-show="['replicated', 'replicated-job'].includes(model.mode)"
v-if="['replicated', 'replicated-job'].includes(model.mode)"
>
<n-input-number
:placeholder="t('fields.replicas')"
@ -564,13 +564,13 @@ const showMore = ref(false);
const rules: any = {
name: requiredRule(),
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')),
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')),
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')),
};
const mountTypeOptions = [

View File

@ -1,7 +1,7 @@
import { isRef, onMounted, reactive } from "vue"
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({
loading: false,
data: [],
@ -42,7 +42,9 @@ export function useDataTable(loader: Function, filter: Object | Function) {
fetchData()
}
onMounted(fetchData)
if (autoFetch) {
onMounted(fetchData)
}
return { state, pagination, fetchData, changePageSize }
}