@checkstack/gitops-frontend 0.3.7 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +203 -0
- package/package.json +10 -8
- package/src/components/GitOpsLockBanner.tsx +16 -5
- package/src/components/GitOpsSourceBadge.tsx +77 -0
- package/src/components/ProvenanceStatus.tsx +2 -2
- package/src/components/ProviderEditor.tsx +1 -1
- package/src/components/ProviderList.tsx +34 -6
- package/src/components/SecretList.tsx +23 -2
- package/src/hooks/useProvenanceLocks.ts +43 -0
- package/src/index.tsx +5 -0
- package/tsconfig.json +17 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,208 @@
|
|
|
1
1
|
# @checkstack/gitops-frontend
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f6f9a5c: Surface the source repository for GitOps-managed entities and gate the
|
|
8
|
+
system→group remove button on the system's lock state.
|
|
9
|
+
|
|
10
|
+
- `provenanceSchema` now carries a `sourceUrl` field, derived on the
|
|
11
|
+
backend from the provider type, baseUrl, repository and filePath. URLs
|
|
12
|
+
are constructed for github.com / gitlab.com and self-hosted
|
|
13
|
+
GitHub/GitLab where the API base ends in `/api/v3` or `/api/v4`. Other
|
|
14
|
+
baseUrls fall back to `null` so the UI keeps showing the raw path.
|
|
15
|
+
- New `useProvenanceLocks` hook (bulk variant of `useProvenanceLock`)
|
|
16
|
+
for views that render many entities and need to look up locks
|
|
17
|
+
client-side.
|
|
18
|
+
- New `<GitOpsSourceBadge>` popover component that replaces the bare
|
|
19
|
+
GitBranch icon on system and group catalog cards. The popover
|
|
20
|
+
surfaces the repository, file path, and a "View in source provider"
|
|
21
|
+
deep link.
|
|
22
|
+
- `<GitOpsLockBanner>` repo line is now a real link when a sourceUrl is
|
|
23
|
+
available.
|
|
24
|
+
- The system→group remove button in the catalog now disables itself
|
|
25
|
+
when the system is GitOps-managed, matching the backend lock that was
|
|
26
|
+
already in place.
|
|
27
|
+
|
|
28
|
+
- 3547670: Wire the new tips infrastructure across the frontends:
|
|
29
|
+
|
|
30
|
+
**Empty-state coaching.** Replace generic "no items" copy with onboarding
|
|
31
|
+
guidance — short description, three numbered steps and a primary CTA — on
|
|
32
|
+
every EmptyState that has a meaningful next action. Affects: catalog
|
|
33
|
+
(systems + groups), dashboard, health-check page, integrations (subscriptions
|
|
34
|
+
|
|
35
|
+
- provider connections), GitOps providers + secrets, GitOps provenance,
|
|
36
|
+
SLO config + overview, maintenance config, satellites, plugin manager,
|
|
37
|
+
incident config, announcements. Read-only EmptyStates (incident history,
|
|
38
|
+
maintenance history, plugin events) get clearer descriptions explaining
|
|
39
|
+
what would populate them.
|
|
40
|
+
|
|
41
|
+
**First-run anchored tips.** Add `<Tip>` popovers to the most important
|
|
42
|
+
"Create" affordances so first-time users see a one-line explanation of
|
|
43
|
+
what they're about to make and why it matters: catalog “Add System” /
|
|
44
|
+
“Add Group”, healthcheck “Create Check”, integrations “New Subscription”,
|
|
45
|
+
GitOps “Add Provider”, SLO “Create SLO”, maintenance “Create Maintenance”,
|
|
46
|
+
satellite “Create Satellite”, plugin-manager “Install plugin”, incident
|
|
47
|
+
“Report Incident”, announcement “New Announcement”. Each tip is dismissed
|
|
48
|
+
per user (server-backed when signed in, localStorage otherwise) and
|
|
49
|
+
namespaced through `qualifyTipId(plugin, …)` so it cannot escape the
|
|
50
|
+
plugin's own namespace.
|
|
51
|
+
|
|
52
|
+
**Welcome banner on the dashboard.** A `<TipBanner>` at the top of the
|
|
53
|
+
dashboard introduces Checkstack's main flow ("add a system, then a health
|
|
54
|
+
check") with a one-click jump into the catalog.
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- 950d6ec: Fix mobile UserMenu items rendering at zero height, group menu items by
|
|
59
|
+
section, and unstack cramped card headers on small viewports.
|
|
60
|
+
|
|
61
|
+
- **UserMenu mobile bug**: On mobile, the user-menu Sheet rendered every
|
|
62
|
+
menu item as a grid row, which combined with `flex-shrink: 1` on each
|
|
63
|
+
item collapsed the buttons whose internal layout uses `display: flex`
|
|
64
|
+
(the items registered with `useNavigate` rather than `<Link>`) to zero
|
|
65
|
+
content height. Switched the mobile container to a flex column with
|
|
66
|
+
`[&>*]:shrink-0` and added `min-h-0` so the sheet scrolls correctly
|
|
67
|
+
when the list overflows.
|
|
68
|
+
|
|
69
|
+
- **UserMenu grouping**: Slot extensions now accept an optional `group`
|
|
70
|
+
field. The user menu buckets `UserMenuItemsSlot` extensions by `group`
|
|
71
|
+
and renders each group under a labeled header (`Workspace`,
|
|
72
|
+
`Reliability`, `Configuration`, `Documentation`, `Account`). Existing
|
|
73
|
+
core plugins are tagged with the appropriate group; third-party plugins
|
|
74
|
+
can pick any of these or supply their own label. Untagged extensions
|
|
75
|
+
render last with no header. `UserMenuItemsBottomSlot` is unaffected.
|
|
76
|
+
|
|
77
|
+
- **Card header responsiveness**: `CardHeaderRow` (the primitive shared by
|
|
78
|
+
Incident, Maintenance, Auth, Catalog, GitOps and other config cards) now
|
|
79
|
+
stacks vertically on narrow viewports and only switches to a single row
|
|
80
|
+
at the `sm` breakpoint, so titles and adjacent filter controls (e.g.
|
|
81
|
+
status `Select`, "Show resolved" checkbox) no longer cram together on
|
|
82
|
+
mobile. Refactored the Incident and Maintenance config pages to use the
|
|
83
|
+
primitive instead of a hand-rolled `flex items-center justify-between`
|
|
84
|
+
row, and made their `Select` triggers full-width on mobile.
|
|
85
|
+
|
|
86
|
+
- Updated dependencies [42abfff]
|
|
87
|
+
- Updated dependencies [3547670]
|
|
88
|
+
- Updated dependencies [f6f9a5c]
|
|
89
|
+
- Updated dependencies [1ef2e79]
|
|
90
|
+
- Updated dependencies [aa89bc5]
|
|
91
|
+
- Updated dependencies [3547670]
|
|
92
|
+
- Updated dependencies [950d6ec]
|
|
93
|
+
- Updated dependencies [3547670]
|
|
94
|
+
- @checkstack/common@0.9.0
|
|
95
|
+
- @checkstack/ui@1.8.0
|
|
96
|
+
- @checkstack/gitops-common@0.3.0
|
|
97
|
+
- @checkstack/frontend-api@0.5.0
|
|
98
|
+
- @checkstack/tips-frontend@0.2.0
|
|
99
|
+
|
|
100
|
+
## 0.3.8
|
|
101
|
+
|
|
102
|
+
### Patch Changes
|
|
103
|
+
|
|
104
|
+
- 50e5f5f: Runtime plugin system: install + uninstall plugins from npm, GitHub releases
|
|
105
|
+
(including private GitHub Enterprise instances), or tarball uploads at
|
|
106
|
+
runtime, with multi-package bundles, dependency-derived compatibility checks,
|
|
107
|
+
multi-instance coordination via a Postgres artifact store, and
|
|
108
|
+
single-coordinator destructive cleanup.
|
|
109
|
+
|
|
110
|
+
Highlights:
|
|
111
|
+
|
|
112
|
+
- New `PluginSource` discriminated union and `PluginInstaller` /
|
|
113
|
+
`PluginInstallerRegistry` interfaces in `@checkstack/backend-api`. The
|
|
114
|
+
GitHub variant accepts an optional `apiBaseUrl` so deployments backed by
|
|
115
|
+
GitHub Enterprise can install from `https://ghe.example.com/api/v3`
|
|
116
|
+
instead of `api.github.com`.
|
|
117
|
+
- New `installPackageMetadataSchema` (Zod) in `@checkstack/common` validates
|
|
118
|
+
every plugin's `package.json` at install time. Required fields: `name`,
|
|
119
|
+
`version`, `description`, `author`, `license`, `checkstack.type`,
|
|
120
|
+
`checkstack.pluginId`. Optional: `checkstack.bundle`,
|
|
121
|
+
`checkstack.usageInstructions`, `checkstack.allowInstallScripts`.
|
|
122
|
+
- New `pluginManagerContract` in `@checkstack/pluginmanager-common` with
|
|
123
|
+
`list`, `previewInstall`, `install`, `previewUninstall`, `uninstall`, and
|
|
124
|
+
`events` procedures.
|
|
125
|
+
- New `@checkstack/pluginmanager-frontend` admin UI: installed-plugins list
|
|
126
|
+
with per-row uninstall (typed-confirmation modal, schema/configs/cascade
|
|
127
|
+
toggles), install page with NPM / Tarball Upload / GitHub Release tabs
|
|
128
|
+
(Catalog tab disabled — coming soon), and an events page surfacing the
|
|
129
|
+
install/uninstall audit log.
|
|
130
|
+
- New `bunx @checkstack/scripts plugin-pack` CLI for plugin authors —
|
|
131
|
+
per-package mode produces an npm-shaped tarball; `--bundle` mode produces
|
|
132
|
+
an outer tarball containing every sibling declared in
|
|
133
|
+
`package.json#checkstack.bundle`. Published to npm so external authors
|
|
134
|
+
can `bunx` it directly without a workspace checkout.
|
|
135
|
+
- Compatibility derived from `package.json#dependencies` ranges
|
|
136
|
+
(`semver.satisfies` against the platform's loaded `@checkstack/*`
|
|
137
|
+
versions) — no separate `compatibility` field.
|
|
138
|
+
- Multi-instance: originator persists artifacts + `plugins` rows + broadcasts
|
|
139
|
+
install/uninstall; receiving instances do in-process register/unregister
|
|
140
|
+
only. Destructive ops (drop schema, delete plugin_configs, delete
|
|
141
|
+
artifacts, delete `plugins` rows) run exactly once on the originator.
|
|
142
|
+
- Fresh-instance bootstrap: `loadPlugins()` hydrates any
|
|
143
|
+
`is_uninstallable=true` plugin missing from `node_modules` from the
|
|
144
|
+
artifact store before normal Phase 1 register.
|
|
145
|
+
- New schema: `plugin_artifacts` (tarball storage), `plugin_install_events`
|
|
146
|
+
(audit/error log). `plugins` extended with `version`, `metadata`,
|
|
147
|
+
`source`, `bundle_id`, `is_primary`. Local plugin sync now writes
|
|
148
|
+
`version` from each plugin's `package.json` so the admin UI shows real
|
|
149
|
+
versions instead of `—`.
|
|
150
|
+
- Tarball-upload endpoint (`POST /api/pluginmanager/upload-tarball`) for
|
|
151
|
+
the install UI; access-gated by `pluginmanager.plugin.manage`.
|
|
152
|
+
- Plugin Manager menu link added to the user menu (main grid, alongside
|
|
153
|
+
Profile / Notification Settings / etc.).
|
|
154
|
+
|
|
155
|
+
Cross-cutting changes:
|
|
156
|
+
|
|
157
|
+
- Backend request/response logging now flows through `rootLogger` (winston)
|
|
158
|
+
instead of `hono/logger`. 5xx responses include the response body inline
|
|
159
|
+
so swallowed early-return errors are visible in the log.
|
|
160
|
+
- The `/api/:pluginId/*` dispatcher now logs which core service is missing
|
|
161
|
+
or which `pluginId` had no metadata when it 500s.
|
|
162
|
+
- New `registerCorePluginMetadata` on `PluginManager` for core routers
|
|
163
|
+
(like the plugin manager itself) that need their metadata visible to the
|
|
164
|
+
RPC dispatcher without going through the full plugin lifecycle.
|
|
165
|
+
- ESLint: `unicorn/no-null` is now disabled globally. Drizzle distinguishes
|
|
166
|
+
between `null` (writes a real SQL NULL) and `undefined` (skip the column
|
|
167
|
+
on insert), so treating them as interchangeable produced latent bugs at
|
|
168
|
+
the persistence boundary. The bulk of the patch-bumped packages above
|
|
169
|
+
reflect lint-fix touches that landed when this rule was relaxed.
|
|
170
|
+
- Workspace-wide license normalization to `Elastic-2.0` (matches
|
|
171
|
+
`LICENSE.md`). Every `package.json` in the workspace now declares the
|
|
172
|
+
same SPDX identifier; the patch bumps capture this.
|
|
173
|
+
|
|
174
|
+
Plugin packages (every `plugins/*`): added a `pack` npm script
|
|
175
|
+
(`bunx @checkstack/scripts plugin-pack`), mirrored each plugin's
|
|
176
|
+
`pluginId` from `plugin-metadata.ts` into `package.json#checkstack.pluginId`
|
|
177
|
+
so install-time validation passes, stubbed any missing required metadata
|
|
178
|
+
fields (`description`, `author`, `license`), and added
|
|
179
|
+
`checkstack.bundle` to multi-package plugin primaries (telegram, rcon, ssh,
|
|
180
|
+
jira, queue-bullmq, queue-memory, cache-memory).
|
|
181
|
+
|
|
182
|
+
Breaking changes:
|
|
183
|
+
|
|
184
|
+
- The legacy single-method `PluginInstaller` interface (`install(packageName)`)
|
|
185
|
+
is removed. Callers must use `coreServices.pluginInstallerRegistry`.
|
|
186
|
+
- The old `pluginAdminContract` and `createPluginAdminRouter` are removed.
|
|
187
|
+
Replaced by `pluginManagerContract` in `@checkstack/pluginmanager-common`
|
|
188
|
+
and `createPluginManagerRouter` in `core/backend`.
|
|
189
|
+
- `@checkstack/test-utils-backend` no longer exports
|
|
190
|
+
`createMockPluginInstaller` / `MockPluginInstaller` (the legacy interface
|
|
191
|
+
it shimmed is gone).
|
|
192
|
+
|
|
193
|
+
Note: bumps are limited to `minor` (for packages with new public API
|
|
194
|
+
surface) and `patch` (for downstream consumers, license normalization,
|
|
195
|
+
and lint fixes). No `major` bumps despite the `PluginInstaller` removal —
|
|
196
|
+
the legacy interface had no third-party consumers in the wild before this
|
|
197
|
+
runtime plugin system landed, and the contract surface is the same shape
|
|
198
|
+
modulo the rename.
|
|
199
|
+
|
|
200
|
+
- Updated dependencies [50e5f5f]
|
|
201
|
+
- @checkstack/common@0.8.0
|
|
202
|
+
- @checkstack/gitops-common@0.2.2
|
|
203
|
+
- @checkstack/ui@1.7.1
|
|
204
|
+
- @checkstack/frontend-api@0.4.2
|
|
205
|
+
|
|
3
206
|
## 0.3.7
|
|
4
207
|
|
|
5
208
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/gitops-frontend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"license": "Elastic-2.0",
|
|
4
5
|
"type": "module",
|
|
5
6
|
"main": "src/index.tsx",
|
|
6
7
|
"checkstack": {
|
|
7
8
|
"type": "frontend"
|
|
8
9
|
},
|
|
9
10
|
"scripts": {
|
|
10
|
-
"typecheck": "
|
|
11
|
+
"typecheck": "tsgo -b",
|
|
11
12
|
"lint": "bun run lint:code",
|
|
12
13
|
"lint:code": "eslint . --max-warnings 0"
|
|
13
14
|
},
|
|
14
15
|
"dependencies": {
|
|
15
|
-
"@checkstack/common": "0.
|
|
16
|
-
"@checkstack/frontend-api": "0.4.
|
|
17
|
-
"@checkstack/gitops-common": "0.2.
|
|
18
|
-
"@checkstack/
|
|
16
|
+
"@checkstack/common": "0.8.0",
|
|
17
|
+
"@checkstack/frontend-api": "0.4.2",
|
|
18
|
+
"@checkstack/gitops-common": "0.2.2",
|
|
19
|
+
"@checkstack/tips-frontend": "0.1.0",
|
|
20
|
+
"@checkstack/ui": "1.7.1",
|
|
19
21
|
"lucide-react": "^0.344.0",
|
|
20
22
|
"react": "^18.2.0",
|
|
21
23
|
"react-router-dom": "^6.22.0"
|
|
@@ -23,7 +25,7 @@
|
|
|
23
25
|
"devDependencies": {
|
|
24
26
|
"typescript": "^5.0.0",
|
|
25
27
|
"@types/react": "^18.2.0",
|
|
26
|
-
"@checkstack/tsconfig": "0.0.
|
|
27
|
-
"@checkstack/scripts": "0.
|
|
28
|
+
"@checkstack/tsconfig": "0.0.7",
|
|
29
|
+
"@checkstack/scripts": "0.3.0"
|
|
28
30
|
}
|
|
29
31
|
}
|
|
@@ -23,12 +23,23 @@ export const GitOpsLockBanner: React.FC<GitOpsLockBannerProps> = ({
|
|
|
23
23
|
<span className="text-muted-foreground ml-1">
|
|
24
24
|
— edits are disabled. Changes must be made in Git.
|
|
25
25
|
</span>
|
|
26
|
-
|
|
27
|
-
<
|
|
26
|
+
{provenance.sourceUrl ? (
|
|
27
|
+
<a
|
|
28
|
+
href={provenance.sourceUrl}
|
|
29
|
+
target="_blank"
|
|
30
|
+
rel="noreferrer noopener"
|
|
31
|
+
className="text-xs text-primary hover:underline mt-0.5 flex items-center gap-1"
|
|
32
|
+
>
|
|
33
|
+
<span className="truncate">
|
|
34
|
+
{provenance.repository}/{provenance.filePath}
|
|
35
|
+
</span>
|
|
36
|
+
<ExternalLink className="w-3 h-3 shrink-0" />
|
|
37
|
+
</a>
|
|
38
|
+
) : (
|
|
39
|
+
<div className="text-xs text-muted-foreground mt-0.5 truncate">
|
|
28
40
|
{provenance.repository}/{provenance.filePath}
|
|
29
|
-
</
|
|
30
|
-
|
|
31
|
-
</div>
|
|
41
|
+
</div>
|
|
42
|
+
)}
|
|
32
43
|
</div>
|
|
33
44
|
</div>
|
|
34
45
|
);
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { GitBranch, ExternalLink } from "lucide-react";
|
|
3
|
+
import {
|
|
4
|
+
Popover,
|
|
5
|
+
PopoverContent,
|
|
6
|
+
PopoverTrigger,
|
|
7
|
+
} from "@checkstack/ui";
|
|
8
|
+
import type { Provenance } from "@checkstack/gitops-common";
|
|
9
|
+
|
|
10
|
+
interface GitOpsSourceBadgeProps {
|
|
11
|
+
provenance: Provenance;
|
|
12
|
+
iconClassName?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Badge that signals an entity is GitOps-managed and, on click, surfaces the
|
|
17
|
+
* source repository, file path, and (when derivable) a "View in <provider>"
|
|
18
|
+
* deep link. Used on catalog cards alongside disabled controls so users can
|
|
19
|
+
* jump straight to the file that owns the entity.
|
|
20
|
+
*/
|
|
21
|
+
export const GitOpsSourceBadge: React.FC<GitOpsSourceBadgeProps> = ({
|
|
22
|
+
provenance,
|
|
23
|
+
iconClassName,
|
|
24
|
+
}) => {
|
|
25
|
+
const { repository, filePath, sourceUrl } = provenance;
|
|
26
|
+
return (
|
|
27
|
+
<Popover>
|
|
28
|
+
<PopoverTrigger asChild>
|
|
29
|
+
<button
|
|
30
|
+
type="button"
|
|
31
|
+
aria-label="View GitOps source"
|
|
32
|
+
title="View GitOps source"
|
|
33
|
+
className="shrink-0 inline-flex items-center justify-center rounded hover:bg-muted/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 p-0.5"
|
|
34
|
+
>
|
|
35
|
+
<GitBranch
|
|
36
|
+
className={iconClassName ?? "w-4 h-4 text-primary"}
|
|
37
|
+
/>
|
|
38
|
+
</button>
|
|
39
|
+
</PopoverTrigger>
|
|
40
|
+
<PopoverContent className="w-80 p-3 space-y-2 text-sm">
|
|
41
|
+
<div className="flex items-center gap-2 font-medium text-foreground">
|
|
42
|
+
<GitBranch className="w-4 h-4 text-primary shrink-0" />
|
|
43
|
+
Managed by GitOps
|
|
44
|
+
</div>
|
|
45
|
+
<div className="space-y-1 text-xs">
|
|
46
|
+
<div>
|
|
47
|
+
<div className="text-muted-foreground">Repository</div>
|
|
48
|
+
<div className="font-mono text-foreground break-all">
|
|
49
|
+
{repository}
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
<div>
|
|
53
|
+
<div className="text-muted-foreground">File</div>
|
|
54
|
+
<div className="font-mono text-foreground break-all">
|
|
55
|
+
{filePath}
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
{sourceUrl ? (
|
|
60
|
+
<a
|
|
61
|
+
href={sourceUrl}
|
|
62
|
+
target="_blank"
|
|
63
|
+
rel="noreferrer noopener"
|
|
64
|
+
className="inline-flex items-center gap-1.5 text-xs font-medium text-primary hover:underline"
|
|
65
|
+
>
|
|
66
|
+
<ExternalLink className="w-3.5 h-3.5" />
|
|
67
|
+
View in source provider
|
|
68
|
+
</a>
|
|
69
|
+
) : (
|
|
70
|
+
<p className="text-xs text-muted-foreground">
|
|
71
|
+
Open this file in your Git provider to make changes.
|
|
72
|
+
</p>
|
|
73
|
+
)}
|
|
74
|
+
</PopoverContent>
|
|
75
|
+
</Popover>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
@@ -263,8 +263,8 @@ export const ProvenanceStatus = () => {
|
|
|
263
263
|
<div className="text-center py-8 text-muted-foreground">Loading...</div>
|
|
264
264
|
) : synced.length === 0 ? (
|
|
265
265
|
<EmptyState
|
|
266
|
-
title="
|
|
267
|
-
description="
|
|
266
|
+
title="Nothing synced from Git yet"
|
|
267
|
+
description="Once a sync run finds and applies YAML descriptors from your Git providers, the resulting Checkstack entities (systems, groups, health checks, …) appear here with provenance — what file they came from and which commit. That's how you know which resources are managed in Git versus created in the UI."
|
|
268
268
|
/>
|
|
269
269
|
) : (
|
|
270
270
|
renderEntryList(synced, false)
|
|
@@ -79,7 +79,7 @@ export const ProviderEditor: React.FC<ProviderEditorProps> = ({
|
|
|
79
79
|
// - empty string → undefined (keep current)
|
|
80
80
|
let authTokenValue: string | null | undefined;
|
|
81
81
|
if (clearToken) {
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
authTokenValue = null;
|
|
84
84
|
} else if (authToken.trim()) {
|
|
85
85
|
authTokenValue = authToken.trim();
|
|
@@ -4,7 +4,12 @@ import {
|
|
|
4
4
|
useApi,
|
|
5
5
|
accessApiRef,
|
|
6
6
|
} from "@checkstack/frontend-api";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
GitOpsApi,
|
|
9
|
+
gitopsAccess,
|
|
10
|
+
pluginMetadata as gitopsPluginMetadata,
|
|
11
|
+
} from "@checkstack/gitops-common";
|
|
12
|
+
import { Tip } from "@checkstack/tips-frontend";
|
|
8
13
|
import {
|
|
9
14
|
Card,
|
|
10
15
|
CardHeader,
|
|
@@ -151,10 +156,19 @@ export const ProviderList = () => {
|
|
|
151
156
|
<CardHeaderRow>
|
|
152
157
|
<CardTitle>Git Providers</CardTitle>
|
|
153
158
|
{canManage && (
|
|
154
|
-
<
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
159
|
+
<Tip
|
|
160
|
+
plugin={gitopsPluginMetadata}
|
|
161
|
+
id="providers.create"
|
|
162
|
+
title="Manage Checkstack from Git"
|
|
163
|
+
description="Connect a GitHub or GitLab repository and Checkstack will sync your YAML descriptors — systems, groups, health checks — into the platform. Reviews happen as PRs, history lives in commits, and rollbacks are a `git revert` away."
|
|
164
|
+
side="bottom"
|
|
165
|
+
align="end"
|
|
166
|
+
>
|
|
167
|
+
<Button size="sm" onClick={() => setIsEditorOpen(true)}>
|
|
168
|
+
<Plus className="w-4 h-4 mr-2" />
|
|
169
|
+
Add Provider
|
|
170
|
+
</Button>
|
|
171
|
+
</Tip>
|
|
158
172
|
)}
|
|
159
173
|
</CardHeaderRow>
|
|
160
174
|
</CardHeader>
|
|
@@ -165,8 +179,22 @@ export const ProviderList = () => {
|
|
|
165
179
|
</div>
|
|
166
180
|
) : !providers || providers.length === 0 ? (
|
|
167
181
|
<EmptyState
|
|
182
|
+
icon={<Github className="size-10" />}
|
|
168
183
|
title="No providers configured"
|
|
169
|
-
description="
|
|
184
|
+
description="GitOps lets you keep your Checkstack infrastructure (systems, groups, health checks, secrets) in a Git repository and sync it into the platform automatically — pull-request reviews, audit trail, rollbacks, all included."
|
|
185
|
+
steps={[
|
|
186
|
+
"Add a GitHub or GitLab provider with a token that can read the repository.",
|
|
187
|
+
"Create a sync target that points at a path in that repo containing your YAML descriptors.",
|
|
188
|
+
"Push a change and watch Checkstack apply it — provenance is tracked per resource.",
|
|
189
|
+
]}
|
|
190
|
+
actions={
|
|
191
|
+
canManage ? (
|
|
192
|
+
<Button onClick={() => setIsEditorOpen(true)}>
|
|
193
|
+
<Plus className="w-4 h-4 mr-2" />
|
|
194
|
+
Add Git provider
|
|
195
|
+
</Button>
|
|
196
|
+
) : undefined
|
|
197
|
+
}
|
|
170
198
|
/>
|
|
171
199
|
) : (
|
|
172
200
|
<div className="space-y-3">
|
|
@@ -160,8 +160,29 @@ export const SecretList = () => {
|
|
|
160
160
|
</div>
|
|
161
161
|
) : !secrets || secrets.length === 0 ? (
|
|
162
162
|
<EmptyState
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
icon={<KeyRound className="size-10" />}
|
|
164
|
+
title="No secrets yet"
|
|
165
|
+
description={
|
|
166
|
+
<>
|
|
167
|
+
Secrets keep credentials, tokens and API keys out of your
|
|
168
|
+
YAML descriptors and out of Git. Reference them from any
|
|
169
|
+
GitOps file with{" "}
|
|
170
|
+
<code className="text-xs">{"${{ secrets.NAME }}"}</code>.
|
|
171
|
+
</>
|
|
172
|
+
}
|
|
173
|
+
steps={[
|
|
174
|
+
"Add a secret with a recognisable name (e.g. PROD_API_TOKEN).",
|
|
175
|
+
"Reference it in any descriptor with the ${{ secrets.NAME }} syntax — values are resolved server-side at apply time.",
|
|
176
|
+
"Rotate by editing the secret here; descriptors don't have to change.",
|
|
177
|
+
]}
|
|
178
|
+
actions={
|
|
179
|
+
canManage ? (
|
|
180
|
+
<Button onClick={() => setIsEditorOpen(true)}>
|
|
181
|
+
<Plus className="w-4 h-4 mr-2" />
|
|
182
|
+
Add your first secret
|
|
183
|
+
</Button>
|
|
184
|
+
) : undefined
|
|
185
|
+
}
|
|
165
186
|
/>
|
|
166
187
|
) : (
|
|
167
188
|
<div className="space-y-3">
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { usePluginClient } from "@checkstack/frontend-api";
|
|
3
|
+
import { GitOpsApi, type Provenance } from "@checkstack/gitops-common";
|
|
4
|
+
|
|
5
|
+
export interface ProvenanceLock {
|
|
6
|
+
isLocked: boolean;
|
|
7
|
+
provenance: Provenance | null;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const lockKey = ({ kind, entityId }: { kind: string; entityId: string }) =>
|
|
11
|
+
`${kind}::${entityId}`;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Bulk variant of `useProvenanceLock`. Issues a single `listProvenance` query
|
|
15
|
+
* for the whole tenant and returns a `getLock(kind, entityId)` lookup, so
|
|
16
|
+
* callers rendering many rows can avoid an N-query fan-out.
|
|
17
|
+
*/
|
|
18
|
+
export const useProvenanceLocks = () => {
|
|
19
|
+
const gitopsClient = usePluginClient(GitOpsApi);
|
|
20
|
+
|
|
21
|
+
const { data: provenances, isLoading } =
|
|
22
|
+
gitopsClient.listProvenance.useQuery();
|
|
23
|
+
|
|
24
|
+
const lockMap = useMemo(() => {
|
|
25
|
+
const map = new Map<string, Provenance>();
|
|
26
|
+
for (const p of provenances ?? []) {
|
|
27
|
+
if (p.status !== "synced") continue;
|
|
28
|
+
map.set(lockKey({ kind: p.kind, entityId: p.entityId }), p);
|
|
29
|
+
}
|
|
30
|
+
return map;
|
|
31
|
+
}, [provenances]);
|
|
32
|
+
|
|
33
|
+
const getLock = (params: {
|
|
34
|
+
kind: string;
|
|
35
|
+
entityId: string | undefined;
|
|
36
|
+
}): ProvenanceLock => {
|
|
37
|
+
if (!params.entityId) return { isLocked: false, provenance: null };
|
|
38
|
+
const provenance = lockMap.get(lockKey({ kind: params.kind, entityId: params.entityId })) ?? null;
|
|
39
|
+
return { isLocked: !!provenance, provenance };
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return { getLock, isLoading };
|
|
43
|
+
};
|
package/src/index.tsx
CHANGED
|
@@ -33,14 +33,19 @@ export const gitopsPlugin = createFrontendPlugin({
|
|
|
33
33
|
createSlotExtension(UserMenuItemsSlot, {
|
|
34
34
|
id: "gitops.user-menu.link",
|
|
35
35
|
component: GitOpsMenuItem,
|
|
36
|
+
metadata: { group: "Configuration" },
|
|
36
37
|
}),
|
|
37
38
|
createSlotExtension(UserMenuItemsSlot, {
|
|
38
39
|
id: "gitops.user-menu.kind-registry",
|
|
39
40
|
component: KindRegistryMenuItem,
|
|
41
|
+
metadata: { group: "Documentation" },
|
|
40
42
|
}),
|
|
41
43
|
],
|
|
42
44
|
});
|
|
43
45
|
|
|
44
46
|
// Public API for other frontend plugins
|
|
45
47
|
export { useProvenanceLock } from "./hooks/useProvenanceLock";
|
|
48
|
+
export { useProvenanceLocks } from "./hooks/useProvenanceLocks";
|
|
49
|
+
export type { ProvenanceLock } from "./hooks/useProvenanceLocks";
|
|
46
50
|
export { GitOpsLockBanner } from "./components/GitOpsLockBanner";
|
|
51
|
+
export { GitOpsSourceBadge } from "./components/GitOpsSourceBadge";
|
package/tsconfig.json
CHANGED
|
@@ -2,5 +2,22 @@
|
|
|
2
2
|
"extends": "@checkstack/tsconfig/frontend.json",
|
|
3
3
|
"include": [
|
|
4
4
|
"src"
|
|
5
|
+
],
|
|
6
|
+
"references": [
|
|
7
|
+
{
|
|
8
|
+
"path": "../common"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"path": "../frontend-api"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"path": "../gitops-common"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"path": "../tips-frontend"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"path": "../ui"
|
|
21
|
+
}
|
|
5
22
|
]
|
|
6
23
|
}
|