@prefecthq/prefect-ui-library 3.9.0 → 3.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,8 @@
1
+ import { FlowRun } from '../models';
1
2
  declare function __VLS_template(): {
2
3
  slots: {
3
4
  default?(_: {
4
- flowRun: import("../models").FlowRun | undefined;
5
+ flowRun: FlowRun;
5
6
  }): any;
6
7
  };
7
8
  refs: {};
@@ -9,15 +10,17 @@ declare function __VLS_template(): {
9
10
  };
10
11
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
11
12
  declare const __VLS_component: import("vue").DefineComponent<__VLS_TypePropsToOption<{
12
- flowRunId: string;
13
+ flowRun: FlowRun;
13
14
  showAll?: boolean;
14
15
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
16
  delete: (...args: any[]) => void;
17
+ update: (...args: any[]) => void;
16
18
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
17
- flowRunId: string;
19
+ flowRun: FlowRun;
18
20
  showAll?: boolean;
19
21
  }>>> & {
20
22
  onDelete?: ((...args: any[]) => any) | undefined;
23
+ onUpdate?: ((...args: any[]) => any) | undefined;
21
24
  }, {}, {}>;
22
25
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
23
26
  export default _default;
@@ -203,9 +203,7 @@ export declare function useSchemaPropertyInput(schemaProperty: MaybeRefOrGetter<
203
203
  "onUpdate:value"?: ((args_0: import("../../schemas/types/schemaValues").PrefectKindWorkspaceVariable) => any) | undefined;
204
204
  }, never>, ""> & Record<string, unknown>;
205
205
  } | {
206
- component: () => {
207
- template: string;
208
- };
206
+ component: () => string;
209
207
  props?: (Omit<unknown, ""> & Record<string, unknown>) | undefined;
210
208
  }>;
211
209
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prefecthq/prefect-ui-library",
3
- "version": "3.9.0",
3
+ "version": "3.9.1",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -7,7 +7,7 @@
7
7
  <p-overflow-menu-item v-if="canSuspend && showAll" label="Pause" @click="openSuspendModal" />
8
8
  <p-overflow-menu-item v-if="canCancel && showAll" label="Cancel" @click="openCancelModal" />
9
9
  <p-overflow-menu-item v-if="canChangeState" label="Change state" @click="openChangeStateModal" />
10
- <copy-overflow-menu-item label="Copy ID" :item="flowRunId" />
10
+ <copy-overflow-menu-item label="Copy ID" :item="flowRun.id" />
11
11
  <p-overflow-menu-item v-if="can.delete.flow_run" label="Delete" @click="openDeleteModal" />
12
12
 
13
13
  <slot v-bind="{ flowRun }" />
@@ -21,16 +21,16 @@
21
21
  :flow-run="flowRun"
22
22
  />
23
23
 
24
- <FlowRunResumeModal v-model:showModal="showResumeModal" :flow-run-id="flowRunId" />
24
+ <FlowRunResumeModal v-model:showModal="showResumeModal" :flow-run-id="flowRun.id" />
25
25
 
26
26
  <FlowRunCancelModal
27
27
  v-model:showModal="showCancelModal"
28
- :flow-run-id="flowRunId"
28
+ :flow-run-id="flowRun.id"
29
29
  @change="showCancelModal"
30
30
  />
31
31
  <FlowRunSuspendModal
32
32
  v-model:showModal="showSuspendModal"
33
- :flow-run-id="flowRunId"
33
+ :flow-run-id="flowRun.id"
34
34
  @change="showSuspendModal"
35
35
  />
36
36
  <ConfirmStateChangeModal
@@ -45,30 +45,29 @@
45
45
  v-model:showModal="showDeleteModal"
46
46
  label="Flow Run"
47
47
  :name="flowRun.name!"
48
- @delete="deleteFlowRun(flowRunId)"
48
+ @delete="deleteFlowRun(flowRun.id)"
49
49
  />
50
50
  </template>
51
51
 
52
52
  <script lang="ts" setup>
53
53
  import { showToast } from '@prefecthq/prefect-design'
