X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/4e508e00be54a40845147e17b2410d27a8516dc1..e0dfdad390b88924f15e4f6e7d8e7eadd585e06f:/services/workbench2/src/views/project-panel/project-panel-run.tsx?ds=inline

diff --git a/services/workbench2/src/views/project-panel/project-panel-run.tsx b/services/workbench2/src/views/project-panel/project-panel-run.tsx
new file mode 100644
index 0000000000..94d492e735
--- /dev/null
+++ b/services/workbench2/src/views/project-panel/project-panel-run.tsx
@@ -0,0 +1,200 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import React from "react";
+import { ProjectIcon } from "components/icon/icon";
+import { PROJECT_PANEL_RUN_ID } from "store/project-panel/project-panel-action-bind";
+import { DataColumns } from 'components/data-table/data-table';
+import { DataExplorer } from "views-components/data-explorer/data-explorer";
+import { ProjectResource } from 'models/project';
+import { SortDirection } from "components/data-table/data-column";
+import { createTree } from "models/tree";
+import {
+    ContainerRunTime,
+    ResourceContainerUuid,
+    ResourceCreatedAtDate,
+    ResourceDeleteDate,
+    ResourceLastModifiedDate,
+    ResourceLogUuid,
+    ResourceModifiedByUserUuid,
+    ResourceName,
+    ResourceOutputUuid,
+    ResourceOwnerWithName,
+    ResourceParentProcess,
+    ResourceStatus,
+    ResourceTrashDate,
+    ResourceType,
+    ResourceUUID,
+} from "views-components/data-explorer/renderers";
+import { getInitialProcessStatusFilters, getInitialProcessTypeFilters } from "store/resource-type-filters/resource-type-filters";
+import { connect } from "react-redux";
+import { RootState } from "store/store";
+import { getProjectPanelCurrentUuid } from "store/project-panel/project-panel-action";
+import { getResource } from "store/resources/resources";
+
+export enum ProjectPanelRunColumnNames {
+    NAME = 'Name',
+    STATUS = 'Status',
+    TYPE = 'Type',
+    OWNER = 'Owner',
+    PORTABLE_DATA_HASH = 'Portable Data Hash',
+    FILE_SIZE = 'File Size',
+    FILE_COUNT = 'File Count',
+    UUID = 'UUID',
+    CONTAINER_UUID = 'Container UUID',
+    RUNTIME = 'Runtime',
+    OUTPUT_UUID = 'Output UUID',
+    LOG_UUID = 'Log UUID',
+    PARENT_PROCESS = 'Parent Process UUID',
+    MODIFIED_BY_USER_UUID = 'Modified by User UUID',
+    VERSION = 'Version',
+    CREATED_AT = 'Date Created',
+    LAST_MODIFIED = 'Last Modified',
+    TRASH_AT = 'Trash at',
+    DELETE_AT = 'Delete at',
+}
+
+export const projectPanelRunColumns: DataColumns<string, ProjectResource> = [
+    {
+        name: ProjectPanelRunColumnNames.NAME,
+        selected: true,
+        configurable: true,
+        sort: { direction: SortDirection.NONE, field: 'name' },
+        filters: createTree(),
+        render: (uuid) => <ResourceName uuid={uuid} />,
+    },
+    {
+        name: ProjectPanelRunColumnNames.STATUS,
+        selected: true,
+        configurable: true,
+        mutuallyExclusiveFilters: true,
+        filters: getInitialProcessStatusFilters(),
+        render: (uuid) => <ResourceStatus uuid={uuid} />,
+    },
+    {
+        name: ProjectPanelRunColumnNames.TYPE,
+        selected: true,
+        configurable: true,
+        filters: getInitialProcessTypeFilters(),
+        render: (uuid) => <ResourceType uuid={uuid} />,
+    },
+    {
+        name: ProjectPanelRunColumnNames.OWNER,
+        selected: false,
+        configurable: true,
+        filters: createTree(),
+        render: (uuid) => <ResourceOwnerWithName uuid={uuid} />,
+    },
+    {
+        name: ProjectPanelRunColumnNames.UUID,
+        selected: false,
+        configurable: true,
+        filters: createTree(),
+        render: (uuid) => <ResourceUUID uuid={uuid} />,
+    },
+    {
+        name: ProjectPanelRunColumnNames.CONTAINER_UUID,
+        selected: false,
+        configurable: true,
+        filters: createTree(),
+        render: (uuid) => <ResourceContainerUuid uuid={uuid} />,
+    },
+    {
+        name: ProjectPanelRunColumnNames.RUNTIME,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: (uuid) => <ContainerRunTime uuid={uuid} />,
+    },
+    {
+        name: ProjectPanelRunColumnNames.OUTPUT_UUID,
+        selected: false,
+        configurable: true,
+        filters: createTree(),
+        render: (uuid) => <ResourceOutputUuid uuid={uuid} />,
+    },
+    {
+        name: ProjectPanelRunColumnNames.LOG_UUID,
+        selected: false,
+        configurable: true,
+        filters: createTree(),
+        render: (uuid) => <ResourceLogUuid uuid={uuid} />,
+    },
+    {
+        name: ProjectPanelRunColumnNames.PARENT_PROCESS,
+        selected: false,
+        configurable: true,
+        filters: createTree(),
+        render: (uuid) => <ResourceParentProcess uuid={uuid} />,
+    },
+    {
+        name: ProjectPanelRunColumnNames.MODIFIED_BY_USER_UUID,
+        selected: false,
+        configurable: true,
+        filters: createTree(),
+        render: (uuid) => <ResourceModifiedByUserUuid uuid={uuid} />,
+    },
+    {
+        name: ProjectPanelRunColumnNames.CREATED_AT,
+        selected: false,
+        configurable: true,
+        sort: { direction: SortDirection.NONE, field: 'createdAt' },
+        filters: createTree(),
+        render: (uuid) => <ResourceCreatedAtDate uuid={uuid} />,
+    },
+    {
+        name: ProjectPanelRunColumnNames.LAST_MODIFIED,
+        selected: true,
+        configurable: true,
+        sort: { direction: SortDirection.DESC, field: 'modifiedAt' },
+        filters: createTree(),
+        render: (uuid) => <ResourceLastModifiedDate uuid={uuid} />,
+    },
+    {
+        name: ProjectPanelRunColumnNames.TRASH_AT,
+        selected: false,
+        configurable: true,
+        sort: { direction: SortDirection.NONE, field: 'trashAt' },
+        filters: createTree(),
+        render: (uuid) => <ResourceTrashDate uuid={uuid} />,
+    },
+    {
+        name: ProjectPanelRunColumnNames.DELETE_AT,
+        selected: false,
+        configurable: true,
+        sort: { direction: SortDirection.NONE, field: 'deleteAt' },
+        filters: createTree(),
+        render: (uuid) => <ResourceDeleteDate uuid={uuid} />,
+    },
+];
+
+const DEFAULT_VIEW_MESSAGES = ['No workflow runs found'];
+
+interface ProjectPanelRunProps {
+    project?: ProjectResource;
+}
+
+const mapStateToProps = (state: RootState): ProjectPanelRunProps => {
+    const projectUuid = getProjectPanelCurrentUuid(state) || "";
+    const project = getResource<ProjectResource>(projectUuid)(state.resources);
+    return {
+        project,
+    };
+};
+
+export const ProjectPanelRun = connect(mapStateToProps)((props: ProjectPanelRunProps) => {
+    const handleRowClick = () => {};
+    const handleRowDoubleClick = () => {};
+    const handleContextMenu = () => {};
+
+    return <DataExplorer
+        id={PROJECT_PANEL_RUN_ID}
+        onRowClick={handleRowClick}
+        onRowDoubleClick={handleRowDoubleClick}
+        onContextMenu={handleContextMenu}
+        contextMenuColumn={true}
+        defaultViewIcon={ProjectIcon}
+        defaultViewMessages={DEFAULT_VIEW_MESSAGES}
+    />;
+});
