mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-25 08:00:59 +00:00
feat(frontend): added a name blacklist for flow inputs
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
import Portal from 'svelte-portal'
|
||||
|
||||
export let isFlowInput = false
|
||||
export let blacklistedNames: string[] = []
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
@@ -374,5 +375,6 @@
|
||||
on:save={(e) => handleAddOrEditArgument(e.detail)}
|
||||
bind:editing
|
||||
bind:oldArgName
|
||||
{blacklistedNames}
|
||||
/>
|
||||
</Portal>
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
export let editing = false
|
||||
export let oldArgName: string | undefined = undefined
|
||||
export let isFlowInput = false
|
||||
export let blacklistedNames: string[] = []
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
let drawer: Drawer
|
||||
@@ -80,12 +81,21 @@
|
||||
let property: ModalSchemaProperty = DEFAULT_PROPERTY
|
||||
|
||||
function handleKeyUp(event: KeyboardEvent) {
|
||||
validateName(property.name)
|
||||
const key = event.key
|
||||
if (key === 'Enter') {
|
||||
dispatch('save', property)
|
||||
}
|
||||
}
|
||||
|
||||
function validateName(name: string) {
|
||||
if (blacklistedNames.includes(name.toLowerCase())) {
|
||||
error = 'This name is not allowed.'
|
||||
} else {
|
||||
error = ''
|
||||
}
|
||||
}
|
||||
|
||||
export function openDrawer(nproperty: ModalSchemaProperty): void {
|
||||
drawer.openDrawer()
|
||||
property = nproperty
|
||||
|
||||
@@ -87,6 +87,7 @@
|
||||
on:change={() => {
|
||||
$flowStore = $flowStore
|
||||
}}
|
||||
blacklistedNames={['iter']}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user