@prefecthq/prefect-ui-library 3.5.5 → 3.5.8

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.
@@ -0,0 +1,16 @@
1
+ import { FlowRun } from '../models/FlowRun';
2
+ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
3
+ flowRun: FlowRun;
4
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
5
+ flowRun: FlowRun;
6
+ }>>>, {}, {}>;
7
+ export default _default;
8
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
9
+ type __VLS_TypePropsToOption<T> = {
10
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
11
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
12
+ } : {
13
+ type: import('vue').PropType<T[K]>;
14
+ required: true;
15
+ };
16
+ };
@@ -1,17 +1,17 @@
1
1
  import { Deployment } from '../models';
2
+ declare let __VLS_typeProps: {
3
+ deployment: Deployment;
4
+ };
5
+ type __VLS_PublicProps = {
6
+ 'showModal': boolean;
7
+ } & typeof __VLS_typeProps;
2
8
  declare function __VLS_template(): {
3
9
  actions?(_: {}): any;
4
10
  };
5
- declare const __VLS_component: import("vue").DefineComponent<__VLS_TypePropsToOption<{
6
- showModal: boolean;
7
- deployment: Deployment;
8
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
- "update:showModal": (value: boolean) => void;
10
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
11
- showModal: boolean;
12
- deployment: Deployment;
13
- }>>> & {
14
- "onUpdate:showModal"?: ((value: boolean) => any) | undefined;
11
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_PublicProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
+ "update:showModal": (showModal: boolean) => void;
13
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_PublicProps>>> & {
14
+ "onUpdate:showModal"?: ((showModal: boolean) => any) | undefined;
15
15
  }, {}, {}>;
16
16
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
17
17
  export default _default;
@@ -27,4 +27,5 @@ export declare class WorkspaceFlowRunsApi extends WorkspaceApi {
27
27
  resumeFlowRun(id: string, values?: SchemaValues): Promise<OrchestrationResult>;
28
28
  resumeFlowRunV2(id: string, values: SchemaValuesV2): Promise<OrchestrationResult>;
29
29
  deleteFlowRun(flowRunId: string): Promise<void>;
30
+ downloadFlowRunLogsCsv(flowRunId: string, flowRunName: string | null): Promise<void>;
30
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prefecthq/prefect-ui-library",
3
- "version": "3.5.5",
3
+ "version": "3.5.8",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -57,22 +57,22 @@
57
57
  "@types/lodash.debounce": "4.0.9",
58
58
  "@types/lodash.isequal": "^4.5.8",
59
59
  "@types/lodash.merge": "4.6.9",
60
- "@types/node": "^20.14.11",
60
+ "@types/node": "^22.0.0",
61
61
  "@types/prismjs": "^1.26.4",
62
- "@vitejs/plugin-vue": "5.0.5",
62
+ "@vitejs/plugin-vue": "5.1.1",
63
63
  "auto-changelog": "^2.4.0",
64
64
  "autoprefixer": "10.4.19",
65
65
  "eslint": "8.57.0",
66
66
  "lodash.camelcase": "4.3.0",
67
67
  "lodash.debounce": "4.0.8",
68
68
  "postcss": "8.4.39",
69
- "tailwindcss": "3.4.6",
69
+ "tailwindcss": "3.4.7",
70
70
  "tsc-alias": "1.8.10",
71
71
  "typescript": "5.5.4",
72
- "vite": "5.3.4",
72
+ "vite": "5.3.5",
73
73
  "vite-svg-loader": "^5.1.0",
74
74
  "vitest": "^2.0.4",
75
- "vue-tsc": "^2.0.26"
75
+ "vue-tsc": "^2.0.29"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "@prefecthq/prefect-design": "^2.11.5",
@@ -15,7 +15,7 @@
15
15
  </template>
16
16
 
17
17
  <template #action="{ row }">
18
- <ConcurrencyLimitMenu size="xs" :concurrency-limit="row" @delete="concurrencyLimitSubscription.refresh" />
18
+ <ConcurrencyLimitMenu size="xs" :concurrency-limit="row" @delete="() => concurrencyLimitSubscription.refresh()" />
19
19
  </template>
20
20
 
21
21
  <template #empty-state>
@@ -20,7 +20,7 @@
20
20
  </template>
21
21
 
22
22
  <template #action="{ row }">
23
- <ConcurrencyLimitV2Menu size="xs" :concurrency-limit="row" @delete="concurrencyLimitSubscription.refresh" />
23
+ <ConcurrencyLimitV2Menu size="xs" :concurrency-limit="row" @delete="() => concurrencyLimitSubscription.refresh()" />
24
24
  </template>
25
25
 
26
26
  <template #empty-state>
@@ -3,9 +3,8 @@
3
3
  <p-list-header>
4
4
  <template #controls>
5
5
  <LogLevelSelect v-model:selected="logLevel" />
6
- </template>
7
- <template #sort>
8
6
  <LogsSort v-model:selected="logsSort" />
7
+ <FlowRunLogsDownloadButton :flow-run />
9
8
  </template>
10
9
  </p-list-header>
11
10
 
@@ -45,6 +44,7 @@
45
44
  import { differenceInSeconds } from 'date-fns'
46
45
  import { ref, computed } from 'vue'
47
46
  import { LogLevelSelect, LogsContainer, LogsSort } from '@/components'
47
+ import FlowRunLogsDownloadButton from '@/components/FlowRunLogsDownloadButton.vue'
48
48
  import { useLogsSort, useWorkspaceApi } from '@/compositions'
49
49
  import { usePaginatedSubscription } from '@/compositions/usePaginatedSubscription'
50
50
  import { isTerminalStateType } from '@/models'
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <p-tooltip text="Download a csv of all logs" avoid-collisions>
3
+ <p-button class="flow-run-logs-download-button" icon="Download" :loading @click="download" />
4
+ </p-tooltip>
5
+ </template>
6
+
7
+ <script lang="ts" setup>
8
+ import { showToast } from '@prefecthq/prefect-design'
9
+ import { ref } from 'vue'
10
+ import { useWorkspaceApi } from '@/compositions'
11
+ import { FlowRun } from '@/models/FlowRun'
12
+
13
+ const { flowRun } = defineProps<{
14
+ flowRun: FlowRun,
15
+ }>()
16
+
17
+ const api = useWorkspaceApi()
18
+ const loading = ref(false)
19
+
20
+ async function download(): Promise<void> {
21
+ loading.value = true
22
+
23
+ try {
24
+ await api.flowRuns.downloadFlowRunLogsCsv(flowRun.id, flowRun.name)
25
+ } catch (error) {
26
+ console.error(error)
27
+
28
+ showToast('There was an error downloading logs', 'error')
29
+ }
30
+
31
+ loading.value = false
32
+ }
33
+ </script>
@@ -1,10 +1,11 @@
1
1
  <template>
2
- <p-modal v-model:showModal="internalShowModal" class="quick-run-parameters-modal-v2" title="Run Deployment">
2
+ <p-modal v-model:showModal="showModal" class="quick-run-parameters-modal-v2" title="Run Deployment">
3
3
  <SchemaFormV2
4
4
  :id="formId"
5
5
  v-model:values="parameters"
6
+ v-model:loading="loading"
6
7
  :schema="deployment.parameterOpenApiSchema"
7
- :enforce-parameter-schema
8
+ :validate="enforceParameterSchema"
8
9
  :kinds="['json', 'workspace_variable']"
9
10
  @submit="submit"
10
11
  >
@@ -25,7 +26,7 @@
25
26
 
26
27
  <template #actions>
27
28
  <slot name="actions">
28
- <p-button type="submit" primary :form="formId">
29
+ <p-button type="submit" :loading primary :form="formId">
29
30
  Run
30
31
  </p-button>
31
32
  </slot>
@@ -35,7 +36,7 @@
35
36
 
36
37
  <script lang="ts" setup>
37
38
  import { PButton, randomId, showToast } from '@prefecthq/prefect-design'
38
- import { computed, h, ref } from 'vue'
39
+ import { h, ref } from 'vue'
39
40
  import { useRouter } from 'vue-router'
40
41
  import { ToastFlowRunCreate } from '@/components'
41
42
  import { useWorkspaceApi, useWorkspaceRoutes } from '@/compositions'
@@ -44,8 +45,9 @@
44
45
  import { SchemaFormV2, SchemaValuesV2 } from '@/schemas'
45
46
  import { getApiErrorMessage } from '@/utilities/errors'
46
47
 
48
+ const showModal = defineModel<boolean>('showModal', { required: true })
49
+
47
50
  const props = defineProps<{
48
- showModal: boolean,
49
51
  deployment: Deployment,
50
52
  }>()
51
53
 
@@ -53,24 +55,13 @@
53
55
  const router = useRouter()
54
56
  const routes = useWorkspaceRoutes()
55
57
  const formId = randomId()
56
-
57
- const emit = defineEmits<{
58
- (event: 'update:showModal', value: boolean): void,
59
- }>()
60
-
58
+ const loading = ref(false)
61
59
  const enforceParameterSchema = ref(props.deployment.enforceParameterSchema)
62
60
  const parameters = ref<SchemaValuesV2>({ ...props.deployment.parameters })
63
61
 
64
- const internalShowModal = computed({
65
- get() {
66
- return props.showModal
67
- },
68
- set(value: boolean) {
69
- emit('update:showModal', value)
70
- },
71
- })
72
-
73
62
  async function submit(): Promise<void> {
63
+ loading.value = true
64
+
74
65
  const values: DeploymentFlowRunCreate = {
75
66
  state: {
76
67
  type: 'scheduled',
@@ -89,9 +80,13 @@
89
80
  const message = getApiErrorMessage(error, localization.error.scheduleFlowRun)
90
81
  showToast(message, 'error')
91
82
  console.error(error)
83
+
84
+ return
85
+ } finally {
86
+ loading.value = false
92
87
  }
93
88
 
94
- internalShowModal.value = false
89
+ showModal.value = false
95
90
  }
96
91
  </script>
97
92
 
@@ -146,4 +146,20 @@ export class WorkspaceFlowRunsApi extends WorkspaceApi {
146
146
  return this.delete(`/${flowRunId}`)
147
147
  }
148
148
 
149
+ public async downloadFlowRunLogsCsv(flowRunId: string, flowRunName: string | null): Promise<void> {
150
+ const { data } = await this.get<string>(`/${flowRunId}/download-logs-csv`, {
151
+ responseType: 'stream',
152
+ })
153
+
154
+ const url = URL.createObjectURL(new Blob([data]))
155
+ const link = document.createElement('a')
156
+ const filename = flowRunName ?? 'logs'
157
+
158
+ link.href = url
159
+ link.setAttribute('download', `${filename}.csv`)
160
+ link.click()
161
+
162
+ URL.revokeObjectURL(url)
163
+ }
164
+
149
165
  }