added adrFileLocationUrl for adr file read
Signed-off-by: Deepankumar Loganathan <deepan0433@gmail.com>
This commit is contained in:
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user