From 15073cbc817124bac3cd72caeee5bb3ee6515836 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sat, 2 Jan 2021 20:31:26 +0100 Subject: [PATCH] reenabled @typescript-eslint/no-dynamic-delete --- .eslintrc.yml | 1 - .../pluginsSettingsTab.component.pug | 18 +++++++++--------- .../components/pluginsSettingsTab.component.ts | 14 +++++++------- .../src/services/sessions.service.ts | 6 +++--- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index 6f5b52b4..5d3cb46b 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -102,7 +102,6 @@ rules: - allowConstantLoopConditions: true '@typescript-eslint/no-untyped-public-signature': off # bugs out on constructors '@typescript-eslint/restrict-template-expressions': off - '@typescript-eslint/no-dynamic-delete': off '@typescript-eslint/prefer-readonly-parameter-types': off '@typescript-eslint/no-unsafe-member-access': off '@typescript-eslint/no-unsafe-call': off diff --git a/terminus-plugin-manager/src/components/pluginsSettingsTab.component.pug b/terminus-plugin-manager/src/components/pluginsSettingsTab.component.pug index dd64a627..e595893f 100644 --- a/terminus-plugin-manager/src/components/pluginsSettingsTab.component.pug +++ b/terminus-plugin-manager/src/components/pluginsSettingsTab.component.pug @@ -22,10 +22,10 @@ button.btn.btn-primary.ml-2( *ngIf='knownUpgrades[plugin.name]', (click)='upgradePlugin(plugin)', - [disabled]='busy[plugin.name] != undefined' + [disabled]='busy.has(plugin.name)' ) - i.fas.fa-fw.fa-arrow-up(*ngIf='busy[plugin.name] != BusyState.Installing') - i.fas.fa-fw.fa-circle-notch.fa-spin(*ngIf='busy[plugin.name] == BusyState.Installing') + i.fas.fa-fw.fa-arrow-up(*ngIf='busy.get(plugin.name) != BusyState.Installing') + i.fas.fa-fw.fa-circle-notch.fa-spin(*ngIf='busy.get(plugin.name) == BusyState.Installing') span Upgrade ({{knownUpgrades[plugin.name].version}}) button.btn.btn-link.text-primary.ml-2( @@ -43,10 +43,10 @@ button.btn.btn-link.text-danger.ml-2( (click)='uninstallPlugin(plugin)', *ngIf='!plugin.isBuiltin', - [disabled]='busy[plugin.name] != undefined' + [disabled]='busy.has(plugin.name)' ) - i.fas.fa-fw.fa-trash(*ngIf='busy[plugin.name] != BusyState.Uninstalling') - i.fas.fa-fw.fa-circle-notch.fa-spin(*ngIf='busy[plugin.name] == BusyState.Uninstalling') + i.fas.fa-fw.fa-trash(*ngIf='busy.get(plugin.name) != BusyState.Uninstalling') + i.fas.fa-fw.fa-circle-notch.fa-spin(*ngIf='busy.get(plugin.name) == BusyState.Uninstalling') div h3.mt-4 Available @@ -69,10 +69,10 @@ div .list-group-item.d-flex.align-items-center(*ngIf='!isAlreadyInstalled(plugin)') button.btn.btn-primary.mr-3( (click)='installPlugin(plugin)', - [disabled]='busy[plugin.name] != undefined' + [disabled]='busy.has(plugin.name)' ) - i.fas.fa-fw.fa-download(*ngIf='busy[plugin.name] != BusyState.Installing') - i.fas.fa-fw.fa-circle-notch.fa-spin(*ngIf='busy[plugin.name] == BusyState.Installing') + i.fas.fa-fw.fa-download(*ngIf='busy.get(plugin.name) != BusyState.Installing') + i.fas.fa-fw.fa-circle-notch.fa-spin(*ngIf='busy.get(plugin.name) == BusyState.Installing') div((click)='showPluginInfo(plugin)') div diff --git a/terminus-plugin-manager/src/components/pluginsSettingsTab.component.ts b/terminus-plugin-manager/src/components/pluginsSettingsTab.component.ts index f9dafee8..0ca124fc 100644 --- a/terminus-plugin-manager/src/components/pluginsSettingsTab.component.ts +++ b/terminus-plugin-manager/src/components/pluginsSettingsTab.component.ts @@ -20,7 +20,7 @@ export class PluginsSettingsTabComponent { @Input() availablePluginsQuery$ = new BehaviorSubject('') @Input() availablePluginsReady = false @Input() knownUpgrades: Record = {} - @Input() busy: Record = {} + @Input() busy = new Map() @Input() erroredPlugin: string @Input() errorMessage: string @@ -67,29 +67,29 @@ export class PluginsSettingsTabComponent { } async installPlugin (plugin: PluginInfo): Promise { - this.busy[plugin.name] = BusyState.Installing + this.busy.set(plugin.name, BusyState.Installing) try { await this.pluginManager.installPlugin(plugin) - delete this.busy[plugin.name] + this.busy.delete(plugin.name) this.config.requestRestart() } catch (err) { this.erroredPlugin = plugin.name this.errorMessage = err - delete this.busy[plugin.name] + this.busy.delete(plugin.name) throw err } } async uninstallPlugin (plugin: PluginInfo): Promise { - this.busy[plugin.name] = BusyState.Uninstalling + this.busy.set(plugin.name, BusyState.Uninstalling) try { await this.pluginManager.uninstallPlugin(plugin) - delete this.busy[plugin.name] + this.busy.delete(plugin.name) this.config.requestRestart() } catch (err) { this.erroredPlugin = plugin.name this.errorMessage = err - delete this.busy[plugin.name] + this.busy.delete(plugin.name) throw err } } diff --git a/terminus-terminal/src/services/sessions.service.ts b/terminus-terminal/src/services/sessions.service.ts index 1702049d..cc598c60 100644 --- a/terminus-terminal/src/services/sessions.service.ts +++ b/terminus-terminal/src/services/sessions.service.ts @@ -331,7 +331,7 @@ export class Session extends BaseSession { /** @hidden */ @Injectable({ providedIn: 'root' }) export class SessionsService { - sessions: Record = {} + sessions = new Map() logger: Logger private lastID = 0 @@ -347,9 +347,9 @@ export class SessionsService { options.name = `session-${this.lastID}` session.start(options) session.destroyed$.pipe(first()).subscribe(() => { - delete this.sessions[session.name] + this.sessions.delete(session.name) }) - this.sessions[session.name] = session + this.sessions.set(session.name, session) return session } }