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

Commit

Permalink
Remove inapplicable logic for dashboard (#706)
Browse files Browse the repository at this point in the history
  • Loading branch information
pshao25 authored Aug 23, 2024
1 parent 039ab07 commit cd9fdd6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 24 deletions.
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

0 comments on commit cd9fdd6

Please sign in to comment.