54
- import { computed, ref, toRefs } from 'vue'
54
+ import { computed, ref } from 'vue'
55
55
  import { FlowRunRetryModal, FlowRunCancelModal, FlowRunSuspendModal, ConfirmStateChangeModal, ConfirmDeleteModal, CopyOverflowMenuItem } from '@/components'
56
56
  import FlowRunResumeModal from '@/components/FlowRunResumeModal.vue'
57
- import { useCan, useWorkspaceApi, useShowModal, useWorkspaceRoutes, useFlowRuns, useFlowRun, useDeployment } from '@/compositions'
57
+ import { useCan, useWorkspaceApi, useShowModal, useWorkspaceRoutes, useFlowRuns, useDeployment } from '@/compositions'
58
58
  import { localization } from '@/localization'
59
- import { FlowRunsFilter, isPausedStateType, isRunningStateType, isStuckStateType, isTerminalStateType, StateUpdateDetails } from '@/models'
59
+ import { FlowRun, FlowRunsFilter, isPausedStateType, isRunningStateType, isStuckStateType, isTerminalStateType, StateUpdateDetails } from '@/models'
60
60
  import { deleteItem } from '@/utilities'
61
61
  import { getApiErrorMessage } from '@/utilities/errors'
62
62
 
63
63
  const props = defineProps<{
64
- flowRunId: string,
64
+ flowRun: FlowRun,
65
65
  showAll?: boolean,
66
66
  }>()
67
67
 
68
68
  const can = useCan()
69
69
  const api = useWorkspaceApi()
70
70
  const routes = useWorkspaceRoutes()
71
- const { flowRunId } = toRefs(props)
72
71
 
73
72
  const { showModal: showRetryModal, open: openRetryModal } = useShowModal()
74
73
  const { showModal: showResumeModal, open: openResumeModal } = useShowModal()
@@ -79,32 +78,31 @@
79
78
 
80
79
  const retryingRun = ref(false)
81
80
 
82
- const { flowRun, subscription: flowRunSubscription } = useFlowRun(flowRunId, { interval: 3000 })
83
- const { deployment } = useDeployment(() => flowRun.value?.deploymentId)
81
+ const { deployment } = useDeployment(() => props.flowRun.deploymentId)
84
82
 
