Skip to content

Commit

Permalink
Add individual concurrency limit page with active runs list (#7848)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhen0 authored and zanieb committed Dec 15, 2022
1 parent 4f577ef commit 1e1316e
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
62 changes: 62 additions & 0 deletions orion-ui/src/pages/ConcurrencyLimit.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<template>
<p-layout-well class="concurrencyLimit">
<template #header>
<PageHeadingConcurrencyLimit v-if="concurrencyLimit" :concurrency-limit="concurrencyLimit" @delete="deleteConcurrencyLimit" />
</template>

<p-tabs :tabs="tabs">
<template #details>
<ConcurrencyLimitDetails v-if="concurrencyLimit" :concurrency-limit="concurrencyLimit" />
</template>
<template #active-task-runs>
<ConcurrencyLimitActiveRuns v-if="concurrencyLimit?.activeSlots" :active-slots="concurrencyLimit.activeSlots" />
</template>
</p-tabs>
<template #well>
<ConcurrencyLimitDetails v-if="concurrencyLimit" alternate :concurrency-limit="concurrencyLimit" />
</template>
</p-layout-well>
</template>
<script lang="ts" setup>
import { PageHeadingConcurrencyLimit, ConcurrencyLimitDetails, ConcurrencyLimitActiveRuns, useTabs, useWorkspaceApi } from '@prefecthq/orion-design'
import { media } from '@prefecthq/prefect-design'
import { useRouteParam, useSubscription } from '@prefecthq/vue-compositions'
import { computed } from 'vue'
import { useRouter } from 'vue-router'
import { usePageTitle } from '@/compositions/usePageTitle'
import { routes } from '@/router'
const api = useWorkspaceApi()
const concurrencyLimitId = useRouteParam('concurrencyLimitId')
const router = useRouter()
const computedTabs = computed(() => [
{ label: 'Details', hidden: media.xl },
{ label: 'Active Task Runs' },
])
const tabs = useTabs(computedTabs)
const subscriptionOptions = {
interval: 300000,
}
const concurrencyLimitSubscription = useSubscription(api.concurrencyLimits.getConcurrencyLimit, [concurrencyLimitId.value], subscriptionOptions)
const concurrencyLimit = computed(() => concurrencyLimitSubscription.response)
function deleteConcurrencyLimit(): void {
router.push(routes.concurrencyLimits())
}
const title = computed<string>(() => {
if (!concurrencyLimit.value) {
return 'Concurrency Limit'
}
return `Concurrency Limit: ${concurrencyLimit.value.tag}`
})
usePageTitle(title)
</script>
1 change: 1 addition & 0 deletions orion-ui/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const workspaceRoutes = createWorkspaceRouteRecords({
notifications: () => import('@/pages/Notifications.vue'),
notificationCreate: () => import('@/pages/NotificationCreate.vue'),
notificationEdit: () => import('@/pages/NotificationEdit.vue'),
concurrencyLimit: () => import('@/pages/ConcurrencyLimit.vue'),
concurrencyLimits: () => import('@/pages/ConcurrencyLimits.vue'),
})

Expand Down

0 comments on commit 1e1316e

Please sign in to comment.