fix: identify bundled official plugins in workspace
This commit is contained in:
@@ -12,7 +12,11 @@ import {
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog';
|
||||
import type { DataServiceInstanceState } from '../../../shared/data-service';
|
||||
import type { PluginWorkspaceCommand, PluginWorkspaceItem } from './plugin-workspace-model';
|
||||
import {
|
||||
isBundledOfficialPlugin,
|
||||
type PluginWorkspaceCommand,
|
||||
type PluginWorkspaceItem,
|
||||
} from './plugin-workspace-model';
|
||||
|
||||
interface DetailOperation {
|
||||
capabilityId: string;
|
||||
@@ -286,7 +290,7 @@ export function PluginDetails(props: PluginDetailsProps) {
|
||||
<dd className="mt-1 text-sm font-semibold">
|
||||
{props.item.source === 'local'
|
||||
? (props.item.localEnabled ? '本机全局已启用' : '本机全局已停用')
|
||||
: installation?.version ? `官方包 ${installation.version}` : props.item.delivery === 'system_included' ? '随应用提供' : '未下载官方包'}
|
||||
: installation?.version ? `官方包 ${installation.version}` : isBundledOfficialPlugin(props.item) ? '随应用提供' : '未下载官方包'}
|
||||
</dd>
|
||||
</div>
|
||||
<div className="rounded-xl bg-surface-subtle p-3">
|
||||
|
||||
@@ -21,7 +21,7 @@ import type {
|
||||
PluginWorkspaceProjection,
|
||||
PluginWorkspaceState,
|
||||
} from './plugin-workspace-model';
|
||||
import { buildPluginWorkspaceProjection } from './plugin-workspace-model';
|
||||
import { buildPluginWorkspaceProjection, isBundledOfficialPlugin } from './plugin-workspace-model';
|
||||
import { resolvePluginWorkspaceSearch, serializePluginWorkspaceSearch } from './plugin-workspace-query';
|
||||
|
||||
const DELIVERY_TEXT = {
|
||||
@@ -111,7 +111,7 @@ function PluginCard({
|
||||
<p className="mt-2 line-clamp-3 text-pretty text-sm leading-6 text-muted-foreground">{item.summary}</p>
|
||||
<dl className="mt-4 space-y-2 text-sm">
|
||||
<div className="flex justify-between gap-4"><dt className="text-muted-foreground">当前项目</dt><dd className="text-right font-medium">{PROJECT_TEXT[item.projectState]}</dd></div>
|
||||
<div className="flex justify-between gap-4"><dt className="text-muted-foreground">本机状态</dt><dd className="text-right font-medium">{item.source === 'local' ? (item.localEnabled ? '本机全局已启用' : '本机全局已停用') : item.official?.installation?.version ? `官方包 ${item.official.installation.version}` : item.delivery === 'system_included' ? '随应用提供' : '未下载官方包'}</dd></div>
|
||||
<div className="flex justify-between gap-4"><dt className="text-muted-foreground">本机状态</dt><dd className="text-right font-medium">{item.source === 'local' ? (item.localEnabled ? '本机全局已启用' : '本机全局已停用') : item.official?.installation?.version ? `官方包 ${item.official.installation.version}` : isBundledOfficialPlugin(item) ? '随应用提供' : '未下载官方包'}</dd></div>
|
||||
<div className="flex justify-between gap-4"><dt className="text-muted-foreground">伙伴</dt><dd className="text-right font-medium">{agentText(item)}</dd></div>
|
||||
<div className="flex justify-between gap-4"><dt className="text-muted-foreground">计费</dt><dd className="text-right font-medium">{BILLING_TEXT[item.billing]}</dd></div>
|
||||
</dl>
|
||||
|
||||
@@ -104,6 +104,11 @@ export interface PluginWorkspaceItem {
|
||||
local: DevicePackageRecordV1 | null;
|
||||
}
|
||||
|
||||
export function isBundledOfficialPlugin(item: PluginWorkspaceItem): boolean {
|
||||
return item.source === 'official'
|
||||
&& (item.delivery === 'system_included' || isCodeOwnedOptionalBundledPluginId(item.pluginId));
|
||||
}
|
||||
|
||||
export type PluginWorkspaceNotice =
|
||||
| { kind: 'scope_fallback'; message: string }
|
||||
| { kind: 'source_unavailable'; source: 'catalog' | 'library' | 'device' | 'project'; message: string }
|
||||
|
||||
Reference in New Issue
Block a user