85
83
  const canRetry = computed(() => {
86
- if (!can.update.flow_run || !flowRun.value?.stateType || !flowRun.value.deploymentId) {
84
+ if (!can.update.flow_run || !props.flowRun.stateType || !props.flowRun.deploymentId) {
87
85
  return false
88
86
  }
89
- return isTerminalStateType(flowRun.value.stateType)
87
+ return isTerminalStateType(props.flowRun.stateType)
90
88
  })
91
89
 
92
90
  const canResume = computed(() => {
93
- if (!can.update.flow_run || !flowRun.value?.stateType) {
91
+ if (!can.update.flow_run || !props.flowRun.stateType) {
94
92
  return false
95
93
  }
96
94
 
97
- return isPausedStateType(flowRun.value.stateType)
95
+ return isPausedStateType(props.flowRun.stateType)
98
96
  })
99
97
 
100
98
  const flowRunFilter = (): FlowRunsFilter | null => {
101
- if (!flowRun.value?.parentTaskRunId) {
99
+ if (!props.flowRun.parentTaskRunId) {
102
100
  return null
103
101
  }
104
102
 
105
103
  return {
106
104
  taskRuns: {
107
- id: [flowRun.value.parentTaskRunId],
105
+ id: [props.flowRun.parentTaskRunId],
108
106
  },
109
107
  }
110
108
  }
@@ -117,31 +115,31 @@
117
115
  return value.id
118
116
  })
119
117
  const canCancel = computed(() => {
120
- if (!can.update.flow_run || !flowRun.value?.stateType || parentFlowRunId.value) {
118
+ if (!can.update.flow_run || !props.flowRun.stateType || parentFlowRunId.value) {
121
119
  return false
122
120
  }
123
- return isStuckStateType(flowRun.value.stateType)
121
+ return isStuckStateType(props.flowRun.stateType)
124
122
  })
125
123
 
126
124
  const canSuspend = computed(() => {
127
- if (!can.update.flow_run || !flowRun.value?.stateType || !flowRun.value.deploymentId) {
125
+ if (!can.update.flow_run || !props.flowRun.stateType || !props.flowRun.deploymentId) {
128
126
  return false
129
127
  }
130
128
 
131
- return isRunningStateType(flowRun.value.stateType)
129
+ return isRunningStateType(props.flowRun.stateType)
132
130
  })
133
131
 
134
132
  const canChangeState = computed(() => {
135
- if (!can.update.flow_run || !flowRun.value?.stateType) {
133
+ if (!can.update.flow_run || !props.flowRun.stateType) {
136
134
  return false
137
135
  }
138
- return isTerminalStateType(flowRun.value.stateType)
136
+ return isTerminalStateType(props.flowRun.stateType)
139
137
  })
140
138
 
141
139
  const changeFlowRunState = async (values: StateUpdateDetails): Promise<void> => {
142
140
  try {
143
- await api.flowRuns.setFlowRunState(props.flowRunId, { state: values })
144
- flowRunSubscription.refresh()
141
+ await api.flowRuns.setFlowRunState(props.flowRun.id, { state: values })
142
+ emit('update')
145
143
  showToast(localization.success.changeFlowRunState, 'success')
146
144
  } catch (error) {
147
145
  console.error(error)
@@ -150,7 +148,7 @@
150
148
  }
151
149
  }
152
150
 
153
- const emit = defineEmits(['delete'])
151
+ const emit = defineEmits(['delete', 'update'])
154
152
 
155
153
  const deleteFlowRun = async (id: string): Promise<void> => {
156
154
  await deleteItem(id, api.flowRuns.deleteFlowRun, 'Flow run')
@@ -33,12 +33,12 @@
33
33
  <template #actions>
34
34
  <template v-if="flowRun">
35
35
  <template v-if="media.sm">
36
- <FlowRunSuspendButton :flow-run="flowRun" />
37
- <FlowRunResumeButton :flow-run="flowRun" />
38
- <FlowRunRetryButton :flow-run="flowRun" />
39
- <FlowRunCancelButton :flow-run="flowRun" />
36
+ <FlowRunSuspendButton :flow-run />
37
+ <FlowRunResumeButton :flow-run />
38
+ <FlowRunRetryButton :flow-run />
39
+ <FlowRunCancelButton :flow-run />
40
40
  </template>
41
- <FlowRunMenu :flow-run-id="flowRun.id" :show-all="!media.sm" @delete="emit('delete')" />
41
+ <FlowRunMenu :flow-run :show-all="!media.sm" @delete="emit('delete')" />
42
42
  </template>
43
43
  </template>
44
44
  </page-heading>
@@ -86,7 +86,7 @@
86
86
  { text: flowRun.value?.name ?? '' },
87
87
  ])
88
88
 
89
- const { flowRun } = useFlowRun(() => props.flowRunId, { interval: 30000 })
89
+ const { flowRun } = useFlowRun(() => props.flowRunId, { interval: 30_000 })
90
90
 
91
91
  const isPending = computed(() => flowRun.value?.stateType ? isPendingStateType(flowRun.value.stateType) : true)
92
92
 
@@ -59,6 +59,6 @@
59
59
  })
60
60
  }
61
61
 
62
- return withProps(() => ({ template: '' }))
62
+ return withProps(() => '')
63
63
  })
64
64
  </script>
@@ -66,7 +66,7 @@ export function useSchemaPropertyInput(schemaProperty: MaybeRefOrGetter<SchemaPr
66
66
  const exhaustive: never = propertyValue.value
67
67
  console.error(new Error(`SchemaFormProperty input is not exhaustive: ${JSON.stringify(exhaustive)}`))
68
68
 
69
- return withProps(() => ({ template: '' }))
69
+ return withProps(() => '')
70
70
  })
71
71
 
72
72
  return { input }