@checkstack/queue-frontend 0.2.31 → 0.3.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 +37 -0
- package/package.json +4 -3
- package/src/components/QueueConfigTab.tsx +184 -0
- package/src/index.tsx +19 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @checkstack/queue-frontend
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8d1ef12: ## Infrastructure Configuration Shell & Cache System
|
|
8
|
+
|
|
9
|
+
### New Packages
|
|
10
|
+
|
|
11
|
+
- **`@checkstack/cache-api`**: Core cache abstractions — `CacheProvider` interface, `createScopedCache` factory for plugin key isolation, `CachePlugin`/`CacheManager` lifecycle interfaces.
|
|
12
|
+
- **`@checkstack/cache-common`**: Shared cache types, RPC contract (`getPlugins`, `getConfiguration`, `updateConfiguration`), access rules, and plugin metadata.
|
|
13
|
+
- **`@checkstack/cache-backend`**: Cache settings RPC router — exposes plugin discovery, configuration read/write endpoints with access-gated authorization.
|
|
14
|
+
- **`@checkstack/cache-frontend`**: Cache configuration tab component for the Infrastructure Settings page.
|
|
15
|
+
- **`@checkstack/infrastructure-common`**: Infrastructure tab registry, routes, and shared types for the IDE-style configuration shell.
|
|
16
|
+
- **`@checkstack/infrastructure-frontend`**: Infrastructure Settings page with vertical tab bar, per-tab access control, and user menu integration.
|
|
17
|
+
|
|
18
|
+
### Modified Packages
|
|
19
|
+
|
|
20
|
+
- **`@checkstack/backend-api`**: Added `cachePluginRegistry` and `cacheManager` to `RpcContext` and `coreServices`.
|
|
21
|
+
- **`@checkstack/backend`**: Registered cache services in boot sequence, added cache config loading, extended dependency sorter for cache plugin ordering.
|
|
22
|
+
- **`@checkstack/queue-frontend`**: Refactored from standalone `/queue/config` route to an infrastructure tab. Queue settings now live inside the Infrastructure Settings page.
|
|
23
|
+
|
|
24
|
+
### Architecture
|
|
25
|
+
|
|
26
|
+
The former monolithic Queue Config page is replaced by a pluggable Infrastructure Settings shell (`/infrastructure/config`). Plugins register configuration tabs via `registerInfrastructureTab()` with their own access rules, icons, and components. The shell evaluates per-tab access and only renders tabs the user can see.
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [8d1ef12]
|
|
31
|
+
- Updated dependencies [8d1ef12]
|
|
32
|
+
- Updated dependencies [8d1ef12]
|
|
33
|
+
- @checkstack/common@0.7.0
|
|
34
|
+
- @checkstack/infrastructure-common@0.2.0
|
|
35
|
+
- @checkstack/ui@1.6.0
|
|
36
|
+
- @checkstack/frontend-api@0.3.11
|
|
37
|
+
- @checkstack/queue-common@0.2.9
|
|
38
|
+
- @checkstack/signal-frontend@0.0.16
|
|
39
|
+
|
|
3
40
|
## 0.2.31
|
|
4
41
|
|
|
5
42
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/queue-frontend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"checkstack": {
|
|
@@ -21,10 +21,11 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@checkstack/common": "0.6.5",
|
|
24
|
-
"@checkstack/frontend-api": "0.3.
|
|
24
|
+
"@checkstack/frontend-api": "0.3.10",
|
|
25
|
+
"@checkstack/infrastructure-common": "0.1.0",
|
|
25
26
|
"@checkstack/queue-common": "0.2.8",
|
|
26
27
|
"@checkstack/signal-frontend": "0.0.15",
|
|
27
|
-
"@checkstack/ui": "1.5.
|
|
28
|
+
"@checkstack/ui": "1.5.1",
|
|
28
29
|
"ajv": "^8.18.0",
|
|
29
30
|
"ajv-formats": "^3.0.1",
|
|
30
31
|
"lucide-react": "^0.468.0",
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { usePluginClient } from "@checkstack/frontend-api";
|
|
3
|
+
import {
|
|
4
|
+
QueuePluginDto,
|
|
5
|
+
QueueApi,
|
|
6
|
+
} from "@checkstack/queue-common";
|
|
7
|
+
import {
|
|
8
|
+
Button,
|
|
9
|
+
Alert,
|
|
10
|
+
AlertTitle,
|
|
11
|
+
AlertDescription,
|
|
12
|
+
Card,
|
|
13
|
+
CardContent,
|
|
14
|
+
CardFooter,
|
|
15
|
+
CardHeader,
|
|
16
|
+
CardTitle,
|
|
17
|
+
PluginConfigForm,
|
|
18
|
+
useToast,
|
|
19
|
+
} from "@checkstack/ui";
|
|
20
|
+
import { AlertTriangle, Save, Info, Gauge, Activity } from "lucide-react";
|
|
21
|
+
import { QueueLagAlert } from "./QueueLagAlert";
|
|
22
|
+
import { extractErrorMessage } from "@checkstack/common";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Queue configuration tab component.
|
|
26
|
+
*
|
|
27
|
+
* Renders inside the Infrastructure Config page as a registered tab.
|
|
28
|
+
* Extracted from the former QueueConfigPage.
|
|
29
|
+
*
|
|
30
|
+
* Receives `canUpdate` from the infrastructure shell instead of
|
|
31
|
+
* querying access internally (the shell handles per-tab access).
|
|
32
|
+
*/
|
|
33
|
+
export const QueueConfigTab = ({ canUpdate }: { canUpdate: boolean }) => {
|
|
34
|
+
const queueClient = usePluginClient(QueueApi);
|
|
35
|
+
const toast = useToast();
|
|
36
|
+
|
|
37
|
+
// Fetch plugins and configuration
|
|
38
|
+
const { data: pluginsList } = queueClient.getPlugins.useQuery();
|
|
39
|
+
const { data: configuration, refetch: refetchConfig } =
|
|
40
|
+
queueClient.getConfiguration.useQuery();
|
|
41
|
+
const updateConfigMutation = queueClient.updateConfiguration.useMutation();
|
|
42
|
+
|
|
43
|
+
const [selectedPluginId, setSelectedPluginId] = useState<string>("");
|
|
44
|
+
const [config, setConfig] = useState<Record<string, unknown>>({});
|
|
45
|
+
|
|
46
|
+
// Sync state with fetched data
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (configuration) {
|
|
49
|
+
setSelectedPluginId(configuration.pluginId);
|
|
50
|
+
setConfig(configuration.config);
|
|
51
|
+
}
|
|
52
|
+
}, [configuration]);
|
|
53
|
+
|
|
54
|
+
const handleSave = async () => {
|
|
55
|
+
if (!selectedPluginId) return;
|
|
56
|
+
try {
|
|
57
|
+
await updateConfigMutation.mutateAsync({
|
|
58
|
+
pluginId: selectedPluginId,
|
|
59
|
+
config,
|
|
60
|
+
});
|
|
61
|
+
toast.success("Configuration saved successfully!");
|
|
62
|
+
refetchConfig();
|
|
63
|
+
} catch (error) {
|
|
64
|
+
const message = extractErrorMessage(error);
|
|
65
|
+
toast.error(`Failed to save configuration: ${message}`);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const isMemoryQueue = selectedPluginId === "memory";
|
|
70
|
+
const plugins: QueuePluginDto[] = pluginsList ?? [];
|
|
71
|
+
const isSaving = updateConfigMutation.isPending;
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<div className="space-y-6">
|
|
75
|
+
<QueueLagAlert requireAccess={false} />
|
|
76
|
+
<Card>
|
|
77
|
+
<CardHeader>
|
|
78
|
+
<CardTitle>Queue Configuration</CardTitle>
|
|
79
|
+
<p className="text-sm text-muted-foreground">
|
|
80
|
+
Select and configure the queue plugin
|
|
81
|
+
</p>
|
|
82
|
+
</CardHeader>
|
|
83
|
+
<CardContent className="space-y-6">
|
|
84
|
+
{isMemoryQueue && (
|
|
85
|
+
<Alert variant="warning">
|
|
86
|
+
<AlertTriangle className="h-5 w-5" />
|
|
87
|
+
<div>
|
|
88
|
+
<AlertTitle>In-Memory Queue Warning</AlertTitle>
|
|
89
|
+
<AlertDescription>
|
|
90
|
+
The in-memory queue is suitable for development and
|
|
91
|
+
single-instance deployments only. It will not scale across
|
|
92
|
+
multiple instances and jobs will be lost on restart. For
|
|
93
|
+
production environments with multiple instances, consider
|
|
94
|
+
using a persistent queue implementation.
|
|
95
|
+
</AlertDescription>
|
|
96
|
+
</div>
|
|
97
|
+
</Alert>
|
|
98
|
+
)}
|
|
99
|
+
|
|
100
|
+
<PluginConfigForm
|
|
101
|
+
label="Queue Plugin"
|
|
102
|
+
plugins={plugins}
|
|
103
|
+
selectedPluginId={selectedPluginId}
|
|
104
|
+
onPluginChange={(value) => {
|
|
105
|
+
setSelectedPluginId(value);
|
|
106
|
+
setConfig({});
|
|
107
|
+
}}
|
|
108
|
+
config={config}
|
|
109
|
+
onConfigChange={setConfig}
|
|
110
|
+
disabled={!canUpdate}
|
|
111
|
+
/>
|
|
112
|
+
</CardContent>
|
|
113
|
+
<CardFooter className="flex justify-end gap-2">
|
|
114
|
+
<Button onClick={handleSave} disabled={!canUpdate || isSaving}>
|
|
115
|
+
<Save className="mr-2 h-4 w-4" />
|
|
116
|
+
{isSaving ? "Saving..." : "Save Configuration"}
|
|
117
|
+
</Button>
|
|
118
|
+
</CardFooter>
|
|
119
|
+
</Card>
|
|
120
|
+
|
|
121
|
+
{/* Performance Guidance */}
|
|
122
|
+
<Card>
|
|
123
|
+
<CardHeader>
|
|
124
|
+
<CardTitle className="flex items-center gap-2">
|
|
125
|
+
<Info className="h-5 w-5" />
|
|
126
|
+
Performance Tuning
|
|
127
|
+
</CardTitle>
|
|
128
|
+
</CardHeader>
|
|
129
|
+
<CardContent className="space-y-4">
|
|
130
|
+
<div className="grid gap-4 md:grid-cols-2">
|
|
131
|
+
<div className="space-y-2">
|
|
132
|
+
<h4 className="flex items-center gap-2 font-medium">
|
|
133
|
+
<Gauge className="h-4 w-4" />
|
|
134
|
+
Concurrency Settings
|
|
135
|
+
</h4>
|
|
136
|
+
<ul className="text-sm text-muted-foreground space-y-1 list-disc list-inside">
|
|
137
|
+
<li>
|
|
138
|
+
<strong>Default (10)</strong>: Conservative, safe for most
|
|
139
|
+
workloads
|
|
140
|
+
</li>
|
|
141
|
+
<li>
|
|
142
|
+
<strong>Moderate (25-50)</strong>: Good for I/O-bound health
|
|
143
|
+
checks
|
|
144
|
+
</li>
|
|
145
|
+
<li>
|
|
146
|
+
<strong>Aggressive (100)</strong>: Maximum, monitor resource
|
|
147
|
+
usage
|
|
148
|
+
</li>
|
|
149
|
+
</ul>
|
|
150
|
+
<p className="text-xs text-muted-foreground mt-2">
|
|
151
|
+
Formula: throughput ≈ concurrency / avg_job_duration
|
|
152
|
+
</p>
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
<div className="space-y-2">
|
|
156
|
+
<h4 className="flex items-center gap-2 font-medium">
|
|
157
|
+
<Activity className="h-4 w-4" />
|
|
158
|
+
Bottleneck Indicators
|
|
159
|
+
</h4>
|
|
160
|
+
<ul className="text-sm text-muted-foreground space-y-1 list-disc list-inside">
|
|
161
|
+
<li>
|
|
162
|
+
<strong>Jobs queueing</strong>: Increase concurrency or
|
|
163
|
+
scale horizontally
|
|
164
|
+
</li>
|
|
165
|
+
<li>
|
|
166
|
+
<strong>High CPU (>70%)</strong>: Scale horizontally,
|
|
167
|
+
don't increase concurrency
|
|
168
|
+
</li>
|
|
169
|
+
<li>
|
|
170
|
+
<strong>DB connection errors</strong>: Reduce concurrency or
|
|
171
|
+
increase pool
|
|
172
|
+
</li>
|
|
173
|
+
<li>
|
|
174
|
+
<strong>Rate limit errors</strong>: Reduce concurrency for
|
|
175
|
+
external checks
|
|
176
|
+
</li>
|
|
177
|
+
</ul>
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|
|
180
|
+
</CardContent>
|
|
181
|
+
</Card>
|
|
182
|
+
</div>
|
|
183
|
+
);
|
|
184
|
+
};
|
package/src/index.tsx
CHANGED
|
@@ -1,31 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
pluginMetadata,
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { createFrontendPlugin } from "@checkstack/frontend-api";
|
|
2
|
+
import { registerInfrastructureTab } from "@checkstack/infrastructure-common";
|
|
3
|
+
import { pluginMetadata, queueAccess } from "@checkstack/queue-common";
|
|
4
|
+
import { QueueConfigTab } from "./components/QueueConfigTab";
|
|
5
|
+
import { Gauge } from "lucide-react";
|
|
6
|
+
|
|
7
|
+
// Register queue tab into the Infrastructure Configuration page
|
|
8
|
+
registerInfrastructureTab({
|
|
9
|
+
id: "queue",
|
|
10
|
+
pluginId: pluginMetadata.pluginId,
|
|
11
|
+
label: "Queue",
|
|
12
|
+
icon: Gauge,
|
|
13
|
+
component: QueueConfigTab,
|
|
14
|
+
readAccess: queueAccess.settings.read,
|
|
15
|
+
manageAccess: queueAccess.settings.manage,
|
|
16
|
+
order: 10, // First tab
|
|
17
|
+
});
|
|
13
18
|
|
|
14
19
|
export const queuePlugin = createFrontendPlugin({
|
|
15
20
|
metadata: pluginMetadata,
|
|
16
|
-
routes
|
|
17
|
-
|
|
18
|
-
route: queueRoutes.routes.config,
|
|
19
|
-
element: <QueueConfigPage />,
|
|
20
|
-
accessRule: queueAccess.settings.read,
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
extensions: [
|
|
24
|
-
createSlotExtension(UserMenuItemsSlot, {
|
|
25
|
-
id: "queue.user-menu.items",
|
|
26
|
-
component: QueueUserMenuItems,
|
|
27
|
-
}),
|
|
28
|
-
],
|
|
21
|
+
// No routes — the queue tab lives inside the infrastructure page now
|
|
22
|
+
// Former standalone /queue/config route is replaced by /infrastructure/config
|
|
29
23
|
});
|
|
30
24
|
|
|
31
25
|
export * from "./api";
|