Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature color cylc message bubbles #1436

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
10 changes: 5 additions & 5 deletions src/components/cylc/MessageChip.vue
MetRonnie marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@
isMessage: Boolean
})

const classMap = new Map([

Check warning on line 44 in src/components/cylc/MessageChip.vue

View check run for this annotation

Codecov / codecov/patch

src/components/cylc/MessageChip.vue#L44

Added line #L44 was not covered by tests
['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(() => (

Check warning on line 52 in src/components/cylc/MessageChip.vue

View check run for this annotation

Codecov / codecov/patch

src/components/cylc/MessageChip.vue#L52

Added line #L52 was not covered by tests
classMap.get(props.level) ?? (props.isMessage ? 'bg-grey-lighten-5' : 'bg-grey')
))

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 @@
const ret = []
let messageOutput

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

Check warning on line 75 in src/utils/tasks.js

View check run for this annotation

Codecov / codecov/patch

src/utils/tasks.js#L75

Added line #L75 was not covered by tests
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 @@
} 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
Loading