mirror of
https://github.com/Eugeny/tabby
synced 2024-11-16 01:38:07 +00:00
link plugin pages in the plugin list
This commit is contained in:
parent
87730ba7b3
commit
1614405c62
3 changed files with 10 additions and 6 deletions
|
@ -14,7 +14,7 @@ h3 Installed
|
||||||
.d-flex.w-100
|
.d-flex.w-100
|
||||||
.mr-auto.d-flex.flex-column
|
.mr-auto.d-flex.flex-column
|
||||||
strong {{plugin.name}}
|
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
|
.d-flex.flex-column.align-items-end.mr-3
|
||||||
div {{plugin.version}}
|
div {{plugin.version}}
|
||||||
small.text-muted {{plugin.author}}
|
small.text-muted {{plugin.author}}
|
||||||
|
@ -32,7 +32,8 @@ h3 Installed
|
||||||
.d-flex.w-100
|
.d-flex.w-100
|
||||||
.mr-auto.d-flex.flex-column
|
.mr-auto.d-flex.flex-column
|
||||||
strong {{plugin.name}}
|
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
|
.d-flex.flex-column.align-items-end.mr-3
|
||||||
div {{plugin.version}}
|
div {{plugin.version}}
|
||||||
small.text-muted {{plugin.author}}
|
small.text-muted {{plugin.author}}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { BehaviorSubject, Observable } from 'rxjs'
|
||||||
import * as semver from 'semver'
|
import * as semver from 'semver'
|
||||||
|
|
||||||
import { Component, Input } from '@angular/core'
|
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'
|
import { IPluginInfo, PluginManagerService } from '../services/pluginManager.service'
|
||||||
|
|
||||||
enum BusyState { Installing, Uninstalling }
|
enum BusyState { Installing, Uninstalling }
|
||||||
|
@ -24,6 +24,7 @@ export class PluginsSettingsTabComponent {
|
||||||
@Input() npmMissing = false
|
@Input() npmMissing = false
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
|
private electron: ElectronService,
|
||||||
private config: ConfigService,
|
private config: ConfigService,
|
||||||
private hostApp: HostAppService,
|
private hostApp: HostAppService,
|
||||||
public pluginManager: PluginManagerService
|
public pluginManager: PluginManagerService
|
||||||
|
@ -100,4 +101,8 @@ export class PluginsSettingsTabComponent {
|
||||||
async upgradePlugin (plugin: IPluginInfo): Promise<void> {
|
async upgradePlugin (plugin: IPluginInfo): Promise<void> {
|
||||||
return this.installPlugin(this.knownUpgrades[plugin.name])
|
return this.installPlugin(this.knownUpgrades[plugin.name])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showPluginInfo (plugin: IPluginInfo) {
|
||||||
|
this.electron.shell.openExternal('https://www.npmjs.com/package/' + plugin.packageName)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,6 @@ export class PluginManagerService {
|
||||||
.fromPromise(
|
.fromPromise(
|
||||||
axios.get(`https://www.npmjs.com/-/search?text=keywords:${KEYWORD}+${encodeURIComponent(query || '')}&from=0&size=1000`)
|
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 => ({
|
.map(response => response.data.objects.map(item => ({
|
||||||
name: item.package.name.substring(NAME_PREFIX.length),
|
name: item.package.name.substring(NAME_PREFIX.length),
|
||||||
packageName: item.package.name,
|
packageName: item.package.name,
|
||||||
|
@ -85,8 +84,7 @@ export class PluginManagerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
async installPlugin (plugin: IPluginInfo) {
|
async installPlugin (plugin: IPluginInfo) {
|
||||||
let result = await exec(`${this.npmPath} --prefix "${this.userPluginsPath}" install ${plugin.packageName}@${plugin.version}`)
|
await exec(`${this.npmPath} --prefix "${this.userPluginsPath}" install ${plugin.packageName}@${plugin.version}`)
|
||||||
console.log(result)
|
|
||||||
this.installedPlugins = this.installedPlugins.filter(x => x.packageName !== plugin.packageName)
|
this.installedPlugins = this.installedPlugins.filter(x => x.packageName !== plugin.packageName)
|
||||||
this.installedPlugins.push(plugin)
|
this.installedPlugins.push(plugin)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue