Skip to content

Commit 745791a

Browse files
authored
Merge pull request #4226 from reportportal/rc/5.12.4
Merge rc/5.12.4 into develop
2 parents 3130b10 + b4c7c57 commit 745791a

File tree

11 files changed

+113
-63
lines changed

11 files changed

+113
-63
lines changed

app/src/controllers/dashboard/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ export {
3737
loadingSelector,
3838
totalDashboardsSelector,
3939
dashboardPaginationSelector,
40+
querySelector,
41+
getDashboardItemPageLinkSelector,
4042
} from './selectors';
4143
export {
4244
DASHBOARDS_TABLE_VIEW,

app/src/controllers/dashboard/sagas.js

+6
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
activeDashboardIdSelector,
3131
pageSelector,
3232
projectIdSelector,
33+
pagePropertiesSelector,
3334
} from 'controllers/pages';
3435
import { provideEcGA } from 'components/main/analytics/utils';
3536
import { formatEcDashboardData } from 'components/main/analytics/events/common/widgetPages/utils';
@@ -166,9 +167,13 @@ function* addDashboard({ payload }) {
166167
);
167168

168169
yield put(hideModalAction());
170+
const query = yield select(pagePropertiesSelector);
169171
yield put({
170172
type: PROJECT_DASHBOARD_ITEM_PAGE,
171173
payload: { projectId: activeProject, dashboardId: id },
174+
meta: {
175+
query,
176+
},
172177
});
173178
} catch (error) {
174179
if (isPreconfigured && onError) {
@@ -221,6 +226,7 @@ function* copyDashboardConfig({ payload: dashboard }) {
221226
yield put(showDefaultErrorNotification(error));
222227
}
223228
}
229+
224230
function* updateDashboard({ payload: dashboard }) {
225231
const activeProject = yield select(activeProjectSelector);
226232
const { name, description, id } = dashboard;

app/src/controllers/dashboard/selectors.js

+20-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515
*/
1616

1717
import { createSelector } from 'reselect';
18-
import { activeDashboardIdSelector, createQueryParametersSelector } from 'controllers/pages';
18+
import {
19+
activeDashboardIdSelector,
20+
pagePropertiesSelector,
21+
createQueryParametersSelector,
22+
PROJECT_DASHBOARD_ITEM_PAGE,
23+
} from 'controllers/pages';
24+
import { activeProjectSelector } from 'controllers/user';
1925

2026
const domainSelector = (state) => state.dashboards || {};
2127
export const loadingSelector = (state) => domainSelector(state).loading || false;
@@ -43,3 +49,16 @@ export const dashboardFullScreenModeSelector = (state) => domainSelector(state).
4349
export const querySelector = createQueryParametersSelector();
4450

4551
export const dashboardPaginationSelector = (state) => domainSelector(state).pagination;
52+
53+
export const getDashboardItemPageLinkSelector = (state) => (dashboardId) => {
54+
const activeProject = activeProjectSelector(state);
55+
const queryParams = pagePropertiesSelector(state);
56+
57+
return {
58+
type: PROJECT_DASHBOARD_ITEM_PAGE,
59+
payload: { projectId: activeProject, dashboardId },
60+
meta: {
61+
query: queryParams,
62+
},
63+
};
64+
};

app/src/pages/inside/common/dashboardPageHeader/dashboardPageHeader.jsx

+34-23
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ import classNames from 'classnames/bind';
2222
import { activeProjectSelector } from 'controllers/user';
2323
import {
2424
activeDashboardIdSelector,
25+
pagePropertiesSelector,
2526
PROJECT_DASHBOARD_PAGE,
26-
PROJECT_DASHBOARD_ITEM_PAGE,
2727
} from 'controllers/pages';
2828
import {
2929
dashboardItemsSelector,
3030
dashboardItemPropTypes,
3131
totalDashboardsSelector,
3232
loadingSelector,
33+
getDashboardItemPageLinkSelector,
3334
} from 'controllers/dashboard';
3435
import { InputDropdown } from 'components/inputs/inputDropdown';
3536
import { NavLink } from 'components/main/navLink';
@@ -53,53 +54,63 @@ const DASHBOARDS_LIMIT = 3000;
5354
activeItemId: activeDashboardIdSelector(state),
5455
totalDashboards: totalDashboardsSelector(state),
5556
isLoading: loadingSelector(state),
57+
getDashboardItemPageLink: getDashboardItemPageLinkSelector(state),
58+
query: pagePropertiesSelector(state),
5659
}))
5760
@injectIntl
5861
export class DashboardPageHeader extends Component {
5962
static propTypes = {
6063
intl: PropTypes.object.isRequired,
6164
projectId: PropTypes.string.isRequired,
65+
getDashboardItemPageLink: PropTypes.func.isRequired,
6266
activeItemId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
6367
dashboardsToDisplay: PropTypes.arrayOf(dashboardItemPropTypes),
6468
isLoading: PropTypes.bool,
6569
totalDashboards: PropTypes.number,
70+
query: PropTypes.object,
6671
};
6772

6873
static defaultProps = {
6974
activeItemId: '',
7075
dashboardsToDisplay: [],
7176
isLoading: true,
7277
totalDashboards: 0,
78+
query: {},
7379
};
7480

75-
getDashboardPageItem = () => ({
76-
label: (
77-
<NavLink
78-
exact
79-
to={{
80-
type: PROJECT_DASHBOARD_PAGE,
81-
payload: { projectId: this.props.projectId },
82-
}}
83-
className={cx('link')}
84-
activeClassName={cx('active-link')}
85-
>
86-
{this.props.intl.formatMessage(messages.allDashboardsTitle)}
87-
</NavLink>
88-
),
89-
value: DASHBOARD_PAGE_ITEM_VALUE,
90-
});
91-
92-
createDashboardLink = (dashboardId) => ({
93-
type: PROJECT_DASHBOARD_ITEM_PAGE,
94-
payload: { projectId: this.props.projectId, dashboardId },
95-
});
81+
getDashboardPageItem = () => {
82+
const {
83+
query,
84+
projectId,
85+
intl: { formatMessage },
86+
} = this.props;
87+
return {
88+
label: (
89+
<NavLink
90+
exact
91+
to={{
92+
type: PROJECT_DASHBOARD_PAGE,
93+
payload: { projectId },
94+
meta: {
95+
query,
96+
},
97+
}}
98+
className={cx('link')}
99+
activeClassName={cx('active-link')}
100+
>
101+
{formatMessage(messages.allDashboardsTitle)}
102+
</NavLink>
103+
),
104+
value: DASHBOARD_PAGE_ITEM_VALUE,
105+
};
106+
};
96107

97108
generateOptions = () =>
98109
[this.getDashboardPageItem()].concat(
99110
this.props.dashboardsToDisplay.map((item) => ({
100111
label: (
101112
<NavLink
102-
to={this.createDashboardLink(item.id)}
113+
to={this.props.getDashboardItemPageLink(item.id)}
103114
className={cx('link')}
104115
activeClassName={cx('active-link')}
105116
>

app/src/pages/inside/dashboardItemPage/dashboardItemPage.jsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import {
3939
PROJECT_DASHBOARD_PAGE,
4040
PROJECT_DASHBOARD_PRINT_PAGE,
4141
activeDashboardIdSelector,
42+
pagePropertiesSelector,
4243
} from 'controllers/pages';
4344
import { showModalAction } from 'controllers/modal';
4445
import { showNotification, NOTIFICATION_TYPES } from 'controllers/notification';
@@ -113,6 +114,7 @@ const messages = defineMessages({
113114
userInfo: userInfoSelector(state),
114115
fullScreenMode: dashboardFullScreenModeSelector(state),
115116
activeDashboardId: activeDashboardIdSelector(state),
117+
query: pagePropertiesSelector(state),
116118
}),
117119
{
118120
showModalAction,
@@ -146,11 +148,13 @@ export class DashboardItemPage extends Component {
146148
deleteDashboard: PropTypes.func.isRequired,
147149
editDashboard: PropTypes.func.isRequired,
148150
activeDashboardId: PropTypes.number,
151+
query: PropTypes.object,
149152
};
150153

151154
static defaultProps = {
152155
fullScreenMode: false,
153156
activeDashboardId: undefined,
157+
query: {},
154158
};
155159

156160
onDeleteDashboard = () => {
@@ -206,13 +210,16 @@ export class DashboardItemPage extends Component {
206210
};
207211

208212
getBreadcrumbs = () => {
209-
const { activeProject, intl } = this.props;
213+
const { activeProject, query, intl } = this.props;
210214
return [
211215
{
212216
title: intl.formatMessage(messages.pageTitle),
213217
link: {
214218
type: PROJECT_DASHBOARD_PAGE,
215219
payload: { projectId: activeProject },
220+
meta: {
221+
query,
222+
},
216223
},
217224
eventInfo: DASHBOARD_PAGE_EVENTS.BREADCRUMB_ALL_DASHBOARD,
218225
},

app/src/pages/inside/dashboardItemPage/modals/widgetWizardModal/widgetWizardContent/widgetWizardContent.jsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019 EPAM Systems
2+
* Copyright 2025 EPAM Systems
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -111,13 +111,17 @@ export class WidgetWizardContent extends Component {
111111
step: 0,
112112
};
113113
const {
114-
fetchDashboards,
115114
intl: { formatMessage },
116115
} = this.props;
117-
fetchDashboards();
118116
this.widgets = getWidgets(formatMessage);
119117
}
120118

119+
componentDidMount() {
120+
if (!this.props.activeDashboardId) {
121+
this.props.fetchDashboards();
122+
}
123+
}
124+
121125
onClickNextStep = () => {
122126
const {
123127
tracking,

app/src/pages/inside/dashboardPage/dashboardList/dashboardGrid/dashboardGrid.jsx

+6-8
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import React, { Fragment, Component } from 'react';
17+
import React, { Component } from 'react';
1818
import PropTypes from 'prop-types';
1919
import { injectIntl } from 'react-intl';
2020
import { DASHBOARD_PAGE_EVENTS } from 'components/main/analytics/events';
@@ -35,13 +35,11 @@ export class DashboardGrid extends Component {
3535
const { dashboardItems, intl, ...rest } = this.props;
3636

3737
return (
38-
<Fragment>
39-
<DashboardGridList
40-
dashboardList={dashboardItems}
41-
nameEventInfo={DASHBOARD_PAGE_EVENTS.DASHBOARD_NAME_CLICK}
42-
{...rest}
43-
/>
44-
</Fragment>
38+
<DashboardGridList
39+
dashboardList={dashboardItems}
40+
nameEventInfo={DASHBOARD_PAGE_EVENTS.DASHBOARD_NAME_CLICK}
41+
{...rest}
42+
/>
4543
);
4644
}
4745
}

app/src/pages/inside/dashboardPage/dashboardList/dashboardGrid/dashboardGridItem/dashboardGridItem.jsx

+5-6
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,15 @@ import track from 'react-tracking';
1919
import classNames from 'classnames/bind';
2020
import PropTypes from 'prop-types';
2121
import { connect } from 'react-redux';
22-
import { PROJECT_DASHBOARD_ITEM_PAGE } from 'controllers/pages';
23-
import { activeProjectSelector } from 'controllers/user';
22+
import { getDashboardItemPageLinkSelector } from 'controllers/dashboard/selectors';
2423
import { Icon } from 'components/main/icon';
2524
import { NavLink } from 'components/main/navLink';
2625
import styles from './dashboardGridItem.scss';
2726

2827
const cx = classNames.bind(styles);
2928

3029
@connect((state) => ({
31-
projectId: activeProjectSelector(state),
30+
getDashboardItemPageLink: getDashboardItemPageLinkSelector(state),
3231
}))
3332
@track()
3433
export class DashboardGridItem extends Component {
@@ -37,7 +36,6 @@ export class DashboardGridItem extends Component {
3736
}
3837

3938
static propTypes = {
40-
projectId: PropTypes.string.isRequired,
4139
item: PropTypes.object,
4240
onEdit: PropTypes.func,
4341
onDelete: PropTypes.func,
@@ -46,6 +44,7 @@ export class DashboardGridItem extends Component {
4644
trackEvent: PropTypes.func,
4745
getTrackingData: PropTypes.func,
4846
}).isRequired,
47+
getDashboardItemPageLink: PropTypes.func.isRequired,
4948
};
5049

5150
static defaultProps = {
@@ -72,13 +71,13 @@ export class DashboardGridItem extends Component {
7271
};
7372

7473
render() {
75-
const { item, projectId } = this.props;
74+
const { item, getDashboardItemPageLink } = this.props;
7675
const { name, description, owner, id } = item;
7776

7877
return (
7978
<div className={cx('grid-view')}>
8079
<NavLink
81-
to={{ type: PROJECT_DASHBOARD_ITEM_PAGE, payload: { projectId, dashboardId: id } }}
80+
to={getDashboardItemPageLink(id)}
8281
className={cx('grid-view-inner')}
8382
onClick={() => this.props.tracking.trackEvent(this.props.nameEventInfo)}
8483
>

app/src/pages/inside/dashboardPage/dashboardList/dashboardTable/dashboardTable.jsx

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019 EPAM Systems
2+
* Copyright 2025 EPAM Systems
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,10 +18,10 @@ import React, { Component, Fragment } from 'react';
1818
import classNames from 'classnames/bind';
1919
import PropTypes from 'prop-types';
2020
import { connect } from 'react-redux';
21-
import { activeProjectSelector } from 'controllers/user';
2221
import { injectIntl } from 'react-intl';
2322
import { Grid, ALIGN_CENTER } from 'components/main/grid';
2423
import { EmptyDashboards } from 'pages/inside/dashboardPage/dashboardList/EmptyDashboards';
24+
import { getDashboardItemPageLinkSelector } from 'controllers/dashboard';
2525
import { messages } from './messages';
2626
import {
2727
NameColumn,
@@ -37,16 +37,16 @@ const cx = classNames.bind(styles);
3737

3838
@injectIntl
3939
@connect((state) => ({
40-
projectId: activeProjectSelector(state),
40+
getDashboardItemPageLink: getDashboardItemPageLinkSelector(state),
4141
}))
4242
export class DashboardTable extends Component {
4343
static propTypes = {
4444
intl: PropTypes.object.isRequired,
45+
getDashboardItemPageLink: PropTypes.func.isRequired,
4546
onDeleteItem: PropTypes.func,
4647
onEditItem: PropTypes.func,
4748
onDuplicate: PropTypes.func,
4849
onAddItem: PropTypes.func,
49-
projectId: PropTypes.string,
5050
dashboardItems: PropTypes.array,
5151
loading: PropTypes.bool,
5252
filter: PropTypes.string,
@@ -57,14 +57,13 @@ export class DashboardTable extends Component {
5757
onEditItem: () => {},
5858
onDuplicate: () => {},
5959
onAddItem: () => {},
60-
projectId: '',
6160
dashboardItems: [],
6261
loading: false,
6362
filter: '',
6463
};
6564

6665
getTableColumns() {
67-
const { onDeleteItem, onEditItem, onDuplicate, intl, projectId } = this.props;
66+
const { onDeleteItem, onEditItem, onDuplicate, intl, getDashboardItemPageLink } = this.props;
6867

6968
return [
7069
{
@@ -74,7 +73,7 @@ export class DashboardTable extends Component {
7473
},
7574
component: NameColumn,
7675
customProps: {
77-
projectId,
76+
getLink: getDashboardItemPageLink,
7877
},
7978
},
8079
{

0 commit comments

Comments
 (0)