@prefecthq/prefect-ui-library 3.0.0 → 3.0.2
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.
- package/dist/{RunsPageWithDefaultFilter-BEdkj37v.mjs → RunsPageWithDefaultFilter-BCl1-RE3.mjs} +2 -2
- package/dist/{RunsPageWithDefaultFilter-BEdkj37v.mjs.map → RunsPageWithDefaultFilter-BCl1-RE3.mjs.map} +1 -1
- package/dist/{index-BkrMAPXw.mjs → index-O7uqAfLu.mjs} +4252 -4226
- package/dist/index-O7uqAfLu.mjs.map +1 -0
- package/dist/prefect-ui-library.mjs +1 -1
- package/dist/prefect-ui-library.umd.js +46 -46
- package/dist/prefect-ui-library.umd.js.map +1 -1
- package/dist/types/src/components/DeploymentsCount.vue.d.ts +2 -0
- package/dist/types/src/compositions/useDeploymentsCount.d.ts +1 -0
- package/dist/types/src/compositions/useWorkspaceRoutes.d.ts +7 -0
- package/dist/types/src/models/api/UiDeploymentsCountsByFlow.d.ts +1 -0
- package/dist/types/src/models/api/index.d.ts +1 -0
- package/dist/types/src/router/index.d.ts +2 -1
- package/dist/types/src/router/routes.d.ts +8 -0
- package/dist/types/src/services/UiApi.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/DeploymentsCount.vue +3 -8
- package/src/components/FlowList.vue +21 -4
- package/src/compositions/useDeploymentsCount.ts +1 -0
- package/src/models/api/UiDeploymentsCountsByFlow.ts +1 -0
- package/src/models/api/index.ts +1 -0
- package/src/router/index.ts +19 -1
- package/src/router/routes.ts +2 -0
- package/src/services/UiApi.ts +8 -0
- package/dist/index-BkrMAPXw.mjs.map +0 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
|
|
2
|
+
count: number;
|
|
2
3
|
flowId: string;
|
|
3
4
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
|
|
5
|
+
count: number;
|
|
4
6
|
flowId: string;
|
|
5
7
|
}>>>, {}, {}>;
|
|
6
8
|
export default _default;
|
|
@@ -3,4 +3,5 @@ import { DeploymentsFilter } from '../models';
|
|
|
3
3
|
import { WorkspaceDeploymentsApi } from '../services/WorkspaceDeploymentsApi';
|
|
4
4
|
import { UseEntitySubscription } from '../types/useEntitySubscription';
|
|
5
5
|
export type UseDeploymentsCount = UseEntitySubscription<WorkspaceDeploymentsApi['getDeploymentsCount'], 'count'>;
|
|
6
|
+
/** @deprecated prefer to use the dedicated /ui/flows/count-deployments bulk endpoint since this is an expensive bespoke query */
|
|
6
7
|
export declare function useDeploymentsCount(filter?: MaybeRefOrGetter<DeploymentsFilter>): UseDeploymentsCount;
|
|
@@ -72,6 +72,13 @@ export declare function useWorkspaceRoutes(): {
|
|
|
72
72
|
tab?: string | undefined;
|
|
73
73
|
} | undefined;
|
|
74
74
|
};
|
|
75
|
+
flowRuns: () => {
|
|
76
|
+
readonly name: "workspace.flow-runs";
|
|
77
|
+
readonly params: {
|
|
78
|
+
readonly accountId?: string | undefined;
|
|
79
|
+
readonly workspaceId?: string | undefined;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
75
82
|
flowRun: (flowRunId: string) => {
|
|
76
83
|
readonly name: "workspace.runs.flow-run";
|
|
77
84
|
readonly params: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type UiDeploymentsCountsByFlow = Record<string, number>;
|
|
@@ -32,6 +32,7 @@ export * from './StateResponse';
|
|
|
32
32
|
export * from './StateUpdateRequest';
|
|
33
33
|
export * from './TaskInputResponse';
|
|
34
34
|
export * from './TaskRunResponse';
|
|
35
|
+
export * from './UiDeploymentsCountsByFlow';
|
|
35
36
|
export * from './UiFlowRunHistoryResponse';
|
|
36
37
|
export * from './WorkerCollectionItemResponse';
|
|
37
38
|
export * from './WorkerScheduledFlowRunResponse';
|
|
@@ -6,7 +6,8 @@ export type Route = Exclude<RouteLocationRaw, string>;
|
|
|
6
6
|
type WorkspaceRoutes = ReturnType<typeof createWorkspaceRoutes>;
|
|
7
7
|
type WorkspaceRouteKey = keyof WorkspaceRoutes;
|
|
8
8
|
type WorkspaceRoute = ReturnType<WorkspaceRoutes[WorkspaceRouteKey]>;
|
|
9
|
-
export type
|
|
9
|
+
export type DeprecatedNamedRoutes = 'workspace.flow-runs' | 'workspace.flow-runs.flow-run' | 'workspace.flow-runs.task-run';
|
|
10
|
+
export type WorkspaceNamedRoute = WorkspaceRoute['name'] | DeprecatedNamedRoutes;
|
|
10
11
|
type WorkspaceRouteRecordParent = {
|
|
11
12
|
name?: WorkspaceNamedRoute;
|
|
12
13
|
children: WorkspaceRouteRecord[];
|
|
@@ -77,6 +77,14 @@ export declare function createWorkspaceRoutes(config?: CreateWorkspaceRoutesConf
|
|
|
77
77
|
tab?: string | undefined;
|
|
78
78
|
} | undefined;
|
|
79
79
|
};
|
|
80
|
+
/** @deprecated use workspace.runs instead */
|
|
81
|
+
flowRuns: () => {
|
|
82
|
+
readonly name: "workspace.flow-runs";
|
|
83
|
+
readonly params: {
|
|
84
|
+
readonly accountId?: string | undefined;
|
|
85
|
+
readonly workspaceId?: string | undefined;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
80
88
|
flowRun: (flowRunId: string) => {
|
|
81
89
|
readonly name: "workspace.runs.flow-run";
|
|
82
90
|
readonly params: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UiDeploymentsCountsByFlow } from '../models/api/UiDeploymentsCountsByFlow';
|
|
1
2
|
import { FlowRunsFilter, TaskRunsFilter } from '../models/Filters';
|
|
2
3
|
import { UiFlowRunHistory } from '../models/UiFlowRunHistory';
|
|
3
4
|
import { UiTaskRunCountsByState } from '../models/UiTaskRunCountsByState';
|
|
@@ -9,4 +10,5 @@ export declare class UiApi extends WorkspaceApi implements IUiApi {
|
|
|
9
10
|
protected routePrefix: string;
|
|
10
11
|
getFlowRunHistory(filter: FlowRunsFilter): Promise<UiFlowRunHistory[]>;
|
|
11
12
|
getTaskRunsCountByState(filter: TaskRunsFilter): Promise<UiTaskRunCountsByState>;
|
|
13
|
+
getDeploymentsCountByFlow(flowIds: string[]): Promise<UiDeploymentsCountsByFlow>;
|
|
12
14
|
}
|
package/package.json
CHANGED
|
@@ -11,21 +11,16 @@
|
|
|
11
11
|
|
|
12
12
|
<script lang="ts" setup>
|
|
13
13
|
import { toPluralString } from '@prefecthq/prefect-design'
|
|
14
|
-
import {
|
|
14
|
+
import { useWorkspaceRoutes } from '@/compositions'
|
|
15
15
|
import { localization } from '@/localization'
|
|
16
16
|
import { withQuery } from '@/utilities'
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
defineProps<{
|
|
19
|
+
count: number,
|
|
19
20
|
flowId: string,
|
|
20
21
|
}>()
|
|
21
22
|
|
|
22
23
|
const routes = useWorkspaceRoutes()
|
|
23
|
-
|
|
24
|
-
const { count } = useDeploymentsCount(() => ({
|
|
25
|
-
flows: {
|
|
26
|
-
id: [props.flowId],
|
|
27
|
-
},
|
|
28
|
-
}))
|
|
29
24
|
</script>
|
|
30
25
|
|
|
31
26
|
<style>
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
</template>
|
|
42
42
|
|
|
43
43
|
<template #deployments="{ row }">
|
|
44
|
-
<DeploymentsCount :flow-id="row.id" class="flow-list__deployment-count" />
|
|
44
|
+
<DeploymentsCount :count="getDeploymentsCount(row.id)" :flow-id="row.id" class="flow-list__deployment-count" />
|
|
45
45
|
</template>
|
|
46
46
|
|
|
47
47
|
<template #activity="{ row }">
|
|
@@ -87,10 +87,10 @@
|
|
|
87
87
|
|
|
88
88
|
<script lang="ts" setup>
|
|
89
89
|
import { ColumnClassesMethod, TableColumn } from '@prefecthq/prefect-design'
|
|
90
|
-
import { NumberRouteParam, useDebouncedRef, useRouteQueryParam } from '@prefecthq/vue-compositions'
|
|
90
|
+
import { NumberRouteParam, useDebouncedRef, useRouteQueryParam, useSubscriptionWithDependencies } from '@prefecthq/vue-compositions'
|
|
91
91
|
import { secondsInWeek } from 'date-fns/constants'
|
|
92
92
|
import merge from 'lodash.merge'
|
|
93
|
-
import { ref } from 'vue'
|
|
93
|
+
import { computed, ref, toRef } from 'vue'
|
|
94
94
|
import {
|
|
95
95
|
FlowsDeleteButton,
|
|
96
96
|
LastFlowRun,
|
|
@@ -102,10 +102,11 @@
|
|
|
102
102
|
SelectedCount,
|
|
103
103
|
FlowRunTagsInput
|
|
104
104
|
} from '@/components'
|
|
105
|
-
import { useCan, useFlowsFilterFromRoute, useWorkspaceRoutes, useFlows } from '@/compositions'
|
|
105
|
+
import { useCan, useFlowsFilterFromRoute, useWorkspaceRoutes, useFlows, useWorkspaceApi } from '@/compositions'
|
|
106
106
|
import { useComponent } from '@/compositions/useComponent'
|
|
107
107
|
import { FlowsFilter } from '@/models/Filters'
|
|
108
108
|
import { Flow } from '@/models/Flow'
|
|
109
|
+
import { Getter } from '@/types'
|
|
109
110
|
import { flowSortOptions } from '@/types/SortOptionTypes'
|
|
110
111
|
import { snakeCase } from '@/utilities'
|
|
111
112
|
import { formatDateTimeNumeric } from '@/utilities/dates'
|
|
@@ -116,6 +117,7 @@
|
|
|
116
117
|
|
|
117
118
|
const { FlowMenu } = useComponent()
|
|
118
119
|
|
|
120
|
+
const api = useWorkspaceApi()
|
|
119
121
|
const can = useCan()
|
|
120
122
|
const routes = useWorkspaceRoutes()
|
|
121
123
|
|
|
@@ -134,6 +136,21 @@
|
|
|
134
136
|
interval: 30000,
|
|
135
137
|
})
|
|
136
138
|
|
|
139
|
+
const deploymentsCountsSubscriptionGetter: Getter<[string[]] | null> = () => {
|
|
140
|
+
if (flows.value.length > 0) {
|
|
141
|
+
return [flows.value.map(flow => flow.id)]
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return null
|
|
145
|
+
}
|
|
146
|
+
const deploymentsCountsSubscriptionArgs = toRef(deploymentsCountsSubscriptionGetter)
|
|
147
|
+
const deploymentsCountsSubscription = useSubscriptionWithDependencies(api.ui.getDeploymentsCountByFlow, deploymentsCountsSubscriptionArgs)
|
|
148
|
+
const deploymentsCounts = computed(() => deploymentsCountsSubscription.response)
|
|
149
|
+
|
|
150
|
+
function getDeploymentsCount(flowId: string): number {
|
|
151
|
+
return deploymentsCounts.value?.[flowId] ?? 0
|
|
152
|
+
}
|
|
153
|
+
|
|
137
154
|
const columns: TableColumn<Flow>[] = [
|
|
138
155
|
{
|
|
139
156
|
property: 'name',
|
|
@@ -9,6 +9,7 @@ import { UseEntitySubscription } from '@/types/useEntitySubscription'
|
|
|
9
9
|
|
|
10
10
|
export type UseDeploymentsCount = UseEntitySubscription<WorkspaceDeploymentsApi['getDeploymentsCount'], 'count'>
|
|
11
11
|
|
|
12
|
+
/** @deprecated prefer to use the dedicated /ui/flows/count-deployments bulk endpoint since this is an expensive bespoke query */
|
|
12
13
|
export function useDeploymentsCount(filter?: MaybeRefOrGetter<DeploymentsFilter>): UseDeploymentsCount {
|
|
13
14
|
const api = useWorkspaceApi()
|
|
14
15
|
const can = useCan()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type UiDeploymentsCountsByFlow = Record<string, number>
|
package/src/models/api/index.ts
CHANGED
|
@@ -32,6 +32,7 @@ export * from './StateResponse'
|
|
|
32
32
|
export * from './StateUpdateRequest'
|
|
33
33
|
export * from './TaskInputResponse'
|
|
34
34
|
export * from './TaskRunResponse'
|
|
35
|
+
export * from './UiDeploymentsCountsByFlow'
|
|
35
36
|
export * from './UiFlowRunHistoryResponse'
|
|
36
37
|
export * from './WorkerCollectionItemResponse'
|
|
37
38
|
export * from './WorkerScheduledFlowRunResponse'
|
package/src/router/index.ts
CHANGED
|
@@ -9,7 +9,8 @@ type WorkspaceRoutes = ReturnType<typeof createWorkspaceRoutes>
|
|
|
9
9
|
type WorkspaceRouteKey = keyof WorkspaceRoutes
|
|
10
10
|
type WorkspaceRoute = ReturnType<WorkspaceRoutes[WorkspaceRouteKey]>
|
|
11
11
|
|
|
12
|
-
export type
|
|
12
|
+
export type DeprecatedNamedRoutes = 'workspace.flow-runs' | 'workspace.flow-runs.flow-run' | 'workspace.flow-runs.task-run'
|
|
13
|
+
export type WorkspaceNamedRoute = WorkspaceRoute['name'] | DeprecatedNamedRoutes
|
|
13
14
|
|
|
14
15
|
type WorkspaceRouteRecordParent = { name?: WorkspaceNamedRoute, children: WorkspaceRouteRecord[] }
|
|
15
16
|
type WorkspaceRouteRecordChild = { name: WorkspaceNamedRoute }
|
|
@@ -51,6 +52,23 @@ export function createWorkspaceRouteRecords(components: Partial<WorkspaceRouteCo
|
|
|
51
52
|
},
|
|
52
53
|
],
|
|
53
54
|
},
|
|
55
|
+
{
|
|
56
|
+
path: 'flow-runs',
|
|
57
|
+
name: 'workspace.flow-runs',
|
|
58
|
+
redirect: to => ({ name: 'workspace.runs', query: to.query, params: to.params }),
|
|
59
|
+
children: [
|
|
60
|
+
{
|
|
61
|
+
name: 'workspace.flow-runs.flow-run',
|
|
62
|
+
path: 'flow-run/:flowRunId',
|
|
63
|
+
redirect: to => ({ name: 'workspace.runs.flow-run', query: to.query, params: to.params }),
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'workspace.flow-runs.task-run',
|
|
67
|
+
path: 'task-run/:taskRunId',
|
|
68
|
+
redirect: to => ({ name: 'workspace.runs.task-run', query: to.query, params: to.params }),
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
54
72
|
{
|
|
55
73
|
path: 'flows',
|
|
56
74
|
meta: {
|
package/src/router/routes.ts
CHANGED
|
@@ -26,6 +26,8 @@ export function createWorkspaceRoutes(config?: CreateWorkspaceRoutesConfig) {
|
|
|
26
26
|
artifacts: () => ({ name: 'workspace.artifacts', params: { ...config } }) as const,
|
|
27
27
|
dashboard: () => ({ name: 'workspace.dashboard', params: { ...config } }) as const,
|
|
28
28
|
runs: (query?: { tab?: string }) => ({ name: 'workspace.runs', params: { ...config }, query }) as const,
|
|
29
|
+
/** @deprecated use workspace.runs instead */
|
|
30
|
+
flowRuns: () => ({ name: 'workspace.flow-runs', params: { ...config } }) as const,
|
|
29
31
|
flowRun: (flowRunId: string) => ({ name: 'workspace.runs.flow-run', params: { flowRunId, ...config } }) as const,
|
|
30
32
|
taskRun: (taskRunId: string) => ({ name: 'workspace.runs.task-run', params: { taskRunId, ...config } }) as const,
|
|
31
33
|
flows: () => ({ name: 'workspace.flows', params: { ...config } }) as const,
|
package/src/services/UiApi.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UiDeploymentsCountsByFlow } from '@/models/api/UiDeploymentsCountsByFlow'
|
|
1
2
|
import { UiFlowRunHistoryResponse } from '@/models/api/UiFlowRunHistoryResponse'
|
|
2
3
|
import { UiTaskRunCountsByStateResponse } from '@/models/api/UiTaskRunCountsByStateResponse'
|
|
3
4
|
import { FlowRunsFilter, TaskRunsFilter } from '@/models/Filters'
|
|
@@ -26,4 +27,11 @@ export class UiApi extends WorkspaceApi implements IUiApi {
|
|
|
26
27
|
|
|
27
28
|
return mapper.map('UiTaskRunCountsByStateResponse', data, 'UiTaskRunCountsByState')
|
|
28
29
|
}
|
|
30
|
+
|
|
31
|
+
public async getDeploymentsCountByFlow(flowIds: string[]): Promise<UiDeploymentsCountsByFlow> {
|
|
32
|
+
const request = { 'flow_ids': flowIds }
|
|
33
|
+
const { data } = await this.post<UiDeploymentsCountsByFlow>('/flows/count-deployments', request)
|
|
34
|
+
|
|
35
|
+
return data
|
|
36
|
+
}
|
|
29
37
|
}
|