Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ANT-706] New design for listings clusters (Thermal / Renewables) #1513

Closed
6 of 9 tasks
skamril opened this issue May 12, 2023 · 5 comments · Fixed by #1633
Closed
6 of 9 tasks

[ANT-706] New design for listings clusters (Thermal / Renewables) #1513

skamril opened this issue May 12, 2023 · 5 comments · Fixed by #1633
Assignees
Labels
enhancement New feature or request front-end hot
Milestone

Comments

@skamril
Copy link
Member

skamril commented May 12, 2023

Update the cluster view with this new design:

image

More informations of clusters will be available directly on root page.

  • Create a generic components for listing clusters (src/components/common/DynamicDataTable) with the features below:
    • Display defined list of items (with or without group)
    • Display defined columns
    • Select and delete items
    • Add new item
    • Create AddItemDialog
    • Display the sum for number columns by group
  • Update Modelization > Areas > Thermal view with DynamicDataTable
  • Update Modelization > Areas > Renewables view with DynamicDataTable

Comparison feature will be added later in DynamicDataTable (#1514).

Links:

@skamril skamril assigned skamril and hdinia and unassigned skamril May 12, 2023
@skamril skamril added enhancement New feature or request front-end hot labels May 12, 2023
@skamril skamril added this to the v2.15 milestone May 12, 2023
@skamril skamril changed the title New design for listings clusters (Thermal / Renewables) [ANT-706] New design for listings clusters (Thermal / Renewables) May 12, 2023
@skamril
Copy link
Member Author

skamril commented Jun 1, 2023

  • list prop:
[{ id: "sct11", name: "SCT 1.1", group: "Noeud 1", columns: { status: "actif", injection: 350, ...} },
 { id: "sct12", name: "SCT 1.2", group: "Noeud 1", columns: { status: "inactif", injection: 300, ...},
 { id: "sct12", name: "SCT 1.2", group: "Noeud 1", columns: { status: "actif", role: "admin", injection: 300, ...}
 }]
  • columns prop:
[{ name: "status", label: "Statut", chip: { actif: "success", "inactif": "primary" }},
 { name: "role", label: "Role", chip: { admin: "success" },
 { name: "injection", label: "Injection nominale capacity", groupOperation: "sum" }]

@skamril
Copy link
Member Author

skamril commented Jul 4, 2023

@hdinia
Copy link
Member

hdinia commented Jul 24, 2023

Following Material React Table's documentation here's example data, columns and groups props that are expected by the component:

Basic STStorage example

  type Storage = {
    id: string;
    group: string;
    name: string;
    injectionNominalCapacity: number;
    withdrawalNominalCapacity: number;
    reservoirCapacity: number;
    efficiency: number;
  };

data

   const data: Storage[] = [
    {
      id: "short-term-storage-of-area-west",
      group: "",
      name: "Short-Term Storage of Area West",
      injectionNominalCapacity: 5000.0,
      withdrawalNominalCapacity: 4500.0,
      reservoirCapacity: 61000.0,
      efficiency: 0.0,
    },
    {
      id: "short-term-storage-of-area-east",
      group: "",
      name: "Short-Term Storage of Area East",
      injectionNominalCapacity: 1500.0,
      withdrawalNominalCapacity: 1500.0,
      reservoirCapacity: 20000.0,
      efficiency: 0.94,
    },
    {
      id: "storage1",
      group: "Battery",
      name: "Storage1",
      injectionNominalCapacity: 1500.0,
      withdrawalNominalCapacity: 1500.0,
      reservoirCapacity: 20000.0,
      efficiency: 0.94,
    },
    {
      id: "psp1",
      group: "PSP_closed",
      name: "PSP_closed_1",
      injectionNominalCapacity: 3500.0,
      withdrawalNominalCapacity: 3000.0,
      reservoirCapacity: 41000.0,
      efficiency: 0.75,
    },
    {
      id: "storage2",
      group: "PSP_closed",
      name: "Storage2",
      injectionNominalCapacity: 2000.0,
      withdrawalNominalCapacity: 1500.0,
      reservoirCapacity: 20000.0,
      efficiency: 0.78,
    },
    {
      id: "storage3",
      group: "PSP_closed",
      name: "Storage3",
      injectionNominalCapacity: 1500.0,
      withdrawalNominalCapacity: 1500.0,
      reservoirCapacity: 21000.0,
      efficiency: 0.72,
    },
  ];

columns

const columns = useMemo<MRT_ColumnDef<Storage>[]>(
    () => [
      {
        accessorKey: "group",
        header: "Group",
        size: 150,
      },
      {
        accessorKey: "name",
        header: "Name",
        size: 200,
      },
      {
        accessorKey: "injectionNominalCapacity",
        header: "Injection Nominal Capacity",
        size: 200,
      },
      {
        accessorKey: "withdrawalNominalCapacity",
        header: "Withdrawal Nominal Capacity",
        size: 220,
      },
      {
        accessorKey: "reservoirCapacity",
        header: "Reservoir Capacity",
        size: 180,
      },
      {
        accessorKey: "efficiency",
        header: "Efficiency",
        size: 150,
      },
    ],
    []
  );

groups

  const groups = ["Battery", "PSP_closed"];

Import the component and use:

      <GroupedDataTable
          data={data}
          columns={columns}
          groups={groups}
          onSubmit={handleSubmit}
          onDelete={handleDelete}
        />

@makdeuneuv
Copy link
Contributor

Two issues refers to this one still open.

@hdinia
Copy link
Member

hdinia commented Aug 31, 2023

we still need to refactor and use the new GroupedDataTable component for the Thermal and Renewables views, we will do this in separate issues, as each view involve several updates:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request front-end hot
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants