Skip to content
This repository has been archived by the owner on Jan 21, 2025. It is now read-only.

Remove inapplicable logic for dashboard #706

Merged
merged 4 commits into from
Aug 23, 2024
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
6 changes: 6 additions & 0 deletions .changeset/unlucky-candles-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@azure-tools/cadl-ranch-coverage-sdk": patch
"@azure-tools/cadl-ranch-dashboard": patch
---

Remove inapplicable code in dashboard
31 changes: 7 additions & 24 deletions packages/cadl-ranch-coverage-sdk/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,40 +87,23 @@ export class CadlRanchCoverageOperations {
this.#container.getBlockBlobClient(`${generatorName}/index.json`),
);

// Compatible with current format, delete later
const blobClientOldVersion = this.#container.getBlockBlobClient(`${generatorName}/reports/${index.version}.json`);
if (await blobClientOldVersion.exists()) {
const blob = await blobClientOldVersion.download();
const blobClient = this.#container.getBlockBlobClient(
`${generatorName}/reports/${index.version}/${generatorMode}.json`,
);
if (await blobClient.exists()) {
const blob = await blobClient.download();
const body = await blob.blobBody;
const content = await body?.text();
const report = content ? JSON.parse(content) : undefined;
return {
generatorMetadata: {
version: blob.metadata?.generatorversion,
name: blob.metadata?.generatorname,
mode: "azure",
mode: blob.metadata?.generatorMode,
},
...report,
};
} else {
const blobClient = this.#container.getBlockBlobClient(
`${generatorName}/reports/${index.version}/${generatorMode}.json`,
);
if (await blobClient.exists()) {
const blob = await blobClient.download();
const body = await blob.blobBody;
const content = await body?.text();
const report = content ? JSON.parse(content) : undefined;
return {
generatorMetadata: {
version: blob.metadata?.generatorversion,
name: blob.metadata?.generatorname,
mode: blob.metadata?.generatorMode,
},
...report,
};
} else return undefined;
}
} else return undefined;
}

private async updateIndex(generatorName: string, version: string) {
Expand Down
Loading