prefect-ui-library
prefect-ui-library copied to clipboard
Use stable sendTo value source in NotificationDetails.vue
https://github.com/PrefectHQ/prefect-ui-library/blob/5ebb04968a6ce55f51ab7fb72d087b15e2bd97f2/src/components/NotificationDetails.vue#L59-L63
Currently, sendTo
in NotificationDetails will use a random value from props.data
for most BlockType, it will cause inconsistecy in different deploy of prefect server instances.
In my PR https://github.com/PrefectHQ/prefect/pull/9547 , which add a CustomWebhookNotificationBlock, both name
and url
can becomes the value displayed at sendTo
depends on database type(postgresql jsonb type will not keep key order of object, which may be the root cause).
Using sqlite:
Using postgresql:
I think it's better to use something like this, so the value source of sendTo
is stable:
// try name, url in order, or blockName is non exists.
value: asArray(
props.data.name ||
props.data.url ||
props.blockType.name
),
Or, still use Object.values(props.data)[0]
in place of props.blockType.name
for backword compatibility.