-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathui_manifest.go
More file actions
72 lines (70 loc) · 2.8 KB
/
ui_manifest.go
File metadata and controls
72 lines (70 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package external
// UIManifest describes the UI contribution of a go-plugin UI plugin.
// Place this as "ui.json" in the plugin directory alongside "plugin.json".
//
// # Directory Layout
//
// plugins/
// my-ui-plugin/
// my-ui-plugin (binary, required for API handlers; optional for asset-only plugins)
// plugin.json (gRPC plugin manifest; required when binary is present)
// ui.json (UI manifest: nav items and asset location)
// assets/ (static files: HTML, CSS, JS, images, etc.)
// index.html
// main.js
//
// # Asset Versioning
//
// Include a version hash in asset filenames (e.g. main.abc123.js) and
// reference them from index.html so browsers pick up new files after
// hot-deploy.
//
// # Hot-Reload
//
// After updating assets or ui.json, call:
//
// POST /api/v1/plugins/ui/{name}/reload
//
// This re-reads the manifest and serves the new files without restarting the
// workflow engine.
//
// # Hot-Deploy
//
// Replace the plugin binary and/or assets directory with the new version,
// then call the reload endpoint above.
type UIManifest struct {
// Name is the plugin identifier. Must match the plugin directory name.
Name string `json:"name"`
// Version is the plugin version string (e.g. "1.0.0").
Version string `json:"version"`
// Description is a short human-readable description of the plugin.
Description string `json:"description,omitempty"`
// NavItems declares navigation entries contributed to the admin UI.
NavItems []UINavItem `json:"navItems,omitempty"`
// AssetDir is the subdirectory within the plugin directory that holds
// static assets. Defaults to "assets" when empty.
AssetDir string `json:"assetDir,omitempty"`
}
// UINavItem describes a single entry in the admin UI navigation sidebar.
type UINavItem struct {
// ID is the unique page identifier (e.g. "my-plugin-dashboard").
ID string `json:"id"`
// Label is the human-readable navigation label shown in the sidebar.
Label string `json:"label"`
// Icon is an emoji or icon token rendered alongside the label.
Icon string `json:"icon,omitempty"`
// Category groups navigation entries:
// "global" – always visible top-level entries
// "workflow" – shown only when a workflow is open
// "plugin" – plugin-contributed entries (default)
// "tools" – administrative tooling entries
Category string `json:"category,omitempty"`
// Order controls the sort position within the category (lower = higher up).
Order int `json:"order,omitempty"`
// RequiredRole is the minimum role needed to see this page
// (e.g. "viewer", "editor", "admin", "operator").
RequiredRole string `json:"requiredRole,omitempty"`
// RequiredPermission is a specific permission key required to see this page
// (e.g. "plugins.manage").
RequiredPermission string `json:"requiredPermission,omitempty"`
}