mirror of
https://github.com/rustfs/console.git
synced 2026-09-21 14:19:08 +08:00
fix: ak sk permanent validity rustfs/rustfs#897
This commit is contained in:
@@ -47,7 +47,8 @@ async function openDialog(row: any) {
|
||||
formModel.accesskey = row.accessKey
|
||||
const policyValue = typeof res.policy === 'string' ? res.policy : JSON.stringify(res.policy ?? {})
|
||||
formModel.policy = policyValue
|
||||
formModel.expiry = res.expiration ? dayjs(res.expiration).toISOString() : null
|
||||
formModel.expiry =
|
||||
res.expiration && res.expiration !== '9999-01-01T00:00:00Z' ? dayjs(res.expiration).toISOString() : null
|
||||
formModel.name = res.name ?? ''
|
||||
formModel.description = res.description ?? ''
|
||||
formModel.status = res.accountStatus ?? 'on'
|
||||
@@ -78,7 +79,7 @@ async function submitForm() {
|
||||
newStatus: formModel.status,
|
||||
newName: formModel.name,
|
||||
newDescription: formModel.description,
|
||||
newExpiration: formModel.expiry ? dayjs(formModel.expiry).toISOString() : undefined,
|
||||
newExpiration: formModel.expiry ? dayjs(formModel.expiry).toISOString() : '9999-01-01T00:00:00Z',
|
||||
})
|
||||
message.success(t('Updated successfully'))
|
||||
closeModal()
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
<FieldLabel for="create-expiry">{{ t('Expiry') }}</FieldLabel>
|
||||
<FieldLabel for="create-expiry">{{ t('Expiry') }}({{ t('empty is indicates permanent validity') }})</FieldLabel>
|
||||
<FieldContent>
|
||||
<DateTimePicker
|
||||
id="create-expiry"
|
||||
@@ -181,15 +181,16 @@ function validate() {
|
||||
errors.secretKey = t('Secret Key length must be between 8 and 40 characters')
|
||||
}
|
||||
|
||||
if (!formModel.expiry) {
|
||||
errors.expiry = t('Please select expiry date')
|
||||
}
|
||||
// remove expiry validation
|
||||
// if (!formModel.expiry) {
|
||||
// errors.expiry = t('Please select expiry date')
|
||||
// }
|
||||
|
||||
if (!formModel.name) {
|
||||
errors.name = t('Please enter name')
|
||||
}
|
||||
|
||||
return !errors.accessKey && !errors.secretKey && !errors.expiry && !errors.name
|
||||
return !errors.accessKey && !errors.secretKey && !errors.name
|
||||
}
|
||||
|
||||
async function submitForm() {
|
||||
@@ -214,7 +215,7 @@ async function submitForm() {
|
||||
const payload = {
|
||||
...formModel,
|
||||
policy: customPolicy,
|
||||
expiration: formModel.expiry,
|
||||
expiration: formModel.expiry ? formModel.expiry : '9999-01-01T00:00:00.000Z',
|
||||
}
|
||||
|
||||
const res = await createServiceAccount(payload)
|
||||
|
||||
@@ -152,7 +152,8 @@ watch(
|
||||
formModel.name = props.user.name ?? ''
|
||||
formModel.description = props.user.description ?? ''
|
||||
formModel.impliedPolicy = props.user.impliedPolicy ?? true
|
||||
formModel.expiry = props.user.expiration ?? null
|
||||
formModel.expiry =
|
||||
props.user.expiration && props.user.expiration !== '9999-01-01T00:00:00Z' ? props.user.expiration : null
|
||||
formModel.policy = props.user.policy ?? '{}'
|
||||
formModel.accountStatus = props.user.accountStatus ?? 'on'
|
||||
loadParentPolicy()
|
||||
@@ -174,10 +175,10 @@ const cancelEdit = () => {
|
||||
}
|
||||
|
||||
const validateForm = () => {
|
||||
if (!formModel.expiry) {
|
||||
message.error(t('Please select expiration date'))
|
||||
return false
|
||||
}
|
||||
// if (!formModel.expiry) {
|
||||
// message.error(t('Please select expiration date'))
|
||||
// return false
|
||||
// }
|
||||
if (!formModel.impliedPolicy) {
|
||||
try {
|
||||
JSON.parse(formModel.policy || '{}')
|
||||
|
||||
@@ -212,7 +212,7 @@ watch(searchTerm, value => {
|
||||
})
|
||||
|
||||
const formatExpiration = (value?: string) => {
|
||||
if (!value) return '-'
|
||||
if (!value || value == '9999-01-01T00:00:00Z') return '-'
|
||||
const date = dayjs(value)
|
||||
if (!date.isValid()) return '-'
|
||||
return date.format('YYYY-MM-DD HH:mm')
|
||||
@@ -305,10 +305,10 @@ const validateForm = () => {
|
||||
message.error(t('Secret Key length must be between 8 and 40 characters'))
|
||||
return false
|
||||
}
|
||||
if (!formModel.expiry) {
|
||||
message.error(t('Please select expiration date'))
|
||||
return false
|
||||
}
|
||||
// if (!formModel.expiry) {
|
||||
// message.error(t('Please select expiration date'))
|
||||
// return false
|
||||
// }
|
||||
if (!formModel.impliedPolicy) {
|
||||
try {
|
||||
JSON.parse(formModel.policy || '{}')
|
||||
@@ -336,7 +336,7 @@ const submitForm = async () => {
|
||||
...formModel,
|
||||
targetUser: props.user.accessKey,
|
||||
policy: formModel.impliedPolicy ? null : JSON.stringify(JSON.parse(formModel.policy || '{}')),
|
||||
expiration: formModel.expiry ? new Date(formModel.expiry).toISOString() : null,
|
||||
expiration: formModel.expiry ? new Date(formModel.expiry).toISOString() : '9999-01-01T00:00:00.000Z',
|
||||
}
|
||||
const res = await createServiceAccount(payload)
|
||||
message.success(t('Add Success'))
|
||||
|
||||
@@ -866,5 +866,6 @@
|
||||
"API request failed": "API request failed",
|
||||
"Operation failed": "Operation failed",
|
||||
"Create a user to get started": "Create a user to get started",
|
||||
"Get Notification Config Failed": "Get Notification Config Failed"
|
||||
"Get Notification Config Failed": "Get Notification Config Failed",
|
||||
"empty is indicates permanent validity": "empty is indicates permanent validity"
|
||||
}
|
||||
|
||||
@@ -866,5 +866,6 @@
|
||||
"API request failed": "API isteği başarısız",
|
||||
"Operation failed": "İşlem başarısız",
|
||||
"Create a user to get started": "Başlamak için bir kullanıcı oluşturun",
|
||||
"Get Notification Config Failed": "Bildirim Yapılandırması Alınamadı"
|
||||
"Get Notification Config Failed": "Bildirim Yapılandırması Alınamadı",
|
||||
"empty is indicates permanent validity": "boş, kalıcı geçerlilik gösterir"
|
||||
}
|
||||
|
||||
@@ -866,5 +866,6 @@
|
||||
"API request failed": "API 请求失败",
|
||||
"Operation failed": "操作失败",
|
||||
"Create a user to get started": "开始创建一个用户",
|
||||
"Get Notification Config Failed": "获取通知配置失败"
|
||||
"Get Notification Config Failed": "获取通知配置失败",
|
||||
"empty is indicates permanent validity": "空表示永久有效"
|
||||
}
|
||||
|
||||
@@ -93,7 +93,12 @@ const columns: ColumnDef<RowData>[] = [
|
||||
accessorKey: 'expiration',
|
||||
header: () => t('Expiration'),
|
||||
cell: ({ row }) =>
|
||||
h('span', row.original.expiration ? dayjs(row.original.expiration).format('YYYY-MM-DD HH:mm') : '-'),
|
||||
h(
|
||||
'span',
|
||||
row.original.expiration && row.original.expiration !== '9999-01-01T00:00:00Z'
|
||||
? dayjs(row.original.expiration).format('YYYY-MM-DD HH:mm')
|
||||
: '-'
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: 'accountStatus',
|
||||
|
||||
Reference in New Issue
Block a user