This commit is contained in:
Eugene Pankov
2017-06-04 18:58:00 +02:00
parent 2e81a1657e
commit 2edcd5b57a
23 changed files with 175 additions and 155 deletions

View File

@@ -2,63 +2,81 @@
strong Error in {{erroredPlugin}}:
pre {{errorMessage}}
button.btn.btn-outline-info.btn-sm.pull-right((click)='openPluginsFolder()')
i.fa.fa-folder
span Plugins folder
h3 Installed
.list-group
ng-container(*ngFor='let plugin of pluginManager.installedPlugins')
ng-container(*ngFor='let plugin of pluginManager.installedPlugins|orderBy:"name"')
.list-group-item.flex-column.align-items-start(*ngIf='knownUpgrades[plugin.name]')
.d-flex.w-100
h5.mr-auto.mb-0 {{plugin.name}}
.mr-auto.d-flex.flex-column
strong {{plugin.name}}
small.text-muted.mb-0 {{plugin.description}}
p.mb-0.mr-3 {{plugin.version}}
button.btn.btn-outline-primary(
*ngIf='npmInstalled',
(click)='upgradePlugin(plugin)',
[disabled]='busy[plugin.name] != undefined'
)
i.fa.fa-fw.fa-arrow-up(*ngIf='busy[plugin.name] != BusyState.Installing')
i.fa.fa-fw.fa-circle-o-notch.fa-spin(*ngIf='busy[plugin.name] == BusyState.Installing')
span Upgrade ({{knownUpgrades[plugin.name].version}})
small.text-muted.mb-0 {{plugin.description}}
ng-container(*ngFor='let plugin of pluginManager.installedPlugins')
ng-container(*ngFor='let plugin of pluginManager.installedPlugins|orderBy:"name"')
.list-group-item.flex-column.align-items-start(*ngIf='!knownUpgrades[plugin.name]')
.d-flex.w-100
h5.mr-auto.mb-0 {{plugin.name}}
.mr-auto.d-flex.flex-column
strong {{plugin.name}}
small.text-muted.mb-0 {{plugin.description}}
p.mb-0.mr-3 {{plugin.version}}
button.btn.btn-outline-danger(
(click)='uninstallPlugin(plugin)',
*ngIf='!plugin.isBuiltin',
*ngIf='!plugin.isBuiltin && npmInstalled',
[disabled]='busy[plugin.name] != undefined'
)
i.fa.fa-fw.fa-trash-o(*ngIf='busy[plugin.name] != BusyState.Uninstalling')
i.fa.fa-fw.fa-circle-o-notch.fa-spin(*ngIf='busy[plugin.name] == BusyState.Uninstalling')
small.text-muted.mb-0 {{plugin.description}}
.text-center.mt-5(*ngIf='npmMissing')
h4 NPM not installed
p.mb-2 The Node Package Manager is required to install Terminus plugins.
.btn-group
button.btn.btn-outline-primary((click)='downloadNPM()')
i.fa.fa-download
span Download NPM
button.btn.btn-outline-info((click)='checkNPM()')
i.fa.fa-refresh
span Try again
div(*ngIf='npmInstalled')
h3.mt-4 Available
.input-group.mb-4
.input-group-addon
i.fa.fa-fw.fa-circle-o-notch.fa-spin(*ngIf='!availablePluginsReady')
i.fa.fa-fw.fa-search(*ngIf='availablePluginsReady')
input.form-control(
type='text',
'[(ngModel)]'='_1',
(ngModelChange)='searchAvailable(_1)',
placeholder='Search plugins'
)
h3.mt-4 Available
.input-group.mb-4
.input-group-addon
i.fa.fa-fw.fa-circle-o-notch.fa-spin(*ngIf='!availablePluginsReady')
i.fa.fa-fw.fa-search(*ngIf='availablePluginsReady')
input.form-control(
type='text',
'[(ngModel)]'='_1',
(ngModelChange)='searchAvailable(_1)',
placeholder='Search plugins'
)
.list-group(*ngIf='availablePlugins$')
ng-container(*ngFor='let plugin of (availablePlugins$|async)')
.list-group-item.flex-column.align-items-start(*ngIf='!isAlreadyInstalled(plugin)')
.d-flex.w-100
h5.mr-auto.mb-0 {{plugin.name}}
p.mb-0.mr-3 {{plugin.version}}
button.btn.btn-outline-primary(
(click)='installPlugin(plugin)',
[disabled]='busy[plugin.name] != undefined'
)
i.fa.fa-fw.fa-download(*ngIf='busy[plugin.name] != BusyState.Installing')
i.fa.fa-fw.fa-circle-o-notch.fa-spin(*ngIf='busy[plugin.name] == BusyState.Installing')
span Install
small.text-muted.mb-0 {{plugin.description}}
.list-group(*ngIf='availablePlugins$')
ng-container(*ngFor='let plugin of (availablePlugins$|async|orderBy:"name")')
.list-group-item.flex-column.align-items-start(*ngIf='!isAlreadyInstalled(plugin)')
.d-flex.w-100
.mr-auto.d-flex.flex-column
strong {{plugin.name}}
small.text-muted.mb-0 {{plugin.description}}
p.mb-0.mr-3 {{plugin.version}}
button.btn.btn-outline-primary(
(click)='installPlugin(plugin)',
[disabled]='busy[plugin.name] != undefined'
)
i.fa.fa-fw.fa-download(*ngIf='busy[plugin.name] != BusyState.Installing')
i.fa.fa-fw.fa-circle-o-notch.fa-spin(*ngIf='busy[plugin.name] == BusyState.Installing')

View File

@@ -2,7 +2,7 @@ import { BehaviorSubject, Observable } from 'rxjs'
import * as semver from 'semver'
import { Component, Input } from '@angular/core'
import { ConfigService } from 'terminus-core'
import { ConfigService, HostAppService } from 'terminus-core'
import { IPluginInfo, PluginManagerService } from '../services/pluginManager.service'
enum BusyState { Installing, Uninstalling }
@@ -20,9 +20,12 @@ export class PluginsSettingsTabComponent {
@Input() busy: {[id: string]: BusyState} = {}
@Input() erroredPlugin: string
@Input() errorMessage: string
@Input() npmInstalled = false
@Input() npmMissing = false
constructor (
private config: ConfigService,
private hostApp: HostAppService,
public pluginManager: PluginManagerService
) {
}
@@ -42,6 +45,20 @@ export class PluginsSettingsTabComponent {
this.knownUpgrades[plugin.name] = available.find(x => x.name === plugin.name && semver.gt(x.version, plugin.version))
}
})
this.checkNPM()
}
openPluginsFolder (): void {
this.hostApp.getShell().openItem(this.pluginManager.userPluginsPath)
}
downloadNPM (): void {
this.hostApp.getShell().openExternal('https://nodejs.org/en/download/current/')
}
async checkNPM () {
this.npmInstalled = await this.pluginManager.isNPMInstalled()
this.npmMissing = !this.npmInstalled
}
searchAvailable (query: string) {