Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions src/components/cylc/TaskStateBadge.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!--
Copyright (C) NIWA & British Crown (Met Office) & Contributors.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->

<template>
<div
class="task-state-badge d-flex justify-center align-center px-1"
:class="state"
v-tooltip="{ text: tooltip, openDelay: 400, location: 'top' }"
>
{{ value > 99 ? '99+' : value }}
</div>
</template>

<script setup>
import { computed } from 'vue'

const props = defineProps({
state: {
type: String,
required: true
},
value: {
type: Number,
required: true,
},
})

const tooltip = computed(
() => `${props.value} ${props.state} task${props.value > 1 ? 's' : ''}`
)
</script>
4 changes: 1 addition & 3 deletions src/components/cylc/WarningIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

<template>
<span
class="c-warn"
class="c-warn d-inline-flex"
:class="{'active': workflow.node.warningActive}"
style="display: inline-block;"
>
<v-tooltip
:activator="null"
Expand All @@ -45,7 +44,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
@click="deactivate"
@click.prevent
style="
vertical-align: middle;
cursor: pointer;
"
:style="[workflow.node.logRecords?.length ? {opacity: 1} : {opacity: 0.3}]"
Expand Down
13 changes: 9 additions & 4 deletions src/components/cylc/table/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
:class="{ 'flow-none': isFlowNone(item.task.node.flowNums) }"
:data-cy-task-name="item.task.name"
>
<div style="width: 2em;">
<div v-bind="jobIconParentProps">
<Task
v-command-menu="item.task"
:task="item.task.node"
:startTime="item.latestJob?.node?.startedTime"
/>
</div>
<div style="width: 2em;">
<div v-bind="jobIconParentProps">
<Job
v-if="item.latestJob"
v-command-menu="item.latestJob"
Expand Down Expand Up @@ -93,14 +93,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
>
<td :colspan="3">
<div class="d-flex align-content-center flex-nowrap">
<div class="d-flex" style="margin-left: 2em;">
<div v-bind="jobIconParentProps" :style="{ marginLeft: jobIconParentProps.style.width }">
<Job
v-command-menu="job"
:key="`${job.id}-summary-${index}`"
:status="job.node.state"
/>
<span class="ml-2">#{{ job.node.submitNum }}</span>
</div>
<span>#{{ job.node.submitNum }}</span>
</div>
</td>
<td>{{ job.node.platform }}</td>
Expand Down Expand Up @@ -288,6 +288,11 @@ const taskRunTimes = computed(() => new Map(
])
))

const jobIconParentProps = {
class: ['d-flex', 'align-center'],
style: { width: '2em' },
}

const itemsPerPageOptions = [
{ value: 10, title: '10' },
{ value: 20, title: '20' },
Expand Down
57 changes: 17 additions & 40 deletions src/components/cylc/tree/GScanTreeItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,37 +47,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</span>
</div>
<div class="d-flex text-right c-gscan-workflow-states flex-grow-0">
<!-- task summary tooltips -->
<!-- a v-tooltip does not work directly set on Cylc job component, so we use a div to wrap it -->
<div
class="ma-0 pa-0"
min-width="0"
min-height="0"
style="font-size: 120%; width: auto;"
>
<WarningIcon v-if="workflowWarnings" :workflow="node" />
</div>
<div
v-for="[state, tasks] in Object.entries(descendantTaskInfo.latestTasks)"
:key="`${node.id}-${state}`"
:class="getTaskStateClass(descendantTaskInfo.stateTotals, state)"
class="ma-0 pa-0"
min-width="0"
min-height="0"
style="font-size: 120%; width: auto;"
>
<Job :status="state" />
<v-tooltip location="top">
<!-- tooltip text -->
<div class="text-grey-lighten-1">
{{ descendantTaskInfo.stateTotals[state] ?? 0 }} {{ state }}. Recent {{ state }} tasks:
</div>
<div v-for="(task, index) in tasks.slice(0, $options.maxTasksDisplayed)" :key="index">
{{ task }}<br v-if="index !== tasks.length - 1" />
</div>
</v-tooltip>
</div>
<WarningIcon
v-if="workflowWarnings"
:workflow="node"
style="font-size: 120%;"
/>
</div>
<template
v-for="state in Object.keys(descendantTaskInfo.latestTasks)"
:key="`${node.id}-${state}`"
>
<TaskStateBadge
v-if="descendantTaskInfo.stateTotals[state]"
:state="state"
:value="descendantTaskInfo.stateTotals[state]"
/>
</template>
</div>
</v-list-item>

Expand All @@ -95,7 +80,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</template>

<script>
import Job from '@/components/cylc/Job.vue'
import TaskStateBadge from '@/components/cylc/TaskStateBadge.vue'
import WorkflowIcon from '@/components/cylc/gscan/WorkflowIcon.vue'
import TreeItem from '@/components/cylc/tree/TreeItem.vue'
import WarningIcon from '@/components/cylc/WarningIcon.vue'
Expand Down Expand Up @@ -144,7 +129,7 @@ export default {
name: 'GScanTreeItem',

components: {
Job,
TaskStateBadge,
TreeItem,
WarningIcon,
WorkflowIcon,
Expand Down Expand Up @@ -197,14 +182,6 @@ export default {
}
},

methods: {
getTaskStateClass (stateTotals, state) {
return {
'empty-state': !stateTotals[state]
}
},
},

nodeTypes: ['workflow-part', 'workflow'],
maxTasksDisplayed: 5,
WorkflowState,
Expand Down
2 changes: 1 addition & 1 deletion src/components/cylc/workspace/Toolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

<!-- control bar elements displayed only when there is a current workflow in the store -->
<template v-if="currentWorkflow">
<div class="c-workflow-controls flex-shrink-0">
<div class="c-workflow-controls d-flex align-center flex-shrink-0">
<WarningIcon
:workflow="currentWorkflow"
style="font-size: 120%; padding-right: 0.3em;"
Expand Down
Loading
Loading