Skip to content

Commit

Permalink
feat(workflows): add repo count description
Browse files Browse the repository at this point in the history
  • Loading branch information
zjp-CN committed Oct 23, 2024
1 parent f8b11ba commit 9708b73
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions os-checks/pages/workflows.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
<template>
<div style="padding: 10px;">
Repo:
<!-- <Select v-model="selectedRepo" filter :options="repos" :optionLabel="label" /> -->
<MultiSelect v-model="selectedRepo" display="chip" :options="repos" :optionLabel="label" filter
:maxSelectedLabels="3" placeholder="Select Repos" />
<div style="padding: 16px; display: flex; justify-content: space-between; ">
<div>
Repo:
<MultiSelect v-model="selectedRepo" display="chip" :options="repos" :optionLabel="label" filter
:maxSelectedLabels="3" placeholder="Select Repos" />
</div>

<Message severity="secondary" >
Repo Count: {{ summariesInfo.total_repos }} in total, {{ summariesInfo.good }} good, and
{{ summariesInfo.zero_history }} with zero history
</Message>
</div>

<TargetTable :data="workflowSelected" :dataColumns="workflowColumns" :rowSelect="onRowSelectedWorkflow"
Expand Down Expand Up @@ -121,6 +127,7 @@ const data = ref<Workflows>();
const selectedSummaries = ref<Summary[]>([]);
const summaries = ref<Summary[]>([]);
githubFetch<Summary[]>({
path: "plugin/github-api/workflows/summaries.json"
}).then(val => {
Expand All @@ -137,6 +144,16 @@ githubFetch<Summary[]>({
data.value = summary_to_workflows(latest);
});
const summariesInfo = computed(() => {
const val = summaries.value;
const total_repos = val.length;
const zero_history = val.reduce((acc, cur) => {
if (cur.runs === 0) { acc += 1; }
return acc;
}, 0);
return { total_repos, zero_history, good: total_repos - zero_history };
});
function onRowSelectedWorkflow(event: DataTableRowSelectEvent) {
const user = event.data.user;
const repo = event.data.repo;
Expand Down

0 comments on commit 9708b73

Please sign in to comment.