X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/9cb78f72cfe7da0fd3e04609f13d5f930a76a2f1..e53e6f1efe7b156934514b51fd5f956262f6f9af:/src/views-components/data-explorer/renderers.tsx

diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx
index 2e1d608c..c96813df 100644
--- a/src/views-components/data-explorer/renderers.tsx
+++ b/src/views-components/data-explorer/renderers.tsx
@@ -5,7 +5,7 @@
 import * as React from 'react';
 import { Grid, Typography } from '@material-ui/core';
 import { FavoriteStar } from '../favorite-star/favorite-star';
-import { ResourceKind, TrashResource } from '~/models/resource';
+import { ResourceKind, TrashableResource } from '~/models/resource';
 import { ProjectIcon, CollectionIcon, ProcessIcon, DefaultIcon } from '~/components/icon/icon';
 import { formatDate, formatFileSize } from '~/common/formatters';
 import { resourceLabel } from '~/common/labels';
@@ -35,7 +35,7 @@ export const renderName = (item: { name: string; uuid: string, kind: string }) =
 
 export const ResourceName = connect(
     (state: RootState, props: { uuid: string }) => {
-        const resource = getResource(props.uuid)(state.resources) as GroupContentsResource | undefined;
+        const resource = getResource<GroupContentsResource>(props.uuid)(state.resources);
         return resource || { name: '', uuid: '', kind: '' };
     })(renderName);
 
@@ -58,19 +58,19 @@ export const renderDate = (date?: string) => {
 
 export const ResourceLastModifiedDate = connect(
     (state: RootState, props: { uuid: string }) => {
-        const resource = getResource(props.uuid)(state.resources) as GroupContentsResource | undefined;
+        const resource = getResource<GroupContentsResource>(props.uuid)(state.resources);
         return { date: resource ? resource.modifiedAt : '' };
     })((props: { date: string }) => renderDate(props.date));
 
 export const ResourceTrashDate = connect(
     (state: RootState, props: { uuid: string }) => {
-        const resource = getResource(props.uuid)(state.resources) as TrashResource | undefined;
+        const resource = getResource<TrashableResource>(props.uuid)(state.resources);
         return { date: resource ? resource.trashAt : '' };
     })((props: { date: string }) => renderDate(props.date));
 
 export const ResourceDeleteDate = connect(
     (state: RootState, props: { uuid: string }) => {
-        const resource = getResource(props.uuid)(state.resources) as TrashResource | undefined;
+        const resource = getResource<TrashableResource>(props.uuid)(state.resources);
         return { date: resource ? resource.deleteAt : '' };
     })((props: { date: string }) => renderDate(props.date));
 
@@ -81,7 +81,7 @@ export const renderFileSize = (fileSize?: number) =>
 
 export const ResourceFileSize = connect(
     (state: RootState, props: { uuid: string }) => {
-        const resource = getResource(props.uuid)(state.resources) as GroupContentsResource | undefined;
+        const resource = getResource<GroupContentsResource>(props.uuid)(state.resources);
         return {};
     })((props: { fileSize?: number }) => renderFileSize(props.fileSize));
 
@@ -92,7 +92,7 @@ export const renderOwner = (owner: string) =>
 
 export const ResourceOwner = connect(
     (state: RootState, props: { uuid: string }) => {
-        const resource = getResource(props.uuid)(state.resources) as GroupContentsResource | undefined;
+        const resource = getResource<GroupContentsResource>(props.uuid)(state.resources);
         return { owner: resource ? resource.ownerUuid : '' };
     })((props: { owner: string }) => renderOwner(props.owner));
 
@@ -103,7 +103,7 @@ export const renderType = (type: string) =>
 
 export const ResourceType = connect(
     (state: RootState, props: { uuid: string }) => {
-        const resource = getResource(props.uuid)(state.resources) as GroupContentsResource | undefined;
+        const resource = getResource<GroupContentsResource>(props.uuid)(state.resources);
         return { type: resource ? resource.kind : '' };
     })((props: { type: string }) => renderType(props.type));
 
@@ -114,6 +114,6 @@ export const renderStatus = (item: { status?: string }) =>
 
 export const ProcessStatus = connect(
     (state: RootState, props: { uuid: string }) => {
-        const resource = getResource(props.uuid)(state.resources) as ProcessResource | undefined;
+        const resource = getResource<ProcessResource>(props.uuid)(state.resources);
         return { status: resource ? resource.state : '-' };
     })((props: { status: string }) => renderType(props.status));
