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

Staging #69

Merged
merged 16 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,10 @@ function ResourceInstance() {
</Collapse>
<Tabs
value={currentTab}
sx={{ marginTop: insightsVisible ? "10px" : "24px" }}
sx={{
marginTop: "24px",
transition: "margin-top 0.5s ease-in-out",
}}
>
{Object.entries(tabs).map(([key, value]) => {
return (
Expand Down
63 changes: 26 additions & 37 deletions pages/access/[serviceId]/[environmentId]/access-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
CircularProgress,
IconButton,
InputAdornment,
MenuItem,
Stack,
} from "@mui/material";
import { useMutation } from "@tanstack/react-query";
Expand All @@ -14,7 +13,6 @@ import React, { useEffect, useMemo, useState } from "react";
import Button from "../../../../src/components/Button/Button";
import DashboardLayout from "../../../../src/components/DashboardLayout/DashboardLayout";
import Form from "../../../../src/components/FormElements/Form/Form";
import TextField from "../../../../src/components/FormElements/TextField/TextField";
import useSnackbar from "../../../../src/hooks/useSnackbar";
import LoadingSpinnerSmall from "../../../../src/components/CircularProgress/CircularProgress";
import { useRouter } from "next/router";
Expand Down Expand Up @@ -47,6 +45,9 @@ import AccessControlIcon from "src/components/Icons/AccessControlIcon/AccessCont
import { Text } from "src/components/Typography/Typography";
import DataGrid from "src/components/DataGrid/DataGrid";
import AccessControlHeader from "src/components/Access/AccessControl/AccessControlHeader";
import Select from "src/components/FormElementsv2/Select/Select";
import TextField from "src/components/FormElementsv2/TextField/TextField";
import MenuItem from "src/components/FormElementsv2/MenuItem/MenuItem";

export const getServerSideProps = async () => {
return {
Expand Down Expand Up @@ -215,22 +216,16 @@ function AccessControl() {
field: "name",
headerName: "Name",
flex: 1,
headerAlign: "center",
align: "center",
},
{
field: "emailAddress",
headerName: "Email Address",
flex: 1,
headerAlign: "center",
align: "center",
},
{
field: "role",
headerName: "Role",
flex: 1,
headerAlign: "center",
align: "center",
valueGetter: (params) => {
const role = params.row.role;
if (role === "editor") {
Expand All @@ -248,21 +243,15 @@ function AccessControl() {
field: "resource",
headerName: "Resource",
flex: 1,
headerAlign: "center",
align: "center",
},
{
field: "resourceInstance",
headerName: "Resource Instance",
flex: 1,
headerAlign: "center",
align: "center",
},
{
field: "action",
headerName: "Action",
headerAlign: "center",
align: "center",
renderCell: (params) => {
const role = params.row.role;
if (role !== "root") {
Expand Down Expand Up @@ -598,6 +587,8 @@ function AccessControl() {
position="start"
sx={{
marginRight: "0px",
paddingRight: "0px !important",
borderLeft: "none !important",
"& .MuiIconButton-root": {
padding: 0,
},
Expand All @@ -610,40 +601,37 @@ function AccessControl() {
),
}}
/>
<TextField
<Select
required
select
displayEmpty
name={`userInvite[${index}].roleType`}
value={invite.roleType}
onChange={formik.handleChange}
sx={{ width: "400px", flex: 1 }}
SelectProps={{
displayEmpty: true,
renderValue: function (value) {
if (value) return value;
return "Role";
},
}}
renderValue={(value) => value || "Role"}
>
{["Editor", "Reader"].map((option) => (
<MenuItem key={option} value={option}>
{option}
</MenuItem>
))}
</TextField>
</Select>
</Box>
<Box
sx={{
visibility:
index === 0 ? "hidden" : "visible",
}}
>
<IconButton
size="small"
onClick={() => {
remove(index);
}}
>
<RiDeleteBinLine />
</IconButton>
</Box>
{index !== 0 && (
<Box>
<IconButton
size="small"
onClick={() => {
remove(index);
}}
>
<RiDeleteBinLine />
</IconButton>
</Box>
)}
</Box>
);
})}
Expand Down Expand Up @@ -743,11 +731,12 @@ function AccessControl() {
formData={deleteformik}
title={`Delete User`}
buttonLabel={"Delete"}
buttonColour={"red"}
buttonColour={"#D92D20"}
subtitle={`Are you sure you want to Delete ${modifyFormikValue.emailAddress}?`}
message={
"To confirm deletion, please enter <b> deleteme </b>, in the field below:"
}
isLoading={deleteUserMutation.isLoading}
/>
<SideDrawerRight
size="xlarge"
Expand Down
Loading
Loading