Add Revit XLSX settings page
This commit is contained in:
parent
1cfeb06ec7
commit
c633e78cd4
15 changed files with 259 additions and 1025 deletions
|
|
@ -38,18 +38,14 @@ import type {
|
|||
RoomDto,
|
||||
CircuitTreeResponseDto,
|
||||
ProjectCircuitTreesResponseDto,
|
||||
ExternalCsvConfigurationSnapshotDto,
|
||||
ExternalCsvPreviewDto,
|
||||
ExternalInitialImportPlanDto,
|
||||
ApplyExternalInitialImportInput,
|
||||
ExternalInitialImportResultDto,
|
||||
ExternalModelConfigurationSnapshotDto,
|
||||
CreateEstimateBalanceInput,
|
||||
EstimateBalanceCommandResultDto,
|
||||
EstimateBalanceDto,
|
||||
EstimateBalanceUpdateResultDto,
|
||||
EstimateComparisonDto,
|
||||
} from "../types";
|
||||
import type { ExternalCsvConfiguration } from "../../external-model/csv/external-csv-contracts";
|
||||
import type { ExternalModelConfiguration } from "../../external-model/configuration/external-model-configuration";
|
||||
import type { ProjectDeviceSyncField } from "../../shared/constants/project-device-sync-fields";
|
||||
import {
|
||||
createCircuitUpdateProjectCommand,
|
||||
|
|
@ -168,6 +164,40 @@ export function getProject(projectId: string) {
|
|||
return request<ProjectDto>(`/api/projects/${projectId}`);
|
||||
}
|
||||
|
||||
export function getExternalModelConfiguration(projectId: string) {
|
||||
return request<{ configuration: ExternalModelConfigurationSnapshotDto | null }>(
|
||||
`/api/projects/${projectId}/external-model/configuration`
|
||||
);
|
||||
}
|
||||
|
||||
export function updateExternalModelConfiguration(
|
||||
projectId: string,
|
||||
expectedRevision: number,
|
||||
configuration: ExternalModelConfiguration
|
||||
) {
|
||||
return request<{
|
||||
configuration: ExternalModelConfigurationSnapshotDto;
|
||||
history: ProjectHistoryStateDto;
|
||||
}>(`/api/projects/${projectId}/external-model/configuration`, {
|
||||
method: "PUT",
|
||||
body: JSON.stringify({ expectedRevision, configuration }),
|
||||
});
|
||||
}
|
||||
|
||||
export async function detectExternalModelWorkbook(
|
||||
projectId: string,
|
||||
file: File,
|
||||
configuration: ExternalModelConfiguration
|
||||
) {
|
||||
const bytes = new Uint8Array(await file.arrayBuffer());
|
||||
let binary = "";
|
||||
for (const byte of bytes) binary += String.fromCharCode(byte);
|
||||
return request<{ sheetName: string; columnCount: number; objectCount: number }>(
|
||||
`/api/projects/${projectId}/external-model/configuration/detect`,
|
||||
{ method: "POST", body: JSON.stringify({ fileName: file.name, contentBase64: btoa(binary), configuration }) }
|
||||
);
|
||||
}
|
||||
|
||||
export function getProjectHistory(projectId: string) {
|
||||
return request<ProjectHistoryStateDto>(
|
||||
`/api/projects/${projectId}/history`
|
||||
|
|
@ -469,12 +499,6 @@ export function deleteDocumentLogo() {
|
|||
return request<void>(documentLogoUrl, { method: "DELETE" });
|
||||
}
|
||||
|
||||
export function getExternalCsvConfiguration(projectId: string) {
|
||||
return request<{ configuration: ExternalCsvConfigurationSnapshotDto | null }>(
|
||||
`/api/projects/${projectId}/external-csv/configuration`
|
||||
);
|
||||
}
|
||||
|
||||
export function getExternalCircuitListObjects(
|
||||
projectId: string,
|
||||
circuitListId: string
|
||||
|
|
@ -484,57 +508,6 @@ export function getExternalCircuitListObjects(
|
|||
);
|
||||
}
|
||||
|
||||
export function updateExternalCsvConfiguration(
|
||||
projectId: string,
|
||||
expectedRevision: number,
|
||||
configuration: ExternalCsvConfiguration
|
||||
) {
|
||||
return request<
|
||||
ProjectCommandResultDto & { configuration: ExternalCsvConfigurationSnapshotDto }
|
||||
>(`/api/projects/${projectId}/external-csv/configuration`, {
|
||||
method: "PUT",
|
||||
body: JSON.stringify({ expectedRevision, configuration }),
|
||||
});
|
||||
}
|
||||
|
||||
export function previewExternalCsv(
|
||||
projectId: string,
|
||||
fileName: string,
|
||||
contentBase64: string
|
||||
) {
|
||||
return request<ExternalCsvPreviewDto>(
|
||||
`/api/projects/${projectId}/external-csv/preview`,
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({ fileName, contentBase64 }),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function planExternalInitialImport(
|
||||
projectId: string,
|
||||
fileName: string,
|
||||
contentBase64: string
|
||||
) {
|
||||
return request<ExternalInitialImportPlanDto>(
|
||||
`/api/projects/${projectId}/external-csv/initial-import/plan`,
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({ fileName, contentBase64 }),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function applyExternalInitialImport(
|
||||
projectId: string,
|
||||
input: ApplyExternalInitialImportInput
|
||||
) {
|
||||
return request<ExternalInitialImportResultDto>(
|
||||
`/api/projects/${projectId}/external-csv/initial-import/apply`,
|
||||
{ method: "POST", body: JSON.stringify(input) }
|
||||
);
|
||||
}
|
||||
|
||||
export function copyDistributionBoard(
|
||||
projectId: string,
|
||||
distributionBoardId: string,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue