@prefecthq/prefect-ui-library 2.10.0 → 2.10.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.
- package/dist/{FlowRunsPageWithDefaultFilter-C6ZDBABX.mjs → FlowRunsPageWithDefaultFilter-BLZb8xVV.mjs} +2 -2
- package/dist/{FlowRunsPageWithDefaultFilter-C6ZDBABX.mjs.map → FlowRunsPageWithDefaultFilter-BLZb8xVV.mjs.map} +1 -1
- package/dist/{index-CIX59mKM.mjs → index-D7gE2dA7.mjs} +9086 -9073
- package/dist/index-D7gE2dA7.mjs.map +1 -0
- package/dist/prefect-ui-library.mjs +70 -69
- package/dist/prefect-ui-library.umd.js +85 -85
- package/dist/prefect-ui-library.umd.js.map +1 -1
- package/dist/types/src/compositions/index.d.ts +1 -0
- package/dist/types/src/compositions/useFlowRuns.d.ts +8 -5
- package/dist/types/src/compositions/useLastFlowRun.d.ts +1 -1
- package/dist/types/src/compositions/useNextFlowRun.d.ts +2 -3
- package/dist/types/src/compositions/usePaginatedFlowRuns.d.ts +7 -0
- package/package.json +1 -1
- package/src/components/DeploymentQuickRunOverflowMenuItem.vue +1 -1
- package/src/components/FlowRunFilteredList.vue +2 -2
- package/src/components/FlowRunsAccordionContent.vue +2 -2
- package/src/components/FlowRunsBarChart.vue +1 -3
- package/src/components/WorkPoolQueueUpcomingFlowRunsList.vue +3 -3
- package/src/compositions/index.ts +1 -0
- package/src/compositions/useFlowRuns.ts +13 -18
- package/src/compositions/useLastFlowRun.ts +3 -3
- package/src/compositions/useNextFlowRun.ts +4 -5
- package/src/compositions/usePaginatedFlowRuns.ts +46 -0
- package/dist/index-CIX59mKM.mjs.map +0 -1
|
@@ -31,6 +31,7 @@ export * from './useLogsSort';
|
|
|
31
31
|
export * from './useNextFlowRun';
|
|
32
32
|
export * from './useOptionalPropertiesSchema';
|
|
33
33
|
export * from './useOptionalRules';
|
|
34
|
+
export * from './usePaginatedFlowRuns';
|
|
34
35
|
export * from './usePaginatedSubscription';
|
|
35
36
|
export * from './usePagination';
|
|
36
37
|
export * from './useReactiveField';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { MaybeReadonly } from '@prefecthq/prefect-design';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { FlowRunsFilter } from '../models';
|
|
2
|
+
import { UseSubscription } from '@prefecthq/vue-compositions';
|
|
3
|
+
import { ComputedRef, MaybeRefOrGetter } from 'vue';
|
|
4
|
+
import { FlowRun, FlowRunsFilter } from '../models';
|
|
5
5
|
import { WorkspaceFlowRunsApi } from '../services';
|
|
6
|
-
export type UseFlowRuns =
|
|
7
|
-
|
|
6
|
+
export type UseFlowRuns = {
|
|
7
|
+
subscription: UseSubscription<WorkspaceFlowRunsApi['getFlowRuns']>;
|
|
8
|
+
flowRuns: ComputedRef<FlowRun[]>;
|
|
9
|
+
};
|
|
10
|
+
export declare function useFlowRuns(filter?: MaybeRefOrGetter<MaybeReadonly<FlowRunsFilter> | null | undefined>): UseFlowRuns;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComputedRef, MaybeRefOrGetter } from 'vue';
|
|
2
2
|
import { UseFlowRuns } from '../compositions/useFlowRuns';
|
|
3
3
|
import { FlowRun, UnionFilter } from '../models';
|
|
4
|
-
export type UseLastFlowRun = Pick<UseFlowRuns, '
|
|
4
|
+
export type UseLastFlowRun = Pick<UseFlowRuns, 'subscription'> & {
|
|
5
5
|
flowRun: ComputedRef<FlowRun | undefined>;
|
|
6
6
|
};
|
|
7
7
|
export declare function useLastFlowRun(filter: MaybeRefOrGetter<UnionFilter | null | undefined>): UseLastFlowRun;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { SubscriptionOptions } from '@prefecthq/vue-compositions';
|
|
2
1
|
import { ComputedRef, MaybeRefOrGetter } from 'vue';
|
|
3
2
|
import { UseFlowRuns } from '../compositions/useFlowRuns';
|
|
4
3
|
import { FlowRun, UnionFilter } from '../models';
|
|
5
|
-
export type UseNextFlowRun = Pick<UseFlowRuns, '
|
|
4
|
+
export type UseNextFlowRun = Pick<UseFlowRuns, 'subscription'> & {
|
|
6
5
|
flowRun: ComputedRef<FlowRun | undefined>;
|
|
7
6
|
};
|
|
8
|
-
export declare function useNextFlowRun(filter: MaybeRefOrGetter<UnionFilter | null | undefined
|
|
7
|
+
export declare function useNextFlowRun(filter: MaybeRefOrGetter<UnionFilter | null | undefined>): UseNextFlowRun;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MaybeReadonly } from '@prefecthq/prefect-design';
|
|
2
|
+
import { MaybeRefOrGetter } from 'vue';
|
|
3
|
+
import { PaginationOptions, UsePaginationEntity } from '../compositions/usePagination';
|
|
4
|
+
import { FlowRunsFilter } from '../models';
|
|
5
|
+
import { WorkspaceFlowRunsApi } from '../services';
|
|
6
|
+
export type UsePaginatedFlowRuns = UsePaginationEntity<WorkspaceFlowRunsApi['getFlowRuns'], WorkspaceFlowRunsApi['getFlowRunsCount'], 'flowRuns'>;
|
|
7
|
+
export declare function usePaginatedFlowRuns(filter?: MaybeRefOrGetter<MaybeReadonly<FlowRunsFilter> | null | undefined>, options?: PaginationOptions): UsePaginatedFlowRuns;
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
const router = useRouter()
|
|
26
26
|
const routes = useWorkspaceRoutes()
|
|
27
27
|
|
|
28
|
-
const {
|
|
28
|
+
const { subscription: nextRunSubscription } = useNextFlowRun(() => ({
|
|
29
29
|
deployments: {
|
|
30
30
|
id: [props.deployment.id],
|
|
31
31
|
},
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
FlowRunsDeleteButton
|
|
50
50
|
} from '@/components'
|
|
51
51
|
import SearchInput from '@/components/SearchInput.vue'
|
|
52
|
-
import {
|
|
52
|
+
import { useFlowRunsFilterFromRoute, usePaginatedFlowRuns } from '@/compositions'
|
|
53
53
|
import { useCan } from '@/compositions/useCan'
|
|
54
54
|
import { FlowRunsFilter } from '@/models/Filters'
|
|
55
55
|
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
},
|
|
73
73
|
}), props.prefix)
|
|
74
74
|
|
|
75
|
-
const { flowRuns, total, subscriptions, next } =
|
|
75
|
+
const { flowRuns, total, subscriptions, next } = usePaginatedFlowRuns(filter, {
|
|
76
76
|
interval: 30000,
|
|
77
77
|
mode: 'infinite',
|
|
78
78
|
})
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<script lang="ts" setup>
|
|
13
13
|
import { computed } from 'vue'
|
|
14
14
|
import FlowRunList from '@/components/FlowRunList.vue'
|
|
15
|
-
import {
|
|
15
|
+
import { usePaginatedFlowRuns } from '@/compositions'
|
|
16
16
|
import { FlowRunsFilter } from '@/models/Filters'
|
|
17
17
|
|
|
18
18
|
const props = defineProps<{
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
limit: 3,
|
|
33
33
|
})
|
|
34
34
|
|
|
35
|
-
const { flowRuns, total, next } =
|
|
35
|
+
const { flowRuns, total, next } = usePaginatedFlowRuns(filter, {
|
|
36
36
|
mode: 'infinite',
|
|
37
37
|
})
|
|
38
38
|
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
import { StyleValue, computed, ref, toValue } from 'vue'
|
|
25
25
|
import FlowRunPopoverContent from '@/components/FlowRunPopOverContent.vue'
|
|
26
26
|
import { useFlowRuns } from '@/compositions/useFlowRuns'
|
|
27
|
-
import { useInterval } from '@/compositions/useInterval'
|
|
28
27
|
import { FlowRunsFilter } from '@/models/Filters'
|
|
29
28
|
import { FlowRun } from '@/models/FlowRun'
|
|
30
29
|
import { MaybeGetter } from '@/types/reactivity'
|
|
@@ -67,8 +66,7 @@
|
|
|
67
66
|
return merge({}, base, filter)
|
|
68
67
|
}
|
|
69
68
|
|
|
70
|
-
const
|
|
71
|
-
const { flowRuns } = useFlowRuns(filter, options)
|
|
69
|
+
const { flowRuns } = useFlowRuns(filter)
|
|
72
70
|
|
|
73
71
|
const barFlowRuns = computed(() => organizeFlowRunsWithGaps(flowRuns.value))
|
|
74
72
|
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
},
|
|
42
42
|
})
|
|
43
43
|
|
|
44
|
-
const { flowRuns,
|
|
44
|
+
const { flowRuns, subscription } = useFlowRuns(filter)
|
|
45
45
|
|
|
46
|
-
const empty = computed(() =>
|
|
46
|
+
const empty = computed(() => subscription.executed && flowRuns.value.length === 0)
|
|
47
47
|
const isPaused = computed(() => workPoolQueue.value.isPaused)
|
|
48
48
|
|
|
49
49
|
// pretty sure this isn't needed but I haven't tested for sure
|
|
50
50
|
// the subscription should refresh automatically because if the workPoolQueue
|
|
51
51
|
// updates the filter will update which creates a new subscription
|
|
52
52
|
watch(() => workPoolQueue, () => {
|
|
53
|
-
|
|
53
|
+
subscription.refresh()
|
|
54
54
|
})
|
|
55
55
|
</script>
|
|
@@ -31,6 +31,7 @@ export * from './useLogsSort'
|
|
|
31
31
|
export * from './useNextFlowRun'
|
|
32
32
|
export * from './useOptionalPropertiesSchema'
|
|
33
33
|
export * from './useOptionalRules'
|
|
34
|
+
export * from './usePaginatedFlowRuns'
|
|
34
35
|
export * from './usePaginatedSubscription'
|
|
35
36
|
export * from './usePagination'
|
|
36
37
|
export * from './useReactiveField'
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { MaybeReadonly } from '@prefecthq/prefect-design'
|
|
2
|
-
import {
|
|
2
|
+
import { UseSubscription, useSubscriptionWithDependencies } from '@prefecthq/vue-compositions'
|
|
3
|
+
import { ComputedRef, MaybeRefOrGetter, computed, toRef, toValue } from 'vue'
|
|
3
4
|
import { useCan } from '@/compositions/useCan'
|
|
4
|
-
import { PaginationOptions, UsePaginationEntity, usePagination } from '@/compositions/usePagination'
|
|
5
5
|
import { useWorkspaceApi } from '@/compositions/useWorkspaceApi'
|
|
6
|
-
import { FlowRunsFilter } from '@/models'
|
|
6
|
+
import { FlowRun, FlowRunsFilter } from '@/models'
|
|
7
7
|
import { WorkspaceFlowRunsApi } from '@/services'
|
|
8
8
|
import { Getter } from '@/types/reactivity'
|
|
9
9
|
|
|
10
|
-
export type UseFlowRuns =
|
|
11
|
-
WorkspaceFlowRunsApi['getFlowRuns']
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
>
|
|
10
|
+
export type UseFlowRuns = {
|
|
11
|
+
subscription: UseSubscription<WorkspaceFlowRunsApi['getFlowRuns']>,
|
|
12
|
+
flowRuns: ComputedRef<FlowRun[]>,
|
|
13
|
+
}
|
|
15
14
|
|
|
16
|
-
export function useFlowRuns(filter?: MaybeRefOrGetter<MaybeReadonly<FlowRunsFilter> | null | undefined
|
|
15
|
+
export function useFlowRuns(filter?: MaybeRefOrGetter<MaybeReadonly<FlowRunsFilter> | null | undefined>): UseFlowRuns {
|
|
17
16
|
const api = useWorkspaceApi()
|
|
18
17
|
const can = useCan()
|
|
19
18
|
|
|
@@ -31,16 +30,12 @@ export function useFlowRuns(filter?: MaybeRefOrGetter<MaybeReadonly<FlowRunsFilt
|
|
|
31
30
|
return [value]
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
countMethod: api.flowRuns.getFlowRunsCount,
|
|
38
|
-
countParameters: parameters,
|
|
39
|
-
options,
|
|
40
|
-
})
|
|
33
|
+
const parametersRef = toRef(parameters)
|
|
34
|
+
const subscription = useSubscriptionWithDependencies(api.flowRuns.getFlowRuns, parametersRef)
|
|
35
|
+
const flowRuns = computed(() => subscription.response ?? [])
|
|
41
36
|
|
|
42
37
|
return {
|
|
43
|
-
|
|
44
|
-
flowRuns
|
|
38
|
+
subscription,
|
|
39
|
+
flowRuns,
|
|
45
40
|
}
|
|
46
41
|
}
|
|
@@ -4,7 +4,7 @@ import { useCan } from '@/compositions/useCan'
|
|
|
4
4
|
import { UseFlowRuns, useFlowRuns } from '@/compositions/useFlowRuns'
|
|
5
5
|
import { FlowRun, FlowRunsFilter, UnionFilter } from '@/models'
|
|
6
6
|
|
|
7
|
-
export type UseLastFlowRun = Pick<UseFlowRuns, '
|
|
7
|
+
export type UseLastFlowRun = Pick<UseFlowRuns, 'subscription'> & {
|
|
8
8
|
flowRun: ComputedRef<FlowRun | undefined>,
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -29,11 +29,11 @@ export function useLastFlowRun(filter: MaybeRefOrGetter<UnionFilter | null | und
|
|
|
29
29
|
return merge({}, filterValue, latestFilter)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const { flowRuns,
|
|
32
|
+
const { flowRuns, subscription } = useFlowRuns(getter)
|
|
33
33
|
const flowRun = computed(() => flowRuns.value.at(0))
|
|
34
34
|
|
|
35
35
|
return {
|
|
36
|
-
|
|
36
|
+
subscription,
|
|
37
37
|
flowRun,
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { SubscriptionOptions } from '@prefecthq/vue-compositions'
|
|
2
1
|
import merge from 'lodash.merge'
|
|
3
2
|
import { computed, ComputedRef, MaybeRefOrGetter, toValue } from 'vue'
|
|
4
3
|
import { useCan } from '@/compositions/useCan'
|
|
5
4
|
import { UseFlowRuns, useFlowRuns } from '@/compositions/useFlowRuns'
|
|
6
5
|
import { FlowRun, FlowRunsFilter, UnionFilter } from '@/models'
|
|
7
6
|
|
|
8
|
-
export type UseNextFlowRun = Pick<UseFlowRuns, '
|
|
7
|
+
export type UseNextFlowRun = Pick<UseFlowRuns, 'subscription'> & {
|
|
9
8
|
flowRun: ComputedRef<FlowRun | undefined>,
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
export function useNextFlowRun(filter: MaybeRefOrGetter<UnionFilter | null | undefined
|
|
11
|
+
export function useNextFlowRun(filter: MaybeRefOrGetter<UnionFilter | null | undefined>): UseNextFlowRun {
|
|
13
12
|
const can = useCan()
|
|
14
13
|
|
|
15
14
|
const getter = (): FlowRunsFilter | null => {
|
|
@@ -31,11 +30,11 @@ export function useNextFlowRun(filter: MaybeRefOrGetter<UnionFilter | null | und
|
|
|
31
30
|
return merge({}, filterValue, nextFlowRunFilter)
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
const { flowRuns,
|
|
33
|
+
const { flowRuns, subscription } = useFlowRuns(getter)
|
|
35
34
|
const flowRun = computed(() => flowRuns.value.at(0))
|
|
36
35
|
|
|
37
36
|
return {
|
|
38
|
-
|
|
37
|
+
subscription,
|
|
39
38
|
flowRun,
|
|
40
39
|
}
|
|
41
40
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { MaybeReadonly } from '@prefecthq/prefect-design'
|
|
2
|
+
import { MaybeRefOrGetter, toValue } from 'vue'
|
|
3
|
+
import { useCan } from '@/compositions/useCan'
|
|
4
|
+
import { PaginationOptions, UsePaginationEntity, usePagination } from '@/compositions/usePagination'
|
|
5
|
+
import { useWorkspaceApi } from '@/compositions/useWorkspaceApi'
|
|
6
|
+
import { FlowRunsFilter } from '@/models'
|
|
7
|
+
import { WorkspaceFlowRunsApi } from '@/services'
|
|
8
|
+
import { Getter } from '@/types/reactivity'
|
|
9
|
+
|
|
10
|
+
export type UsePaginatedFlowRuns = UsePaginationEntity<
|
|
11
|
+
WorkspaceFlowRunsApi['getFlowRuns'],
|
|
12
|
+
WorkspaceFlowRunsApi['getFlowRunsCount'],
|
|
13
|
+
'flowRuns'
|
|
14
|
+
>
|
|
15
|
+
|
|
16
|
+
export function usePaginatedFlowRuns(filter?: MaybeRefOrGetter<MaybeReadonly<FlowRunsFilter> | null | undefined>, options?: PaginationOptions): UsePaginatedFlowRuns {
|
|
17
|
+
const api = useWorkspaceApi()
|
|
18
|
+
const can = useCan()
|
|
19
|
+
|
|
20
|
+
const parameters: Getter<[FlowRunsFilter] | null> = () => {
|
|
21
|
+
if (!can.read.flow_run) {
|
|
22
|
+
return null
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const value = toValue(filter)
|
|
26
|
+
|
|
27
|
+
if (!value) {
|
|
28
|
+
return null
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return [value]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const pagination = usePagination({
|
|
35
|
+
fetchMethod: api.flowRuns.getFlowRuns,
|
|
36
|
+
fetchParameters: parameters,
|
|
37
|
+
countMethod: api.flowRuns.getFlowRunsCount,
|
|
38
|
+
countParameters: parameters,
|
|
39
|
+
options,
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
...pagination,
|
|
44
|
+
flowRuns: pagination.results,
|
|
45
|
+
}
|
|
46
|
+
}
|