kui-shell
Version:
This is the monorepo for Kui, the hybrid command-line/GUI electron-based Kubernetes tool
37 lines • 1.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const debug_1 = require("debug");
const marked = require("marked");
const debug = debug_1.default('plugin/operator-framework/view/modes/description');
function isDescriptionBearer(resource) {
const bearer = resource;
return bearer !== undefined && bearer.spec !== undefined && bearer.spec.description !== undefined;
}
exports.descriptionMode = {
when: isDescriptionBearer,
mode: (command, resource) => {
try {
return {
mode: 'Description',
leaveBottomStripeAlone: true,
direct: {
plugin: 'operator-framework/dist/index',
operation: 'renderAndViewDescription',
parameters: { command, resource }
}
};
}
catch (err) {
debug('error rendering description button');
console.error(err);
}
}
};
exports.renderAndView = (tab, parameters) => {
const { command, resource } = parameters;
debug('renderAndView', command, resource);
const container = document.createElement('div');
container.innerHTML = marked(resource.resource.spec.description);
return container;
};
//# sourceMappingURL=description.js.map