feat(plugins): 内置同版本显示「内置已提供」而非重复安装
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m13s
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m13s
This commit is contained in:
1 parent
59b79d54a3
commit
8d57c26fe5
1 file changed
+5
-1
@@ -59,6 +59,8 @@
|
||||
const label = busy === p.id ? '处理中…' : (!have ? '安装' : (need ? '更新' : '移除外部副本'))
|
||||
const kind = !have || need ? 'install' : 'uninstall'
|
||||
const reg = (pluginItems || []).find((x) => x && x.id === p.id)
|
||||
// 内置已提供同版本 ⇒ 无需再装外部副本(避免「安装」一个本来就有的插件)
|
||||
const builtinSame = !have && reg && reg.version === p.version
|
||||
return el('div', { key: p.id, className: 'iwb-plugin-row' },
|
||||
el('label', { className: 'iwb-label iwb-grow' },
|
||||
reg ? el('input', {
|
||||
@@ -70,7 +72,9 @@
|
||||
p.desc ? el('div', { className: 'iwb-hint' }, p.desc) : null,
|
||||
),
|
||||
reg ? el('button', { className: 'iwb-btn iwb-btn-sm', onClick: () => setTab('plugin:' + p.id) }, '设置') : null,
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm', disabled: !!busy, onClick: () => act(kind, p.id) }, label),
|
||||
builtinSame
|
||||
? el('span', { className: 'iwb-hint' }, '内置已提供')
|
||||
: el('button', { className: 'iwb-btn iwb-btn-sm', disabled: !!busy, onClick: () => act(kind, p.id) }, label),
|
||||
)
|
||||
}),
|
||||
msg ? el('div', { className: 'iwb-hint' }, msg) : null,
|
||||
|
||||
Reference in new issue
Block a user