chore: update cloudly dependency stack
Align Cloudly with the current typedserver, smartconfig, smartstate, and Docker tooling releases so builds and Docker output stay compatible with the upgraded stack.
This commit is contained in:
+121
-117
@@ -3,7 +3,7 @@ import * as domtools from '@design.estate/dees-domtools';
|
||||
|
||||
const appstate = new plugins.deesDomtools.plugins.smartstate.Smartstate();
|
||||
export interface ILoginState {
|
||||
identity: plugins.interfaces.data.IIdentity;
|
||||
identity: plugins.interfaces.data.IIdentity | null;
|
||||
}
|
||||
export const loginStatePart: plugins.smartstate.StatePart<unknown, ILoginState> = await appstate.getStatePart<ILoginState>(
|
||||
'login',
|
||||
@@ -13,8 +13,8 @@ export const loginStatePart: plugins.smartstate.StatePart<unknown, ILoginState>
|
||||
|
||||
export const loginAction = loginStatePart.createAction<{ username: string; password: string }>(
|
||||
async (statePartArg, payloadArg) => {
|
||||
const currentState = statePartArg.getState();
|
||||
let identity: plugins.interfaces.data.IIdentity = null;
|
||||
const currentState = statePartArg.getState() || { identity: null };
|
||||
let identity: plugins.interfaces.data.IIdentity | null = null;
|
||||
try {
|
||||
identity = await apiClient.loginWithUsernameAndPassword(payloadArg.username, payloadArg.password);
|
||||
} catch (err) {
|
||||
@@ -31,7 +31,7 @@ export const loginAction = loginStatePart.createAction<{ username: string; passw
|
||||
if (!apiClient['typedsocketClient']) {
|
||||
await apiClient.start();
|
||||
}
|
||||
try { apiClient.typedsocketClient.addTag('identity', apiClient.identity); } catch {}
|
||||
try { await apiClient.typedsocketClient.setTag('identity', apiClient.identity); } catch {}
|
||||
}
|
||||
} catch {}
|
||||
return newState;
|
||||
@@ -39,7 +39,7 @@ export const loginAction = loginStatePart.createAction<{ username: string; passw
|
||||
);
|
||||
|
||||
export const logoutAction = loginStatePart.createAction(async (statePartArg) => {
|
||||
const currentState = statePartArg.getState();
|
||||
const currentState = statePartArg.getState() || { identity: null };
|
||||
return {
|
||||
...currentState,
|
||||
identity: null,
|
||||
@@ -88,17 +88,21 @@ export const dataState = await appstate.getStatePart<IDataState>(
|
||||
);
|
||||
|
||||
// Shared API client instance (used by UI actions)
|
||||
type TCloudlyApiClientWithNullableIdentity = Omit<plugins.servezoneApi.CloudlyApiClient, 'identity'> & {
|
||||
identity: plugins.interfaces.data.IIdentity | null;
|
||||
};
|
||||
|
||||
export const apiClient = new plugins.servezoneApi.CloudlyApiClient({
|
||||
registerAs: 'api',
|
||||
cloudlyUrl: (typeof window !== 'undefined' && window.location?.origin) ? window.location.origin : undefined,
|
||||
});
|
||||
}) as TCloudlyApiClientWithNullableIdentity;
|
||||
|
||||
// Getting data
|
||||
export const getAllDataAction = dataState.createAction(async (statePartArg) => {
|
||||
let currentState = statePartArg.getState();
|
||||
let currentState = statePartArg.getState() || {};
|
||||
// SecretsGroups
|
||||
try {
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
const secretGroups = await apiClient.secretgroup.getSecretGroups();
|
||||
currentState = {
|
||||
...currentState,
|
||||
@@ -114,7 +118,7 @@ export const getAllDataAction = dataState.createAction(async (statePartArg) => {
|
||||
|
||||
// SecretBundles
|
||||
try {
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
const responseSecretBundles = await apiClient.secretbundle.getSecretBundles();
|
||||
currentState = {
|
||||
...currentState,
|
||||
@@ -130,7 +134,7 @@ export const getAllDataAction = dataState.createAction(async (statePartArg) => {
|
||||
|
||||
// images
|
||||
try {
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
const images = await apiClient.image.getImages();
|
||||
currentState = {
|
||||
...currentState,
|
||||
@@ -146,7 +150,7 @@ export const getAllDataAction = dataState.createAction(async (statePartArg) => {
|
||||
|
||||
// Clusters
|
||||
try {
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
const clusters = await apiClient.cluster.getClusters();
|
||||
currentState = {
|
||||
...currentState,
|
||||
@@ -162,7 +166,7 @@ export const getAllDataAction = dataState.createAction(async (statePartArg) => {
|
||||
|
||||
// External Registries via shared API client
|
||||
try {
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
const registries = await apiClient.externalRegistry.getRegistries();
|
||||
currentState = {
|
||||
...currentState,
|
||||
@@ -178,7 +182,7 @@ export const getAllDataAction = dataState.createAction(async (statePartArg) => {
|
||||
|
||||
// Services
|
||||
try {
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
const services = await apiClient.services.getServices();
|
||||
currentState = {
|
||||
...currentState,
|
||||
@@ -194,7 +198,7 @@ export const getAllDataAction = dataState.createAction(async (statePartArg) => {
|
||||
|
||||
// Deployments
|
||||
try {
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
const responseDeployments = await apiClient.deployments.getDeployments();
|
||||
currentState = {
|
||||
...currentState,
|
||||
@@ -210,7 +214,7 @@ export const getAllDataAction = dataState.createAction(async (statePartArg) => {
|
||||
|
||||
// Domains via API client
|
||||
try {
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
const responseDomains = await apiClient.domains.getDomains();
|
||||
currentState = {
|
||||
...currentState,
|
||||
@@ -226,7 +230,7 @@ export const getAllDataAction = dataState.createAction(async (statePartArg) => {
|
||||
|
||||
// DNS Entries via API client
|
||||
try {
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
const responseDnsEntries = await apiClient.dns.getDnsEntries();
|
||||
currentState = {
|
||||
...currentState,
|
||||
@@ -245,58 +249,57 @@ export const getAllDataAction = dataState.createAction(async (statePartArg) => {
|
||||
|
||||
// Service Actions
|
||||
export const createServiceAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { serviceData: plugins.interfaces.data.IService['data'] }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
async (statePartArg, payloadArg: { serviceData: plugins.interfaces.data.IService['data'] }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.services.createService(payloadArg.serviceData);
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
return currentState;
|
||||
}
|
||||
);
|
||||
|
||||
export const updateServiceAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { serviceId: string; serviceData: plugins.interfaces.data.IService['data'] }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
async (statePartArg, payloadArg: { serviceId: string; serviceData: plugins.interfaces.data.IService['data'] }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.services.updateService(payloadArg.serviceId, payloadArg.serviceData);
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
return currentState;
|
||||
}
|
||||
);
|
||||
|
||||
export const deleteServiceAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { serviceId: string }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
async (statePartArg, payloadArg: { serviceId: string }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.services.deleteService(payloadArg.serviceId);
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
return currentState;
|
||||
}
|
||||
);
|
||||
|
||||
// SecretGroup Actions
|
||||
export const createSecretGroupAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: plugins.interfaces.data.ISecretGroup) => {
|
||||
let currentState = statePartArg.getState();
|
||||
async (statePartArg, payloadArg: { data: plugins.interfaces.data.ISecretGroup['data'] }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
try {
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.secretgroup.createSecretGroup(payloadArg.data);
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
} catch (err) {
|
||||
console.error('Failed to create secret group:', err);
|
||||
}
|
||||
return currentState;
|
||||
return currentState;
|
||||
}
|
||||
);
|
||||
|
||||
export const deleteSecretGroupAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { secretGroupId: string }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
async (statePartArg, payloadArg: { secretGroupId: string }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
try {
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.secretgroup.deleteSecretGroupById(payloadArg.secretGroupId);
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
} catch (err) {
|
||||
console.error('Failed to delete secret group:', err);
|
||||
}
|
||||
@@ -306,12 +309,12 @@ export const deleteSecretGroupAction = dataState.createAction(
|
||||
|
||||
// SecretBundle Actions
|
||||
export const deleteSecretBundleAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { configBundleId: string }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
async (statePartArg, payloadArg: { configBundleId: string }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
try {
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.secretbundle.deleteSecretBundleById(payloadArg.configBundleId);
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
} catch (err) {
|
||||
console.error('Failed to delete secret bundle:', err);
|
||||
}
|
||||
@@ -321,146 +324,146 @@ export const deleteSecretBundleAction = dataState.createAction(
|
||||
|
||||
// image actions
|
||||
export const createImageAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { imageName: string, description: string }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
async (statePartArg, payloadArg: { imageName: string, description: string }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.image.createImage({ name: payloadArg.imageName, description: payloadArg.description });
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
return currentState;
|
||||
}
|
||||
);
|
||||
|
||||
export const deleteImageAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { imageId: string }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
async (statePartArg, payloadArg: { imageId: string }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.image.deleteImage(payloadArg.imageId);
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
return currentState;
|
||||
}
|
||||
);
|
||||
|
||||
// Deployment Actions
|
||||
export const createDeploymentAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { deploymentData: Partial<plugins.interfaces.data.IDeployment> }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
async (statePartArg, payloadArg: { deploymentData: Partial<plugins.interfaces.data.IDeployment> }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.deployments.createDeployment(payloadArg.deploymentData);
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
return currentState;
|
||||
}
|
||||
);
|
||||
|
||||
export const updateDeploymentAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { deploymentId: string; deploymentData: Partial<plugins.interfaces.data.IDeployment> }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
async (statePartArg, payloadArg: { deploymentId: string; deploymentData: Partial<plugins.interfaces.data.IDeployment> }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.deployments.updateDeployment(payloadArg.deploymentId, payloadArg.deploymentData);
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
return currentState;
|
||||
}
|
||||
);
|
||||
|
||||
export const deleteDeploymentAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { deploymentId: string }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
async (statePartArg, payloadArg: { deploymentId: string }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.deployments.deleteDeployment(payloadArg.deploymentId);
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
return currentState;
|
||||
}
|
||||
);
|
||||
|
||||
// DNS Actions
|
||||
export const createDnsEntryAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { dnsEntryData: plugins.interfaces.data.IDnsEntry['data'] }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
async (statePartArg, payloadArg: { dnsEntryData: plugins.interfaces.data.IDnsEntry['data'] }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.dns.createDnsEntry(payloadArg.dnsEntryData);
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
return currentState;
|
||||
}
|
||||
);
|
||||
|
||||
export const updateDnsEntryAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { dnsEntryId: string; dnsEntryData: plugins.interfaces.data.IDnsEntry['data'] }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
async (statePartArg, payloadArg: { dnsEntryId: string; dnsEntryData: plugins.interfaces.data.IDnsEntry['data'] }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.dns.updateDnsEntry(payloadArg.dnsEntryId, payloadArg.dnsEntryData);
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
return currentState;
|
||||
}
|
||||
);
|
||||
|
||||
export const deleteDnsEntryAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { dnsEntryId: string }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
async (statePartArg, payloadArg: { dnsEntryId: string }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.dns.deleteDnsEntry(payloadArg.dnsEntryId);
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
return currentState;
|
||||
}
|
||||
);
|
||||
|
||||
// Domain Actions
|
||||
export const createDomainAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { domainData: plugins.interfaces.data.IDomain['data'] }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
async (statePartArg, payloadArg: { domainData: plugins.interfaces.data.IDomain['data'] }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.domains.createDomain(payloadArg.domainData);
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
return currentState;
|
||||
}
|
||||
);
|
||||
|
||||
export const updateDomainAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { domainId: string; domainData: plugins.interfaces.data.IDomain['data'] }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
async (statePartArg, payloadArg: { domainId: string; domainData: plugins.interfaces.data.IDomain['data'] }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.domains.updateDomain(payloadArg.domainId, payloadArg.domainData);
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
return currentState;
|
||||
}
|
||||
);
|
||||
|
||||
export const deleteDomainAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { domainId: string }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
async (statePartArg, payloadArg: { domainId: string }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.domains.deleteDomain(payloadArg.domainId);
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
return currentState;
|
||||
}
|
||||
);
|
||||
|
||||
export const verifyDomainAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { domainId: string; verificationMethod?: 'dns' | 'http' | 'email' | 'manual' }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
async (statePartArg, payloadArg: { domainId: string; verificationMethod?: 'dns' | 'http' | 'email' | 'manual' }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.domains.verifyDomain(payloadArg.domainId, payloadArg.verificationMethod);
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
return currentState;
|
||||
}
|
||||
);
|
||||
|
||||
// External Registry Actions
|
||||
export const createExternalRegistryAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { registryData: plugins.interfaces.data.IExternalRegistry['data'] }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
async (statePartArg, payloadArg: { registryData: plugins.interfaces.data.IExternalRegistry['data'] }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.externalRegistry.createRegistry(payloadArg.registryData);
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
return currentState;
|
||||
}
|
||||
);
|
||||
|
||||
export const updateExternalRegistryAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { registryId: string; registryData: plugins.interfaces.data.IExternalRegistry['data'] }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
async (statePartArg, payloadArg: { registryId: string; registryData: plugins.interfaces.data.IExternalRegistry['data'] }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
try {
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.externalRegistry.updateRegistry(payloadArg.registryId, payloadArg.registryData);
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
} catch (err) {
|
||||
console.error('Failed to update external registry:', err);
|
||||
}
|
||||
@@ -469,12 +472,12 @@ export const updateExternalRegistryAction = dataState.createAction(
|
||||
);
|
||||
|
||||
export const deleteExternalRegistryAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { registryId: string }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
async (statePartArg, payloadArg: { registryId: string }, context) => {
|
||||
let currentState = statePartArg.getState() || {};
|
||||
try {
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.externalRegistry.deleteRegistry(payloadArg.registryId);
|
||||
currentState = await dataState.dispatchAction(getAllDataAction, null);
|
||||
currentState = await context.dispatch(getAllDataAction, null);
|
||||
} catch (err) {
|
||||
console.error('Failed to delete external registry:', err);
|
||||
}
|
||||
@@ -484,9 +487,9 @@ export const deleteExternalRegistryAction = dataState.createAction(
|
||||
|
||||
export const verifyExternalRegistryAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { registryId: string }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
let currentState = statePartArg.getState() || {};
|
||||
try {
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
const result = await apiClient.externalRegistry.verifyRegistry(payloadArg.registryId);
|
||||
if (result.success && result.registry) {
|
||||
const regs = (currentState.externalRegistries || []).slice();
|
||||
@@ -514,8 +517,8 @@ export const verifyExternalRegistryAction = dataState.createAction(
|
||||
export const taskActions = {
|
||||
getTasks: dataState.createAction(
|
||||
async (statePartArg, payloadArg: {}) => {
|
||||
const currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
const currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
const response = await apiClient.tasks.getTasks();
|
||||
return {
|
||||
...currentState,
|
||||
@@ -526,8 +529,8 @@ export const taskActions = {
|
||||
|
||||
getTaskExecutions: dataState.createAction(
|
||||
async (statePartArg, payloadArg: { filter?: any }) => {
|
||||
const currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
const currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
const response = await apiClient.tasks.getTaskExecutions(payloadArg.filter);
|
||||
return {
|
||||
...currentState,
|
||||
@@ -538,8 +541,8 @@ export const taskActions = {
|
||||
|
||||
getTaskExecutionById: dataState.createAction(
|
||||
async (statePartArg, payloadArg: { executionId: string }) => {
|
||||
const currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
const currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.tasks.getTaskExecutionById(payloadArg.executionId);
|
||||
return currentState;
|
||||
}
|
||||
@@ -547,8 +550,8 @@ export const taskActions = {
|
||||
|
||||
triggerTask: dataState.createAction(
|
||||
async (statePartArg, payloadArg: { taskName: string; userId?: string }) => {
|
||||
const currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
const currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.tasks.triggerTask(payloadArg.taskName, payloadArg.userId);
|
||||
return currentState;
|
||||
}
|
||||
@@ -556,8 +559,8 @@ export const taskActions = {
|
||||
|
||||
cancelTask: dataState.createAction(
|
||||
async (statePartArg, payloadArg: { executionId: string }) => {
|
||||
const currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
const currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.tasks.cancelTask(payloadArg.executionId);
|
||||
return currentState;
|
||||
}
|
||||
@@ -571,11 +574,12 @@ export const addClusterAction = dataState.createAction(
|
||||
payloadArg: {
|
||||
clusterName: string;
|
||||
setupMode?: 'manual' | 'hetzner' | 'aws' | 'digitalocean';
|
||||
}
|
||||
},
|
||||
context
|
||||
) => {
|
||||
let currentState = statePartArg.getState();
|
||||
apiClient.identity = loginStatePart.getState().identity;
|
||||
let currentState = statePartArg.getState() || {};
|
||||
apiClient.identity = loginStatePart.getState()?.identity ?? null;
|
||||
await apiClient.cluster.createClusterAdvanced(payloadArg.clusterName, payloadArg.setupMode);
|
||||
return await dataState.dispatchAction(getAllDataAction, null);
|
||||
return await context.dispatch(getAllDataAction, null);
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user