diff --git a/src/main/middlewares/passportAuthenticate.ts b/src/main/middlewares/passportAuthenticate.ts
index 40ebc105..80e1841f 100644
--- a/src/main/middlewares/passportAuthenticate.ts
+++ b/src/main/middlewares/passportAuthenticate.ts
@@ -29,20 +29,20 @@ export default {
if (!user) {
return res.redirect(`${baseURL}/login`);
}
- req.login(user, (loginErr) => {
+ return req.login(user, (loginErr) => {
if (loginErr) {
return next(loginErr);
}
- generateToken(user)
+ return generateToken(user)
.then((token: any) => {
req.session.token = token;
+ req.session.roles = _.get(user, ['roles']);
+ req.session.userDetails = _.pick(user, ['id', 'user_name', 'email_address', 'roles']);
+ return res.redirect(baseURL || '/');
})
.catch((tokenError) => {
return next(tokenError);
});
- req.session.roles = _.get(user, ['roles']);
- req.session.userDetails = _.pick(user, ['id', 'user_name', 'email_address', 'roles']);
- res.redirect(baseURL || '/');
});
})(req, res, next);
},
diff --git a/web-console-v2/src/components/Dropzone/PlaceholderContent.tsx b/web-console-v2/src/components/Dropzone/PlaceholderContent.tsx
index 9013689f..8a6e55a8 100644
--- a/web-console-v2/src/components/Dropzone/PlaceholderContent.tsx
+++ b/web-console-v2/src/components/Dropzone/PlaceholderContent.tsx
@@ -15,7 +15,6 @@ const PlaceholderContent = ({ imageUrl, mainText, subText, type }: PlaceholderCo
{type !== DropzopType.standard && (
= ({ onExpandToggle, expand }) => {
};
const handleLogout = () => {
- http.get(apiEndpoints.logout).then(() => {
- navigate(`/login`);
- }).catch(() => {
+ http.get(apiEndpoints.logout).then(() => {
+ localStorage.clear();
+ navigate(`/login`);
+ }).catch(() => {
showAlert('Failed to logout', 'error');
})
};
diff --git a/web-console-v2/src/components/form.tsx b/web-console-v2/src/components/form.tsx
index 70962f19..441253ab 100644
--- a/web-console-v2/src/components/form.tsx
+++ b/web-console-v2/src/components/form.tsx
@@ -218,7 +218,6 @@ const MUIForm = forwardRef((props: any, ref: any) => {
{
- return (
-
-
-
-
- );
-};
-
-export default UploadPage;
diff --git a/web-console-v2/src/pages/alertManager/components/NotificationComponent.tsx b/web-console-v2/src/pages/alertManager/components/NotificationComponent.tsx
index 79e9debf..97a0001e 100644
--- a/web-console-v2/src/pages/alertManager/components/NotificationComponent.tsx
+++ b/web-console-v2/src/pages/alertManager/components/NotificationComponent.tsx
@@ -47,7 +47,7 @@ const NotificationComponent = (props: any) => {
label: "Notification Channels",
type: "autocomplete",
required: true,
- selectOptions: _.concat([{ label: 'none', value: null }], notificationFieldOptions),
+ selectOptions: notificationFieldOptions,
tooltip: "Select the channel for notification delivery"
},
];
@@ -89,7 +89,7 @@ const NotificationComponent = (props: any) => {
/>
-
+
}
@@ -103,12 +103,12 @@ const NotificationComponent = (props: any) => {
navigate('/home/alertChannels')}
+ onClick={() => navigate('/home/alertChannels/new')}
variant="contained"
size="large"
sx={{ width: 'auto' }}
>
-
+
Create Notification Channel
diff --git a/web-console-v2/src/pages/alertManager/components/QueryBuilder.tsx b/web-console-v2/src/pages/alertManager/components/QueryBuilder.tsx
index 31fa2cb7..40c34570 100644
--- a/web-console-v2/src/pages/alertManager/components/QueryBuilder.tsx
+++ b/web-console-v2/src/pages/alertManager/components/QueryBuilder.tsx
@@ -18,10 +18,12 @@ const QueryBuilder = (props: any) => {
if (!_.isEmpty(existingState)) {
const operatorType = _.get(existingState, "operator")
const thresholdValue = _.get(existingState, "threshold")
+ const metricId = _.get(existingState, "id") || ""
+
if (_.includes(["within_range", "outside_range"], operatorType)) {
- return { ..._.omit(existingState, ["threshold"]), threshold_from: _.get(thresholdValue, 0), threshold_to: _.get(thresholdValue, 1) }
+ return { ..._.omit(existingState, ["threshold"]), threshold_from: _.get(thresholdValue, 0), threshold_to: _.get(thresholdValue, 1), metric: metricId }
}
- return { ..._.omit(existingState, ["threshold_from", "threshold_to"]), threshold: _.get(thresholdValue, 0) }
+ return { ..._.omit(existingState, ["threshold_from", "threshold_to"]), threshold: _.get(thresholdValue, 0), metric: metricId }
}
return {}
});
@@ -68,18 +70,18 @@ const QueryBuilder = (props: any) => {
if (selectedSubComponent) {
const filteredMetrics = _.filter(supportedMetrics, (supportedMetric) => supportedMetric.subComponent == selectedSubComponent);
return _.map(filteredMetrics, (supportedMetric) => {
- const { alias, metric } = supportedMetric;
+ const { alias, id } = supportedMetric;
return {
label: alias,
- value: metric
+ value: id
};
});
}
return _.map(supportedMetrics, (supportedMetric) => {
- const { alias, metric } = supportedMetric;
+ const { alias, id } = supportedMetric;
return {
label: alias,
- value: metric
+ value: id
};
});
};
@@ -264,7 +266,7 @@ const QueryBuilder = (props: any) => {
{runQuery && (
-
+
)}
>
@@ -301,4 +303,4 @@ const QueryBuilder = (props: any) => {
>
}
-export default QueryBuilder;
\ No newline at end of file
+export default React.memo(QueryBuilder);
\ No newline at end of file
diff --git a/web-console-v2/src/pages/alertManager/components/RuleLabels.tsx b/web-console-v2/src/pages/alertManager/components/RuleLabels.tsx
index 48b982bc..d8838f0d 100644
--- a/web-console-v2/src/pages/alertManager/components/RuleLabels.tsx
+++ b/web-console-v2/src/pages/alertManager/components/RuleLabels.tsx
@@ -165,7 +165,7 @@ const LabelComponent = (props: any) => {
@@ -114,9 +140,9 @@ const ImportDailog = (props: any) => {
setDatasetId(e.target.value)}
+ onChange={(e) => setLocalDatasetId(e.target.value)}
required
- value={datasetId}
+ value={localDatasetId}
variant="outlined"
fullWidth
disabled