Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ export const assistantKnowledgeTopics = {
{
path: "landing-zone-configurator/app/apps/api/src/deployments/preparations.ts",
sha256:
"178669b42f85549db9e2f09c32e9c657a6a801c012bbd4a317f473549eec8879",
"14eba29818e560a51d155a11b5e692fb5df135161029d34d862b4fff62e1dcc7",
},
{
path: "landing-zone-configurator/app/packages/domain/src/initial-plan.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export interface CredentialProfiles {
name: string,
key: ServiceAccountKey,
firewallAdministration?: FirewallAdministration,
): Promise<void>;
): Promise<void | string>;
remove(session: Session, id: string): Promise<void>;
}
export class PostgresCredentialProfiles implements CredentialProfiles {
Expand Down Expand Up @@ -119,6 +119,7 @@ export class PostgresCredentialProfiles implements CredentialProfiles {
[id],
);
});
return id;
}
async check(session: Session, id: string, organizationId: string) {
return (await this.verifyForPreparation(session, id, organizationId)).check;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,18 @@ export function registerCredentials(
} catch {
return reply.code(400).send({ error: "invalid_service_account_key" });
}
if (input.firewallAdministration)
await profiles.create(
session,
input.name,
key,
input.firewallAdministration,
);
else await profiles.create(session, input.name, key);
return reply.code(201).send({ stored: true });
const profileId = input.firewallAdministration
? await profiles.create(
session,
input.name,
key,
input.firewallAdministration,
)
: await profiles.create(session, input.name, key);
return reply.code(201).send({
stored: true,
...(typeof profileId === "string" ? { profileId } : {}),
});
},
);
routes.post("/api/v1/credentials/:id/check", async (request, reply) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ export class Preparations {
`preparations:${session.userId}`,
]);
const count = await c.query(
"SELECT count(*)::int AS count FROM lzc.deployment_preparations",
"SELECT count(*)::int AS count FROM lzc.deployment_preparations p WHERE NOT EXISTS (SELECT 1 FROM lzc.plan_runs r WHERE r.preparation_id=p.id)",
);
if (count.rows[0].count >= 100)
throw new CredentialError(409, "preparation_limit_reached");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class Plans {
async (client) =>
(
await client.query(
'SELECT r.id,r.preparation_id AS "preparationId",r.status,r.summary,r.error_code AS "errorCode",r.created_at AS "createdAt",r.finished_at AS "finishedAt",r.operation,r.plan_id AS "planId",r.artifact_sha256 AS "artifactSha256",a.expires_at AS "expiresAt",b.descriptor AS "stateBackend",lzc_auth.platform_run_retired(r.id) AS "retirementBlocked" FROM lzc.plan_runs r LEFT JOIN lzc.plan_artifacts a ON a.run_id=r.id LEFT JOIN lzc.platform_states s ON s.state_key=r.state_key LEFT JOIN lzc.state_backends b ON b.id=s.backend_id ORDER BY r.created_at DESC LIMIT 100',
'SELECT r.id,r.preparation_id AS "preparationId",r.status,r.summary,r.error_code AS "errorCode",r.created_at AS "createdAt",r.finished_at AS "finishedAt",r.operation,r.plan_id AS "planId",r.artifact_sha256 AS "artifactSha256",a.expires_at AS "expiresAt",b.descriptor AS "stateBackend",(s.lock_run_id IS NOT NULL OR s.pending_backend_id IS NOT NULL OR s.migration_run_id IS NOT NULL OR r.status=\'recovery_required\') AS "retryCheckpointRequired",lzc_auth.platform_run_retired(r.id) AS "retirementBlocked" FROM lzc.plan_runs r LEFT JOIN lzc.plan_artifacts a ON a.run_id=r.id LEFT JOIN lzc.platform_states s ON s.state_key=r.state_key LEFT JOIN lzc.state_backends b ON b.id=s.backend_id ORDER BY r.created_at DESC LIMIT 100',
)
).rows,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export function Configurations({
onSaved,
onLoad,
onPrepare,
onPlanCurrent,
onAdviceChange,
compact = false,
dirty = true,
}: {
Expand All @@ -90,6 +92,10 @@ export function Configurations({
onSaved: (binding: ConfigurationBinding | null) => void;
onLoad: (draft: EditorDraft, binding: ConfigurationBinding) => void;
onPrepare: (selection: DeploymentSelection) => void;
onPlanCurrent?: () => void;
onAdviceChange?:
| ((advice: { id: string; revision: number } | null) => void)
| undefined;
compact?: boolean;
dirty?: boolean;
}) {
Expand All @@ -106,6 +112,9 @@ export function Configurations({
string,
string
> | null>(null);
useEffect(() => {
onAdviceChange?.(!binding && includeAdvice ? templateAdvice : null);
}, [binding, includeAdvice, templateAdvice, onAdviceChange]);
const currentDraft = useRef({ draft, dirty });
currentDraft.current = { draft, dirty };
const active = useRef(false);
Expand Down Expand Up @@ -291,9 +300,11 @@ export function Configurations({
type="button"
className="button primary"
disabled={busy || !session || !draft}
onClick={() => void save(false, true)}
onClick={() =>
onPlanCurrent ? onPlanCurrent() : void save(false, true)
}
>
{t("Speichern und zur Bereitstellung")}
{t(dirty ? "Speichern und Plan erstellen" : "Plan erstellen")}
</button>
<button
type="button"
Expand Down Expand Up @@ -423,7 +434,7 @@ export function Configurations({
type="button"
className="button secondary"
disabled={busy}
aria-label={t("Deployment vorbereiten: {{value0}}", {
aria-label={t("Plan erstellen: {{value0}}", {
value0: item.name,
})}
onClick={() =>
Expand All @@ -448,7 +459,7 @@ export function Configurations({
) &&
!window.confirm(
t(
"Der aktuelle Entwurf enthält nicht gespeicherte Änderungen. Die Vorbereitung verwendet den gespeicherten Stand ohne diese Änderungen. Trotzdem fortfahren?",
"Der aktuelle Entwurf enthält nicht gespeicherte Änderungen. Der Plan verwendet den gespeicherten Stand ohne diese Änderungen. Trotzdem fortfahren?",
),
)
)
Expand All @@ -457,7 +468,7 @@ export function Configurations({
})
}
>
{t("Deployment vorbereiten")}
{t("Plan erstellen")}
</button>
<button
type="button"
Expand Down
Loading
Loading