diff --git a/src/Pages/Incidents/constants.ts b/src/Pages/Incidents/constants.ts
index 928389c..e9300ba 100644
--- a/src/Pages/Incidents/constants.ts
+++ b/src/Pages/Incidents/constants.ts
@@ -145,3 +145,6 @@ export const initialState = {
isStatusPickerOpen: false,
isTeamPickerOpen: false,
};
+
+export const RESOLVE_STATUS = '4';
+export const DUPLICATE_STATUS = '5';
diff --git a/src/Pages/Incidents/index.tsx b/src/Pages/Incidents/index.tsx
index 187ddef..13bc374 100644
--- a/src/Pages/Incidents/index.tsx
+++ b/src/Pages/Incidents/index.tsx
@@ -6,6 +6,7 @@ import TabItem from '@navi/web-ui/lib-esm/components/Tabs/TabItem';
import Tabs from '@navi/web-ui/lib-esm/components/Tabs/Tabs';
import { SelectPicker } from '@navi/web-ui/lib/components';
import { ModalDialog, Typography } from '@navi/web-ui/lib/primitives';
+import { SelectPickerOptionProps } from '@navi/web-ui/lib/components/SelectPicker/types';
import GoToLinkIcon from '@src/assets/GoToLinkIcon';
import { ApiService } from '@src/services/api';
import ErrorBoundary from '@src/components/ErrorBoundary/ErrorBoundary';
@@ -24,6 +25,8 @@ import {
reducer,
actionTypes,
initialState,
+ DUPLICATE_STATUS,
+ RESOLVE_STATUS,
} from './constants';
import styles from './Incidents.module.scss';
@@ -277,7 +280,9 @@ const Incident: FC = () => {
});
};
- const handleSeveritySelectionChange = (selectedOption: any): void => {
+ const handleSeveritySelectionChange = (
+ selectedOption: SelectPickerOptionProps | SelectPickerOptionProps[],
+ ): void => {
if (selectedOption) {
toast('Updating ticket. Please wait a moment.', {
icon: ,
@@ -295,14 +300,15 @@ const Incident: FC = () => {
});
}
};
- const handleStatusSelectionChange = (selectedOption: any): void => {
+ const handleStatusSelectionChange = (
+ selectedOption: SelectPickerOptionProps | SelectPickerOptionProps[],
+ ): void => {
if (selectedOption) {
dispatch({ type: actionTypes.SET_IS_STATUS_PICKER_OPEN, payload: false });
const value = Array.isArray(selectedOption)
? selectedOption[0].value
: selectedOption.value;
-
- if (value === 4) {
+ if (value === RESOLVE_STATUS) {
dispatch({
type: actionTypes.SET_DIALOG_TEXT,
payload: 'Resolve incident',
@@ -312,7 +318,7 @@ const Incident: FC = () => {
payload: 'resolved',
});
dispatch({ type: actionTypes.SET_OPEN_DIALOG, payload: true });
- } else if (value === 5) {
+ } else if (value === DUPLICATE_STATUS) {
dispatch({
type: actionTypes.SET_DIALOG_TEXT,
payload: 'Duplicate incident',
@@ -333,7 +339,9 @@ const Incident: FC = () => {
}
}
};
- const handleTeamSelectionChange = (selectedOption: any): void => {
+ const handleTeamSelectionChange = (
+ selectedOption: SelectPickerOptionProps | SelectPickerOptionProps[],
+ ): void => {
if (selectedOption) {
dispatch({ type: actionTypes.SET_IS_TEAM_PICKER_OPEN, payload: false });
toast('Updating ticket. Please wait a moment.', {
@@ -350,7 +358,7 @@ const Incident: FC = () => {
};
const handleOpenConfirmationDailog = (
- selectedOption: any,
+ selectedOption: SelectPickerOptionProps | SelectPickerOptionProps[],
updateType: number,
): void => {
const currentValue =
@@ -360,10 +368,13 @@ const Incident: FC = () => {
? state.status?.value
: state.team?.value;
const currentState = currentValue.toString();
- if (currentState !== selectedOption.value) {
+ const selectedvalue = Array.isArray(selectedOption)
+ ? selectedOption[0].value
+ : selectedOption.value;
+ if (currentState !== selectedvalue) {
if (
updateType === 1 &&
- (selectedOption.value === 4 || selectedOption.value === 5)
+ (selectedvalue === RESOLVE_STATUS || selectedvalue === DUPLICATE_STATUS)
) {
handleStatusSelectionChange(selectedOption);
} else {
@@ -392,6 +403,16 @@ const Incident: FC = () => {
}
};
+ const handleGoToSlackChannel = () => {
+ console.log('hello');
+ const slackChannelURL = `https://go-navi.slack.com/archives/${state.incidentData?.slackChannel}`;
+ window.open(slackChannelURL, '_blank');
+ dispatch({
+ type: actionTypes.SET_OPEN_DIALOG,
+ payload: false,
+ });
+ };
+
const getUpdateValueText = () => {
switch (state.updateType) {
case 0:
@@ -411,7 +432,11 @@ const Incident: FC = () => {
teamsMap && state.team?.value ? teamsMap[state.team.value] : '-'
} `;
default:
- return ' unknown ';
+ return ` ${
+ severityMap && state.severity?.value
+ ? severityMap[state.severity.value]
+ : '-'
+ } `;
}
};
@@ -639,14 +664,7 @@ const Incident: FC = () => {
},
{
label: 'Go to slack channel',
- onClick: () => {
- const slackChannelURL = `https://go-navi.slack.com/archives/${state.incidentData?.slackChannel}`;
- window.open(slackChannelURL, '_blank');
- dispatch({
- type: actionTypes.SET_OPEN_DIALOG,
- payload: false,
- });
- },
+ onClick: handleGoToSlackChannel,
startAdornment: ,
},
]}