|
|
@ -52,8 +52,15 @@ class VerticalIconComponent { |
|
|
|
listenOnStatus (api) { |
|
|
|
listenOnStatus (api) { |
|
|
|
if (!api.events) return |
|
|
|
if (!api.events) return |
|
|
|
const fn = (status) => { |
|
|
|
const fn = (status) => { |
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
|
|
status.type === 'warning' || |
|
|
|
|
|
|
|
status.type === 'danger' || |
|
|
|
|
|
|
|
status.key === 'code' || |
|
|
|
|
|
|
|
status.key === 'check' || |
|
|
|
|
|
|
|
(status.key === '' && status.type === '' && status.title === '')) { |
|
|
|
this.setIconStatus(api.profile.name, status) |
|
|
|
this.setIconStatus(api.profile.name, status) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
this.iconStatus[api.profile.name] = fn |
|
|
|
this.iconStatus[api.profile.name] = fn |
|
|
|
api.events.on('statusChanged', this.iconStatus[api.profile.name]) |
|
|
|
api.events.on('statusChanged', this.iconStatus[api.profile.name]) |
|
|
|
} |
|
|
|
} |
|
|
@ -90,17 +97,33 @@ class VerticalIconComponent { |
|
|
|
let key = helper.checkSpecialChars(status.key) ? '' : status.key |
|
|
|
let key = helper.checkSpecialChars(status.key) ? '' : status.key |
|
|
|
let type = helper.checkSpecialChars(status.type) ? '' : status.type |
|
|
|
let type = helper.checkSpecialChars(status.type) ? '' : status.type |
|
|
|
let title = helper.checkSpecialChars(status.title) ? '' : status.title |
|
|
|
let title = helper.checkSpecialChars(status.title) ? '' : status.title |
|
|
|
el.appendChild(yo`<span title="${title}" class="badge badge-pill badge-${type} ${css.status}" aria-hidden="true">3</span>`) |
|
|
|
|
|
|
|
|
|
|
|
let classes = css.status |
|
|
|
|
|
|
|
switch (key) { |
|
|
|
|
|
|
|
case 'check': |
|
|
|
|
|
|
|
classes += ' badge badge-pill badge-' + type + ' text-' + type |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
case 'code': |
|
|
|
|
|
|
|
classes += ' fas fa-sync text-' + type |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
classes += ' badge badge-pill badge-' + type |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
el.appendChild(yo`<span
|
|
|
|
|
|
|
|
title="${title}" |
|
|
|
|
|
|
|
class="${classes}" |
|
|
|
|
|
|
|
aria-hidden="true" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
${key === 'code' ? '' : key === 'check' ? 'o' : key} |
|
|
|
|
|
|
|
</span>`) |
|
|
|
|
|
|
|
|
|
|
|
// el.classList = "" doesn't work on all browser use instead
|
|
|
|
// el.classList = "" doesn't work on all browser use instead
|
|
|
|
var classList = el.classList |
|
|
|
var classList = el.classList |
|
|
|
while (classList.length > 0) { |
|
|
|
while (classList.length > 0) { |
|
|
|
classList.remove(classList.item(0)) |
|
|
|
classList.remove(classList.item(0)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
el.classList.add(`${css.icon}`) |
|
|
|
el.classList.add(`${css.icon}`) |
|
|
|
//el.classList.add('border')
|
|
|
|
|
|
|
|
//el.classList.add(`border-${type}`)
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|