Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPMRPP-88780 || Increase the dashboard limit per project #3943

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions app/src/common/urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,8 @@ export const URLS = {
`${urlBase}data/${activeProject}/userphoto${getQueryParams({ login, loadThumbnail })}`,

dashboard: (activeProject, id) => `${urlBase}${activeProject}/dashboard/${id}`,
dashboards: (activeProject) =>
`${urlBase}${activeProject}/dashboard${getQueryParams({
'page.page': 1,
'page.size': 300,
})}`,
dashboards: (activeProject, params) =>
`${urlBase}${activeProject}/dashboard${getQueryParams({ ...params })}`,

widget: (activeProject, widgetId = '') => `${urlBase}${activeProject}/widget/${widgetId}`,
widgetMultilevel: (activeProject, widgetId, params) =>
Expand Down
2 changes: 2 additions & 0 deletions app/src/controllers/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ export {
dashboardFullScreenModeSelector,
loadingSelector,
totalDashboardsSelector,
dashboardPaginationSelector,
} from './selectors';
export {
DASHBOARDS_TABLE_VIEW,
DASHBOARDS_GRID_VIEW,
dashboardItemPropTypes,
CHANGE_FULL_SCREEN_MODE,
TOGGLE_FULL_SCREEN_MODE,
NAMESPACE,
} from './constants';
export { dashboardSagas } from './sagas';
5 changes: 4 additions & 1 deletion app/src/controllers/dashboard/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import { createSelector } from 'reselect';
import { activeDashboardIdSelector, createQueryParametersSelector } from 'controllers/pages';
import { NAMESPACE } from './constants';

const domainSelector = (state) => state.dashboards || {};
export const loadingSelector = (state) => domainSelector(state).loading || false;
Expand All @@ -40,4 +41,6 @@ export const totalDashboardsSelector = (state) =>

export const dashboardFullScreenModeSelector = (state) => domainSelector(state).fullScreenMode;

export const querySelector = createQueryParametersSelector();
Vadim73i marked this conversation as resolved.
Show resolved Hide resolved
export const querySelector = createQueryParametersSelector({ namespace: NAMESPACE });
Vadim73i marked this conversation as resolved.
Show resolved Hide resolved

export const dashboardPaginationSelector = (state) => domainSelector(state).pagination;
45 changes: 44 additions & 1 deletion app/src/pages/inside/dashboardPage/dashboardPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ import {
DASHBOARDS_TABLE_VIEW,
DASHBOARDS_GRID_VIEW,
loadingSelector,
NAMESPACE,
dashboardPaginationSelector,
} from 'controllers/dashboard';
import { DEFAULT_PAGINATION, PAGE_KEY, SIZE_KEY, withPagination } from 'controllers/pagination';
import { DASHBOARD_PAGE, DASHBOARD_PAGE_EVENTS } from 'components/main/analytics/events';
import { PaginationToolbar } from 'components/main/paginationToolbar';
import { DASHBOARD_EVENTS } from 'analyticsEvents/dashboardsPageEvents';
import { userInfoSelector } from 'controllers/user';
import { showModalAction } from 'controllers/modal';
Expand Down Expand Up @@ -89,6 +93,10 @@ const messages = defineMessages({
addDashboard: addDashboardAction,
},
)
@withPagination({
paginationSelector: dashboardPaginationSelector,
namespace: NAMESPACE,
})
Vadim73i marked this conversation as resolved.
Show resolved Hide resolved
@withFilter()
@injectIntl
@track({ page: DASHBOARD_PAGE })
Expand All @@ -110,6 +118,12 @@ export class DashboardPage extends Component {
getTrackingData: PropTypes.func,
}).isRequired,
loading: PropTypes.bool,
pageCount: PropTypes.number,
activePage: PropTypes.number,
itemCount: PropTypes.number,
pageSize: PropTypes.number,
onChangePage: PropTypes.func,
onChangePageSize: PropTypes.func,
};

static defaultProps = {
Expand All @@ -124,6 +138,12 @@ export class DashboardPage extends Component {
onFilterChange: () => {},
changeVisibilityType: () => {},
loading: false,
pageCount: null,
activePage: DEFAULT_PAGINATION[PAGE_KEY],
itemCount: null,
pageSize: DEFAULT_PAGINATION[SIZE_KEY],
onChangePage: () => {},
onChangePageSize: () => {},
};

onDeleteDashboardItem = (item) => {
Expand Down Expand Up @@ -200,7 +220,20 @@ export class DashboardPage extends Component {
};

render() {
const { gridType, userInfo, onFilterChange, filter, dashboardItems, loading } = this.props;
const {
gridType,
userInfo,
onFilterChange,
filter,
dashboardItems,
loading,
pageCount,
activePage,
itemCount,
pageSize,
onChangePage,
onChangePageSize,
} = this.props;

return (
<PageLayout>
Expand All @@ -226,6 +259,16 @@ export class DashboardPage extends Component {
onAddItem={this.onAddDashboardItem}
filter={filter}
/>
{!!pageCount && !loading && (
<PaginationToolbar
activePage={activePage}
itemCount={itemCount}
pageCount={pageCount}
pageSize={pageSize}
onChangePage={onChangePage}
onChangePageSize={onChangePageSize}
/>
)}
</PageSection>
</PageLayout>
);
Expand Down
Loading