✨ feat(client): 清理入口移到插件页,不再藏在组件行里
This commit is contained in:
@@ -8,11 +8,14 @@
|
||||
*
|
||||
* The temporary-file sweep is the plugin's other operation, and it lives on
|
||||
* this plugin's own page under Settings → Plugins: the entry registers into
|
||||
* `plugins.row.config` under the `<package name>#<row id>` key the manager
|
||||
* dispatches, which also gives the row its configure control. That is the same
|
||||
* seat a bundled plugin's configuration form occupies, so the plugin's only
|
||||
* control sits beside everything else the manager says about it instead of
|
||||
* taking a row in General settings.
|
||||
* `plugins.bundle.config` under this package's name, the page-level seat the
|
||||
* manager renders on a bundle's page between its description and its rows.
|
||||
*
|
||||
* That page-level seat is deliberate, not the row-level `plugins.row.config`
|
||||
* one. The row seat grows a configure control on the row listed under
|
||||
* 「包含的组件」 and nothing else, so it parks this plugin's one and only control
|
||||
* one click deeper than the page the user just opened; the page seat puts it
|
||||
* where the page is read.
|
||||
*
|
||||
* Two client-authoring rules shape this file:
|
||||
*
|
||||
@@ -44,15 +47,13 @@ window.__ModuleLoader__.load({
|
||||
/** Between the shipped `archive` (100) and `pin` (200) hover buttons. */
|
||||
const ROW_ACTION_ORDER = 150
|
||||
/**
|
||||
* The key `plugins.row.config` is dispatched under: the manager composes it
|
||||
* as `<package name>#<row id>`, with the row id read from this bundle's own
|
||||
* patch. Both halves are literals from `package.json` and
|
||||
* `cordis.patch.yml`; a typo costs the configure control silently, so they
|
||||
* are the only two places renaming has to reach.
|
||||
* The key `plugins.bundle.config` is dispatched under: the manager keys a
|
||||
* bundle's own configuration by its npm package name and renders the entry
|
||||
* on that bundle's page, between the description and the rows. The value is
|
||||
* the literal from `package.json` — a typo costs the section silently, so
|
||||
* it is the only place renaming has to reach.
|
||||
*/
|
||||
const PACKAGE = '@dsh-plugin/session-delete'
|
||||
const ROW_ID = 'session-delete'
|
||||
const CONFIG_KEY = `${PACKAGE}#${ROW_ID}`
|
||||
const TOOLTIP_DELAY_MS = 500
|
||||
const TOOLTIP_GAP = 8
|
||||
/** Document base captured at bundle registration, before any routing. */
|
||||
@@ -331,12 +332,12 @@ window.__ModuleLoader__.load({
|
||||
* This plugin's page under Settings → Plugins: sweep spilled tool output
|
||||
* whose conversation no longer exists.
|
||||
*
|
||||
* The owner asks every `plugins.row.config` entry for two views. `summary`
|
||||
* is the one-liner on the row, and this plugin's manifest description
|
||||
* already fills that seat, so `summary` renders nothing and the page keeps
|
||||
* the text the manager read from `locale/*.json`. `page` is the section the
|
||||
* manager renders with its own heading, breadcrumb, and title; copy,
|
||||
* control, and result belong to this entry.
|
||||
* The owner dispatches the `page` view only: a bundle's configuration has
|
||||
* no one-line form, because the page header already prints this package's
|
||||
* title and description from the manifest. So the section opens with the
|
||||
* operation's own name and the rule it applies — what the header cannot say
|
||||
* — and the guard below keeps rendering nothing if a `summary` view ever
|
||||
* arrives.
|
||||
*/
|
||||
function TempCleanupPanel(props) {
|
||||
const t = translate(props.t)
|
||||
@@ -650,12 +651,13 @@ window.__ModuleLoader__.load({
|
||||
}),
|
||||
}, DeleteSessionDialog))
|
||||
|
||||
// The cleanup control belongs on this plugin's own page: registering
|
||||
// this cell key is what makes the row grow a configure control, and the
|
||||
// manager renders the entry for both its summary and page views.
|
||||
ctx.slots.inject('plugins.row.config', () => ctx.slots.register({
|
||||
name: 'plugins.row.config',
|
||||
key: CONFIG_KEY,
|
||||
// The cleanup control belongs on this plugin's own page itself, not
|
||||
// behind the component row listed under 「包含的组件」:
|
||||
// `plugins.bundle.config` keyed by this package's name is the seat the
|
||||
// manager renders between the page's description and its rows.
|
||||
ctx.slots.inject('plugins.bundle.config', () => ctx.slots.register({
|
||||
name: 'plugins.bundle.config',
|
||||
key: PACKAGE,
|
||||
locale: NS,
|
||||
inject: () => ({ cleanOrphans }),
|
||||
}, TempCleanupPanel))
|
||||
|
||||
Reference in New Issue
Block a user