Skip to content

Commit 8bfc55d

Browse files
frano-mFran McDade
andauthored
fix: dataset download manifest (#4093) (#4099)
Co-authored-by: Fran McDade <franmcdade@Frans-MacBook-Pro.local>
1 parent a2749cc commit 8bfc55d

2 files changed

Lines changed: 28 additions & 2 deletions

File tree

explorer/app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,6 +1282,32 @@ export const renderExportEntityWarning = (
12821282
};
12831283
};
12841284

1285+
/**
1286+
* Renders entity related download manifest when the given datasests response is accessible.
1287+
* @param datasetsResponse - Response model return from datasets API.
1288+
* @returns model to be used as props for the ConditionalComponent component.
1289+
*/
1290+
export const renderManifestDownloadEntity = (
1291+
datasetsResponse: DatasetsResponse
1292+
): React.ComponentProps<typeof C.ConditionalComponent> => {
1293+
return {
1294+
isIn: isDatasetAccessible(datasetsResponse),
1295+
};
1296+
};
1297+
1298+
/**
1299+
* Renders entity related download manifest warning when the given datasests response is not accessible.
1300+
* @param datasetsResponse - Response model return from datasets API.
1301+
* @returns model to be used as props for the ConditionalComponent component.
1302+
*/
1303+
export const renderManifestDownloadEntityWarning = (
1304+
datasetsResponse: DatasetsResponse
1305+
): React.ComponentProps<typeof C.ConditionalComponent> => {
1306+
return {
1307+
isIn: !isDatasetAccessible(datasetsResponse),
1308+
};
1309+
};
1310+
12851311
/**
12861312
* Returns value from a string array matching the given index.
12871313
* @param arr - String array.

explorer/site-config/anvil-cmg/dev/detail/dataset/metadataMainColumn.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const mainColumn: ComponentConfig[] = [
1919
} as ComponentConfig<typeof C.BackPageContentSingleColumn>,
2020
],
2121
component: C.ConditionalComponent,
22-
viewBuilder: V.renderExportEntityWarning,
22+
viewBuilder: V.renderManifestDownloadEntityWarning,
2323
} as ComponentConfig<typeof C.ConditionalComponent, DatasetsResponse>,
2424
{
2525
/* Dataset is accessible; render export entity */
@@ -41,6 +41,6 @@ export const mainColumn: ComponentConfig[] = [
4141
...sideColumn,
4242
],
4343
component: C.ConditionalComponent,
44-
viewBuilder: V.renderExportEntity,
44+
viewBuilder: V.renderManifestDownloadEntity,
4545
} as ComponentConfig<typeof C.ConditionalComponent, DatasetsResponse>,
4646
];

0 commit comments

Comments
 (0)