Skip to content

Commit

Permalink
ADM-691: [frontend] fix: add request fields (#1143)
Browse files Browse the repository at this point in the history
* ADM-691: [frontend] fix: add request fields

* ADM-691: [frontend] fix: fix sonar cloud

* ADM-691: [frontend] fix: fix unit test

* ADM-691: [frontend] chore: modify sytle, rename field

* ADM-691: [frontend] fix: fix sonar issue

* ADM-691: [frontend] fix: remove unused code

---------

Co-authored-by: Leiqiuhong <qiuhong.lei@thoughtworks.com>
  • Loading branch information
neomgb and Leiqiuhong authored Mar 13, 2024
1 parent 0c3191f commit f775626
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ describe('MetricsStep', () => {
await waitFor(() => {
expect(screen.getByText(/crew settings/i)).toBeInTheDocument();
});
expect(screen.getByText(/board mapping/i)).toBeInTheDocument();
expect(screen.getByText(/board mappings/i)).toBeInTheDocument();
});

it('should show retry button when call get info timeout', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ describe('Report Step', () => {

describe('export board data', () => {
it('should not show export board button when not selecting board metrics', () => {
const { queryByText } = setup([REQUIRED_DATA_LIST[4]]);
const { queryByText } = setup([REQUIRED_DATA_LIST[5]]);

const exportPipelineButton = queryByText(EXPORT_BOARD_DATA);

Expand Down
20 changes: 19 additions & 1 deletion frontend/__tests__/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ export const MOCK_GENERATE_REPORT_REQUEST_PARAMS: ReportRequestDTO = {
targetFields: [{ key: 'parent', name: 'Parent', flag: false }],
doneColumn: ['Done'],
overrideFields: [{ key: '123', name: 'Story Point', flag: true }],
reworkTimesSetting: {
reworkState: 'Done',
excludedStates: [],
},
},
};

Expand Down Expand Up @@ -339,7 +343,7 @@ export const MOCK_GITHUB_VERIFY_RESPONSE = {
};

export const CREWS_SETTING = 'Crew settings';
export const BOARD_MAPPING = 'Board mapping';
export const BOARD_MAPPING = 'Board mappings';
export const CLASSIFICATION_SETTING = 'Classification setting';
export const REAL_DONE = 'Real done setting';
export const DEPLOYMENT_FREQUENCY_SETTINGS = 'Pipeline settings';
Expand Down Expand Up @@ -404,6 +408,19 @@ export const MOCK_REPORT_RESPONSE: ReportResponseDTO = {
},
],
},
rework: {
totalReworkTimes: 111,
reworkState: 'Done',
fromToDo: 111,
fromInDev: 111,
fromBlock: 111,
fromWaitingForTesting: 111,
fromTesting: 111,
fromReview: 111,
fromDone: 111,
totalReworkCards: 111,
reworkCardsRatio: 111,
},
deploymentFrequency: {
avgDeploymentFrequency: {
name: 'Average',
Expand Down Expand Up @@ -651,6 +668,7 @@ export const EMPTY_REPORT_VALUES: ReportResponseDTO = {
velocity: null,
classificationList: null,
cycleTime: null,
rework: null,
deploymentFrequency: null,
changeFailureRate: null,
meanTimeToRecovery: null,
Expand Down
13 changes: 13 additions & 0 deletions frontend/src/clients/report/ReportClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ export class ReportClient extends HttpClient {
},
],
},
rework: {
totalReworkTimes: 0,
reworkState: 'Done',
fromToDo: 0,
fromInDev: 0,
fromBlock: 0,
fromWaitingForTesting: 0,
fromTesting: 0,
fromReview: 0,
fromDone: 0,
totalReworkCards: 0,
reworkCardsRatio: 0,
},
classificationList: [
{
fieldName: '',
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/clients/report/dto/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,17 @@ export interface ReportRequestDTO {
assigneeFilter: string;
targetFields: { key: string; name: string; flag: boolean }[];
overrideFields: { key: string; name: string; flag: boolean }[];
reworkTimesSetting: ReworkSettingsRequest;
doneColumn: string[];
};
csvTimeStamp?: number;
}

interface ReworkSettingsRequest {
reworkState?: string | null;
excludedStates?: string[];
}

export interface BoardReportRequestDTO {
considerHoliday: boolean;
startTime: string | null;
Expand All @@ -66,6 +72,7 @@ export interface BoardReportRequestDTO {
assigneeFilter: string;
targetFields: { key: string; name: string; flag: boolean }[];
overrideFields: { key: string; name: string; flag: boolean }[];
reworkTimesSetting: ReworkSettingsRequest;
doneColumn: string[];
};
csvTimeStamp?: number;
Expand Down
15 changes: 15 additions & 0 deletions frontend/src/clients/report/dto/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Nullable } from '@src/utils/types';
export interface ReportResponseDTO {
velocity: Nullable<VelocityResponse>;
cycleTime: Nullable<CycleTimeResponse>;
rework: Nullable<ReworkTimeResponse>;
classificationList: Nullable<ClassificationResponse[]>;
deploymentFrequency: Nullable<DeploymentFrequencyResponse>;
meanTimeToRecovery: Nullable<MeanTimeToRecoveryResponse>;
Expand Down Expand Up @@ -40,6 +41,20 @@ export interface CycleTimeResponse {
swimlaneList: Array<Swimlane>;
}

export interface ReworkTimeResponse {
totalReworkTimes: number;
reworkState: string;
fromToDo: number;
fromInDev: number;
fromBlock: number;
fromWaitingForTesting: number;
fromTesting: number;
fromReview: number;
fromDone: number;
totalReworkCards: number;
reworkCardsRatio: number;
}

export interface ClassificationResponse {
fieldName: string;
pairList: Array<ClassificationNameValuePair>;
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/constants/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export enum METRICS_TITLE {
VELOCITY = 'Velocity',
CYCLE_TIME = 'Cycle Time',
CLASSIFICATION = 'Classification',
REWORK_TIMES = 'Rework times',
LEAD_TIME_FOR_CHANGES = 'Lead Time For Changes',
DEPLOYMENT_FREQUENCY = 'Deployment Frequency',
CHANGE_FAILURE_RATE = 'Change Failure Rate',
Expand Down Expand Up @@ -85,7 +86,12 @@ export const DORA_METRICS: string[] = [
REQUIRED_DATA.MEAN_TIME_TO_RECOVERY,
];

export const BOARD_METRICS: string[] = [REQUIRED_DATA.VELOCITY, REQUIRED_DATA.CYCLE_TIME, REQUIRED_DATA.CLASSIFICATION];
export const BOARD_METRICS: string[] = [
REQUIRED_DATA.VELOCITY,
REQUIRED_DATA.CYCLE_TIME,
REQUIRED_DATA.CLASSIFICATION,
REQUIRED_DATA.REWORK_TIMES,
];

export enum CONFIG_TITLE {
BOARD = 'Board',
Expand Down Expand Up @@ -152,9 +158,9 @@ export const REWORK_TIME_LIST = [
METRICS_CONSTANTS.analysisValue,
METRICS_CONSTANTS.inDevValue,
METRICS_CONSTANTS.blockValue,
METRICS_CONSTANTS.reviewValue,
METRICS_CONSTANTS.waitingValue,
METRICS_CONSTANTS.testingValue,
METRICS_CONSTANTS.reviewValue,
];

export const TOKEN_HELPER_TEXT = {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/containers/MetricsStep/Advance/style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const AdvancedTitleContainer = styled.div({
fontSize: '1rem',
lineHeight: '1.25rem',
fontWeight: '600',
marginRight: '1rem',
});

export const AdvancedContainer = styled('div')({
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/containers/MetricsStep/CycleTime/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const CycleTime = () => {
return (
<div aria-label='Cycle time settings section'>
<TitleAndTooltipContainer>
<MetricsSettingTitle title={'Board mapping'} />
<MetricsSettingTitle title={'Board mappings'} />
<TooltipContainer aria-label='tooltip' data-test-id={'tooltip'}>
<StyledTooltip arrow title={TIPS.CYCLE_TIME}>
<IconButton aria-label='info'>
Expand Down
1 change: 0 additions & 1 deletion frontend/src/containers/MetricsStep/CycleTime/style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export const TitleAndTooltipContainer = styled('div')({
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
gap: '1rem',
});

export const TooltipContainer = styled('div')({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function ReworkSettings() {

const MultiOptions = reworkTimesSettings.rework2State
? [
...REWORK_TIME_LIST.slice(REWORK_TIME_LIST.indexOf(reworkTimesSettings.rework2State as string) + 1),
...REWORK_TIME_LIST.slice(REWORK_TIME_LIST.indexOf(reworkTimesSettings.rework2State) + 1),
METRICS_CONSTANTS.doneValue,
]
: [];
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/containers/ReportStep/BoardMetrics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const BoardMetrics = ({
targetFields,
doneColumn,
assigneeFilter,
importedData: { importedAdvancedSettings },
importedData: { importedAdvancedSettings, reworkTimesSettings },
} = useAppSelector(selectMetricsContent);

const { metrics, calendarType } = configData.basic;
Expand Down Expand Up @@ -94,6 +94,10 @@ const BoardMetrics = ({
assigneeFilter,
targetFields: formatDuplicatedNameWithSuffix(targetFields),
doneColumn: getRealDoneStatus(cycleTimeSettings, cycleTimeSettingsType, doneColumn),
reworkTimesSetting: {
reworkState: reworkTimesSettings.rework2State,
excludedStates: reworkTimesSettings.excludeStates,
},
overrideFields: [
{
name: 'Story Points',
Expand Down

0 comments on commit f775626

Please sign in to comment.