[ARVADOS-WORKBENCH2] updated: 2.1.0-255-g5c3eaae0

Git user git at public.arvados.org
Tue Mar 16 16:10:19 UTC 2021


Summary of changes:
 src/plugins/sample-tracker/index.tsx      |   9 +-
 src/plugins/sample-tracker/patient.tsx    |  19 +++-
 src/plugins/sample-tracker/sampleList.tsx | 138 +++++++++++++++++++++++++++++-
 src/plugins/sample-tracker/study.tsx      |   1 -
 4 files changed, 156 insertions(+), 11 deletions(-)

       via  5c3eaae04d6fb9cbcb50c05bc77b90964955e49e (commit)
      from  c257e8b30811ef9d7be4d52b0af13c566c8f5756 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 5c3eaae04d6fb9cbcb50c05bc77b90964955e49e
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Tue Mar 16 12:09:56 2021 -0400

    Working on samples panel
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/src/plugins/sample-tracker/index.tsx b/src/plugins/sample-tracker/index.tsx
index fabe85ca..46ab489c 100644
--- a/src/plugins/sample-tracker/index.tsx
+++ b/src/plugins/sample-tracker/index.tsx
@@ -27,7 +27,8 @@ import {
     patientListPanelColumns, patientListPanelActions, patientRoutePath, patientBaseRoutePath
 } from './patientList';
 import {
-    AddSampleMenuComponent, CreateSampleDialog
+    AddSampleMenuComponent, CreateSampleDialog, SampleListPanelMiddlewareService,
+    SAMPLE_LIST_PANEL_ID, sampleListPanelColumns, sampleListPanelActions
 } from './sampleList';
 import {
     openStudyPanel, StudyMainPanel
@@ -105,7 +106,7 @@ export const register = (pluginConfig: PluginConfig) => {
         if (patientid) {
             store.dispatch(handleFirstTimeLoad(
                 (dispatch: Dispatch) => {
-                    // dispatch(patientListPanelActions.SET_COLUMNS({ columns: patientListPanelColumns }));
+                    dispatch(sampleListPanelActions.SET_COLUMNS({ columns: sampleListPanelColumns }));
                     dispatch<any>(openPatientPanel(patientid.params.uuid));
                     // dispatch<any>(activateSidePanelTreeItem(categoryName));
                     const patientrsc = getResource<GroupResource>(pathname)(store.getState().resources);
@@ -139,6 +140,10 @@ export const register = (pluginConfig: PluginConfig) => {
         elms.push(dataExplorerMiddleware(
             new PatientListPanelMiddlewareService(services, PATIENT_LIST_PANEL_ID)
         ));
+        elms.push(dataExplorerMiddleware(
+            new SampleListPanelMiddlewareService(services, SAMPLE_LIST_PANEL_ID)
+        ));
+
         return elms;
     });
 
diff --git a/src/plugins/sample-tracker/patient.tsx b/src/plugins/sample-tracker/patient.tsx
index 84273a97..f01b587d 100644
--- a/src/plugins/sample-tracker/patient.tsx
+++ b/src/plugins/sample-tracker/patient.tsx
@@ -8,15 +8,16 @@ import { Dispatch } from "redux";
 import { propertiesActions } from "~/store/properties/properties-actions";
 import { getProperty } from '~/store/properties/properties';
 import { RootState } from '~/store/store';
-// import { DataExplorer } from "~/views-components/data-explorer/data-explorer";
-// import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view';
+import { DataExplorer } from "~/views-components/data-explorer/data-explorer";
+import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view';
 
 import { PATIENT_PANEL_CURRENT_UUID } from './patientList';
+import { SAMPLE_LIST_PANEL_ID, sampleListPanelActions } from './sampleList';
 
 export const openPatientPanel = (projectUuid: string) =>
     (dispatch: Dispatch) => {
         dispatch(propertiesActions.SET_PROPERTY({ key: PATIENT_PANEL_CURRENT_UUID, value: projectUuid }));
-        // dispatch(patientListPanelActions.REQUEST_ITEMS());
+        dispatch(sampleListPanelActions.REQUEST_ITEMS());
     };
 
 interface PatientProps {
@@ -30,5 +31,15 @@ export const patientMapStateToProps = (state: RootState) => ({
 export const PatientMainPanel = connect(patientMapStateToProps)(
     ({ patientUuid }: PatientProps) =>
         <div>
-            <h1>Samples</h1>
+            <DataExplorer
+                id={SAMPLE_LIST_PANEL_ID}
+                hideSearchInput={true}
+                hideColumnSelector={true}
+                onRowClick={(uuid: string) => { }}
+                onRowDoubleClick={(uuid: string) => { }}
+                onContextMenu={(event: React.MouseEvent<HTMLElement>, resourceUuid: string) => { }}
+                contextMenuColumn={true}
+                dataTableDefaultView={
+                    <DataTableDefaultView />
+                } />
         </div>);
diff --git a/src/plugins/sample-tracker/sampleList.tsx b/src/plugins/sample-tracker/sampleList.tsx
index af05bd6a..3edfc833 100644
--- a/src/plugins/sample-tracker/sampleList.tsx
+++ b/src/plugins/sample-tracker/sampleList.tsx
@@ -29,6 +29,7 @@ import {
     dataExplorerToListParams
 } from '~/store/data-explorer/data-explorer-middleware-service';
 import { GroupResource } from "~/models/group";
+import { LinkResource } from "~/models/link";
 import { ListResults } from '~/services/common-service/common-service';
 import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions.ts';
 import { DataExplorer as DataExplorerState, getDataExplorer } from '~/store/data-explorer/data-explorer-reducer';
@@ -240,9 +241,50 @@ export const AddSampleMenuComponent = connect<{}, {}, MenuItemProps>(samplesMapS
 
 
 enum SamplePanelColumnNames {
-    NAME = "Name"
+    NAME = "Name",
+    TIME_POINT = "Time point",
+    COLLECTION_TYPE = "Collection type",
+    SAMPLE_TYPE = "Sample type",
+    FLOW_STARTED_AT = "Flow started",
+    FLOW_COMPLETED_AT = "Flow completed",
+    COLLECTED_AT = "Collected",
+    EXTRACTION_TYPE = "Extraction",
+    SEQUENCING_SENT = "Sent for sequencing",
+    SEQUENCING_COMPLETE = "Sequencing completed",
+    TRACKER_STATE = "State",
+    BATCH_ID = "Batch",
 }
 
+export const TimePointComponent = connect(
+    (state: RootState, props: { uuid: string }) => {
+        const resource = getResource<LinkResource>(props.uuid)(state.resources);
+        return resource;
+    })((resource: LinkResource & DispatchProp<any>) => <span>{resource.properties["sample_tracker:time_point"]}</span>);
+
+export const CollectionTypeComponent = connect(
+    (state: RootState, props: { uuid: string }) => {
+        const resource = getResource<LinkResource>(props.uuid)(state.resources);
+        return resource;
+    })((resource: LinkResource & DispatchProp<any>) => <span>{resource.properties["sample_tracker:collection_type"]}</span>);
+
+export const SampleTypeComponent = connect(
+    (state: RootState, props: { uuid: string }) => {
+        const resource = getResource<LinkResource>(props.uuid)(state.resources);
+        return resource;
+    })((resource: LinkResource & DispatchProp<any>) => <span>{resource.properties["sample_tracker:sample_type"]}</span>);
+
+export const TimestampComponent = connect(
+    (state: RootState, props: { uuid: string, propertyname: string }) => {
+        const resource = getResource<LinkResource>(props.uuid)(state.resources);
+        return { resource, propertyname: props.propertyname };
+    })((props: { resource: LinkResource, propertyname: string } & DispatchProp<any>) => <span>{props.resource.properties[props.propertyname]}</span>);
+
+export const TextComponent = connect(
+    (state: RootState, props: { uuid: string, propertyname: string }) => {
+        const resource = getResource<LinkResource>(props.uuid)(state.resources);
+        return { resource, propertyname: props.propertyname };
+    })((props: { resource: LinkResource, propertyname: string } & DispatchProp<any>) => <span>{props.resource.properties[props.propertyname]}</span>);
+
 export const sampleListPanelColumns: DataColumns<string> = [
     {
         name: SamplePanelColumnNames.NAME,
@@ -251,6 +293,94 @@ export const sampleListPanelColumns: DataColumns<string> = [
         sortDirection: SortDirection.NONE,
         filters: createTree(),
         render: uuid => <ResourceName uuid={uuid} />
+    },
+    /*{
+        name: SamplePanelColumnNames.TIME_POINT,
+        selected: true,
+        configurable: true,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: uuid => <TimePointComponent uuid={uuid} />
+    },
+    {
+        name: SamplePanelColumnNames.COLLECTION_TYPE,
+        selected: true,
+        configurable: true,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: uuid => <CollectionTypeComponent uuid={uuid} />
+    },*/
+    {
+        name: SamplePanelColumnNames.SAMPLE_TYPE,
+        selected: true,
+        configurable: true,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: uuid => <SampleTypeComponent uuid={uuid} />
+    },
+    {
+        name: SamplePanelColumnNames.COLLECTED_AT,
+        selected: true,
+        configurable: true,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: uuid => <TimestampComponent uuid={uuid} propertyname="sample_tracker:collected_at" />
+    },
+    {
+        name: SamplePanelColumnNames.FLOW_STARTED_AT,
+        selected: true,
+        configurable: true,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: uuid => <TimestampComponent uuid={uuid} propertyname="sample_tracker:flow_started_at" />
+    },
+    {
+        name: SamplePanelColumnNames.FLOW_COMPLETED_AT,
+        selected: true,
+        configurable: true,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: uuid => <TimestampComponent uuid={uuid} propertyname="sample_tracker:flow_completed_at" />
+    },
+    {
+        name: SamplePanelColumnNames.EXTRACTION_TYPE,
+        selected: true,
+        configurable: true,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: uuid => <span />
+    },
+    {
+        name: SamplePanelColumnNames.SEQUENCING_SENT,
+        selected: true,
+        configurable: true,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: uuid => <span />
+    },
+    {
+        name: SamplePanelColumnNames.SEQUENCING_COMPLETE,
+        selected: true,
+        configurable: true,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: uuid => <span />
+    },
+    {
+        name: SamplePanelColumnNames.TRACKER_STATE,
+        selected: true,
+        configurable: true,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: uuid => <span />
+    },
+    {
+        name: SamplePanelColumnNames.BATCH_ID,
+        selected: true,
+        configurable: true,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: uuid => <span />
     }
 ];
 
@@ -270,7 +400,7 @@ export const SampleListPanel = connect(samplesMapStateToProps)(
                 <DataTableDefaultView />
             } />);
 
-const setItems = (listResults: ListResults<GroupResource>) =>
+const setItems = (listResults: ListResults<LinkResource>) =>
     sampleListPanelActions.SET_ITEMS({
         ...listResultsToDataExplorerItemsMeta(listResults),
         items: listResults.items.map(resource => resource.uuid),
@@ -279,7 +409,7 @@ const setItems = (listResults: ListResults<GroupResource>) =>
 const getFilters = (dataExplorer: DataExplorerState, patientUuid: string) => {
     const fb = new FilterBuilder();
     fb.addEqual("owner_uuid", patientUuid);
-    fb.addEqual("properties.type", sampleTrackerSampleType);
+    fb.addEqual("link_class", sampleTrackerSampleType);
 
     const nameFilters = new FilterBuilder()
         .addILike("name", dataExplorer.searchValue)
@@ -313,7 +443,7 @@ export class SampleListPanelMiddlewareService extends DataExplorerMiddlewareServ
 
         try {
             api.dispatch(progressIndicatorActions.START_WORKING(this.getId()));
-            const response = await this.services.groupsService.list(getParams(dataExplorer, patientUuid));
+            const response = await this.services.linkService.list(getParams(dataExplorer, patientUuid));
             api.dispatch(progressIndicatorActions.PERSIST_STOP_WORKING(this.getId()));
             for (const i of response.items) {
                 i.uuid = sampleBaseRoutePath + "/" + i.uuid;
diff --git a/src/plugins/sample-tracker/study.tsx b/src/plugins/sample-tracker/study.tsx
index 4accdb65..117a26bf 100644
--- a/src/plugins/sample-tracker/study.tsx
+++ b/src/plugins/sample-tracker/study.tsx
@@ -30,7 +30,6 @@ export const studyMapStateToProps = (state: RootState) => ({
 export const StudyMainPanel = connect(studyMapStateToProps)(
     ({ studyUuid }: StudyProps) =>
         <div>
-            <h1>Patients</h1>
             <DataExplorer
                 id={PATIENT_LIST_PANEL_ID}
                 onRowClick={(uuid: string) => { }}

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list