Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
debug('initializing')
if (!Capabilities.isHeadless()) {
const { Models } = await import('@kui-shell/core/api/models')
const { persisters } = await import('./lib/cmds/new')
const getEntity = (tab: Tabs.Tab) => {
const entity = Models.Selection.current(tab)
entity['persister'] = persisters.actions
debug('getEntity', entity)
return entity
}
const { gotoReadonlyView, fetchAction } = await import('./lib/cmds/new')
registerFetcher(fetchAction())
const unlock = lockIcon({
getEntity,
mode: 'unlock',
label: 'Edit',
// icon: 'fas fa-lock',
tooltip: 'Click to edit', // TODO externalize string
direct: edit({
getEntity,
lock: ({ getEntity }) => lockIcon({ getEntity, direct: gotoReadonlyView({ getEntity }) })
})
})
setTimeout(async () => {
const { addActionMode } = await import('@kui-shell/plugin-openwhisk')
addActionMode(unlock, 'unshift')