fix(core): fix secrets scan upserts, connection health checks, and frontend improvements
- Add upsert pattern to SecretsScanService to prevent duplicate key errors on repeated scans - Auto-test connection health on startup so status reflects reality - Fix Actions view to read identity from appstate instead of broken localStorage hack - Fetch both project and group secrets in parallel, add "All Scopes" filter to Secrets view - Enable noCache on UtilityWebsiteServer to prevent stale browser cache
This commit is contained in:
@@ -306,19 +306,26 @@ export const fetchSecretsAction = dataStatePart.createAction<{
|
||||
|
||||
export const fetchAllSecretsAction = dataStatePart.createAction<{
|
||||
connectionId: string;
|
||||
scope: 'project' | 'group';
|
||||
scope?: 'project' | 'group';
|
||||
}>(async (statePartArg, dataArg) => {
|
||||
const context = getActionContext();
|
||||
try {
|
||||
const typedRequest = new plugins.domtools.plugins.typedrequest.TypedRequest<
|
||||
interfaces.requests.IReq_GetAllSecrets
|
||||
>('/typedrequest', 'getAllSecrets');
|
||||
const response = await typedRequest.fire({
|
||||
identity: context.identity!,
|
||||
connectionId: dataArg.connectionId,
|
||||
scope: dataArg.scope,
|
||||
});
|
||||
return { ...statePartArg.getState(), secrets: response.secrets };
|
||||
// When no scope specified, fetch both project and group secrets in parallel
|
||||
const scopes: Array<'project' | 'group'> = dataArg.scope ? [dataArg.scope] : ['project', 'group'];
|
||||
const results = await Promise.all(
|
||||
scopes.map(async (scope) => {
|
||||
const typedRequest = new plugins.domtools.plugins.typedrequest.TypedRequest<
|
||||
interfaces.requests.IReq_GetAllSecrets
|
||||
>('/typedrequest', 'getAllSecrets');
|
||||
const response = await typedRequest.fire({
|
||||
identity: context.identity!,
|
||||
connectionId: dataArg.connectionId,
|
||||
scope,
|
||||
});
|
||||
return response.secrets;
|
||||
}),
|
||||
);
|
||||
return { ...statePartArg.getState(), secrets: results.flat() };
|
||||
} catch (err) {
|
||||
console.error('Failed to fetch all secrets:', err);
|
||||
return statePartArg.getState();
|
||||
|
||||
Reference in New Issue
Block a user