Remove inapplicable logic for dashboard (#706)

This commit is contained in:
Pan Shao 2024-08-24 01:06:24 +08:00 коммит произвёл GitHub
Родитель 039ab07e8c
Коммит cd9fdd66e6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 13 добавлений и 24 удалений

Просмотреть файл

@ -0,0 +1,6 @@
---
"@azure-tools/cadl-ranch-coverage-sdk": patch
"@azure-tools/cadl-ranch-dashboard": patch
---
Remove inapplicable code in dashboard

Просмотреть файл

@ -87,10 +87,11 @@ 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;
@ -98,29 +99,11 @@ export class CadlRanchCoverageOperations {
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) {