Added Prettier test to workflow (#2159)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
This commit is contained in:
7
.github/workflows/jobs.yaml
vendored
7
.github/workflows/jobs.yaml
vendored
@@ -276,7 +276,7 @@ jobs:
|
|||||||
semgrep --config semgrep.yaml $(pwd)/portal-ui --error
|
semgrep --config semgrep.yaml $(pwd)/portal-ui --error
|
||||||
|
|
||||||
no-warnings-and-make-assets:
|
no-warnings-and-make-assets:
|
||||||
name: "React Code Has No Warnings and then Make Assets"
|
name: "React Code Has No Warning & Prettified and then Make Assets"
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -329,6 +329,11 @@ jobs:
|
|||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
run: |
|
run: |
|
||||||
./check-warnings.sh
|
./check-warnings.sh
|
||||||
|
- name: Check if Files are Prettified
|
||||||
|
working-directory: ./portal-ui
|
||||||
|
continue-on-error: false
|
||||||
|
run: |
|
||||||
|
./check-prettier.sh
|
||||||
|
|
||||||
reuse-golang-dependencies:
|
reuse-golang-dependencies:
|
||||||
name: reuse golang dependencies
|
name: reuse golang dependencies
|
||||||
|
|||||||
@@ -6,3 +6,9 @@ build-static:
|
|||||||
|
|
||||||
test-warnings:
|
test-warnings:
|
||||||
./check-warnings.sh
|
./check-warnings.sh
|
||||||
|
|
||||||
|
test-prettier:
|
||||||
|
./check-prettier.sh
|
||||||
|
|
||||||
|
prettify:
|
||||||
|
yarn prettier --write . --loglevel warn
|
||||||
|
|||||||
4
portal-ui/check-prettier.sh
Executable file
4
portal-ui/check-prettier.sh
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
yarn install
|
||||||
|
yarn prettier --check .
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
"@types/react-window": "^1.8.5",
|
"@types/react-window": "^1.8.5",
|
||||||
"@types/react-window-infinite-loader": "^1.0.6",
|
"@types/react-window-infinite-loader": "^1.0.6",
|
||||||
"@types/recharts": "^1.8.22",
|
"@types/recharts": "^1.8.22",
|
||||||
"prettier": "2.6.2",
|
"prettier": "2.7.1",
|
||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
"testcafe": "^1.18.6",
|
"testcafe": "^1.18.6",
|
||||||
"typescript": "^4.4.3"
|
"typescript": "^4.4.3"
|
||||||
|
|||||||
@@ -170,10 +170,12 @@ const AddReplicationModal = ({
|
|||||||
setAddLoading(false);
|
setAddLoading(false);
|
||||||
|
|
||||||
if (itemVal.errorString && itemVal.errorString !== "") {
|
if (itemVal.errorString && itemVal.errorString !== "") {
|
||||||
dispatch(setModalErrorSnackMessage({
|
dispatch(
|
||||||
errorMessage: itemVal.errorString,
|
setModalErrorSnackMessage({
|
||||||
detailedError: "",
|
errorMessage: itemVal.errorString,
|
||||||
}));
|
detailedError: "",
|
||||||
|
})
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,10 +183,12 @@ const AddReplicationModal = ({
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dispatch(setModalErrorSnackMessage({
|
dispatch(
|
||||||
errorMessage: "No changes applied",
|
setModalErrorSnackMessage({
|
||||||
detailedError: "",
|
errorMessage: "No changes applied",
|
||||||
}));
|
detailedError: "",
|
||||||
|
})
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.catch((err: ErrorResponseHandler) => {
|
.catch((err: ErrorResponseHandler) => {
|
||||||
setAddLoading(false);
|
setAddLoading(false);
|
||||||
|
|||||||
@@ -796,8 +796,8 @@ export const wizardCommon = {
|
|||||||
justifyContent: "flex-start" as const,
|
justifyContent: "flex-start" as const,
|
||||||
},
|
},
|
||||||
multiContainerStackNarrow: {
|
multiContainerStackNarrow: {
|
||||||
display: "flex" ,
|
display: "flex",
|
||||||
alignItems: "center" ,
|
alignItems: "center",
|
||||||
justifyContent: "flex-start",
|
justifyContent: "flex-start",
|
||||||
gap: "8px",
|
gap: "8px",
|
||||||
"@media (max-width: 750px)": {
|
"@media (max-width: 750px)": {
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ const Marketplace = () => {
|
|||||||
const displayMarketplace = useSelector(selShowMarketplace);
|
const displayMarketplace = useSelector(selShowMarketplace);
|
||||||
const [isMPMode, setMPMode] = useState<boolean>(true);
|
const [isMPMode, setMPMode] = useState<boolean>(true);
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let mpMode = false;
|
let mpMode = false;
|
||||||
if (features && features.length !== 0) {
|
if (features && features.length !== 0) {
|
||||||
@@ -49,17 +48,20 @@ const Marketplace = () => {
|
|||||||
|
|
||||||
const getTargetPath = () => {
|
const getTargetPath = () => {
|
||||||
let targetPath = "/";
|
let targetPath = "/";
|
||||||
if (localStorage.getItem("redirect-path") && localStorage.getItem("redirect-path") !== "") {
|
if (
|
||||||
|
localStorage.getItem("redirect-path") &&
|
||||||
|
localStorage.getItem("redirect-path") !== ""
|
||||||
|
) {
|
||||||
targetPath = `${localStorage.getItem("redirect-path")}`;
|
targetPath = `${localStorage.getItem("redirect-path")}`;
|
||||||
localStorage.setItem("redirect-path", "");
|
localStorage.setItem("redirect-path", "");
|
||||||
}
|
}
|
||||||
return targetPath;
|
return targetPath;
|
||||||
}
|
};
|
||||||
|
|
||||||
const closeModal = () => {
|
const closeModal = () => {
|
||||||
dispatch(showMarketplace(false));
|
dispatch(showMarketplace(false));
|
||||||
navigate(getTargetPath());
|
navigate(getTargetPath());
|
||||||
}
|
};
|
||||||
|
|
||||||
if (!displayMarketplace || !isMPMode) {
|
if (!displayMarketplace || !isMPMode) {
|
||||||
return <Navigate to={{ pathname: getTargetPath() }} />;
|
return <Navigate to={{ pathname: getTargetPath() }} />;
|
||||||
@@ -70,10 +72,7 @@ const Marketplace = () => {
|
|||||||
<Fragment>
|
<Fragment>
|
||||||
<PageHeader label="Operator Marketplace" />
|
<PageHeader label="Operator Marketplace" />
|
||||||
<PageLayout>
|
<PageLayout>
|
||||||
<SetEmailModal
|
<SetEmailModal open={true} closeModal={closeModal} />
|
||||||
open={true}
|
|
||||||
closeModal={closeModal}
|
|
||||||
/>
|
|
||||||
</PageLayout>
|
</PageLayout>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -42,8 +42,9 @@ const styles = (theme: Theme) =>
|
|||||||
...containerForHeader(theme.spacing(4)),
|
...containerForHeader(theme.spacing(4)),
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line
|
const reEmail =
|
||||||
const reEmail = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
// eslint-disable-next-line
|
||||||
|
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||||
|
|
||||||
const SetEmailModal = ({ open, closeModal }: ISetEmailModalProps) => {
|
const SetEmailModal = ({ open, closeModal }: ISetEmailModalProps) => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
@@ -52,7 +53,7 @@ const SetEmailModal = ({ open, closeModal }: ISetEmailModalProps) => {
|
|||||||
dispatch(setErrorSnackMessage(err));
|
dispatch(setErrorSnackMessage(err));
|
||||||
closeModal();
|
closeModal();
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSuccess = (res: any) => {
|
const onSuccess = (res: any) => {
|
||||||
let msg = `Email ${email} has been saved`;
|
let msg = `Email ${email} has been saved`;
|
||||||
dispatch(setSnackBarMessage(msg));
|
dispatch(setSnackBarMessage(msg));
|
||||||
@@ -62,7 +63,6 @@ const SetEmailModal = ({ open, closeModal }: ISetEmailModalProps) => {
|
|||||||
const [isLoading, invokeApi] = useApi(onSuccess, onError);
|
const [isLoading, invokeApi] = useApi(onSuccess, onError);
|
||||||
const [email, setEmail] = useState<string>("");
|
const [email, setEmail] = useState<string>("");
|
||||||
const [isEmailSet, setIsEmailSet] = useState<boolean>(false);
|
const [isEmailSet, setIsEmailSet] = useState<boolean>(false);
|
||||||
|
|
||||||
|
|
||||||
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
let v = event.target.value;
|
let v = event.target.value;
|
||||||
@@ -72,13 +72,13 @@ const SetEmailModal = ({ open, closeModal }: ISetEmailModalProps) => {
|
|||||||
|
|
||||||
const onConfirm = () => {
|
const onConfirm = () => {
|
||||||
const isInEU = isEU();
|
const isInEU = isEU();
|
||||||
invokeApi("POST", "/api/v1/mp-integration", { email, isInEU});
|
invokeApi("POST", "/api/v1/mp-integration", { email, isInEU });
|
||||||
};
|
};
|
||||||
|
|
||||||
const isEU = () => {
|
const isEU = () => {
|
||||||
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||||
return euTimezones.includes(tz.toLocaleLowerCase());
|
return euTimezones.includes(tz.toLocaleLowerCase());
|
||||||
}
|
};
|
||||||
|
|
||||||
return open ? (
|
return open ? (
|
||||||
<ConfirmDialog
|
<ConfirmDialog
|
||||||
@@ -101,25 +101,27 @@ const SetEmailModal = ({ open, closeModal }: ISetEmailModalProps) => {
|
|||||||
<a
|
<a
|
||||||
href="https://min.io/product/subnet"
|
href="https://min.io/product/subnet"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer">
|
rel="noreferrer"
|
||||||
MinIO Subscription Network (SUBNET)
|
>
|
||||||
</a>.
|
MinIO Subscription Network (SUBNET)
|
||||||
|
</a>
|
||||||
|
.
|
||||||
<br />
|
<br />
|
||||||
Enter your email to register now.
|
Enter your email to register now.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
To register later, contact <a href="mailto: support@min.io">support@min.io</a>.
|
To register later, contact{" "}
|
||||||
|
<a href="mailto: support@min.io">support@min.io</a>.
|
||||||
</p>
|
</p>
|
||||||
<InputBoxWrapper
|
<InputBoxWrapper
|
||||||
id="set-mp-email"
|
id="set-mp-email"
|
||||||
name="set-mp-email"
|
name="set-mp-email"
|
||||||
onChange={handleInputChange}
|
onChange={handleInputChange}
|
||||||
label={""}
|
label={""}
|
||||||
placeholder="Enter email"
|
placeholder="Enter email"
|
||||||
type={"email"}
|
type={"email"}
|
||||||
value={email}
|
value={email}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</Fragment>
|
</Fragment>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -15,64 +15,64 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
export const euTimezones = [
|
export const euTimezones = [
|
||||||
"europe/amsterdam",
|
"europe/amsterdam",
|
||||||
"europe/andorra",
|
"europe/andorra",
|
||||||
"europe/astrakhan",
|
"europe/astrakhan",
|
||||||
"europe/athens",
|
"europe/athens",
|
||||||
"europe/belgrade",
|
"europe/belgrade",
|
||||||
"europe/berlin",
|
"europe/berlin",
|
||||||
"europe/bratislava",
|
"europe/bratislava",
|
||||||
"europe/brussels",
|
"europe/brussels",
|
||||||
"europe/bucharest",
|
"europe/bucharest",
|
||||||
"europe/budapest",
|
"europe/budapest",
|
||||||
"europe/busingen",
|
"europe/busingen",
|
||||||
"europe/chisinau",
|
"europe/chisinau",
|
||||||
"europe/copenhagen",
|
"europe/copenhagen",
|
||||||
"europe/dublin",
|
"europe/dublin",
|
||||||
"europe/gibraltar",
|
"europe/gibraltar",
|
||||||
"europe/guernsey",
|
"europe/guernsey",
|
||||||
"europe/helsinki",
|
"europe/helsinki",
|
||||||
"europe/isle_of_man",
|
"europe/isle_of_man",
|
||||||
"europe/istanbul",
|
"europe/istanbul",
|
||||||
"europe/jersey",
|
"europe/jersey",
|
||||||
"europe/kaliningrad",
|
"europe/kaliningrad",
|
||||||
"europe/kiev",
|
"europe/kiev",
|
||||||
"europe/kirov",
|
"europe/kirov",
|
||||||
"europe/lisbon",
|
"europe/lisbon",
|
||||||
"europe/ljubljana",
|
"europe/ljubljana",
|
||||||
"europe/london",
|
"europe/london",
|
||||||
"europe/luxembourg",
|
"europe/luxembourg",
|
||||||
"europe/madrid",
|
"europe/madrid",
|
||||||
"europe/malta",
|
"europe/malta",
|
||||||
"europe/mariehamn",
|
"europe/mariehamn",
|
||||||
"europe/minsk",
|
"europe/minsk",
|
||||||
"europe/monaco",
|
"europe/monaco",
|
||||||
"europe/moscow",
|
"europe/moscow",
|
||||||
"europe/oslo",
|
"europe/oslo",
|
||||||
"europe/paris",
|
"europe/paris",
|
||||||
"europe/podgorica",
|
"europe/podgorica",
|
||||||
"europe/prague",
|
"europe/prague",
|
||||||
"europe/riga",
|
"europe/riga",
|
||||||
"europe/rome",
|
"europe/rome",
|
||||||
"europe/samara",
|
"europe/samara",
|
||||||
"europe/san_marino",
|
"europe/san_marino",
|
||||||
"europe/sarajevo",
|
"europe/sarajevo",
|
||||||
"europe/saratov",
|
"europe/saratov",
|
||||||
"europe/simferopol",
|
"europe/simferopol",
|
||||||
"europe/skopje",
|
"europe/skopje",
|
||||||
"europe/sofia",
|
"europe/sofia",
|
||||||
"europe/stockholm",
|
"europe/stockholm",
|
||||||
"europe/tallinn",
|
"europe/tallinn",
|
||||||
"europe/tirane",
|
"europe/tirane",
|
||||||
"europe/ulyanovsk",
|
"europe/ulyanovsk",
|
||||||
"europe/uzhgorod",
|
"europe/uzhgorod",
|
||||||
"europe/vaduz",
|
"europe/vaduz",
|
||||||
"europe/vatican",
|
"europe/vatican",
|
||||||
"europe/vienna",
|
"europe/vienna",
|
||||||
"europe/vilnius",
|
"europe/vilnius",
|
||||||
"europe/volgograd",
|
"europe/volgograd",
|
||||||
"europe/warsaw",
|
"europe/warsaw",
|
||||||
"europe/zagreb",
|
"europe/zagreb",
|
||||||
"europe/zaporozhye",
|
"europe/zaporozhye",
|
||||||
"europe/zurich"
|
"europe/zurich",
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -120,7 +120,10 @@ export const objectBrowserSlice = createSlice({
|
|||||||
false;
|
false;
|
||||||
state.objectManager.objectsToManage[objectToComplete].done = true;
|
state.objectManager.objectsToManage[objectToComplete].done = true;
|
||||||
},
|
},
|
||||||
failObject: (state, action: PayloadAction<{instanceID: string; msg: string}>) => {
|
failObject: (
|
||||||
|
state,
|
||||||
|
action: PayloadAction<{ instanceID: string; msg: string }>
|
||||||
|
) => {
|
||||||
const objectToFail = state.objectManager.objectsToManage.findIndex(
|
const objectToFail = state.objectManager.objectsToManage.findIndex(
|
||||||
(item) => item.instanceID === action.payload.instanceID
|
(item) => item.instanceID === action.payload.instanceID
|
||||||
);
|
);
|
||||||
@@ -128,7 +131,8 @@ export const objectBrowserSlice = createSlice({
|
|||||||
state.objectManager.objectsToManage[objectToFail].failed = true;
|
state.objectManager.objectsToManage[objectToFail].failed = true;
|
||||||
state.objectManager.objectsToManage[objectToFail].waitingForFile = false;
|
state.objectManager.objectsToManage[objectToFail].waitingForFile = false;
|
||||||
state.objectManager.objectsToManage[objectToFail].done = true;
|
state.objectManager.objectsToManage[objectToFail].done = true;
|
||||||
state.objectManager.objectsToManage[objectToFail].errorMessage = action.payload.msg;
|
state.objectManager.objectsToManage[objectToFail].errorMessage =
|
||||||
|
action.payload.msg;
|
||||||
},
|
},
|
||||||
cancelObjectInList: (state, action: PayloadAction<string>) => {
|
cancelObjectInList: (state, action: PayloadAction<string>) => {
|
||||||
const objectToCancel = state.objectManager.objectsToManage.findIndex(
|
const objectToCancel = state.objectManager.objectsToManage.findIndex(
|
||||||
|
|||||||
@@ -164,10 +164,12 @@ const NameTenantMain = ({ classes, formToRender }: INameTenantMainScreen) => {
|
|||||||
id="storage_type"
|
id="storage_type"
|
||||||
name="storage_type"
|
name="storage_type"
|
||||||
onChange={(e: SelectChangeEvent<string>) => {
|
onChange={(e: SelectChangeEvent<string>) => {
|
||||||
dispatch(setStorageType({
|
dispatch(
|
||||||
storageType: e.target.value as string,
|
setStorageType({
|
||||||
features: features,
|
storageType: e.target.value as string,
|
||||||
}));
|
features: features,
|
||||||
|
})
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
label={get(
|
label={get(
|
||||||
mkPanelConfigurations,
|
mkPanelConfigurations,
|
||||||
|
|||||||
@@ -281,4 +281,4 @@ export interface ITenantAuditLogs {
|
|||||||
labels: IKeyValue[];
|
labels: IKeyValue[];
|
||||||
annotations: IKeyValue[];
|
annotations: IKeyValue[];
|
||||||
nodeSelector: IKeyValue[];
|
nodeSelector: IKeyValue[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,18 +44,17 @@ import {
|
|||||||
import { IKeyValue, ITenantAuditLogs } from "../ListTenants/types";
|
import { IKeyValue, ITenantAuditLogs } from "../ListTenants/types";
|
||||||
import KeyPairEdit from "./KeyPairEdit";
|
import KeyPairEdit from "./KeyPairEdit";
|
||||||
import InputUnitMenu from "../../Common/FormComponents/InputUnitMenu/InputUnitMenu";
|
import InputUnitMenu from "../../Common/FormComponents/InputUnitMenu/InputUnitMenu";
|
||||||
import {
|
import {
|
||||||
setDBImage,
|
setDBImage,
|
||||||
setDBInitImage,
|
setDBInitImage,
|
||||||
setDBCPURequest,
|
setDBCPURequest,
|
||||||
setDBMemRequest,
|
setDBMemRequest,
|
||||||
setDBRunAsUser,
|
setDBRunAsUser,
|
||||||
setDBFSGroup,
|
setDBFSGroup,
|
||||||
setDBRunAsGroup,
|
setDBRunAsGroup,
|
||||||
setDBRunAsNonRoot,
|
setDBRunAsNonRoot,
|
||||||
setRefreshLoggingInfo,
|
setRefreshLoggingInfo,
|
||||||
} from "../TenantDetails/tenantAuditLogSlice";
|
} from "../TenantDetails/tenantAuditLogSlice";
|
||||||
|
|
||||||
|
|
||||||
import SecurityContextSelector from "../securityContextSelector";
|
import SecurityContextSelector from "../securityContextSelector";
|
||||||
|
|
||||||
@@ -85,7 +84,12 @@ const styles = (theme: Theme) =>
|
|||||||
...wizardCommon,
|
...wizardCommon,
|
||||||
});
|
});
|
||||||
|
|
||||||
const LoggingDBDetails = ({ classes, labels, annotations, nodeSelector }: ITenantAuditLogs) => {
|
const LoggingDBDetails = ({
|
||||||
|
classes,
|
||||||
|
labels,
|
||||||
|
annotations,
|
||||||
|
nodeSelector,
|
||||||
|
}: ITenantAuditLogs) => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const { tenantName, tenantNamespace } = useParams();
|
const { tenantName, tenantNamespace } = useParams();
|
||||||
const dbImage = useSelector(
|
const dbImage = useSelector(
|
||||||
@@ -109,18 +113,28 @@ const LoggingDBDetails = ({ classes, labels, annotations, nodeSelector }: ITenan
|
|||||||
);
|
);
|
||||||
const dbRunAsUser = useSelector(
|
const dbRunAsUser = useSelector(
|
||||||
(state: AppState) => state.editTenantLogging.dbSecurityContext.runAsUser
|
(state: AppState) => state.editTenantLogging.dbSecurityContext.runAsUser
|
||||||
)
|
);
|
||||||
const dbFSGroup = useSelector(
|
const dbFSGroup = useSelector(
|
||||||
(state: AppState) => state.editTenantLogging.dbSecurityContext.fsGroup
|
(state: AppState) => state.editTenantLogging.dbSecurityContext.fsGroup
|
||||||
)
|
);
|
||||||
const dbRunAsNonRoot = useSelector(
|
const dbRunAsNonRoot = useSelector(
|
||||||
(state: AppState) => state.editTenantLogging.dbSecurityContext.runAsNonRoot
|
(state: AppState) => state.editTenantLogging.dbSecurityContext.runAsNonRoot
|
||||||
)
|
);
|
||||||
const [validationErrors, setValidationErrors] = useState<any>({});
|
const [validationErrors, setValidationErrors] = useState<any>({});
|
||||||
|
|
||||||
const [dbLabels, setDBLabels] = useState<IKeyValue[]>((labels != null && labels.length > 0) ? labels : [{ key: "", value: "" }]);
|
const [dbLabels, setDBLabels] = useState<IKeyValue[]>(
|
||||||
const [dbAnnotations, setDBAnnotations] = useState<IKeyValue[]>((annotations != null && annotations.length > 0)? annotations : [{ key: "", value: "" }]);
|
labels != null && labels.length > 0 ? labels : [{ key: "", value: "" }]
|
||||||
const [dbNodeSelector, setDBNodeSelector] = useState<IKeyValue[]>((nodeSelector != null && nodeSelector.length > 0)? nodeSelector :[{ key: "", value: "" }]);
|
);
|
||||||
|
const [dbAnnotations, setDBAnnotations] = useState<IKeyValue[]>(
|
||||||
|
annotations != null && annotations.length > 0
|
||||||
|
? annotations
|
||||||
|
: [{ key: "", value: "" }]
|
||||||
|
);
|
||||||
|
const [dbNodeSelector, setDBNodeSelector] = useState<IKeyValue[]>(
|
||||||
|
nodeSelector != null && nodeSelector.length > 0
|
||||||
|
? nodeSelector
|
||||||
|
: [{ key: "", value: "" }]
|
||||||
|
);
|
||||||
|
|
||||||
const [dbLabelsError, setDBLabelsError] = useState<any>({});
|
const [dbLabelsError, setDBLabelsError] = useState<any>({});
|
||||||
const [dbAnnotationsError, setDBAnnotationsError] = useState<any>({});
|
const [dbAnnotationsError, setDBAnnotationsError] = useState<any>({});
|
||||||
@@ -130,8 +144,6 @@ const LoggingDBDetails = ({ classes, labels, annotations, nodeSelector }: ITenan
|
|||||||
setValidationErrors(clearValidationError(validationErrors, fieldName));
|
setValidationErrors(clearValidationError(validationErrors, fieldName));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const trim = (x: IKeyValue[]): IKeyValue[] => {
|
const trim = (x: IKeyValue[]): IKeyValue[] => {
|
||||||
let retval: IKeyValue[] = [];
|
let retval: IKeyValue[] = [];
|
||||||
for (let i = 0; i < x.length; i++) {
|
for (let i = 0; i < x.length; i++) {
|
||||||
@@ -147,7 +159,7 @@ const LoggingDBDetails = ({ classes, labels, annotations, nodeSelector }: ITenan
|
|||||||
Object.keys(validationErrors).length !== 0 ||
|
Object.keys(validationErrors).length !== 0 ||
|
||||||
Object.keys(dbNodeSelectorError).length !== 0 ||
|
Object.keys(dbNodeSelectorError).length !== 0 ||
|
||||||
Object.keys(dbAnnotationsError).length !== 0 ||
|
Object.keys(dbAnnotationsError).length !== 0 ||
|
||||||
Object.keys(dbLabelsError).length !== 0
|
Object.keys(dbLabelsError).length !== 0
|
||||||
) {
|
) {
|
||||||
let err: ErrorResponseHandler = {
|
let err: ErrorResponseHandler = {
|
||||||
errorMessage: "Invalid entry",
|
errorMessage: "Invalid entry",
|
||||||
@@ -160,32 +172,30 @@ const LoggingDBDetails = ({ classes, labels, annotations, nodeSelector }: ITenan
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const submitLoggingInfo = () => {
|
const submitLoggingInfo = () => {
|
||||||
if (checkValid()) {
|
if (checkValid()) {
|
||||||
const dbSecurityContext = {
|
const dbSecurityContext = {
|
||||||
runAsGroup: dbRunAsGroup != null ? dbRunAsGroup : "",
|
runAsGroup: dbRunAsGroup != null ? dbRunAsGroup : "",
|
||||||
runAsUser: dbRunAsUser != null ? dbRunAsUser : "",
|
runAsUser: dbRunAsUser != null ? dbRunAsUser : "",
|
||||||
fsGroup: dbFSGroup != null ? dbFSGroup : "",
|
fsGroup: dbFSGroup != null ? dbFSGroup : "",
|
||||||
runAsNonRoot: dbRunAsNonRoot != null ? dbRunAsNonRoot : true,
|
runAsNonRoot: dbRunAsNonRoot != null ? dbRunAsNonRoot : true,
|
||||||
}
|
};
|
||||||
api
|
api
|
||||||
.invoke(
|
.invoke(
|
||||||
"PUT",
|
"PUT",
|
||||||
`/api/v1/namespaces/${tenantNamespace}/tenants/${tenantName}/log`,
|
`/api/v1/namespaces/${tenantNamespace}/tenants/${tenantName}/log`,
|
||||||
{
|
{
|
||||||
dbLabels: trim(dbLabels),
|
dbLabels: trim(dbLabels),
|
||||||
dbAnnotations: trim(dbAnnotations),
|
dbAnnotations: trim(dbAnnotations),
|
||||||
dbNodeSelector: trim(dbNodeSelector),
|
dbNodeSelector: trim(dbNodeSelector),
|
||||||
dbImage: dbImage,
|
dbImage: dbImage,
|
||||||
dbInitImage: dbInitImage,
|
dbInitImage: dbInitImage,
|
||||||
dbServiceAccountName: dbServiceAccountName,
|
dbServiceAccountName: dbServiceAccountName,
|
||||||
logDBCPURequest: dbCpuRequest,
|
logDBCPURequest: dbCpuRequest,
|
||||||
logDBMemRequest: dbMemRequest,
|
logDBMemRequest: dbMemRequest,
|
||||||
dbSecurityContext: dbSecurityContext,
|
dbSecurityContext: dbSecurityContext,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setRefreshLoggingInfo(true);
|
setRefreshLoggingInfo(true);
|
||||||
dispatch(setSnackBarMessage(`Audit Log DB configuration updated.`));
|
dispatch(setSnackBarMessage(`Audit Log DB configuration updated.`));
|
||||||
@@ -196,149 +206,150 @@ const LoggingDBDetails = ({ classes, labels, annotations, nodeSelector }: ITenan
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<Fragment>
|
<Fragment>
|
||||||
|
<Grid item xs={12} paddingBottom={2}>
|
||||||
<Grid item xs={12} paddingBottom={2}>
|
<InputBoxWrapper
|
||||||
<InputBoxWrapper
|
id={`dbImage`}
|
||||||
id={`dbImage`}
|
label={"DB Postgres Image"}
|
||||||
label={"DB Postgres Image"}
|
placeholder={"library/postgres:13"}
|
||||||
placeholder={"library/postgres:13"}
|
name={`dbImage`}
|
||||||
name={`dbImage`}
|
value={dbImage}
|
||||||
value={dbImage}
|
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
|
if (event.target.validity.valid) {
|
||||||
if (event.target.validity.valid) {
|
dispatch(setDBImage(event.target.value));
|
||||||
dispatch(setDBImage(event.target.value));
|
|
||||||
}
|
|
||||||
cleanValidation(`dbImage`);
|
|
||||||
}}
|
|
||||||
key={`dbImage`}
|
|
||||||
pattern={"^[a-zA-Z0-9-./:]{1,253}$"}
|
|
||||||
error={validationErrors[`dbImage`] || ""}
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={12} paddingBottom={2}>
|
|
||||||
<InputBoxWrapper
|
|
||||||
id={`dbInitImage`}
|
|
||||||
label={"DB Init Image"}
|
|
||||||
placeholder={"library/busybox:1.33.1"}
|
|
||||||
name={`dbInitImage`}
|
|
||||||
value={dbInitImage}
|
|
||||||
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
|
|
||||||
if (event.target.validity.valid) {
|
|
||||||
dispatch(setDBInitImage(event.target.value));
|
|
||||||
}
|
|
||||||
cleanValidation(`dbInitImage`);
|
|
||||||
}}
|
|
||||||
key={`dbInitImage`}
|
|
||||||
pattern={"^[a-zA-Z0-9-./:]{1,253}$"}
|
|
||||||
error={validationErrors[`dbInitImage`] || ""}
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={12} paddingBottom={2}>
|
|
||||||
<InputBoxWrapper
|
|
||||||
id={`dbCPURequest`}
|
|
||||||
label={"DB CPU Request"}
|
|
||||||
placeholder={"DB CPU Request"}
|
|
||||||
name={`dbCPURequest`}
|
|
||||||
value={dbCpuRequest}
|
|
||||||
pattern={"[0-9]*"}
|
|
||||||
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
|
|
||||||
if (event.target.validity.valid) {
|
|
||||||
dispatch(setDBCPURequest(event.target.value));
|
|
||||||
}
|
|
||||||
cleanValidation(`dbCPURequest`);
|
|
||||||
}}
|
|
||||||
key={`dbCPURequest`}
|
|
||||||
error={validationErrors[`dbCPURequest`] || ""}
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={12} paddingBottom={2}>
|
|
||||||
<InputBoxWrapper
|
|
||||||
id={`dbMemRequest`}
|
|
||||||
label={"DB Memory Request"}
|
|
||||||
placeholder={"DB Memory request"}
|
|
||||||
name={`dbMemRequest`}
|
|
||||||
value={dbMemRequest}
|
|
||||||
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
|
|
||||||
if (event.target.validity.valid) {
|
|
||||||
dispatch(setDBMemRequest(event.target.value));
|
|
||||||
}
|
|
||||||
cleanValidation(`dbMemRequest`);
|
|
||||||
}}
|
|
||||||
pattern={"[0-9]*"}
|
|
||||||
key={`dbMemRequest`}
|
|
||||||
error={validationErrors[`dbMemRequest`] || ""}
|
|
||||||
overlayObject={
|
|
||||||
<InputUnitMenu
|
|
||||||
id={"size-unit"}
|
|
||||||
onUnitChange={() => {}}
|
|
||||||
unitSelected={"Gi"}
|
|
||||||
unitsList={[{ label: "Gi", value: "Gi" }]}
|
|
||||||
disabled={true}
|
|
||||||
/>
|
|
||||||
}
|
}
|
||||||
/>
|
cleanValidation(`dbImage`);
|
||||||
</Grid>
|
}}
|
||||||
|
key={`dbImage`}
|
||||||
<Grid item xs={12} className={classes.formFieldRow}>
|
pattern={"^[a-zA-Z0-9-./:]{1,253}$"}
|
||||||
<span className={classes.inputLabel}>DB Labels</span>
|
error={validationErrors[`dbImage`] || ""}
|
||||||
<KeyPairEdit
|
/>
|
||||||
newValues={dbLabels}
|
</Grid>
|
||||||
setNewValues={setDBLabels}
|
<Grid item xs={12} paddingBottom={2}>
|
||||||
paramName={"dbLabels"}
|
<InputBoxWrapper
|
||||||
error={dbLabelsError}
|
id={`dbInitImage`}
|
||||||
setError={setDBLabelsError}
|
label={"DB Init Image"}
|
||||||
|
placeholder={"library/busybox:1.33.1"}
|
||||||
|
name={`dbInitImage`}
|
||||||
|
value={dbInitImage}
|
||||||
|
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
if (event.target.validity.valid) {
|
||||||
|
dispatch(setDBInitImage(event.target.value));
|
||||||
|
}
|
||||||
|
cleanValidation(`dbInitImage`);
|
||||||
|
}}
|
||||||
|
key={`dbInitImage`}
|
||||||
|
pattern={"^[a-zA-Z0-9-./:]{1,253}$"}
|
||||||
|
error={validationErrors[`dbInitImage`] || ""}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12} paddingBottom={2}>
|
||||||
|
<InputBoxWrapper
|
||||||
|
id={`dbCPURequest`}
|
||||||
|
label={"DB CPU Request"}
|
||||||
|
placeholder={"DB CPU Request"}
|
||||||
|
name={`dbCPURequest`}
|
||||||
|
value={dbCpuRequest}
|
||||||
|
pattern={"[0-9]*"}
|
||||||
|
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
if (event.target.validity.valid) {
|
||||||
|
dispatch(setDBCPURequest(event.target.value));
|
||||||
|
}
|
||||||
|
cleanValidation(`dbCPURequest`);
|
||||||
|
}}
|
||||||
|
key={`dbCPURequest`}
|
||||||
|
error={validationErrors[`dbCPURequest`] || ""}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12} paddingBottom={2}>
|
||||||
|
<InputBoxWrapper
|
||||||
|
id={`dbMemRequest`}
|
||||||
|
label={"DB Memory Request"}
|
||||||
|
placeholder={"DB Memory request"}
|
||||||
|
name={`dbMemRequest`}
|
||||||
|
value={dbMemRequest}
|
||||||
|
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
if (event.target.validity.valid) {
|
||||||
|
dispatch(setDBMemRequest(event.target.value));
|
||||||
|
}
|
||||||
|
cleanValidation(`dbMemRequest`);
|
||||||
|
}}
|
||||||
|
pattern={"[0-9]*"}
|
||||||
|
key={`dbMemRequest`}
|
||||||
|
error={validationErrors[`dbMemRequest`] || ""}
|
||||||
|
overlayObject={
|
||||||
|
<InputUnitMenu
|
||||||
|
id={"size-unit"}
|
||||||
|
onUnitChange={() => {}}
|
||||||
|
unitSelected={"Gi"}
|
||||||
|
unitsList={[{ label: "Gi", value: "Gi" }]}
|
||||||
|
disabled={true}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
}
|
||||||
<Grid item xs={12} className={classes.formFieldRow}>
|
/>
|
||||||
<span className={classes.inputLabel}>DB Annotations</span>
|
</Grid>
|
||||||
<KeyPairEdit
|
|
||||||
newValues={dbAnnotations}
|
<Grid item xs={12} className={classes.formFieldRow}>
|
||||||
setNewValues={setDBAnnotations}
|
<span className={classes.inputLabel}>DB Labels</span>
|
||||||
paramName={"dbAnnotations"}
|
<KeyPairEdit
|
||||||
error={dbAnnotationsError}
|
newValues={dbLabels}
|
||||||
setError={setDBAnnotationsError}
|
setNewValues={setDBLabels}
|
||||||
/>
|
paramName={"dbLabels"}
|
||||||
</Grid>
|
error={dbLabelsError}
|
||||||
|
setError={setDBLabelsError}
|
||||||
<Grid item xs={12} className={classes.formFieldRow}>
|
/>
|
||||||
<span className={classes.inputLabel}>DB Node Selector</span>
|
</Grid>
|
||||||
<KeyPairEdit
|
<Grid item xs={12} className={classes.formFieldRow}>
|
||||||
newValues={dbNodeSelector}
|
<span className={classes.inputLabel}>DB Annotations</span>
|
||||||
setNewValues={setDBNodeSelector}
|
<KeyPairEdit
|
||||||
paramName={"DB Node Selector"}
|
newValues={dbAnnotations}
|
||||||
error={dbNodeSelectorError}
|
setNewValues={setDBAnnotations}
|
||||||
setError={setDBNodeSelectorError}
|
paramName={"dbAnnotations"}
|
||||||
/>
|
error={dbAnnotationsError}
|
||||||
</Grid>
|
setError={setDBAnnotationsError}
|
||||||
|
/>
|
||||||
<Grid item xs={12} className={classes.formFieldRow}>
|
</Grid>
|
||||||
<SecurityContextSelector classes={classes}
|
|
||||||
|
<Grid item xs={12} className={classes.formFieldRow}>
|
||||||
|
<span className={classes.inputLabel}>DB Node Selector</span>
|
||||||
|
<KeyPairEdit
|
||||||
|
newValues={dbNodeSelector}
|
||||||
|
setNewValues={setDBNodeSelector}
|
||||||
|
paramName={"DB Node Selector"}
|
||||||
|
error={dbNodeSelectorError}
|
||||||
|
setError={setDBNodeSelectorError}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid item xs={12} className={classes.formFieldRow}>
|
||||||
|
<SecurityContextSelector
|
||||||
|
classes={classes}
|
||||||
runAsGroup={dbRunAsGroup}
|
runAsGroup={dbRunAsGroup}
|
||||||
runAsUser={dbRunAsUser}
|
runAsUser={dbRunAsUser}
|
||||||
fsGroup={dbFSGroup}
|
fsGroup={dbFSGroup}
|
||||||
runAsNonRoot={dbRunAsNonRoot}
|
runAsNonRoot={dbRunAsNonRoot}
|
||||||
setFSGroup={(value : string)=>dispatch(setDBFSGroup(value))}
|
setFSGroup={(value: string) => dispatch(setDBFSGroup(value))}
|
||||||
setRunAsUser={(value : string)=>dispatch(setDBRunAsUser(value))}
|
setRunAsUser={(value: string) => dispatch(setDBRunAsUser(value))}
|
||||||
setRunAsGroup={(value : string)=>dispatch(setDBRunAsGroup(value))}
|
setRunAsGroup={(value: string) => dispatch(setDBRunAsGroup(value))}
|
||||||
setRunAsNonRoot={(value : boolean)=>dispatch(setDBRunAsNonRoot(value))}
|
setRunAsNonRoot={(value: boolean) =>
|
||||||
/></Grid>
|
dispatch(setDBRunAsNonRoot(value))
|
||||||
<Grid item xs={12} textAlign={"right"}>
|
}
|
||||||
<Button
|
/>
|
||||||
type="submit"
|
</Grid>
|
||||||
variant="contained"
|
<Grid item xs={12} textAlign={"right"}>
|
||||||
color="primary"
|
<Button
|
||||||
disabled={!checkValid()}
|
type="submit"
|
||||||
onClick={() => submitLoggingInfo()}
|
variant="contained"
|
||||||
>
|
color="primary"
|
||||||
Save
|
disabled={!checkValid()}
|
||||||
</Button>
|
onClick={() => submitLoggingInfo()}
|
||||||
</Grid>
|
>
|
||||||
</Fragment>
|
Save
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Fragment>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,18 +45,18 @@ import KeyPairEdit from "./KeyPairEdit";
|
|||||||
import InputUnitMenu from "../../Common/FormComponents/InputUnitMenu/InputUnitMenu";
|
import InputUnitMenu from "../../Common/FormComponents/InputUnitMenu/InputUnitMenu";
|
||||||
import SecurityContextSelector from "../securityContextSelector";
|
import SecurityContextSelector from "../securityContextSelector";
|
||||||
import { clearValidationError } from "../utils";
|
import { clearValidationError } from "../utils";
|
||||||
import {
|
import {
|
||||||
setImage,
|
setImage,
|
||||||
setDiskCapacityGB,
|
setDiskCapacityGB,
|
||||||
setServiceAccountName,
|
setServiceAccountName,
|
||||||
setCPURequest,
|
setCPURequest,
|
||||||
setMemRequest,
|
setMemRequest,
|
||||||
setRunAsUser,
|
setRunAsUser,
|
||||||
setFSGroup,
|
setFSGroup,
|
||||||
setRunAsGroup,
|
setRunAsGroup,
|
||||||
setRunAsNonRoot,
|
setRunAsNonRoot,
|
||||||
setRefreshLoggingInfo,
|
setRefreshLoggingInfo,
|
||||||
} from "../TenantDetails/tenantAuditLogSlice";
|
} from "../TenantDetails/tenantAuditLogSlice";
|
||||||
|
|
||||||
const styles = (theme: Theme) =>
|
const styles = (theme: Theme) =>
|
||||||
createStyles({
|
createStyles({
|
||||||
@@ -82,15 +82,18 @@ const styles = (theme: Theme) =>
|
|||||||
...wizardCommon,
|
...wizardCommon,
|
||||||
});
|
});
|
||||||
|
|
||||||
const TenantAuditLogging = ({ classes, labels, annotations, nodeSelector }: ITenantAuditLogs) => {
|
const TenantAuditLogging = ({
|
||||||
|
classes,
|
||||||
|
labels,
|
||||||
|
annotations,
|
||||||
|
nodeSelector,
|
||||||
|
}: ITenantAuditLogs) => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const { tenantName, tenantNamespace } = useParams();
|
const { tenantName, tenantNamespace } = useParams();
|
||||||
const auditLoggingEnabled = useSelector(
|
const auditLoggingEnabled = useSelector(
|
||||||
(state: AppState) => state.editTenantLogging.auditLoggingEnabled
|
(state: AppState) => state.editTenantLogging.auditLoggingEnabled
|
||||||
);
|
);
|
||||||
const image = useSelector(
|
const image = useSelector((state: AppState) => state.editTenantLogging.image);
|
||||||
(state: AppState) => state.editTenantLogging.image
|
|
||||||
);
|
|
||||||
const diskCapacityGB = useSelector(
|
const diskCapacityGB = useSelector(
|
||||||
(state: AppState) => state.editTenantLogging.diskCapacityGB
|
(state: AppState) => state.editTenantLogging.diskCapacityGB
|
||||||
);
|
);
|
||||||
@@ -108,21 +111,31 @@ const TenantAuditLogging = ({ classes, labels, annotations, nodeSelector }: ITen
|
|||||||
);
|
);
|
||||||
const runAsUser = useSelector(
|
const runAsUser = useSelector(
|
||||||
(state: AppState) => state.editTenantLogging.securityContext.runAsUser
|
(state: AppState) => state.editTenantLogging.securityContext.runAsUser
|
||||||
)
|
);
|
||||||
const fsGroup = useSelector(
|
const fsGroup = useSelector(
|
||||||
(state: AppState) => state.editTenantLogging.securityContext.fsGroup
|
(state: AppState) => state.editTenantLogging.securityContext.fsGroup
|
||||||
)
|
);
|
||||||
const runAsNonRoot = useSelector(
|
const runAsNonRoot = useSelector(
|
||||||
(state: AppState) => state.editTenantLogging.securityContext.runAsNonRoot
|
(state: AppState) => state.editTenantLogging.securityContext.runAsNonRoot
|
||||||
)
|
);
|
||||||
|
|
||||||
const [validationErrors, setValidationErrors] = useState<any>({});
|
const [validationErrors, setValidationErrors] = useState<any>({});
|
||||||
const [loading, setLoading] = useState<boolean>(false);
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
|
|
||||||
const [logLabels, setLabels] = useState<IKeyValue[]>((labels != null && labels.length > 0) ? labels : [{ key: "", value: "" }]);
|
const [logLabels, setLabels] = useState<IKeyValue[]>(
|
||||||
const [logAnnotations, setAnnotations] = useState<IKeyValue[]>((annotations != null && annotations.length > 0)? annotations : [{ key: "", value: "" }]);
|
labels != null && labels.length > 0 ? labels : [{ key: "", value: "" }]
|
||||||
const [logNodeSelector, setNodeSelector] = useState<IKeyValue[]>((nodeSelector != null && nodeSelector.length > 0)? nodeSelector :[{ key: "", value: "" }]);
|
);
|
||||||
|
const [logAnnotations, setAnnotations] = useState<IKeyValue[]>(
|
||||||
|
annotations != null && annotations.length > 0
|
||||||
|
? annotations
|
||||||
|
: [{ key: "", value: "" }]
|
||||||
|
);
|
||||||
|
const [logNodeSelector, setNodeSelector] = useState<IKeyValue[]>(
|
||||||
|
nodeSelector != null && nodeSelector.length > 0
|
||||||
|
? nodeSelector
|
||||||
|
: [{ key: "", value: "" }]
|
||||||
|
);
|
||||||
|
|
||||||
const [labelsError, setLabelsError] = useState<any>({});
|
const [labelsError, setLabelsError] = useState<any>({});
|
||||||
const [annotationsError, setAnnotationsError] = useState<any>({});
|
const [annotationsError, setAnnotationsError] = useState<any>({});
|
||||||
const [nodeSelectorError, setNodeSelectorError] = useState<any>({});
|
const [nodeSelectorError, setNodeSelectorError] = useState<any>({});
|
||||||
@@ -146,7 +159,7 @@ const TenantAuditLogging = ({ classes, labels, annotations, nodeSelector }: ITen
|
|||||||
Object.keys(validationErrors).length !== 0 ||
|
Object.keys(validationErrors).length !== 0 ||
|
||||||
Object.keys(labelsError).length !== 0 ||
|
Object.keys(labelsError).length !== 0 ||
|
||||||
Object.keys(annotationsError).length !== 0 ||
|
Object.keys(annotationsError).length !== 0 ||
|
||||||
Object.keys(nodeSelectorError).length !== 0
|
Object.keys(nodeSelectorError).length !== 0
|
||||||
) {
|
) {
|
||||||
let err: ErrorResponseHandler = {
|
let err: ErrorResponseHandler = {
|
||||||
errorMessage: "Invalid entry",
|
errorMessage: "Invalid entry",
|
||||||
@@ -160,32 +173,31 @@ const TenantAuditLogging = ({ classes, labels, annotations, nodeSelector }: ITen
|
|||||||
};
|
};
|
||||||
|
|
||||||
const submitLoggingInfo = () => {
|
const submitLoggingInfo = () => {
|
||||||
|
|
||||||
if (checkValid()) {
|
if (checkValid()) {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const securityContext = {
|
const securityContext = {
|
||||||
runAsGroup: runAsGroup != null ? runAsGroup : "",
|
runAsGroup: runAsGroup != null ? runAsGroup : "",
|
||||||
runAsUser: runAsUser != null ? runAsUser : "",
|
runAsUser: runAsUser != null ? runAsUser : "",
|
||||||
fsGroup: fsGroup != null ? fsGroup : "",
|
fsGroup: fsGroup != null ? fsGroup : "",
|
||||||
runAsNonRoot: runAsNonRoot != null ? runAsNonRoot : true,
|
runAsNonRoot: runAsNonRoot != null ? runAsNonRoot : true,
|
||||||
}
|
};
|
||||||
|
|
||||||
api
|
api
|
||||||
.invoke(
|
.invoke(
|
||||||
"PUT",
|
"PUT",
|
||||||
`/api/v1/namespaces/${tenantNamespace}/tenants/${tenantName}/log`,
|
`/api/v1/namespaces/${tenantNamespace}/tenants/${tenantName}/log`,
|
||||||
{
|
{
|
||||||
labels: trim(logLabels),
|
labels: trim(logLabels),
|
||||||
annotations: trim(logAnnotations),
|
annotations: trim(logAnnotations),
|
||||||
nodeSelector: trim(logNodeSelector),
|
nodeSelector: trim(logNodeSelector),
|
||||||
image: image,
|
image: image,
|
||||||
diskCapacityGB: diskCapacityGB.toString(),
|
diskCapacityGB: diskCapacityGB.toString(),
|
||||||
serviceAccountName: serviceAccountName,
|
serviceAccountName: serviceAccountName,
|
||||||
logCPURequest: cpuRequest,
|
logCPURequest: cpuRequest,
|
||||||
logMemRequest: memRequest,
|
logMemRequest: memRequest,
|
||||||
securityContext: securityContext,
|
securityContext: securityContext,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setRefreshLoggingInfo(true);
|
setRefreshLoggingInfo(true);
|
||||||
dispatch(setSnackBarMessage(`Audit Log configuration updated.`));
|
dispatch(setSnackBarMessage(`Audit Log configuration updated.`));
|
||||||
@@ -197,9 +209,9 @@ const TenantAuditLogging = ({ classes, labels, annotations, nodeSelector }: ITen
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
{auditLoggingEnabled && (
|
{auditLoggingEnabled && (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<Grid item xs={12} paddingBottom={2}>
|
<Grid item xs={12} paddingBottom={2}>
|
||||||
@@ -220,7 +232,7 @@ const TenantAuditLogging = ({ classes, labels, annotations, nodeSelector }: ITen
|
|||||||
error={validationErrors[`image`] || ""}
|
error={validationErrors[`image`] || ""}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid item xs={12} paddingBottom={2}>
|
<Grid item xs={12} paddingBottom={2}>
|
||||||
<InputBoxWrapper
|
<InputBoxWrapper
|
||||||
id={`diskCapacityGB`}
|
id={`diskCapacityGB`}
|
||||||
@@ -266,7 +278,7 @@ const TenantAuditLogging = ({ classes, labels, annotations, nodeSelector }: ITen
|
|||||||
error={validationErrors[`cpuRequest`] || ""}
|
error={validationErrors[`cpuRequest`] || ""}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid item xs={12} paddingBottom={2}>
|
<Grid item xs={12} paddingBottom={2}>
|
||||||
<InputBoxWrapper
|
<InputBoxWrapper
|
||||||
id={`memRequest`}
|
id={`memRequest`}
|
||||||
@@ -294,7 +306,7 @@ const TenantAuditLogging = ({ classes, labels, annotations, nodeSelector }: ITen
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid item xs={12} paddingBottom={2}>
|
<Grid item xs={12} paddingBottom={2}>
|
||||||
<InputBoxWrapper
|
<InputBoxWrapper
|
||||||
id={`serviceAccountName`}
|
id={`serviceAccountName`}
|
||||||
@@ -314,51 +326,54 @@ const TenantAuditLogging = ({ classes, labels, annotations, nodeSelector }: ITen
|
|||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} className={classes.formFieldRow}>
|
<Grid item xs={12} className={classes.formFieldRow}>
|
||||||
<SecurityContextSelector classes={classes}
|
<SecurityContextSelector
|
||||||
runAsGroup={runAsGroup}
|
classes={classes}
|
||||||
runAsUser={runAsUser}
|
runAsGroup={runAsGroup}
|
||||||
fsGroup={fsGroup}
|
runAsUser={runAsUser}
|
||||||
runAsNonRoot={runAsNonRoot}
|
fsGroup={fsGroup}
|
||||||
setFSGroup={(value : string)=>dispatch(setFSGroup(value))}
|
runAsNonRoot={runAsNonRoot}
|
||||||
setRunAsUser={(value : string)=>dispatch(setRunAsUser(value))}
|
setFSGroup={(value: string) => dispatch(setFSGroup(value))}
|
||||||
setRunAsGroup={(value : string)=>dispatch(setRunAsGroup(value))}
|
setRunAsUser={(value: string) => dispatch(setRunAsUser(value))}
|
||||||
setRunAsNonRoot={(value : boolean)=>dispatch(setRunAsNonRoot(value))}
|
setRunAsGroup={(value: string) => dispatch(setRunAsGroup(value))}
|
||||||
|
setRunAsNonRoot={(value: boolean) =>
|
||||||
|
dispatch(setRunAsNonRoot(value))
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid item xs={12} className={classes.formFieldRow}>
|
<Grid item xs={12} className={classes.formFieldRow}>
|
||||||
<span className={classes.inputLabel}>Labels</span>
|
<span className={classes.inputLabel}>Labels</span>
|
||||||
<KeyPairEdit
|
<KeyPairEdit
|
||||||
newValues={logLabels}
|
newValues={logLabels}
|
||||||
setNewValues={setLabels}
|
setNewValues={setLabels}
|
||||||
paramName={"Labels"}
|
paramName={"Labels"}
|
||||||
error={labelsError}
|
error={labelsError}
|
||||||
setError={setLabelsError}
|
setError={setLabelsError}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid item xs={12} className={classes.formFieldRow}>
|
<Grid item xs={12} className={classes.formFieldRow}>
|
||||||
<span className={classes.inputLabel}>Annotations</span>
|
<span className={classes.inputLabel}>Annotations</span>
|
||||||
<KeyPairEdit
|
<KeyPairEdit
|
||||||
newValues={logAnnotations }
|
newValues={logAnnotations}
|
||||||
setNewValues={setAnnotations}
|
setNewValues={setAnnotations}
|
||||||
paramName={"Annotations"}
|
paramName={"Annotations"}
|
||||||
error={annotationsError}
|
error={annotationsError}
|
||||||
setError={setAnnotationsError}
|
setError={setAnnotationsError}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid item xs={12} className={classes.formFieldRow}>
|
<Grid item xs={12} className={classes.formFieldRow}>
|
||||||
<span className={classes.inputLabel}>Node Selector</span>
|
<span className={classes.inputLabel}>Node Selector</span>
|
||||||
<KeyPairEdit
|
<KeyPairEdit
|
||||||
newValues={logNodeSelector}
|
newValues={logNodeSelector}
|
||||||
setNewValues={setNodeSelector}
|
setNewValues={setNodeSelector}
|
||||||
paramName={"Node Selector"}
|
paramName={"Node Selector"}
|
||||||
error={nodeSelectorError}
|
error={nodeSelectorError}
|
||||||
setError={setNodeSelectorError}
|
setError={setNodeSelectorError}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid item xs={12} textAlign={"right"}>
|
<Grid item xs={12} textAlign={"right"}>
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
// This file is part of MinIO Console Server
|
// This file is part of MinIO Console Server
|
||||||
// Copyright (c) 2021 MinIO, Inc.
|
// Copyright (c) 2021 MinIO, Inc.
|
||||||
//
|
//
|
||||||
@@ -30,34 +29,34 @@ import api from "../../../../common/api";
|
|||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { AppState, useAppDispatch } from "../../../../store";
|
import { AppState, useAppDispatch } from "../../../../store";
|
||||||
import { ErrorResponseHandler } from "../../../../common/types";
|
import { ErrorResponseHandler } from "../../../../common/types";
|
||||||
import { setErrorSnackMessage} from "../../../../systemSlice";
|
import { setErrorSnackMessage } from "../../../../systemSlice";
|
||||||
import FormSwitchWrapper from "../../Common/FormComponents/FormSwitchWrapper/FormSwitchWrapper";
|
import FormSwitchWrapper from "../../Common/FormComponents/FormSwitchWrapper/FormSwitchWrapper";
|
||||||
import { ITenantLogsStruct } from "../ListTenants/types";
|
import { ITenantLogsStruct } from "../ListTenants/types";
|
||||||
import { IKeyValue } from "../ListTenants/types";
|
import { IKeyValue } from "../ListTenants/types";
|
||||||
|
|
||||||
import LoggingDetails from "./LoggingDetails";
|
import LoggingDetails from "./LoggingDetails";
|
||||||
import LoggingDBDetails from "./LoggingDBDetails";
|
import LoggingDBDetails from "./LoggingDBDetails";
|
||||||
import {
|
import {
|
||||||
setAuditLoggingEnabled,
|
setAuditLoggingEnabled,
|
||||||
setDBImage,
|
setDBImage,
|
||||||
setDBInitImage,
|
setDBInitImage,
|
||||||
setDBServiceAccountName,
|
setDBServiceAccountName,
|
||||||
setDBCPURequest,
|
setDBCPURequest,
|
||||||
setDBMemRequest,
|
setDBMemRequest,
|
||||||
setDBRunAsUser,
|
setDBRunAsUser,
|
||||||
setDBFSGroup,
|
setDBFSGroup,
|
||||||
setDBRunAsGroup,
|
setDBRunAsGroup,
|
||||||
setDBRunAsNonRoot,
|
setDBRunAsNonRoot,
|
||||||
setImage,
|
setImage,
|
||||||
setDiskCapacityGB,
|
setDiskCapacityGB,
|
||||||
setServiceAccountName,
|
setServiceAccountName,
|
||||||
setCPURequest,
|
setCPURequest,
|
||||||
setMemRequest,
|
setMemRequest,
|
||||||
setRunAsUser,
|
setRunAsUser,
|
||||||
setFSGroup,
|
setFSGroup,
|
||||||
setRunAsGroup,
|
setRunAsGroup,
|
||||||
setRunAsNonRoot,
|
setRunAsNonRoot,
|
||||||
resetAuditLogForm,
|
resetAuditLogForm,
|
||||||
} from "../TenantDetails/tenantAuditLogSlice";
|
} from "../TenantDetails/tenantAuditLogSlice";
|
||||||
|
|
||||||
interface ILoggingScreenProps {
|
interface ILoggingScreenProps {
|
||||||
@@ -79,12 +78,22 @@ const LoggingScreen = ({ classes }: ILoggingScreenProps) => {
|
|||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
const [toggleConfirmOpen, setToggleConfirmOpen] = useState<boolean>(false);
|
const [toggleConfirmOpen, setToggleConfirmOpen] = useState<boolean>(false);
|
||||||
const [refreshLoggingInfo, setRefreshLoggingInfo] = useState<boolean>(true);
|
const [refreshLoggingInfo, setRefreshLoggingInfo] = useState<boolean>(true);
|
||||||
const [dbLabels, setDBLabels] = useState<IKeyValue[]>([{ key: "", value: "" }]);
|
const [dbLabels, setDBLabels] = useState<IKeyValue[]>([
|
||||||
const [dbAnnotations, setDBAnnotations] = useState<IKeyValue[]>([{ key: "", value: "" }]);
|
{ key: "", value: "" },
|
||||||
const [dbNodeSelector, setDBNodeSelector] = useState<IKeyValue[]>([{ key: "", value: "" }]);
|
]);
|
||||||
|
const [dbAnnotations, setDBAnnotations] = useState<IKeyValue[]>([
|
||||||
|
{ key: "", value: "" },
|
||||||
|
]);
|
||||||
|
const [dbNodeSelector, setDBNodeSelector] = useState<IKeyValue[]>([
|
||||||
|
{ key: "", value: "" },
|
||||||
|
]);
|
||||||
const [labels, setLabels] = useState<IKeyValue[]>([{ key: "", value: "" }]);
|
const [labels, setLabels] = useState<IKeyValue[]>([{ key: "", value: "" }]);
|
||||||
const [annotations, setAnnotations] = useState<IKeyValue[]>([{ key: "", value: "" }]);
|
const [annotations, setAnnotations] = useState<IKeyValue[]>([
|
||||||
const [nodeSelector, setNodeSelector] = useState<IKeyValue[]>([{ key: "", value: "" }]);
|
{ key: "", value: "" },
|
||||||
|
]);
|
||||||
|
const [nodeSelector, setNodeSelector] = useState<IKeyValue[]>([
|
||||||
|
{ key: "", value: "" },
|
||||||
|
]);
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const auditLoggingEnabled = useSelector(
|
const auditLoggingEnabled = useSelector(
|
||||||
(state: AppState) => state.editTenantLogging.auditLoggingEnabled
|
(state: AppState) => state.editTenantLogging.auditLoggingEnabled
|
||||||
@@ -97,61 +106,83 @@ const LoggingScreen = ({ classes }: ILoggingScreenProps) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const setLoggingInfo = (res: ITenantLogsStruct) => {
|
const setLoggingInfo = (res: ITenantLogsStruct) => {
|
||||||
if (res !== null) {
|
if (res !== null) {
|
||||||
dispatch(setAuditLoggingEnabled(res !== null && !res.disabled));
|
dispatch(setAuditLoggingEnabled(res !== null && !res.disabled));
|
||||||
res.dbServiceAccountName != null && dispatch(setDBServiceAccountName(res.dbServiceAccountName));
|
res.dbServiceAccountName != null &&
|
||||||
res.dbImage != null && dispatch(setDBImage(res.dbImage));
|
dispatch(setDBServiceAccountName(res.dbServiceAccountName));
|
||||||
res.dbInitImage != null && dispatch(setDBInitImage(res.dbInitImage));
|
res.dbImage != null && dispatch(setDBImage(res.dbImage));
|
||||||
res.logDBCPURequest != null && dispatch(setDBCPURequest(res.logDBCPURequest));
|
res.dbInitImage != null && dispatch(setDBInitImage(res.dbInitImage));
|
||||||
|
res.logDBCPURequest != null &&
|
||||||
|
dispatch(setDBCPURequest(res.logDBCPURequest));
|
||||||
if (res.logDBMemRequest) {
|
if (res.logDBMemRequest) {
|
||||||
dispatch(setDBMemRequest(Math.floor(parseInt(res.logDBMemRequest, 10)).toString()));
|
dispatch(
|
||||||
|
setDBMemRequest(
|
||||||
|
Math.floor(parseInt(res.logDBMemRequest, 10)).toString()
|
||||||
|
)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
dispatch(setDBMemRequest("0"));
|
dispatch(setDBMemRequest("0"));
|
||||||
}
|
}
|
||||||
if (res.dbSecurityContext) {
|
if (res.dbSecurityContext) {
|
||||||
dispatch(setDBRunAsGroup(res.dbSecurityContext.runAsGroup));
|
dispatch(setDBRunAsGroup(res.dbSecurityContext.runAsGroup));
|
||||||
dispatch(setDBRunAsUser(res.dbSecurityContext.runAsUser));
|
dispatch(setDBRunAsUser(res.dbSecurityContext.runAsUser));
|
||||||
dispatch(setDBFSGroup(res.dbSecurityContext.fsGroup));
|
dispatch(setDBFSGroup(res.dbSecurityContext.fsGroup));
|
||||||
dispatch(setDBRunAsNonRoot(res.dbSecurityContext.runAsNonRoot));
|
dispatch(setDBRunAsNonRoot(res.dbSecurityContext.runAsNonRoot));
|
||||||
}
|
}
|
||||||
res.image != null && dispatch(setImage(res.image));
|
res.image != null && dispatch(setImage(res.image));
|
||||||
res.serviceAccountName != null && dispatch(setServiceAccountName(res.serviceAccountName));
|
res.serviceAccountName != null &&
|
||||||
res.logCPURequest != null && dispatch(setCPURequest(res.logCPURequest));
|
dispatch(setServiceAccountName(res.serviceAccountName));
|
||||||
if (res.logMemRequest) {
|
res.logCPURequest != null && dispatch(setCPURequest(res.logCPURequest));
|
||||||
dispatch(setMemRequest(Math.floor(parseInt(res.logMemRequest, 10)).toString()));
|
if (res.logMemRequest) {
|
||||||
} else {
|
dispatch(
|
||||||
dispatch(setMemRequest("0"));
|
setMemRequest(Math.floor(parseInt(res.logMemRequest, 10)).toString())
|
||||||
}
|
);
|
||||||
if (res.securityContext) {
|
} else {
|
||||||
dispatch(setRunAsGroup(res.securityContext.runAsGroup));
|
dispatch(setMemRequest("0"));
|
||||||
dispatch(setRunAsUser(res.securityContext.runAsUser));
|
}
|
||||||
dispatch(setFSGroup(res.securityContext.fsGroup));
|
if (res.securityContext) {
|
||||||
dispatch(setRunAsNonRoot(res.securityContext.runAsNonRoot));
|
dispatch(setRunAsGroup(res.securityContext.runAsGroup));
|
||||||
}
|
dispatch(setRunAsUser(res.securityContext.runAsUser));
|
||||||
|
dispatch(setFSGroup(res.securityContext.fsGroup));
|
||||||
res.diskCapacityGB != null && dispatch(setDiskCapacityGB(res.diskCapacityGB));
|
dispatch(setRunAsNonRoot(res.securityContext.runAsNonRoot));
|
||||||
res.labels != null ? setLabels(res.labels) : setLabels([{ key: "", value: "" }]);
|
}
|
||||||
res.annotations != null ? setAnnotations(res.annotations) : setAnnotations([{ key: "", value: "" }]);
|
|
||||||
res.nodeSelector != null ? setNodeSelector(res.nodeSelector) : setNodeSelector([{ key: "", value: "" }]);
|
res.diskCapacityGB != null &&
|
||||||
res.dbLabels != null ? setDBLabels(res.dbLabels) : setDBLabels([{ key: "", value: "" }]);
|
dispatch(setDiskCapacityGB(res.diskCapacityGB));
|
||||||
res.dbAnnotations != null ? setDBAnnotations(res.dbAnnotations) : setDBAnnotations([{ key: "", value: "" }]);
|
res.labels != null
|
||||||
res.dbNodeSelector != null ? setDBNodeSelector(res.dbNodeSelector) : setDBNodeSelector([{ key: "", value: "" }]);
|
? setLabels(res.labels)
|
||||||
setRefreshLoggingInfo(false);
|
: setLabels([{ key: "", value: "" }]);
|
||||||
}
|
res.annotations != null
|
||||||
|
? setAnnotations(res.annotations)
|
||||||
|
: setAnnotations([{ key: "", value: "" }]);
|
||||||
|
res.nodeSelector != null
|
||||||
|
? setNodeSelector(res.nodeSelector)
|
||||||
|
: setNodeSelector([{ key: "", value: "" }]);
|
||||||
|
res.dbLabels != null
|
||||||
|
? setDBLabels(res.dbLabels)
|
||||||
|
: setDBLabels([{ key: "", value: "" }]);
|
||||||
|
res.dbAnnotations != null
|
||||||
|
? setDBAnnotations(res.dbAnnotations)
|
||||||
|
: setDBAnnotations([{ key: "", value: "" }]);
|
||||||
|
res.dbNodeSelector != null
|
||||||
|
? setDBNodeSelector(res.dbNodeSelector)
|
||||||
|
: setDBNodeSelector([{ key: "", value: "" }]);
|
||||||
|
setRefreshLoggingInfo(false);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (refreshLoggingInfo) {
|
if (refreshLoggingInfo) {
|
||||||
api
|
api
|
||||||
.invoke(
|
.invoke(
|
||||||
"GET",
|
"GET",
|
||||||
`/api/v1/namespaces/${tenantNamespace}/tenants/${tenantName}/log`
|
`/api/v1/namespaces/${tenantNamespace}/tenants/${tenantName}/log`
|
||||||
)
|
)
|
||||||
.then((res: ITenantLogsStruct) => {
|
.then((res: ITenantLogsStruct) => {
|
||||||
if (res !== null) {
|
if (res !== null) {
|
||||||
dispatch(setAuditLoggingEnabled(res.auditLoggingEnabled));
|
dispatch(setAuditLoggingEnabled(res.auditLoggingEnabled));
|
||||||
setLoggingInfo(res);
|
setLoggingInfo(res);
|
||||||
setRefreshLoggingInfo(false);
|
setRefreshLoggingInfo(false);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err: ErrorResponseHandler) => {
|
.catch((err: ErrorResponseHandler) => {
|
||||||
@@ -170,8 +201,8 @@ const LoggingScreen = ({ classes }: ILoggingScreenProps) => {
|
|||||||
|
|
||||||
const toggleLogging = () => {
|
const toggleLogging = () => {
|
||||||
dispatch(resetAuditLogForm());
|
dispatch(resetAuditLogForm());
|
||||||
if(!auditLoggingEnabled) {
|
if (!auditLoggingEnabled) {
|
||||||
api
|
api
|
||||||
.invoke(
|
.invoke(
|
||||||
"POST",
|
"POST",
|
||||||
`/api/v1/namespaces/${tenantNamespace}/tenants/${tenantName}/enable-logging`
|
`/api/v1/namespaces/${tenantNamespace}/tenants/${tenantName}/enable-logging`
|
||||||
@@ -179,7 +210,7 @@ const LoggingScreen = ({ classes }: ILoggingScreenProps) => {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
setRefreshLoggingInfo(true);
|
setRefreshLoggingInfo(true);
|
||||||
setToggleConfirmOpen(false);
|
setToggleConfirmOpen(false);
|
||||||
setAuditLoggingEnabled(true);
|
setAuditLoggingEnabled(true);
|
||||||
})
|
})
|
||||||
.catch((err: ErrorResponseHandler) => {
|
.catch((err: ErrorResponseHandler) => {
|
||||||
dispatch(
|
dispatch(
|
||||||
@@ -189,61 +220,59 @@ const LoggingScreen = ({ classes }: ILoggingScreenProps) => {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
api
|
api
|
||||||
.invoke(
|
.invoke(
|
||||||
"POST",
|
"POST",
|
||||||
`/api/v1/namespaces/${tenantNamespace}/tenants/${tenantName}/disable-logging`
|
`/api/v1/namespaces/${tenantNamespace}/tenants/${tenantName}/disable-logging`
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setAuditLoggingEnabled(false);
|
setAuditLoggingEnabled(false);
|
||||||
setRefreshLoggingInfo(true);
|
setRefreshLoggingInfo(true);
|
||||||
setToggleConfirmOpen(false);
|
setToggleConfirmOpen(false);
|
||||||
dispatch(resetAuditLogForm());
|
dispatch(resetAuditLogForm());
|
||||||
})
|
|
||||||
.catch((err: ErrorResponseHandler) => {
|
|
||||||
dispatch(
|
|
||||||
setErrorSnackMessage({
|
|
||||||
errorMessage: "Error disabling logging",
|
|
||||||
detailedError: err.detailedError,
|
|
||||||
})
|
})
|
||||||
);
|
.catch((err: ErrorResponseHandler) => {
|
||||||
});
|
dispatch(
|
||||||
};
|
setErrorSnackMessage({
|
||||||
|
errorMessage: "Error disabling logging",
|
||||||
|
detailedError: err.detailedError,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
|
|
||||||
<Grid item xs>
|
|
||||||
{toggleConfirmOpen && (
|
|
||||||
|
|
||||||
<ConfirmDialog
|
|
||||||
isOpen={toggleConfirmOpen}
|
|
||||||
title={
|
|
||||||
!auditLoggingEnabled
|
|
||||||
? "Enable Audit Logging for this tenant?"
|
|
||||||
: "Disable Audit Logging for this tenant?"
|
|
||||||
}
|
|
||||||
confirmText={!auditLoggingEnabled ? "Enable" : "Disable"}
|
|
||||||
cancelText="Cancel"
|
|
||||||
onClose={() => setToggleConfirmOpen(false)}
|
|
||||||
onConfirm={toggleLogging}
|
|
||||||
confirmationContent={
|
|
||||||
<DialogContentText>
|
|
||||||
{!auditLoggingEnabled
|
|
||||||
? "A small Postgres server will be started per the configuration provided, which will collect the audit logs for your tenant."
|
|
||||||
: " Current configuration will be lost, and defaults reset if reenabled."}
|
|
||||||
</DialogContentText>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Grid>
|
|
||||||
<Grid container >
|
|
||||||
<Grid item xs>
|
<Grid item xs>
|
||||||
|
{toggleConfirmOpen && (
|
||||||
|
<ConfirmDialog
|
||||||
|
isOpen={toggleConfirmOpen}
|
||||||
|
title={
|
||||||
|
!auditLoggingEnabled
|
||||||
|
? "Enable Audit Logging for this tenant?"
|
||||||
|
: "Disable Audit Logging for this tenant?"
|
||||||
|
}
|
||||||
|
confirmText={!auditLoggingEnabled ? "Enable" : "Disable"}
|
||||||
|
cancelText="Cancel"
|
||||||
|
onClose={() => setToggleConfirmOpen(false)}
|
||||||
|
onConfirm={toggleLogging}
|
||||||
|
confirmationContent={
|
||||||
|
<DialogContentText>
|
||||||
|
{!auditLoggingEnabled
|
||||||
|
? "A small Postgres server will be started per the configuration provided, which will collect the audit logs for your tenant."
|
||||||
|
: " Current configuration will be lost, and defaults reset if reenabled."}
|
||||||
|
</DialogContentText>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Grid>
|
||||||
|
<Grid container>
|
||||||
|
<Grid item xs>
|
||||||
<h1 className={classes.sectionTitle}>Audit Logs</h1>
|
<h1 className={classes.sectionTitle}>Audit Logs</h1>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid >
|
<Grid>
|
||||||
<FormSwitchWrapper
|
<FormSwitchWrapper
|
||||||
label={""}
|
label={""}
|
||||||
indicatorLabels={["Enabled", "Disabled"]}
|
indicatorLabels={["Enabled", "Disabled"]}
|
||||||
@@ -257,48 +286,48 @@ const LoggingScreen = ({ classes }: ILoggingScreenProps) => {
|
|||||||
description=""
|
description=""
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
|
||||||
<Grid container>
|
<Grid container>
|
||||||
{auditLoggingEnabled && (
|
{auditLoggingEnabled && (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<Grid item xs={9}>
|
<Grid item xs={9}>
|
||||||
<Tabs
|
<Tabs
|
||||||
value={curTab}
|
value={curTab}
|
||||||
onChange={(e: React.ChangeEvent<{}>, newValue: number) => {
|
onChange={(e: React.ChangeEvent<{}>, newValue: number) => {
|
||||||
setCurTab(newValue);
|
setCurTab(newValue);
|
||||||
}}
|
}}
|
||||||
indicatorColor="primary"
|
indicatorColor="primary"
|
||||||
textColor="primary"
|
textColor="primary"
|
||||||
aria-label="cluster-tabs"
|
aria-label="cluster-tabs"
|
||||||
variant="scrollable"
|
variant="scrollable"
|
||||||
scrollButtons="auto"
|
scrollButtons="auto"
|
||||||
>
|
>
|
||||||
<Tab label="Configuration" {...a11yProps(0)} />
|
<Tab label="Configuration" {...a11yProps(0)} />
|
||||||
<Tab label="DB Configuration" {...a11yProps(1)} />
|
<Tab label="DB Configuration" {...a11yProps(1)} />
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<hr className={classes.hrClass} />
|
<hr className={classes.hrClass} />
|
||||||
</Grid>
|
</Grid>
|
||||||
{curTab === 0 && (
|
{curTab === 0 && (
|
||||||
<LoggingDetails
|
<LoggingDetails
|
||||||
classes={classes}
|
classes={classes}
|
||||||
labels={labels}
|
labels={labels}
|
||||||
annotations={annotations}
|
annotations={annotations}
|
||||||
nodeSelector={nodeSelector}
|
nodeSelector={nodeSelector}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
|
{curTab === 1 && (
|
||||||
|
<LoggingDBDetails
|
||||||
|
classes={classes}
|
||||||
|
labels={dbLabels}
|
||||||
|
annotations={dbAnnotations}
|
||||||
|
nodeSelector={dbNodeSelector}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Fragment>
|
||||||
)}
|
)}
|
||||||
{curTab === 1 && (
|
</Grid>
|
||||||
<LoggingDBDetails classes={classes}
|
|
||||||
labels={dbLabels}
|
|
||||||
annotations={dbAnnotations}
|
|
||||||
nodeSelector={dbNodeSelector}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Fragment>
|
|
||||||
)}
|
|
||||||
</Grid>
|
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -59,7 +59,9 @@ const TenantSummary = withSuspense(React.lazy(() => import("./TenantSummary")));
|
|||||||
const TenantLicense = withSuspense(React.lazy(() => import("./TenantLicense")));
|
const TenantLicense = withSuspense(React.lazy(() => import("./TenantLicense")));
|
||||||
const PoolsSummary = withSuspense(React.lazy(() => import("./PoolsSummary")));
|
const PoolsSummary = withSuspense(React.lazy(() => import("./PoolsSummary")));
|
||||||
const PodsSummary = withSuspense(React.lazy(() => import("./PodsSummary")));
|
const PodsSummary = withSuspense(React.lazy(() => import("./PodsSummary")));
|
||||||
const TenantLogging = withSuspense(React.lazy(() => import("./TenantAuditLogsScreen")));
|
const TenantLogging = withSuspense(
|
||||||
|
React.lazy(() => import("./TenantAuditLogsScreen"))
|
||||||
|
);
|
||||||
const TenantEvents = withSuspense(React.lazy(() => import("./TenantEvents")));
|
const TenantEvents = withSuspense(React.lazy(() => import("./TenantEvents")));
|
||||||
const TenantCSR = withSuspense(React.lazy(() => import("./TenantCSR")));
|
const TenantCSR = withSuspense(React.lazy(() => import("./TenantCSR")));
|
||||||
const VolumesSummary = withSuspense(
|
const VolumesSummary = withSuspense(
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export interface IEditTenantAuditLogging {
|
|||||||
memRequest: string;
|
memRequest: string;
|
||||||
dbCPURequest: string;
|
dbCPURequest: string;
|
||||||
dbMemRequest: string;
|
dbMemRequest: string;
|
||||||
securityContext: ISecurityContext;
|
securityContext: ISecurityContext;
|
||||||
dbSecurityContext: ISecurityContext;
|
dbSecurityContext: ISecurityContext;
|
||||||
refreshLoggingInfo: boolean;
|
refreshLoggingInfo: boolean;
|
||||||
}
|
}
|
||||||
@@ -59,18 +59,18 @@ const initialState: IEditTenantAuditLogging = {
|
|||||||
cpuRequest: "",
|
cpuRequest: "",
|
||||||
memRequest: "",
|
memRequest: "",
|
||||||
securityContext: {
|
securityContext: {
|
||||||
runAsUser: "1000",
|
runAsUser: "1000",
|
||||||
runAsGroup: "1000",
|
runAsGroup: "1000",
|
||||||
fsGroup: "1000",
|
fsGroup: "1000",
|
||||||
runAsNonRoot: false,
|
runAsNonRoot: false,
|
||||||
},
|
},
|
||||||
dbSecurityContext: {
|
dbSecurityContext: {
|
||||||
runAsUser: "1000",
|
runAsUser: "1000",
|
||||||
runAsGroup: "1000",
|
runAsGroup: "1000",
|
||||||
fsGroup: "1000",
|
fsGroup: "1000",
|
||||||
runAsNonRoot: false,
|
runAsNonRoot: false,
|
||||||
},
|
},
|
||||||
refreshLoggingInfo: true
|
refreshLoggingInfo: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const editTenantAuditLoggingSlice = createSlice({
|
export const editTenantAuditLoggingSlice = createSlice({
|
||||||
@@ -84,7 +84,7 @@ export const editTenantAuditLoggingSlice = createSlice({
|
|||||||
state.image = action.payload;
|
state.image = action.payload;
|
||||||
},
|
},
|
||||||
setDBImage: (state, action: PayloadAction<string>) => {
|
setDBImage: (state, action: PayloadAction<string>) => {
|
||||||
state.dbImage = action.payload;
|
state.dbImage = action.payload;
|
||||||
},
|
},
|
||||||
setDBInitImage: (state, action: PayloadAction<string>) => {
|
setDBInitImage: (state, action: PayloadAction<string>) => {
|
||||||
state.dbInitImage = action.payload;
|
state.dbInitImage = action.payload;
|
||||||
@@ -99,13 +99,13 @@ export const editTenantAuditLoggingSlice = createSlice({
|
|||||||
state.nodeSelector = action.payload;
|
state.nodeSelector = action.payload;
|
||||||
},
|
},
|
||||||
setDBLabels: (state, action: PayloadAction<IKeyValue[]>) => {
|
setDBLabels: (state, action: PayloadAction<IKeyValue[]>) => {
|
||||||
state.dbLabels = action.payload;
|
state.dbLabels = action.payload;
|
||||||
},
|
},
|
||||||
setDBAnnotations: (state, action: PayloadAction<IKeyValue[]>) => {
|
setDBAnnotations: (state, action: PayloadAction<IKeyValue[]>) => {
|
||||||
state.dbAnnotations = action.payload;
|
state.dbAnnotations = action.payload;
|
||||||
},
|
},
|
||||||
setDBNodeSelector: (state, action: PayloadAction<IKeyValue[]>) => {
|
setDBNodeSelector: (state, action: PayloadAction<IKeyValue[]>) => {
|
||||||
state.dbNodeSelector = action.payload;
|
state.dbNodeSelector = action.payload;
|
||||||
},
|
},
|
||||||
setDiskCapacityGB: (state, action: PayloadAction<number>) => {
|
setDiskCapacityGB: (state, action: PayloadAction<number>) => {
|
||||||
state.diskCapacityGB = action.payload;
|
state.diskCapacityGB = action.payload;
|
||||||
@@ -123,10 +123,10 @@ export const editTenantAuditLoggingSlice = createSlice({
|
|||||||
state.memRequest = action.payload;
|
state.memRequest = action.payload;
|
||||||
},
|
},
|
||||||
setDBCPURequest: (state, action: PayloadAction<string>) => {
|
setDBCPURequest: (state, action: PayloadAction<string>) => {
|
||||||
state.dbCPURequest = action.payload;
|
state.dbCPURequest = action.payload;
|
||||||
},
|
},
|
||||||
setDBMemRequest: (state, action: PayloadAction<string>) => {
|
setDBMemRequest: (state, action: PayloadAction<string>) => {
|
||||||
state.dbMemRequest = action.payload;
|
state.dbMemRequest = action.payload;
|
||||||
},
|
},
|
||||||
setRunAsUser: (state, action: PayloadAction<string>) => {
|
setRunAsUser: (state, action: PayloadAction<string>) => {
|
||||||
state.securityContext.runAsUser = action.payload;
|
state.securityContext.runAsUser = action.payload;
|
||||||
@@ -135,10 +135,10 @@ export const editTenantAuditLoggingSlice = createSlice({
|
|||||||
state.securityContext.runAsGroup = action.payload;
|
state.securityContext.runAsGroup = action.payload;
|
||||||
},
|
},
|
||||||
setFSGroup: (state, action: PayloadAction<string>) => {
|
setFSGroup: (state, action: PayloadAction<string>) => {
|
||||||
state.securityContext.fsGroup = action.payload;
|
state.securityContext.fsGroup = action.payload;
|
||||||
},
|
},
|
||||||
setRunAsNonRoot: (state, action: PayloadAction<boolean>) => {
|
setRunAsNonRoot: (state, action: PayloadAction<boolean>) => {
|
||||||
state.securityContext.runAsNonRoot = action.payload;
|
state.securityContext.runAsNonRoot = action.payload;
|
||||||
},
|
},
|
||||||
setDBRunAsUser: (state, action: PayloadAction<string>) => {
|
setDBRunAsUser: (state, action: PayloadAction<string>) => {
|
||||||
state.dbSecurityContext.runAsUser = action.payload;
|
state.dbSecurityContext.runAsUser = action.payload;
|
||||||
@@ -147,10 +147,10 @@ export const editTenantAuditLoggingSlice = createSlice({
|
|||||||
state.dbSecurityContext.runAsGroup = action.payload;
|
state.dbSecurityContext.runAsGroup = action.payload;
|
||||||
},
|
},
|
||||||
setDBFSGroup: (state, action: PayloadAction<string>) => {
|
setDBFSGroup: (state, action: PayloadAction<string>) => {
|
||||||
state.dbSecurityContext.fsGroup = action.payload;
|
state.dbSecurityContext.fsGroup = action.payload;
|
||||||
},
|
},
|
||||||
setDBRunAsNonRoot: (state, action: PayloadAction<boolean>) => {
|
setDBRunAsNonRoot: (state, action: PayloadAction<boolean>) => {
|
||||||
state.dbSecurityContext.runAsNonRoot = action.payload;
|
state.dbSecurityContext.runAsNonRoot = action.payload;
|
||||||
},
|
},
|
||||||
setRefreshLoggingInfo: (state, action: PayloadAction<boolean>) => {
|
setRefreshLoggingInfo: (state, action: PayloadAction<boolean>) => {
|
||||||
state.refreshLoggingInfo = action.payload;
|
state.refreshLoggingInfo = action.payload;
|
||||||
@@ -160,33 +160,33 @@ export const editTenantAuditLoggingSlice = createSlice({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const {
|
export const {
|
||||||
setAuditLoggingEnabled,
|
setAuditLoggingEnabled,
|
||||||
setImage,
|
setImage,
|
||||||
setDBImage,
|
setDBImage,
|
||||||
setDBInitImage,
|
setDBInitImage,
|
||||||
setLabels,
|
setLabels,
|
||||||
setAnnotations,
|
setAnnotations,
|
||||||
setNodeSelector,
|
setNodeSelector,
|
||||||
setDBLabels,
|
setDBLabels,
|
||||||
setDBAnnotations,
|
setDBAnnotations,
|
||||||
setDBNodeSelector,
|
setDBNodeSelector,
|
||||||
setDiskCapacityGB,
|
setDiskCapacityGB,
|
||||||
setServiceAccountName,
|
setServiceAccountName,
|
||||||
setDBServiceAccountName,
|
setDBServiceAccountName,
|
||||||
setCPURequest,
|
setCPURequest,
|
||||||
setMemRequest,
|
setMemRequest,
|
||||||
setDBCPURequest,
|
setDBCPURequest,
|
||||||
setDBMemRequest,
|
setDBMemRequest,
|
||||||
setRunAsUser,
|
setRunAsUser,
|
||||||
setFSGroup,
|
setFSGroup,
|
||||||
setRunAsGroup,
|
setRunAsGroup,
|
||||||
setRunAsNonRoot,
|
setRunAsNonRoot,
|
||||||
setDBRunAsUser,
|
setDBRunAsUser,
|
||||||
setDBFSGroup,
|
setDBFSGroup,
|
||||||
setDBRunAsGroup,
|
setDBRunAsGroup,
|
||||||
setDBRunAsNonRoot,
|
setDBRunAsNonRoot,
|
||||||
setRefreshLoggingInfo,
|
setRefreshLoggingInfo,
|
||||||
resetAuditLogForm,
|
resetAuditLogForm,
|
||||||
} = editTenantAuditLoggingSlice.actions;
|
} = editTenantAuditLoggingSlice.actions;
|
||||||
|
|
||||||
export default editTenantAuditLoggingSlice.reducer;
|
export default editTenantAuditLoggingSlice.reducer;
|
||||||
|
|||||||
@@ -21,90 +21,96 @@ import { Grid } from "@mui/material";
|
|||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
|
|
||||||
interface IEditSecurityContextProps {
|
interface IEditSecurityContextProps {
|
||||||
classes: any;
|
classes: any;
|
||||||
runAsUser: string;
|
runAsUser: string;
|
||||||
runAsGroup: string;
|
runAsGroup: string;
|
||||||
fsGroup: string;
|
fsGroup: string;
|
||||||
runAsNonRoot: boolean;
|
runAsNonRoot: boolean;
|
||||||
setRunAsUser: any;
|
setRunAsUser: any;
|
||||||
setRunAsGroup: any;
|
setRunAsGroup: any;
|
||||||
setFSGroup: any;
|
setFSGroup: any;
|
||||||
setRunAsNonRoot: any;
|
setRunAsNonRoot: any;
|
||||||
}
|
}
|
||||||
const SecurityContextSelector = ({ classes, runAsGroup, runAsUser, fsGroup, runAsNonRoot, setRunAsUser, setRunAsGroup, setFSGroup, setRunAsNonRoot }: IEditSecurityContextProps ) => {
|
const SecurityContextSelector = ({
|
||||||
const dispatch = useDispatch();
|
classes,
|
||||||
return (
|
runAsGroup,
|
||||||
<Fragment>
|
runAsUser,
|
||||||
<fieldset
|
fsGroup,
|
||||||
className={`${classes.fieldGroup} ${classes.fieldSpaceTop} `}
|
runAsNonRoot,
|
||||||
>
|
setRunAsUser,
|
||||||
<legend className={classes.descriptionText}>
|
setRunAsGroup,
|
||||||
Security Context
|
setFSGroup,
|
||||||
</legend>
|
setRunAsNonRoot,
|
||||||
|
}: IEditSecurityContextProps) => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
return (
|
||||||
|
<Fragment>
|
||||||
|
<fieldset className={`${classes.fieldGroup} ${classes.fieldSpaceTop} `}>
|
||||||
|
<legend className={classes.descriptionText}>Security Context</legend>
|
||||||
|
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<div
|
<div className={`${classes.multiContainerStackNarrow} `}>
|
||||||
className={`${classes.multiContainerStackNarrow} `}
|
<div className={classes.configSectionItem}>
|
||||||
>
|
<InputBoxWrapper
|
||||||
<div className={classes.configSectionItem}>
|
type="number"
|
||||||
<InputBoxWrapper
|
id="securityContext_runAsUser"
|
||||||
type="number"
|
name="securityContext_runAsUser"
|
||||||
id="securityContext_runAsUser"
|
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
name="securityContext_runAsUser"
|
dispatch(setRunAsUser(e.target.value));
|
||||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
}}
|
||||||
dispatch(setRunAsUser(e.target.value));
|
label="Run As User"
|
||||||
}}
|
value={runAsUser}
|
||||||
label="Run As User"
|
required
|
||||||
value={runAsUser}
|
min="0"
|
||||||
required
|
/>
|
||||||
min="0"
|
</div>
|
||||||
/>
|
<div className={classes.configSectionItem}>
|
||||||
</div>
|
<InputBoxWrapper
|
||||||
<div className={classes.configSectionItem}>
|
type="number"
|
||||||
<InputBoxWrapper
|
id="securityContext_runAsGroup"
|
||||||
type="number"
|
name="securityContext_runAsGroup"
|
||||||
id="securityContext_runAsGroup"
|
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
name="securityContext_runAsGroup"
|
dispatch(setRunAsGroup(e.target.value));
|
||||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) => { dispatch(setRunAsGroup(e.target.value));
|
}}
|
||||||
}}
|
label="Run As Group"
|
||||||
label="Run As Group"
|
value={runAsGroup}
|
||||||
value={runAsGroup}
|
required
|
||||||
required
|
min="0"
|
||||||
min="0"
|
/>
|
||||||
/>
|
</div>
|
||||||
</div>
|
<div className={classes.configSectionItem}>
|
||||||
<div className={classes.configSectionItem}>
|
<InputBoxWrapper
|
||||||
<InputBoxWrapper
|
type="number"
|
||||||
type="number"
|
id="securityContext_fsGroup"
|
||||||
id="securityContext_fsGroup"
|
name="securityContext_fsGroup"
|
||||||
name="securityContext_fsGroup"
|
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {dispatch(setFSGroup(e.target.value)); }}
|
dispatch(setFSGroup(e.target.value));
|
||||||
label="FsGroup"
|
}}
|
||||||
value={fsGroup}
|
label="FsGroup"
|
||||||
required
|
value={fsGroup}
|
||||||
min="0"
|
required
|
||||||
/>
|
min="0"
|
||||||
</div>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Grid>
|
</div>
|
||||||
<br />
|
</Grid>
|
||||||
<Grid item xs={12}>
|
<br />
|
||||||
<div className={classes.multiContainer} >
|
<Grid item xs={12}>
|
||||||
<FormSwitchWrapper
|
<div className={classes.multiContainer}>
|
||||||
value="prometheusSecurityContextRunAsNonRoot"
|
<FormSwitchWrapper
|
||||||
id="prometheus_securityContext_runAsNonRoot"
|
value="prometheusSecurityContextRunAsNonRoot"
|
||||||
name="prometheus_securityContext_runAsNonRoot"
|
id="prometheus_securityContext_runAsNonRoot"
|
||||||
checked={runAsNonRoot}
|
name="prometheus_securityContext_runAsNonRoot"
|
||||||
onChange={() => {
|
checked={runAsNonRoot}
|
||||||
dispatch(setRunAsNonRoot(!runAsNonRoot));
|
onChange={() => {
|
||||||
}
|
dispatch(setRunAsNonRoot(!runAsNonRoot));
|
||||||
}
|
}}
|
||||||
label={"Do not run as Root"}
|
label={"Do not run as Root"}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Grid>
|
</Grid>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default SecurityContextSelector;
|
export default SecurityContextSelector;
|
||||||
|
|||||||
@@ -338,4 +338,3 @@ export interface ITenantIdentityProviderResponse {
|
|||||||
user_dn_search_filter: string;
|
user_dn_search_filter: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,11 @@ import { SupportMenuIcon } from "../../icons/SidebarMenus";
|
|||||||
import GithubIcon from "../../icons/GithubIcon";
|
import GithubIcon from "../../icons/GithubIcon";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import Loader from "../Console/Common/Loader/Loader";
|
import Loader from "../Console/Common/Loader/Loader";
|
||||||
import { setErrorSnackMessage, userLogged, showMarketplace } from "../../systemSlice";
|
import {
|
||||||
|
setErrorSnackMessage,
|
||||||
|
userLogged,
|
||||||
|
showMarketplace,
|
||||||
|
} from "../../systemSlice";
|
||||||
import { useAppDispatch } from "../../store";
|
import { useAppDispatch } from "../../store";
|
||||||
|
|
||||||
const styles = (theme: Theme) =>
|
const styles = (theme: Theme) =>
|
||||||
@@ -331,11 +335,11 @@ const Login = ({ classes }: ILoginProps) => {
|
|||||||
localStorage.setItem("redirect-path", "");
|
localStorage.setItem("redirect-path", "");
|
||||||
}
|
}
|
||||||
return targetPath;
|
return targetPath;
|
||||||
}
|
};
|
||||||
|
|
||||||
const redirectAfterLogin = () => {
|
const redirectAfterLogin = () => {
|
||||||
navigate(getTargetPath());
|
navigate(getTargetPath());
|
||||||
}
|
};
|
||||||
|
|
||||||
const redirectToMarketplace = () => {
|
const redirectToMarketplace = () => {
|
||||||
api
|
api
|
||||||
@@ -347,11 +351,12 @@ const Login = ({ classes }: ILoginProps) => {
|
|||||||
if (err.statusCode === 404) {
|
if (err.statusCode === 404) {
|
||||||
dispatch(showMarketplace(true));
|
dispatch(showMarketplace(true));
|
||||||
navigate("/marketplace");
|
navigate("/marketplace");
|
||||||
} else { // Unexpected error, continue with normal flow
|
} else {
|
||||||
|
// Unexpected error, continue with normal flow
|
||||||
redirectAfterLogin();
|
redirectAfterLogin();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
const formSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
const formSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ import editPoolReducer from "./screens/Console/Tenants/TenantDetails/Pools/EditP
|
|||||||
import editTenantMonitoringReducer from "./screens/Console/Tenants/TenantDetails/tenantMonitoringSlice";
|
import editTenantMonitoringReducer from "./screens/Console/Tenants/TenantDetails/tenantMonitoringSlice";
|
||||||
import editTenantAuditLoggingReducer from "./screens/Console/Tenants/TenantDetails/tenantAuditLogSlice";
|
import editTenantAuditLoggingReducer from "./screens/Console/Tenants/TenantDetails/tenantAuditLogSlice";
|
||||||
|
|
||||||
|
|
||||||
const rootReducer = combineReducers({
|
const rootReducer = combineReducers({
|
||||||
system: systemReducer,
|
system: systemReducer,
|
||||||
trace: traceReducer,
|
trace: traceReducer,
|
||||||
|
|||||||
@@ -171,6 +171,7 @@ export const {
|
|||||||
export const selDistSet = (state: AppState) => state.system.distributedSetup;
|
export const selDistSet = (state: AppState) => state.system.distributedSetup;
|
||||||
export const selSiteRep = (state: AppState) => state.system.siteReplicationInfo;
|
export const selSiteRep = (state: AppState) => state.system.siteReplicationInfo;
|
||||||
export const selOpMode = (state: AppState) => state.system.operatorMode;
|
export const selOpMode = (state: AppState) => state.system.operatorMode;
|
||||||
export const selShowMarketplace = (state: AppState) => state.system.showMarketplace;
|
export const selShowMarketplace = (state: AppState) =>
|
||||||
|
state.system.showMarketplace;
|
||||||
|
|
||||||
export default systemSlice.reducer;
|
export default systemSlice.reducer;
|
||||||
|
|||||||
@@ -9132,10 +9132,10 @@ prelude-ls@~1.1.2:
|
|||||||
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
|
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
|
||||||
integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==
|
integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==
|
||||||
|
|
||||||
prettier@2.6.2:
|
prettier@2.7.1:
|
||||||
version "2.6.2"
|
version "2.7.1"
|
||||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.6.2.tgz#e26d71a18a74c3d0f0597f55f01fb6c06c206032"
|
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64"
|
||||||
integrity sha512-PkUpF+qoXTqhOeWL9fu7As8LXsIUZ1WYaJiY/a7McAQzxjk82OF0tibkFXVCDImZtWxbvojFjerkiLb0/q8mew==
|
integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==
|
||||||
|
|
||||||
pretty-bytes@^5.3.0, pretty-bytes@^5.4.1:
|
pretty-bytes@^5.3.0, pretty-bytes@^5.4.1:
|
||||||
version "5.6.0"
|
version "5.6.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user