Merge branch '18965-login-flow-destination' into main. Closes #18965
[arvados-workbench2.git] / src / views-components / data-explorer / with-resources.tsx
index f6670bd66426166a87b42366bd7002a90553cf25..deeabe95eec7682f57aa0de62c55feee126e653d 100644 (file)
@@ -2,11 +2,11 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from 'react';
+import React from 'react';
 import { connect } from 'react-redux';
-import { RootState } from '~/store/store';
-import { getResource } from '~/store/resources/resources';
-import { Resource } from '~/models/resource';
+import { RootState } from 'store/store';
+import { getResource } from 'store/resources/resources';
+import { Resource } from 'models/resource';
 
 interface WithResourceProps {
     resource?: Resource;
@@ -22,3 +22,6 @@ export const withResource = (component: React.ComponentType<WithResourceProps &
 export const getDataFromResource = (property: string, resource?: Resource) => {
     return resource && resource[property] ? resource[property] : '(none)';
 };
+
+export const withResourceData = (property: string, render: (data: any) => React.ReactElement<any>) =>
+    withResource(({ resource }) => render(getDataFromResource(property, resource)));