Create clean release database baseline

This commit is contained in:
Julian Appel 2026-07-31 14:07:26 +02:00
parent 5bee3cb103
commit 734a2bcfc4
129 changed files with 2121 additions and 30607 deletions

View file

@ -130,8 +130,6 @@ export const defaultVisibleColumnKeys = allColumns
const projectColumnLayoutStoragePrefix =
"circuitTreeEditor.columnLayout.v3";
const legacyProjectColumnLayoutStoragePrefix =
"circuitTreeEditor.columnLayout.v2";
export interface CircuitColumnLayout {
order: CellKey[];
@ -164,12 +162,6 @@ export function getProjectColumnLayoutStorageKey(
return `${projectColumnLayoutStoragePrefix}.${projectId}`;
}
export function getLegacyProjectColumnLayoutStorageKey(
projectId: string
): string {
return `${legacyProjectColumnLayoutStoragePrefix}.${projectId}`;
}
export function normalizeColumnOrder(keys: CellKey[]): CellKey[] {
const unique = [...new Set(keys)];
const allKeys = allColumns.map((column) => column.key);
@ -233,28 +225,6 @@ export function parseStoredColumnLayout(
}
}
export function migrateLegacyColumnLayout(
layout: CircuitColumnLayout
): CircuitColumnLayout {
const newlyVisibleKey: CellKey = "protectionSummary";
const order = layout.order.filter(
(key) => key !== newlyVisibleKey
) as CellKey[];
const totalPowerIndex = order.indexOf("rowTotalPower");
order.splice(
totalPowerIndex >= 0 ? totalPowerIndex + 1 : order.length,
0,
newlyVisibleKey
);
return {
order,
visible: layout.visible.includes(newlyVisibleKey)
? layout.visible
: [...layout.visible, newlyVisibleKey],
};
}
const deviceOnlyColumns = new Set<CellKey>([
"quantity",
"powerPerUnit",
@ -422,11 +392,7 @@ export function buildCircuitEditPatch(
if (key === "protectionSummary" || key === "cableSummary") {
return { remark: draft.trim() || null };
}
if (
key === "protectionRatedCurrent" ||
key === "cableLength" ||
key === "voltage"
) {
if (key === "cableLength" || key === "voltage") {
return { [key]: parseNumeric(key, draft) ?? null };
}
if (key === "isReserve") {
@ -530,23 +496,14 @@ export function getCircuitValue(circuit: CircuitTreeCircuitDto, key: CellKey): G
case "protectionType":
return protection
? protectionDeviceTypeLabels[protection.type]
: circuit.protectionType;
: undefined;
case "protectionRatedCurrent":
return protection?.ratedCurrentA ?? circuit.protectionRatedCurrent;
return protection?.ratedCurrentA;
case "protectionCharacteristic":
return protectionCharacteristic || circuit.protectionCharacteristic;
return protectionCharacteristic || undefined;
case "protectionSummary": {
if (!protection) {
const legacyCurrent =
circuit.protectionRatedCurrent !== undefined &&
circuit.protectionRatedCurrent !== null
? `${circuit.protectionRatedCurrent}A`
: "";
return [
circuit.protectionType,
legacyCurrent,
circuit.protectionCharacteristic,
].filter(Boolean).join(" ").trim() || undefined;
return undefined;
}
const currentValue =
protection.ratedCurrentA;