feat(sj_1.0.0_beta3): 1、修复空间唯一ID格式未校验问题 2、修复普通用户不支持删除问题

This commit is contained in:
opensnail 2024-06-01 14:13:39 +08:00
parent e3bf4f9b2a
commit 17e7278051
9 changed files with 26 additions and 13 deletions

View File

@ -502,7 +502,9 @@ const local: App.I18n.Schema = {
form: { form: {
name: 'Please enter name', name: 'Please enter name',
keyword: 'Please enter name/uniqueId', keyword: 'Please enter name/uniqueId',
uniqueId: 'Please enter Unique ID' uniqueId: 'Please enter Unique ID',
uniqueIdRule:
'Must be between 1 and 64 characters in length. Format: numbers, letters, underscores, or hyphens.'
}, },
addNamespace: 'Add Namespace', addNamespace: 'Add Namespace',
editNamespace: 'Edit Namespace' editNamespace: 'Edit Namespace'

View File

@ -510,7 +510,8 @@ const local: App.I18n.Schema = {
form: { form: {
name: '请输入空间名称', name: '请输入空间名称',
keyword: '请输入空间名称/唯一标识', keyword: '请输入空间名称/唯一标识',
uniqueId: '请输入唯一标识' uniqueId: '请输入唯一标识',
uniqueIdRule: '仅支持长度为:1~64位字符.格式为:数字、字母、下划线、短横线。'
}, },
addNamespace: '新增命名空间', addNamespace: '新增命名空间',
editNamespace: '编辑命名空间' editNamespace: '编辑命名空间'

View File

@ -649,6 +649,7 @@ declare namespace App {
name: string; name: string;
keyword: string; keyword: string;
uniqueId: string; uniqueId: string;
uniqueIdRule: string;
}; };
addNamespace: string; addNamespace: string;
editNamespace: string; editNamespace: string;

View File

@ -27,7 +27,8 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
apiParams: { apiParams: {
page: 1, page: 1,
size: 10, size: 10,
groupName: null groupName: null,
groupStatus: null
}, },
columns: () => [ columns: () => [
{ {

View File

@ -35,6 +35,7 @@ function search() {
v-model:value="model.groupStatus" v-model:value="model.groupStatus"
:placeholder="$t('page.groupConfig.form.groupStatus')" :placeholder="$t('page.groupConfig.form.groupStatus')"
:options="translateOptions(groupConfigStatusOptions)" :options="translateOptions(groupConfigStatusOptions)"
clearable
/> />
</NFormItemGi> </NFormItemGi>
</SearchForm> </SearchForm>

View File

@ -14,15 +14,15 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
apiParams: { apiParams: {
page: 1, page: 1,
size: 10, size: 10,
keyword: undefined keyword: null
}, },
columns: () => [ columns: () => [
{ // {
key: 'index', // key: 'index',
title: $t('common.index'), // title: $t('common.index'),
align: 'center', // align: 'center',
width: 64 // width: 64
}, // },
{ {
key: 'name', key: 'name',
title: $t('page.namespace.name'), title: $t('page.namespace.name'),

View File

@ -49,10 +49,16 @@ function createDefaultModel(): Model {
}; };
} }
type RuleKey = Extract<keyof Model, 'name'>; type RuleKey = Extract<keyof Model, App.Global.FormRule>;
const rules: Record<RuleKey, App.Global.FormRule> = { const rules: Record<RuleKey, App.Global.FormRule> = {
name: defaultRequiredRule name: defaultRequiredRule,
uniqueId: {
required: false,
pattern: /^[A-Za-z0-9_-]{1,64}$/,
trigger: 'change',
message: $t('page.namespace.form.uniqueIdRule')
}
}; };
function handleUpdateModelWhenEdit() { function handleUpdateModelWhenEdit() {

View File

@ -39,6 +39,7 @@ function search() {
v-model:value="model.sceneStatus" v-model:value="model.sceneStatus"
:placeholder="$t('page.jobTask.form.jobStatus')" :placeholder="$t('page.jobTask.form.jobStatus')"
:options="translateOptions(enableStatusNumberOptions)" :options="translateOptions(enableStatusNumberOptions)"
clearable
/> />
</NFormItemGi> </NFormItemGi>
</SearchForm> </SearchForm>

View File

@ -110,7 +110,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
<NButton type="primary" ghost size="small" text onClick={() => edit(row.id!)}> <NButton type="primary" ghost size="small" text onClick={() => edit(row.id!)}>
{$t('common.edit')} {$t('common.edit')}
</NButton> </NButton>
{row.id === '1' ? ( {(row.id as any) !== 1 ? (
<> <>
<n-divider vertical /> <n-divider vertical />
<NPopconfirm onPositiveClick={() => handleDelete(row.id!)}> <NPopconfirm onPositiveClick={() => handleDelete(row.id!)}>