fix: extension hiding + deprecation notice

This commit is contained in:
Mo Bitar
2020-09-25 10:56:50 -05:00
parent b124ac4732
commit 945144734c
4 changed files with 11 additions and 8 deletions

View File

@@ -97,6 +97,7 @@ class ActionsMenuCtrl extends PureViewCtrl<{}, ActionsMenuState> implements Acti
loading: state?.loading ?? false, loading: state?.loading ?? false,
error: state?.error ?? false, error: state?.error ?? false,
hidden: state?.hidden ?? false, hidden: state?.hidden ?? false,
deprecation: extension.deprecation!,
actions: extension.actionsWithContextForItem(this.item).map(action => { actions: extension.actionsWithContextForItem(this.item).map(action => {
if (action.id === selectedActionId) { if (action.id === selectedActionId) {
return { return {
@@ -114,7 +115,7 @@ class ActionsMenuCtrl extends PureViewCtrl<{}, ActionsMenuState> implements Acti
async loadExtensions() { async loadExtensions() {
await Promise.all(this.state.extensions.map(async (extension: SNActionsExtension) => { await Promise.all(this.state.extensions.map(async (extension: SNActionsExtension) => {
await this.setLoadingExtension(extension.uuid, true); this.setLoadingExtension(extension.uuid, true);
const updatedExtension = await this.application.actionsManager!.loadExtensionInContextOfItem( const updatedExtension = await this.application.actionsManager!.loadExtensionInContextOfItem(
extension, extension,
this.item this.item
@@ -122,9 +123,9 @@ class ActionsMenuCtrl extends PureViewCtrl<{}, ActionsMenuState> implements Acti
if (updatedExtension) { if (updatedExtension) {
await this.updateExtension(updatedExtension!); await this.updateExtension(updatedExtension!);
} else { } else {
await this.setErrorExtension(extension.uuid, true); this.setErrorExtension(extension.uuid, true);
} }
await this.setLoadingExtension(extension.uuid, false); this.setLoadingExtension(extension.uuid, false);
})); }));
} }

View File

@@ -13,13 +13,15 @@
) )
.sk-menu-panel-column .sk-menu-panel-column
.sk-menu-panel-header-title {{extension.name}} .sk-menu-panel-header-title {{extension.name}}
div(ng-if='extension.visible') … div(ng-if='extension.hidden') …
.sk-menu-panel-header-subtitle(ng-if='extension.deprecation && !extension.hidden')
| {{extension.deprecation}}
div(ng-if='extension.loading') div(ng-if='extension.loading')
.sk-spinner.small.loading .sk-spinner.small.loading
menu-row( menu-row(
action='self.executeAction(action, extension.uuid)', action='self.executeAction(action, extension.uuid)',
label='action.label', label='action.label',
ng-if='!extension.visible && !extension.loading && !extension.error', ng-if='!extension.hidden && !extension.loading && !extension.error',
ng-repeat='action in extension.actions track by $index', ng-repeat='action in extension.actions track by $index',
disabled='action.running' disabled='action.running'
spinner-class="action.running ? 'info' : null", spinner-class="action.running ? 'info' : null",

4
package-lock.json generated
View File

@@ -10956,8 +10956,8 @@
"from": "github:standardnotes/sncrypto#8794c88daa967eaae493cd5fdec7506d52b257ad" "from": "github:standardnotes/sncrypto#8794c88daa967eaae493cd5fdec7506d52b257ad"
}, },
"snjs": { "snjs": {
"version": "github:standardnotes/snjs#30520edbd80564d584c4b00a09b552d89d1c9e26", "version": "github:standardnotes/snjs#303e9609efb9ad83bf07160c2aae6404533efeb7",
"from": "github:standardnotes/snjs#30520edbd80564d584c4b00a09b552d89d1c9e26" "from": "github:standardnotes/snjs#303e9609efb9ad83bf07160c2aae6404533efeb7"
}, },
"sockjs": { "sockjs": {
"version": "0.3.20", "version": "0.3.20",

View File

@@ -68,6 +68,6 @@
}, },
"dependencies": { "dependencies": {
"sncrypto": "github:standardnotes/sncrypto#8794c88daa967eaae493cd5fdec7506d52b257ad", "sncrypto": "github:standardnotes/sncrypto#8794c88daa967eaae493cd5fdec7506d52b257ad",
"snjs": "github:standardnotes/snjs#30520edbd80564d584c4b00a09b552d89d1c9e26" "snjs": "github:standardnotes/snjs#303e9609efb9ad83bf07160c2aae6404533efeb7"
} }
} }