added adrFileLocationUrl for adr file read

Signed-off-by: Deepankumar Loganathan <deepan0433@gmail.com>
This commit is contained in:
Deepankumar Loganathan
2024-02-21 19:46:23 +01:00
parent 2e925ed076
commit 329e210003
2 changed files with 8 additions and 8 deletions
+4 -5
View File
@@ -63,15 +63,14 @@ export const getAdrLocationUrl = (
throw new Error(`Missing ADR annotation: ${ANNOTATION_ADR_LOCATION}`);
}
let url = getAdrLocationDir(entity)!.replace(/\/$/, '');
if (adrFilePath) {
return scmIntegration.resolveUrl({
url: `${getAdrLocationDir(entity)!.replace(/\/$/, '')}/${adrFilePath}`,
base: getEntitySourceLocation(entity).target,
});
url = `${url}/${adrFilePath}`;
}
return scmIntegration.resolveUrl({
url: getAdrLocationDir(entity)!,
url,
base: getEntitySourceLocation(entity).target,
});
};
@@ -44,11 +44,12 @@ export const AdrReader = (props: {
const { entity } = useEntity();
const scmIntegrations = useApi(scmIntegrationsApiRef);
const adrApi = useApi(adrApiRef);
const adrLocationUrl = getAdrLocationUrl(entity, scmIntegrations, adr);
const adrLocationUrl = getAdrLocationUrl(entity, scmIntegrations);
const adrFileLocationUrl = getAdrLocationUrl(entity, scmIntegrations, adr);
const { value, loading, error } = useAsync(
async () => adrApi.readAdr(adrLocationUrl),
[adrLocationUrl],
async () => adrApi.readAdr(adrFileLocationUrl),
[adrFileLocationUrl],
);
const adrContent = useMemo(() => {