From aa1dd2f55536a6437528b0e044029f218459b113 Mon Sep 17 00:00:00 2001 From: Mark Dawson Date: Fri, 11 Aug 2023 16:19:53 +0100 Subject: [PATCH 1/8] added new component for Message Chips --- src/components/cylc/MessageChip.vue | 57 +++++++++++++++++++++++++++ src/components/cylc/tree/TreeItem.vue | 25 +++++------- 2 files changed, 66 insertions(+), 16 deletions(-) create mode 100644 src/components/cylc/MessageChip.vue diff --git a/src/components/cylc/MessageChip.vue b/src/components/cylc/MessageChip.vue new file mode 100644 index 000000000..d6a69cc1b --- /dev/null +++ b/src/components/cylc/MessageChip.vue @@ -0,0 +1,57 @@ + + + diff --git a/src/components/cylc/tree/TreeItem.vue b/src/components/cylc/tree/TreeItem.vue index b39fd9ca2..705a8296e 100644 --- a/src/components/cylc/tree/TreeItem.vue +++ b/src/components/cylc/tree/TreeItem.vue @@ -115,23 +115,14 @@ along with this program. If not, see . prefix). @see https://github.com/cylc/cylc-ui/pull/530#issuecomment-781076619 --> - - - {{ customOutput.message }} - + :level="customOutput.label" + :message="customOutput.message" + :isMessage="customOutput.isMessage" + location="bottom"> + . import { mdiChevronRight } from '@mdi/js' import Task from '@/components/cylc/Task.vue' import Job from '@/components/cylc/Job.vue' +import MessageChip from '@/components/cylc/MessageChip.vue' import { WorkflowState } from '@/model/WorkflowState.model' import { formatDuration, @@ -261,7 +253,8 @@ export default { components: { Task, - Job + Job, + MessageChip }, props: { From 50547fb2ddfe5684dbefc51d414df4fa2072ae4d Mon Sep 17 00:00:00 2001 From: Mark Dawson Date: Tue, 15 Aug 2023 14:15:04 +0100 Subject: [PATCH 2/8] refactored MessageChip component and added tests --- cypress/component/viewMessageChip.cy.js | 48 +++++++++++++++++++++ src/components/cylc/MessageChip.vue | 57 +++++++++---------------- src/components/cylc/tree/TreeItem.vue | 1 + tests/e2e/specs/tree.cy.js | 11 +++-- 4 files changed, 74 insertions(+), 43 deletions(-) create mode 100644 cypress/component/viewMessageChip.cy.js diff --git a/cypress/component/viewMessageChip.cy.js b/cypress/component/viewMessageChip.cy.js new file mode 100644 index 000000000..7910f598f --- /dev/null +++ b/cypress/component/viewMessageChip.cy.js @@ -0,0 +1,48 @@ +/** + * 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 . + */ + +import MessageChip from '@/components/cylc/MessageChip.vue' + +describe('View MessageChip Component', () => { + const mountMessageChip = (props) => { + cy.vmount( + MessageChip, + { + props + } + ).as('wrapper') + // add the classes Vuetify requires + cy.addVuetifyStyles(cy) + } + + it('checks messageChip colors', () => { + // mount the toolbar with a couple of controls + mountMessageChip( + { + level: 'this is a debug message', + message: 'Task Message :this is a debug message', + isMessage: true + } + ) + + // are the messages the correct colours? + cy + .get('.v-chip') + .should('have.class', 'bg-blue') + .contains('this is a debug message') + }) +}) diff --git a/src/components/cylc/MessageChip.vue b/src/components/cylc/MessageChip.vue index d6a69cc1b..6c1bfaa38 100644 --- a/src/components/cylc/MessageChip.vue +++ b/src/components/cylc/MessageChip.vue @@ -16,42 +16,25 @@ - diff --git a/src/components/cylc/tree/TreeItem.vue b/src/components/cylc/tree/TreeItem.vue index 705a8296e..b5c6162c7 100644 --- a/src/components/cylc/tree/TreeItem.vue +++ b/src/components/cylc/tree/TreeItem.vue @@ -129,6 +129,7 @@ along with this program. If not, see . size="small" link @click="toggleExpandCollapse" + data-cy="chip-overflow" > +{{ jobMessageOutputs.length - 5 }} diff --git a/tests/e2e/specs/tree.cy.js b/tests/e2e/specs/tree.cy.js index 9a26b058a..8ad43aef1 100644 --- a/tests/e2e/specs/tree.cy.js +++ b/tests/e2e/specs/tree.cy.js @@ -163,17 +163,16 @@ describe('Tree view', () => { .should('be.visible') // the first job should have 5 outputs (the maximum number we display) - .first() + .first().as('firstJobNode') .find('.message-output') .should('have.length', 5) // the remainder should be referenced in an overflow counter +2 - .parent() + .get('@firstJobNode') + .find('[data-cy=chip-overflow]') .contains('+2') - .parent() - .parent() - .parent() - .parent() + .parents('.treeitem') + .first() // expand the job details node .find('.node-expand-collapse-button') From fa55091941ee59e634c7a0897cdbe340291f6ce2 Mon Sep 17 00:00:00 2001 From: Mark Dawson Date: Tue, 15 Aug 2023 15:46:36 +0100 Subject: [PATCH 3/8] updated CHANGES.md file --- CHANGES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 07b851fc8..48cb53567 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -18,6 +18,10 @@ ones in. --> [#1428](https://github.com/cylc/cylc-ui/pull/1428) - Pinned buttons to the bottom of the command edit form. +[#1436](https://github.com/cylc/cylc-ui/pull/1436) - +Added colours to message chips based on message level + + ------------------------------------------------------------------------------- ## __cylc-ui-2.0.0 (Released 2023-07-21)__ From 901538e9cfe516b7b672ae4b80558482e2e036be Mon Sep 17 00:00:00 2001 From: Mark Dawson Date: Wed, 30 Aug 2023 10:04:14 +0100 Subject: [PATCH 4/8] Update src/components/cylc/MessageChip.vue Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com> --- src/components/cylc/MessageChip.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/cylc/MessageChip.vue b/src/components/cylc/MessageChip.vue index 7f5dad5fb..36fe9b9a1 100644 --- a/src/components/cylc/MessageChip.vue +++ b/src/components/cylc/MessageChip.vue @@ -4,7 +4,7 @@