mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-27 03:54:57 +02:00
UBER-462: prevent creating existing enum value and disable the button in that case (#3465)
Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
|
||||
async function add () {
|
||||
if (newValue.trim().length === 0) return
|
||||
if (value.enumValues.includes(newValue.trim())) return
|
||||
await client.update(value, {
|
||||
$push: { enumValues: newValue }
|
||||
})
|
||||
@@ -123,7 +124,13 @@
|
||||
bind:value={newValue}
|
||||
/>
|
||||
<div class="flex gap-2">
|
||||
<ActionIcon icon={IconAdd} label={setting.string.Add} action={add} size={'small'} />
|
||||
<ActionIcon
|
||||
icon={IconAdd}
|
||||
label={setting.string.Add}
|
||||
action={add}
|
||||
size={'small'}
|
||||
disabled={value.enumValues.includes(newValue.trim())}
|
||||
/>
|
||||
|
||||
<ActionIcon
|
||||
icon={IconAttachment}
|
||||
|
||||
Reference in New Issue
Block a user