Skip to content

Commit

Permalink
fix: loader for saving documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
AdiGajbhiye committed Nov 18, 2024
1 parent 84cb9ef commit 42eb8bc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
18 changes: 18 additions & 0 deletions src/webview_provider/docsEditPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,24 @@ export class DocsEditViewPanel implements WebviewViewProvider {
() => this.saveDocumentation(message, syncRequestId),
);
break;
case "saveDocumentationBulk": {
this.telemetry.sendTelemetryEvent(
TelemetryEvents["DocumentationEditor/SaveClick"],
);
window.withProgress(
{
title: "Saving documentation",
location: ProgressLocation.Notification,
cancellable: false,
},
async () => {
for (const item of message.models) {
await this.saveDocumentation(item, syncRequestId);
}
},
);
break;
}
}
},
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
executeRequestInSync,
} from "@modules/app/requestExecutor";
import { ColumnLineage } from "@lib";
import { panelLogger } from "@modules/logger";
import styles from "./styles.module.scss";

interface Props {
Expand Down Expand Up @@ -141,14 +140,15 @@ export const DocumentationPropagationButton = ({
? defaultPackageName + "://models/schema.yml"
: "";

const req = [];

for (const item of allColumns) {
const key = item.model + "/" + item.column;
if (!selectedColumns[key]) continue;
const splits = item.model.split(".");
const modelName = splits[splits.length - 1];
const node = tableMetadata.find((t) => t.table === item.model);

const result = (await executeRequestInSync("saveDocumentation", {
req.push({
name: modelName,
description: node?.description,
columns: [{ name: item.column, description: currColumnDescription }],
Expand All @@ -157,11 +157,10 @@ export const DocumentationPropagationButton = ({
patchPath: node?.patchPath || defaultPatchPath,
filePath: node?.url,
updatedTests: testsMetadata[item.model],
})) as { saved: boolean };
if (!result.saved) {
panelLogger.error("Unable to save documentation", item);
}
});
}

await executeRequestInSync("saveDocumentationBulk", { models: req });
};

const setAllColumnsValue = (value: boolean) => {
Expand Down

0 comments on commit 42eb8bc

Please sign in to comment.