Skip to content
10 changes: 5 additions & 5 deletions src/components/cylc/MessageChip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ const props = defineProps({
})

const classMap = new Map([
['this is a debug message', ''],
['this is a info message', 'bg-grey'],
['this is a warning message', 'bg-warning'],
['this is an error message', 'bg-error'],
['this is a critical message', 'bg-black font-weight-bold'],
['DEBUG', ''],
['INFO', 'bg-grey'],
['WARNING', 'bg-warning'],
['ERROR', 'bg-error'],
['CRITICAL', 'bg-black font-weight-bold'],
])

const chipClass = computed(() => (
Expand Down
2 changes: 1 addition & 1 deletion src/components/cylc/tree/TreeItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<MessageChip
v-for="(customOutput, index) of [...jobMessageOutputs].slice(0, 5)"
:key="`output-chip-${index}`"
:level="customOutput.label"
:level="customOutput.level"
:message="customOutput.message"
:isMessage="customOutput.isMessage"
location="bottom">
Expand Down
4 changes: 3 additions & 1 deletion src/utils/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ function jobMessageOutputs (jobNode) {
const ret = []
let messageOutput

for (const message of jobNode.node.messages || []) {
for (const messageString of jobNode.node.messages || []) {
const [level, message] = messageString.split(':')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately as Oliver pointed out to me, we can't use String.split() as there could be multiple colons after the first severity level one. We'll have to use a regex here, I think something like

/^(?:(DEBUG|INFO|WARNING|ERROR|CRITICAL):)?(.*)/

if (TASK_OUTPUT_NAMES.includes(message)) {
continue
}
Expand All @@ -88,6 +89,7 @@ function jobMessageOutputs (jobNode) {
} else {
// add a message to the list and make it look like an output
ret.push({
level,
label: message,
message: `Task Message: ${message}`,
isMessage: true
Expand Down