mirror of
https://github.com/Eugeny/tabby
synced 2024-12-14 07:12:50 +00:00
show plugin author names
This commit is contained in:
parent
94217f0b01
commit
536d9537ff
3 changed files with 21 additions and 3 deletions
|
@ -44,6 +44,7 @@ export interface IPluginInfo {
|
|||
packageName: string
|
||||
isBuiltin: boolean
|
||||
version: string
|
||||
author: string
|
||||
homepage?: string
|
||||
path?: string
|
||||
info?: any
|
||||
|
@ -116,12 +117,15 @@ export async function findPlugins (): Promise<IPluginInfo[]> {
|
|||
if (!info.keywords || info.keywords.indexOf('terminus-plugin') === -1) {
|
||||
continue
|
||||
}
|
||||
let author = info.author
|
||||
author = author.name || author
|
||||
foundPlugins.push({
|
||||
name: pluginName.substring('terminus-'.length),
|
||||
packageName: pluginName,
|
||||
isBuiltin: pluginDir === builtinPluginsPath,
|
||||
version: info.version,
|
||||
description: info.description,
|
||||
author,
|
||||
path: pluginPath,
|
||||
info,
|
||||
})
|
||||
|
|
|
@ -15,7 +15,9 @@ h3 Installed
|
|||
.mr-auto.d-flex.flex-column
|
||||
strong {{plugin.name}}
|
||||
small.text-muted.mb-0 {{plugin.description}}
|
||||
p.mb-0.mr-3 {{plugin.version}}
|
||||
.d-flex.flex-column.align-items-end.mr-3
|
||||
div {{plugin.version}}
|
||||
small.text-muted {{plugin.author}}
|
||||
button.btn.btn-outline-primary(
|
||||
*ngIf='npmInstalled',
|
||||
(click)='upgradePlugin(plugin)',
|
||||
|
@ -31,7 +33,10 @@ h3 Installed
|
|||
.mr-auto.d-flex.flex-column
|
||||
strong {{plugin.name}}
|
||||
small.text-muted.mb-0 {{plugin.description}}
|
||||
p.mb-0.mr-3 {{plugin.version}}
|
||||
.d-flex.flex-column.align-items-end.mr-3
|
||||
div {{plugin.version}}
|
||||
small.text-muted {{plugin.author}}
|
||||
i.fa.fa-check.text-success.ml-1(*ngIf='plugin.isOfficial', title='Official')
|
||||
button.btn.btn-outline-danger(
|
||||
(click)='uninstallPlugin(plugin)',
|
||||
*ngIf='!plugin.isBuiltin && npmInstalled',
|
||||
|
@ -73,7 +78,10 @@ div(*ngIf='npmInstalled')
|
|||
.mr-auto.d-flex.flex-column
|
||||
strong {{plugin.name}}
|
||||
small.text-muted.mb-0 {{plugin.description}}
|
||||
p.mb-0.mr-3 {{plugin.version}}
|
||||
.d-flex.flex-column.align-items-end.mr-3
|
||||
div {{plugin.version}}
|
||||
small.text-muted {{plugin.author}}
|
||||
i.fa.fa-check.text-success.ml-1(*ngIf='plugin.isOfficial', title='Official')
|
||||
button.btn.btn-outline-primary(
|
||||
(click)='installPlugin(plugin)',
|
||||
[disabled]='busy[plugin.name] != undefined'
|
||||
|
|
|
@ -8,14 +8,17 @@ import { Logger, LogService, ConfigService, HostAppService, Platform } from 'ter
|
|||
|
||||
const NAME_PREFIX = 'terminus-'
|
||||
const KEYWORD = 'terminus-plugin'
|
||||
const OFFICIAL_NPM_ACCOUNT = 'eugenepankov'
|
||||
|
||||
export interface IPluginInfo {
|
||||
name: string
|
||||
description: string
|
||||
packageName: string
|
||||
isBuiltin: boolean
|
||||
isOfficial: boolean
|
||||
version: string
|
||||
homepage?: string
|
||||
author: string
|
||||
path?: string
|
||||
}
|
||||
|
||||
|
@ -65,12 +68,15 @@ 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,
|
||||
description: item.package.description,
|
||||
version: item.package.version,
|
||||
homepage: item.package.links.homepage,
|
||||
author: (item.package.author || {}).name,
|
||||
isOfficial: item.package.publisher.username === OFFICIAL_NPM_ACCOUNT,
|
||||
})))
|
||||
.map(plugins => plugins.filter(x => x.packageName.startsWith(NAME_PREFIX)))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue