prefect-ui-library icon indicating copy to clipboard operation
prefect-ui-library copied to clipboard

Use stable sendTo value source in NotificationDetails.vue

Open AutumnSun1996 opened this issue 1 year ago • 0 comments

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: image

Using postgresql: image

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.

AutumnSun1996 avatar May 28 '23 14:05 AutumnSun1996