|
| 1 | +<!-- |
| 2 | +Copyright (C) NIWA & British Crown (Met Office) & Contributors. |
| 3 | +
|
| 4 | +This program is free software: you can redistribute it and/or modify |
| 5 | +it under the terms of the GNU General Public License as published by |
| 6 | +the Free Software Foundation, either version 3 of the License, or |
| 7 | +(at your option) any later version. |
| 8 | +
|
| 9 | +This program is distributed in the hope that it will be useful, |
| 10 | +but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | +GNU General Public License for more details. |
| 13 | +
|
| 14 | +You should have received a copy of the GNU General Public License |
| 15 | +along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | +--> |
| 17 | + |
| 18 | +<template> |
| 19 | + <div |
| 20 | + :id="`${node.id}-job-details`" |
| 21 | + class="node leaf job-details mb-2" |
| 22 | + > |
| 23 | + <div class="arrow-up" :style="leafTriangleStyle"></div> |
| 24 | + <div class="leaf-data pa-2 rounded-lg"> |
| 25 | + <v-defaults-provider :defaults="defaults"> |
| 26 | + <JobDetailsTable |
| 27 | + :node="node.node" |
| 28 | + :mean-elapsed-time="meanElapsedTime" |
| 29 | + class="bg-transparent" |
| 30 | + /> |
| 31 | + <v-table |
| 32 | + v-if="customOutputs?.length" |
| 33 | + class="outputs mt-2 bg-white" |
| 34 | + > |
| 35 | + <thead> |
| 36 | + <tr> |
| 37 | + <th>Custom output</th> |
| 38 | + <th>Message</th> |
| 39 | + </tr> |
| 40 | + </thead> |
| 41 | + <tbody> |
| 42 | + <tr |
| 43 | + v-for="customOutput of customOutputs" |
| 44 | + :key="customOutput.label" |
| 45 | + > |
| 46 | + <td>{{ customOutput.isMessage ? '--' : customOutput.label }}</td> |
| 47 | + <td>{{ customOutput.message }}</td> |
| 48 | + </tr> |
| 49 | + </tbody> |
| 50 | + </v-table> |
| 51 | + </v-defaults-provider> |
| 52 | + </div> |
| 53 | + </div> |
| 54 | +</template> |
| 55 | + |
| 56 | +<script setup> |
| 57 | +import { computed } from 'vue' |
| 58 | +import { getIndent } from '@/components/cylc/tree/util' |
| 59 | +import { jobMessageOutputs } from '@/utils/tasks' |
| 60 | +import JobDetailsTable from '@/components/cylc/common/JobDetails.vue' |
| 61 | +
|
| 62 | +const props = defineProps({ |
| 63 | + node: { |
| 64 | + type: Object, |
| 65 | + required: true, |
| 66 | + }, |
| 67 | + /** Indent level */ |
| 68 | + depth: { |
| 69 | + type: Number, |
| 70 | + required: true, |
| 71 | + }, |
| 72 | + meanElapsedTime: { |
| 73 | + type: Number, |
| 74 | + }, |
| 75 | + density: { |
| 76 | + type: String, |
| 77 | + default: 'compact' |
| 78 | + } |
| 79 | +}) |
| 80 | +
|
| 81 | +/** Make the job details triangle point to the job icon */ |
| 82 | +const leafTriangleStyle = computed(() => ({ |
| 83 | + 'margin-left': getIndent(props.depth), |
| 84 | +})) |
| 85 | +
|
| 86 | +const defaults = computed(() => ({ |
| 87 | + VTable: { |
| 88 | + density: props.density, |
| 89 | + hover: true, |
| 90 | + } |
| 91 | +})) |
| 92 | +
|
| 93 | +const customOutputs = computed(() => jobMessageOutputs(props.node)) |
| 94 | +</script> |
0 commit comments