+ {t`MOST RECENT SYNC`}
+
+ {t`JOB ID:`} {job.id}
+
+
+ {t`STATUS:`} {job.status.toUpperCase()}
+
+ {job.finished && (
+
+ {t`FINISHED:`} {formatDateString(job.finished)}
+
+ )}
+ >
+ }
+ key={job.id}
+ >
+
+
+
+
+ );
+}
+
function ConstructedInventoryDetail({ inventory }) {
const history = useHistory();
const helpText = getHelpText();
const {
- result: { instanceGroups, sourceInventories, actions },
+ result: { instanceGroups, inputInventories, inventorySource, actions },
request: fetchRelatedDetails,
error: contentError,
isLoading,
} = useRequest(
useCallback(async () => {
- const [response, sourceInvResponse, options] = await Promise.all([
+ const [
+ instanceGroupsResponse,
+ inputInventoriesResponse,
+ inventorySourceResponse,
+ optionsResponse,
+ ] = await Promise.all([
InventoriesAPI.readInstanceGroups(inventory.id),
- InventoriesAPI.readSourceInventories(inventory.id),
- ConstructedInventoriesAPI.readOptions(inventory.id),
+ InventoriesAPI.readInputInventories(inventory.id),
+ InventoriesAPI.readSources(inventory.id),
+ ConstructedInventoriesAPI.readOptions(),
]);
return {
- instanceGroups: response.data.results,
- sourceInventories: sourceInvResponse.data.results,
- actions: options.data.actions.GET,
+ instanceGroups: instanceGroupsResponse.data.results,
+ inputInventories: inputInventoriesResponse.data.results,
+ inventorySource: inventorySourceResponse.data.results[0],
+ actions: optionsResponse.data.actions.GET,
};
}, [inventory.id]),
{
instanceGroups: [],
- sourceInventories: [],
+ inputInventories: [],
+ inventorySource: {},
actions: {},
isLoading: true,
}
@@ -62,6 +111,16 @@ function ConstructedInventoryDetail({ inventory }) {
fetchRelatedDetails();
}, [fetchRelatedDetails]);
+ const wsInventorySource = useWsInventorySourcesDetails(inventorySource);
+ const inventorySourceSyncJob =
+ wsInventorySource.summary_fields?.current_job ||
+ wsInventorySource.summary_fields?.last_job ||
+ null;
+ const wsInventory = {
+ ...inventory,
+ ...wsInventorySource?.summary_fields?.inventory,
+ };
+
const { request: deleteInventory, error: deleteError } = useRequest(
useCallback(async () => {
await InventoriesAPI.destroy(inventory.id);
@@ -71,9 +130,6 @@ function ConstructedInventoryDetail({ inventory }) {
const { error, dismissError } = useDismissableError(deleteError);
- const { organization, user_capabilities: userCapabilities } =
- inventory.summary_fields;
-
const deleteDetailsRequests =
relatedResourceDeleteRequests.inventory(inventory);
@@ -93,6 +149,14 @@ function ConstructedInventoryDetail({ inventory }) {
value={inventory.name}
dataCy="constructed-inventory-name"
/>
+