Skip to content

Commit

Permalink
Workflow Counts (#1686)
Browse files Browse the repository at this point in the history
* Add counts api to WorkflowCounts. WIP

* Updated protos from 1.24.0 api

* Updated go.work.sum from 1.24.0 api

* New protos

* WIP

* Add systemInfo api

* Get workflow counts working with api

* New api dependencies

* Get WorkflowCount status filters working with other queries

* Include WorkflowType for fun'

* Split out all and status into their own WorkflowCount components

* Better enabled check for cloud

* Update unit tests

* Better check for enabled

* Fix check for groupByCountEnabled

* Remove peacock

* Add translate()

* WIP: Add integration tests for counts

* Add testid, add integration tests for new workflow counts

* Export mockGroupByApi
  • Loading branch information
Alex-Tideman authored Oct 16, 2023
1 parent 29ea87e commit 03135e2
Show file tree
Hide file tree
Showing 32 changed files with 609 additions and 358 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@
"@sveltejs/adapter-vercel": "^1.0.5",
"@sveltejs/kit": "1.15.4",
"@sveltejs/vite-plugin-svelte": "^2.0.2",
"@temporalio/activity": "^1.8.4",
"@temporalio/client": "^1.8.4",
"@temporalio/common": "^1.8.4",
"@temporalio/proto": "^1.8.4",
"@temporalio/testing": "^1.8.4",
"@temporalio/worker": "^1.8.4",
"@temporalio/workflow": "^1.8.4",
"@temporalio/activity": "^1.8.6",
"@temporalio/client": "^1.8.6",
"@temporalio/common": "^1.8.6",
"@temporalio/proto": "^1.8.6",
"@temporalio/testing": "^1.8.6",
"@temporalio/worker": "^1.8.6",
"@temporalio/workflow": "^1.8.6",
"@types/base-64": "^1.0.0",
"@types/cors": "^2.8.13",
"@types/express": "^4.17.17",
Expand Down
125 changes: 72 additions & 53 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ service WorkflowService {
// GetSystemInfo returns information about the system.
rpc GetSystemInfo(GetSystemInfoRequest) returns (GetSystemInfoResponse) {
option (google.api.http) = {
get: "/api/v1/systemInfo"
get: "/api/v1/system-info"
};
}

Expand Down
21 changes: 19 additions & 2 deletions src/lib/components/workflow-status.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import { cva } from 'class-variance-authority';
import Spinner from '$lib/holocene/icon/svg/spinner.svelte';
import { translate } from '$lib/i18n/translate';
import type { EventClassification } from '$lib/models/event-history/get-event-classification';
import type { ScheduleStatus } from '$lib/types/schedule';
Expand All @@ -12,6 +13,8 @@
export let delay = 0;
export let status: Status = 'Running';
export let count: number | undefined = undefined;
export let loading = false;
const label: Record<Status, string> = {
Running: translate('workflows', 'running'),
Expand Down Expand Up @@ -66,11 +69,25 @@
);
</script>

<div class="flex text-center text-sm font-medium leading-4">
<span class={workflowStatus({ status })}>
<div
class="flex text-center text-sm font-medium leading-4"
data-testid={$$props['test-id']}
>
<span class={workflowStatus({ status })} class:count>
{#if loading}
<Spinner class="h-4 w-4 animate-spin" />
{:else if count}
{count.toLocaleString()}
{/if}
{label[status]}
{#if status === 'Running'}
<HeartBeat {delay} />
{/if}
</span>
</div>

<style lang="postcss">
.count {
@apply px-1;
}
</style>
17 changes: 17 additions & 0 deletions src/lib/components/workflow/workflow-count-all.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<script lang="ts">
import Spinner from '$lib/holocene/icon/svg/spinner.svelte';
import { translate } from '$lib/i18n/translate';
import { loading, updating } from '$lib/stores/workflows';
export let count = 0;
</script>

<div class="font-base flex text-center text-sm leading-4">
<p data-testid="workflow-count" data-loaded={!$loading && !$updating}>
{#if $loading || $updating}
<Spinner class="h-4 w-4 animate-spin" />
{:else if count >= 0}
{count.toLocaleString()} {translate('workflows').toLocaleLowerCase()}
{/if}
</p>
</div>
16 changes: 16 additions & 0 deletions src/lib/components/workflow/workflow-count-status.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<script lang="ts">
import { loading, updating } from '$lib/stores/workflows';
import type { WorkflowStatus as Status } from '$lib/types/workflows';
import WorkflowStatus from '../workflow-status.svelte';
export let status: Status;
export let count = 0;
</script>

<WorkflowStatus
loading={$loading || $updating}
{count}
{status}
test-id="workflow-status-{status}"
/>
32 changes: 0 additions & 32 deletions src/lib/components/workflow/workflow-count.svelte

This file was deleted.

Loading

0 comments on commit 03135e2

Please sign in to comment.