From f661edb5bc96e22e60ec91154796b973bcc78432 Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Mon, 6 May 2024 18:33:13 +0100 Subject: [PATCH 1/5] Fixed resizability of last column --- .../src/components/tableComponent/index.tsx | 25 +++++---------- .../pages/GlobalVariablesPage/index.tsx | 31 ++++++++++++------- 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/src/frontend/src/components/tableComponent/index.tsx b/src/frontend/src/components/tableComponent/index.tsx index 3404444c5..7e2cd4b99 100644 --- a/src/frontend/src/components/tableComponent/index.tsx +++ b/src/frontend/src/components/tableComponent/index.tsx @@ -5,7 +5,6 @@ import { ComponentPropsWithoutRef, ElementRef, forwardRef } from "react"; import { useDarkStore } from "../../stores/darkStore"; import "../../style/ag-theme-shadcn.css"; // Custom CSS applied to the grid import { cn } from "../../utils/utils"; -import { Card, CardContent } from "../ui/card"; const TableComponent = forwardRef< ElementRef, @@ -14,23 +13,13 @@ const TableComponent = forwardRef< const dark = useDarkStore((state) => state.dark); return ( -
-
- - - - - -
+
+
); }); diff --git a/src/frontend/src/pages/SettingsPage/pages/GlobalVariablesPage/index.tsx b/src/frontend/src/pages/SettingsPage/pages/GlobalVariablesPage/index.tsx index 2ca48050b..34df9786c 100644 --- a/src/frontend/src/pages/SettingsPage/pages/GlobalVariablesPage/index.tsx +++ b/src/frontend/src/pages/SettingsPage/pages/GlobalVariablesPage/index.tsx @@ -8,6 +8,7 @@ import Dropdown from "../../../../components/dropdownComponent"; import ForwardedIconComponent from "../../../../components/genericIconComponent"; import TableComponent from "../../../../components/tableComponent"; import { Badge } from "../../../../components/ui/badge"; +import { Card, CardContent } from "../../../../components/ui/card"; import { deleteGlobalVariable } from "../../../../controllers/API"; import useAlertStore from "../../../../stores/alertStore"; import { useGlobalVariablesStore } from "../../../../stores/globalVariables"; @@ -104,6 +105,7 @@ export default function GlobalVariablesPage() { field: "default_fields", flex: 1, editable: false, + resizable: false, }, ]); @@ -168,17 +170,24 @@ export default function GlobalVariablesPage() {
- { - setSelectedRows(event.api.getSelectedRows().map((row) => row.name)); - }} - rowSelection="multiple" - suppressRowClickSelection={true} - domLayout="autoHeight" - pagination={false} - columnDefs={colDefs} - rowData={rowData} - /> + + + { + setSelectedRows( + event.api.getSelectedRows().map((row) => row.name), + ); + }} + rowSelection="multiple" + suppressRowClickSelection={true} + domLayout="autoHeight" + pagination={true} + columnDefs={colDefs} + rowData={rowData} + /> + +
); From 28949ed526073ee7e6967cf38ad460a4d6bac778 Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Mon, 6 May 2024 18:37:05 +0100 Subject: [PATCH 2/5] fixed flex on column --- .../src/pages/SettingsPage/pages/GlobalVariablesPage/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/src/pages/SettingsPage/pages/GlobalVariablesPage/index.tsx b/src/frontend/src/pages/SettingsPage/pages/GlobalVariablesPage/index.tsx index 34df9786c..45fe21452 100644 --- a/src/frontend/src/pages/SettingsPage/pages/GlobalVariablesPage/index.tsx +++ b/src/frontend/src/pages/SettingsPage/pages/GlobalVariablesPage/index.tsx @@ -82,7 +82,7 @@ export default function GlobalVariablesPage() { showDisabledCheckboxes: true, headerName: "Variable Name", field: "name", - flex: 1, + flex: 2, }, //This column will be twice as wide as the others { field: "type", From 9172dbc8958cef8fcf572e3f7583859d40150efc Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Mon, 6 May 2024 18:45:13 +0100 Subject: [PATCH 3/5] Fixed size and pagination of globalVariables table --- .../src/components/tableComponent/index.tsx | 4 ++-- .../pages/GlobalVariablesPage/index.tsx | 1 - .../SettingsPage/pages/ShortcutsPage/index.tsx | 17 +++++++++++------ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/frontend/src/components/tableComponent/index.tsx b/src/frontend/src/components/tableComponent/index.tsx index 7e2cd4b99..236f98067 100644 --- a/src/frontend/src/components/tableComponent/index.tsx +++ b/src/frontend/src/components/tableComponent/index.tsx @@ -9,14 +9,14 @@ import { cn } from "../../utils/utils"; const TableComponent = forwardRef< ElementRef, ComponentPropsWithoutRef ->(({ pagination = true, ...props }, ref) => { +>(({ ...props }, ref) => { const dark = useDarkStore((state) => state.dark); return (
diff --git a/src/frontend/src/pages/SettingsPage/pages/GlobalVariablesPage/index.tsx b/src/frontend/src/pages/SettingsPage/pages/GlobalVariablesPage/index.tsx index 45fe21452..0ecdd588b 100644 --- a/src/frontend/src/pages/SettingsPage/pages/GlobalVariablesPage/index.tsx +++ b/src/frontend/src/pages/SettingsPage/pages/GlobalVariablesPage/index.tsx @@ -181,7 +181,6 @@ export default function GlobalVariablesPage() { }} rowSelection="multiple" suppressRowClickSelection={true} - domLayout="autoHeight" pagination={true} columnDefs={colDefs} rowData={rowData} diff --git a/src/frontend/src/pages/SettingsPage/pages/ShortcutsPage/index.tsx b/src/frontend/src/pages/SettingsPage/pages/ShortcutsPage/index.tsx index 65bb3387f..158bf2394 100644 --- a/src/frontend/src/pages/SettingsPage/pages/ShortcutsPage/index.tsx +++ b/src/frontend/src/pages/SettingsPage/pages/ShortcutsPage/index.tsx @@ -2,6 +2,7 @@ import { ColDef, ColGroupDef } from "ag-grid-community"; import { useState } from "react"; import ForwardedIconComponent from "../../../../components/genericIconComponent"; import TableComponent from "../../../../components/tableComponent"; +import { Card, CardContent } from "../../../../components/ui/card"; export default function ShortcutsPage() { const advancedShortcut = "Ctrl + Shift + A"; @@ -95,12 +96,16 @@ export default function ShortcutsPage() {
- + + + + +
); From 2f56f3a95259625d1c7602e221517a26fab64617 Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Mon, 6 May 2024 18:52:36 +0100 Subject: [PATCH 4/5] Fixed password on inputComponent --- .../src/components/inputComponent/index.tsx | 120 +++++++++--------- 1 file changed, 59 insertions(+), 61 deletions(-) diff --git a/src/frontend/src/components/inputComponent/index.tsx b/src/frontend/src/components/inputComponent/index.tsx index 7b178a4d7..b1b4b9ef9 100644 --- a/src/frontend/src/components/inputComponent/index.tsx +++ b/src/frontend/src/components/inputComponent/index.tsx @@ -76,7 +76,7 @@ export default function InputComponent({ editNode ? " input-edit-node " : "", password && editNode ? "pr-8" : "", password && !editNode ? "pr-10" : "", - className! + className!, )} placeholder={password && editNode ? "Key" : placeholder} onChange={(e) => { @@ -104,9 +104,9 @@ export default function InputComponent({ (selectedOption !== "" || !onChange) && setSelectedOption ? selectedOption : (selectedOptions?.length !== 0 || !onChange) && - setSelectedOptions - ? selectedOptions?.join(", ") - : value + setSelectedOptions + ? selectedOptions?.join(", ") + : value } autoFocus={autoFocus} disabled={disabled} @@ -120,7 +120,7 @@ export default function InputComponent({ required={required} className={classNames( password && - selectedOption === "" && + (!setSelectedOption || selectedOption === "") && !pwdVisible && value !== "" ? " text-clip password " @@ -134,7 +134,7 @@ export default function InputComponent({ ? "pr-8" : "", - className! + className!, )} placeholder={password && editNode ? "Key" : placeholder} onChange={(e) => { @@ -194,15 +194,15 @@ export default function InputComponent({ setSelectedOption( currentValue === selectedOption ? "" - : currentValue + : currentValue, ); setSelectedOptions && setSelectedOptions( selectedOptions?.includes(currentValue) ? selectedOptions.filter( - (item) => item !== currentValue + (item) => item !== currentValue, ) - : [...selectedOptions, currentValue] + : [...selectedOptions, currentValue], ); !setSelectedOptions && setShowOptions(false); }} @@ -215,7 +215,7 @@ export default function InputComponent({ selectedOption === option || selectedOptions?.includes(option) ? "opacity-100" - : "opacity-0" + : "opacity-0", )} >
@@ -254,7 +254,7 @@ export default function InputComponent({ ((selectedOptions?.length !== 0 || !onChange) && setSelectedOptions) ? "" - : "hidden" + : "hidden", )} onClick={ ((selectedOption !== "" || !onChange) && setSelectedOption) || @@ -275,7 +275,7 @@ export default function InputComponent({ )}
From fabb3c9b56d0522d9241fea56516f0821dc6e133 Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Mon, 6 May 2024 19:10:19 +0100 Subject: [PATCH 5/5] Added password on addNewVariable modal --- .../addNewVariableButton.tsx | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/frontend/src/components/addNewVariableButtonComponent/addNewVariableButton.tsx b/src/frontend/src/components/addNewVariableButtonComponent/addNewVariableButton.tsx index 8786cdac6..2745ba1bf 100644 --- a/src/frontend/src/components/addNewVariableButtonComponent/addNewVariableButton.tsx +++ b/src/frontend/src/components/addNewVariableButtonComponent/addNewVariableButton.tsx @@ -106,14 +106,26 @@ export default function AddNewVariableButton({ children }): JSX.Element { id={"type-global-variables"} > -