@checkstack/gitops-frontend 0.3.8 → 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 CHANGED
@@ -1,5 +1,102 @@
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
+
3
100
  ## 0.3.8
4
101
 
5
102
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/gitops-frontend",
3
- "version": "0.3.8",
3
+ "version": "0.4.0",
4
4
  "license": "Elastic-2.0",
5
5
  "type": "module",
6
6
  "main": "src/index.tsx",
@@ -13,10 +13,11 @@
13
13
  "lint:code": "eslint . --max-warnings 0"
14
14
  },
15
15
  "dependencies": {
16
- "@checkstack/common": "0.7.0",
17
- "@checkstack/frontend-api": "0.4.1",
18
- "@checkstack/gitops-common": "0.2.1",
19
- "@checkstack/ui": "1.7.0",
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",
20
21
  "lucide-react": "^0.344.0",
21
22
  "react": "^18.2.0",
22
23
  "react-router-dom": "^6.22.0"
@@ -24,7 +25,7 @@
24
25
  "devDependencies": {
25
26
  "typescript": "^5.0.0",
26
27
  "@types/react": "^18.2.0",
27
- "@checkstack/tsconfig": "0.0.6",
28
- "@checkstack/scripts": "0.1.2"
28
+ "@checkstack/tsconfig": "0.0.7",
29
+ "@checkstack/scripts": "0.3.0"
29
30
  }
30
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
- <div className="text-xs text-muted-foreground mt-0.5 flex items-center gap-1">
27
- <span className="truncate">
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
- </span>
30
- <ExternalLink className="w-3 h-3 shrink-0" />
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="No synced entities"
267
- description="Entities will appear here after a successful sync."
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)
@@ -4,7 +4,12 @@ import {
4
4
  useApi,
5
5
  accessApiRef,
6
6
  } from "@checkstack/frontend-api";
7
- import { GitOpsApi, gitopsAccess } from "@checkstack/gitops-common";
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
- <Button size="sm" onClick={() => setIsEditorOpen(true)}>
155
- <Plus className="w-4 h-4 mr-2" />
156
- Add Provider
157
- </Button>
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="Add a GitHub or GitLab provider to start syncing infrastructure definitions."
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
- title="No secrets created"
164
- description="Create secrets to securely reference sensitive values in your YAML descriptors."
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
@@ -13,6 +13,9 @@
13
13
  {
14
14
  "path": "../gitops-common"
15
15
  },
16
+ {
17
+ "path": "../tips-frontend"
18
+ },
16
19
  {
17
20
  "path": "../ui"
18
21
  }