mirror of
https://github.com/fleetdm/fleet
synced 2026-04-29 09:27:18 +00:00
Related to: https://github.com/fleetdm/fleet/issues/42738 Changes: - Uncommented and updated the code that replaces text content in double parentheses with `<bubble>` elements in build-static-content to not replace content inside of `<code>` elements - Created a `<bubble>` component based on the ((bubbles)) in the Sails.js docs.
60 lines
2 KiB
JavaScript
Vendored
60 lines
2 KiB
JavaScript
Vendored
/**
|
|
* <bubble>
|
|
* -----------------------------------------------------------------------------
|
|
* A styled span used in documentation.
|
|
*
|
|
* @type {Component}
|
|
*
|
|
* @event click [emitted when clicked]
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
|
|
parasails.registerComponent('bubble', {
|
|
// ╔═╗╦═╗╔═╗╔═╗╔═╗
|
|
// ╠═╝╠╦╝║ ║╠═╝╚═╗
|
|
// ╩ ╩╚═╚═╝╩ ╚═╝
|
|
props: [
|
|
'type',
|
|
],
|
|
|
|
// ╦╔╗╔╦╔╦╗╦╔═╗╦ ╔═╗╔╦╗╔═╗╔╦╗╔═╗
|
|
// ║║║║║ ║ ║╠═╣║ ╚═╗ ║ ╠═╣ ║ ║╣
|
|
// ╩╝╚╝╩ ╩ ╩╩ ╩╩═╝ ╚═╝ ╩ ╩ ╩ ╩ ╚═╝
|
|
data: function (){
|
|
return {
|
|
rawType: this.type ? this.type.replace(/\?$/, '').toLowerCase() : '',
|
|
isUncertain: this.type ? this.type.match(/\?$/g) ? true : false : '',
|
|
};
|
|
},
|
|
|
|
// ╦ ╦╔╦╗╔╦╗╦
|
|
// ╠═╣ ║ ║║║║
|
|
// ╩ ╩ ╩ ╩ ╩╩═╝
|
|
template: `
|
|
<span>
|
|
<span purpose="bubble-heart" :class="rawType+' '+[[isUncertain ? 'uncertain' : '']]" class="">{{type}}</span>
|
|
</span>
|
|
`,
|
|
|
|
// ╦ ╦╔═╗╔═╗╔═╗╦ ╦╔═╗╦ ╔═╗
|
|
// ║ ║╠╣ ║╣ ║ ╚╦╝║ ║ ║╣
|
|
// ╩═╝╩╚ ╚═╝╚═╝ ╩ ╚═╝╩═╝╚═╝
|
|
beforeMount: function() {
|
|
if(this.type === undefined){
|
|
throw new Error(`Incomplete usage of <bubble>: Please provide a 'type' that will be displayed as text inside the bubble. e.g., <bubble type="Observer"></bubble>`);
|
|
}
|
|
},
|
|
mounted: async function(){
|
|
//…
|
|
},
|
|
beforeDestroy: function() {
|
|
//…
|
|
},
|
|
|
|
// ╦╔╗╔╔╦╗╔═╗╦═╗╔═╗╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
|
|
// ║║║║ ║ ║╣ ╠╦╝╠═╣║ ║ ║║ ║║║║╚═╗
|
|
// ╩╝╚╝ ╩ ╚═╝╩╚═╩ ╩╚═╝ ╩ ╩╚═╝╝╚╝╚═╝
|
|
methods: {
|
|
//…
|
|
}
|
|
});
|