link plugin pages in the plugin list

This commit is contained in:
Eugene Pankov 2017-09-28 20:47:19 +02:00
parent 87730ba7b3
commit 1614405c62
3 changed files with 10 additions and 6 deletions

View file

@ -14,7 +14,7 @@ h3 Installed
.d-flex.w-100
.mr-auto.d-flex.flex-column
strong {{plugin.name}}
small.text-muted.mb-0 {{plugin.description}}
small.text-muted.mb-0((click)='showPluginInfo(plugin)') {{plugin.description}}
.d-flex.flex-column.align-items-end.mr-3
div {{plugin.version}}
small.text-muted {{plugin.author}}
@ -32,7 +32,8 @@ h3 Installed
.d-flex.w-100
.mr-auto.d-flex.flex-column
strong {{plugin.name}}
small.text-muted.mb-0 {{plugin.description}}
a.text-muted.mb-0((click)='showPluginInfo(plugin)')
small {{plugin.description}}
.d-flex.flex-column.align-items-end.mr-3
div {{plugin.version}}
small.text-muted {{plugin.author}}

View file

@ -2,7 +2,7 @@ import { BehaviorSubject, Observable } from 'rxjs'
import * as semver from 'semver'
import { Component, Input } from '@angular/core'
import { ConfigService, HostAppService } from 'terminus-core'
import { ConfigService, HostAppService, ElectronService } from 'terminus-core'
import { IPluginInfo, PluginManagerService } from '../services/pluginManager.service'
enum BusyState { Installing, Uninstalling }
@ -24,6 +24,7 @@ export class PluginsSettingsTabComponent {
@Input() npmMissing = false
constructor (
private electron: ElectronService,
private config: ConfigService,
private hostApp: HostAppService,
public pluginManager: PluginManagerService
@ -100,4 +101,8 @@ export class PluginsSettingsTabComponent {
async upgradePlugin (plugin: IPluginInfo): Promise<void> {
return this.installPlugin(this.knownUpgrades[plugin.name])
}
showPluginInfo (plugin: IPluginInfo) {
this.electron.shell.openExternal('https://www.npmjs.com/package/' + plugin.packageName)
}
}

View file

@ -71,7 +71,6 @@ export class PluginManagerService {
.fromPromise(
axios.get(`https://www.npmjs.com/-/search?text=keywords:${KEYWORD}+${encodeURIComponent(query || '')}&from=0&size=1000`)
)
.do(response => console.log(response.data.objects))
.map(response => response.data.objects.map(item => ({
name: item.package.name.substring(NAME_PREFIX.length),
packageName: item.package.name,
@ -85,8 +84,7 @@ export class PluginManagerService {
}
async installPlugin (plugin: IPluginInfo) {
let result = await exec(`${this.npmPath} --prefix "${this.userPluginsPath}" install ${plugin.packageName}@${plugin.version}`)
console.log(result)
await exec(`${this.npmPath} --prefix "${this.userPluginsPath}" install ${plugin.packageName}@${plugin.version}`)
this.installedPlugins = this.installedPlugins.filter(x => x.packageName !== plugin.packageName)
this.installedPlugins.push(plugin)
}