fix: close marketplace client review findings
This commit is contained in:
@@ -12,8 +12,13 @@ function failureText(reason?: string): string | null {
|
||||
if (!reason) return null;
|
||||
const messages: string[] = [];
|
||||
if (reason.includes('signature')) messages.push('签名校验失败,旧版本仍保留。');
|
||||
if (reason.includes('yanked') || reason.includes('not_ready')) messages.push('版本已撤回或未就绪。');
|
||||
if (reason.includes('incompatible')) messages.push('当前 MakeLore 版本不兼容。');
|
||||
if (reason.includes('artifact_invalid')) messages.push('插件包校验失败,旧版本仍保留。');
|
||||
if (reason.includes('yanked')) messages.push('此版本已撤回,旧版本仍保留。');
|
||||
if (reason.includes('not_ready')) messages.push('此版本尚未就绪,旧版本仍保留。');
|
||||
if (reason.includes('incompatible')) messages.push('当前 MakeLore 版本不兼容,旧版本仍保留。');
|
||||
if (reason.includes('runtime_suspended')) messages.push('插件运行已暂停,设备版本未替换。');
|
||||
if (reason.includes('backend_unavailable')) messages.push('Marketplace 服务暂不可用,设备版本未替换。');
|
||||
if (reason.includes('library_required')) messages.push('请先在账号插件库中获取此插件。');
|
||||
if (messages.length === 0) messages.push('当前版本暂不可用,旧版本仍保留。');
|
||||
return messages.join(' ');
|
||||
}
|
||||
@@ -21,7 +26,13 @@ function failureText(reason?: string): string | null {
|
||||
function actionErrorText(error?: string | null): string | null {
|
||||
if (!error) return null;
|
||||
if (error.includes('plugin_artifact_invalid')) return '插件签名或包校验失败,设备上此前可用版本仍保留。';
|
||||
if (error.includes('plugin_release_not_ready')) return '版本已撤回、尚未就绪或与当前 MakeLore 不兼容;不会替换此前可用版本。';
|
||||
if (error.includes('plugin_signature_invalid')) return '插件签名校验失败,设备上此前可用版本仍保留。';
|
||||
if (error.includes('plugin_release_yanked')) return '此版本已撤回;不会替换此前可用版本。';
|
||||
if (error.includes('plugin_release_not_ready')) return '版本尚未就绪;不会替换此前可用版本。';
|
||||
if (error.includes('plugin_incompatible_client')) return '当前 MakeLore 版本不兼容;不会替换此前可用版本。';
|
||||
if (error.includes('plugin_runtime_suspended')) return '插件运行已暂停;不会替换此前可用版本。';
|
||||
if (error.includes('plugin_backend_unavailable')) return 'Marketplace 服务暂不可用;不会替换此前可用版本。';
|
||||
if (error.includes('plugin_library_required')) return '请先在账号插件库中获取此插件。';
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -33,6 +44,7 @@ export type MyPluginsViewProps = {
|
||||
pending: Record<string, true>;
|
||||
onRefresh(): void | Promise<void>;
|
||||
onInstall(pluginId: string): void | Promise<void>;
|
||||
onInstallBeta(pluginId: string): void | Promise<void>;
|
||||
onUpdate(pluginId: string): void | Promise<void>;
|
||||
onUninstall(pluginId: string): void | Promise<void>;
|
||||
onRemove(pluginId: string): void | Promise<void>;
|
||||
@@ -66,6 +78,7 @@ export function MyPluginsView(props: MyPluginsViewProps) {
|
||||
: !installed ? <Button type="button" className="min-h-10" disabled={busy || suspended} aria-label={`下载${plugin.title}`} onClick={() => void props.onInstall(plugin.pluginId)}><Download className="mr-2 h-4 w-4" />下载</Button>
|
||||
: updateAvailable ? <Button type="button" className="min-h-10" disabled={busy || suspended} aria-label={`更新${plugin.title}`} onClick={() => void props.onUpdate(plugin.pluginId)}><RefreshCw className="mr-2 h-4 w-4" />更新</Button>
|
||||
: <span className="inline-flex min-h-10 items-center px-2 text-sm font-medium"><PackageCheck className="mr-2 h-4 w-4 text-brand" />设备版本已是最新</span>}
|
||||
{!removed && plugin.acquisition !== 'system_included' && plugin.betaVersion ? <Button type="button" variant="outline" className="min-h-10" disabled={busy || suspended} aria-label={`安装 Beta${plugin.title}`} onClick={() => void props.onInstallBeta(plugin.pluginId)}>安装 Beta</Button> : null}
|
||||
{!removed && plugin.acquisition !== 'system_included' ? <Button type="button" variant="outline" className="min-h-10" disabled={busy} aria-label={`移除${plugin.title}`} onClick={() => void props.onRemove(plugin.pluginId)}><Trash2 className="mr-2 h-4 w-4" />移除</Button> : null}
|
||||
{installed ? <Button type="button" variant="ghost" className="min-h-10" disabled={busy} aria-label={`删除设备上的${plugin.title}`} onClick={() => void props.onUninstall(plugin.pluginId)}>删除设备包</Button> : null}
|
||||
<Button asChild variant="outline" className="min-h-10"><Link to="/project-plugins">启用到项目</Link></Button>
|
||||
@@ -94,5 +107,5 @@ export function MyPlugins() {
|
||||
toast.error(reason instanceof Error ? reason.message : String(reason));
|
||||
});
|
||||
const store = pluginMarketplaceStore.getState;
|
||||
return <MyPluginsView library={library} installations={installations} state={state} error={error} pending={pending} onRefresh={() => safe(store().loadLibrary())} onInstall={(id) => safe(store().install(id))} onUpdate={(id) => safe(store().update(id))} onUninstall={(id) => safe(store().uninstall(id))} onRemove={(id) => safe(store().remove(id))} onReacquire={(id) => safe(store().acquire(id))} />;
|
||||
return <MyPluginsView library={library} installations={installations} state={state} error={error} pending={pending} onRefresh={() => safe(store().loadLibrary())} onInstall={(id) => safe(store().install(id))} onInstallBeta={(id) => safe(store().installBeta(id))} onUpdate={(id) => safe(store().update(id))} onUninstall={(id) => safe(store().uninstall(id))} onRemove={(id) => safe(store().remove(id))} onReacquire={(id) => safe(store().acquire(id))} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user