@kineticdata/bundle-queue 5.0.16 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/styles/_assignments.scss +5 -1
- package/assets/styles/_queue_item_details.scss +23 -37
- package/assets/styles/_queue_list.scss +179 -90
- package/assets/styles/_status.scss +6 -17
- package/assets/styles/_submissions.scss +60 -9
- package/assets/styles/_temp.scss +4 -0
- package/lib/App.js +71 -72
- package/lib/components/FormPreview.js +62 -0
- package/lib/components/filter_menu/FilterMenuAbstract.js +112 -70
- package/lib/components/filter_menu/FilterMenuModal.js +316 -0
- package/lib/components/filter_menu/FilterMenuToolbar.js +309 -0
- package/lib/components/new_item_menu/NewItemMenu.js +15 -4
- package/lib/components/new_item_menu/NewItemMenuContainer.js +5 -12
- package/lib/components/queue_item/QueueItem.js +118 -39
- package/lib/components/queue_item/QueueItemDetails.js +179 -132
- package/lib/components/queue_list/BulkAssignModal.js +93 -0
- package/lib/components/queue_list/BulkStatusModal.js +169 -0
- package/lib/components/queue_list/BulkWorkModal.js +74 -0
- package/lib/components/queue_list/QueueList.js +52 -107
- package/lib/components/queue_list/QueueListContainer.js +35 -131
- package/lib/components/queue_list/QueueListItem.js +113 -24
- package/lib/components/queue_list/QueueListPagination.js +105 -14
- package/lib/components/queue_list/QueueListSelection.js +251 -0
- package/lib/components/queue_list/QueueListSidebar.js +114 -0
- package/lib/components/settings/QueueSettings.js +19 -26
- package/lib/components/settings/Settings.js +29 -46
- package/lib/components/settings/forms/FormActivity.js +29 -40
- package/lib/components/settings/forms/FormList.js +19 -37
- package/lib/components/settings/forms/FormSettings.js +33 -48
- package/lib/components/settings/forms/FormSubmissions.js +30 -47
- package/lib/components/shared/PageTitle.js +10 -3
- package/lib/components/shared/StatusContent.js +29 -28
- package/lib/components/work_menu/WorkMenu.js +4 -5
- package/lib/index.js +3 -0
- package/lib/records.js +5 -4
- package/lib/redux/modules/filterMenu.js +13 -11
- package/lib/redux/modules/queue.js +193 -89
- package/lib/redux/modules/queueApp.js +8 -2
- package/lib/redux/sagas/queue.js +518 -179
- package/lib/utils.js +0 -14
- package/package.json +4 -5
package/lib/App.js
CHANGED
|
@@ -3,21 +3,20 @@ import React from 'react';
|
|
|
3
3
|
import { Redirect, Router } from '@reach/router';
|
|
4
4
|
import { compose, lifecycle, withHandlers } from 'recompose';
|
|
5
5
|
import { connect } from './redux/store';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { ErrorMessage, LoadingMessage } from '@kineticdata/bundle-common';
|
|
7
|
+
import { is } from 'immutable';
|
|
8
8
|
import { I18n } from '@kineticdata/react';
|
|
9
|
+
import matchPath from 'rudy-match-path';
|
|
9
10
|
import { actions, selectMyTeamForms } from './redux/modules/queueApp';
|
|
10
11
|
import { actions as queueActions } from './redux/modules/queue';
|
|
11
|
-
import { actions as filterMenuActions } from './redux/modules/filterMenu';
|
|
12
12
|
import { actions as formsActions } from './redux/modules/forms';
|
|
13
13
|
import { PageTitle } from './components/shared/PageTitle';
|
|
14
|
-
import { Sidebar } from './components/Sidebar';
|
|
15
|
-
import { Sidebar as SettingsSidebar } from './components/settings/Sidebar';
|
|
16
14
|
import { QueueItemContainer } from './components/queue_item/QueueItem';
|
|
17
15
|
import { QueueListContainer } from './components/queue_list/QueueListContainer';
|
|
18
16
|
import { NewItemMenuContainer } from './components/new_item_menu/NewItemMenuContainer';
|
|
19
17
|
import { WorkMenuContainer } from './components/work_menu/WorkMenu';
|
|
20
18
|
import { Settings } from './components/settings/Settings';
|
|
19
|
+
import { FormPreview } from './components/FormPreview';
|
|
21
20
|
|
|
22
21
|
var CustomRedirect = function CustomRedirect(props) {
|
|
23
22
|
return /*#__PURE__*/React.createElement(Redirect, {
|
|
@@ -27,67 +26,61 @@ var CustomRedirect = function CustomRedirect(props) {
|
|
|
27
26
|
};
|
|
28
27
|
|
|
29
28
|
var AppComponent = function AppComponent(props) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
from: "queue/filter/__show__/details/:id/summary",
|
|
86
|
-
to: "".concat(props.appLocation, "/item/:id"),
|
|
87
|
-
noThrow: true
|
|
88
|
-
})), /*#__PURE__*/React.createElement(NewItemMenuContainer, null), /*#__PURE__*/React.createElement(WorkMenuContainer, null)))
|
|
89
|
-
});
|
|
90
|
-
}
|
|
29
|
+
return props.render({
|
|
30
|
+
classNames: {
|
|
31
|
+
header: matchPath(props.pathname, {
|
|
32
|
+
path: "".concat(props.appLocation, "/(list|team|custom|adhoc)/:name?"),
|
|
33
|
+
exact: true
|
|
34
|
+
}) ? 'app-header--sticky' : ''
|
|
35
|
+
},
|
|
36
|
+
main: props.error ? /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
37
|
+
title: "Unexpected Error",
|
|
38
|
+
message: "Sorry, an unexpected error has occurred!"
|
|
39
|
+
}) : props.loading ? /*#__PURE__*/React.createElement(LoadingMessage, null) : /*#__PURE__*/React.createElement(I18n, null, /*#__PURE__*/React.createElement("main", {
|
|
40
|
+
className: "package-layout package-layout--queue"
|
|
41
|
+
}, /*#__PURE__*/React.createElement(PageTitle, {
|
|
42
|
+
parts: ['Loading...']
|
|
43
|
+
}), /*#__PURE__*/React.createElement(Router, null, /*#__PURE__*/React.createElement(Settings, {
|
|
44
|
+
path: "settings/*"
|
|
45
|
+
}), /*#__PURE__*/React.createElement(QueueListContainer, {
|
|
46
|
+
path: "list/:filter"
|
|
47
|
+
}), /*#__PURE__*/React.createElement(QueueListContainer, {
|
|
48
|
+
path: "team/:filter"
|
|
49
|
+
}), /*#__PURE__*/React.createElement(QueueListContainer, {
|
|
50
|
+
path: "custom/:filter"
|
|
51
|
+
}), /*#__PURE__*/React.createElement(QueueListContainer, {
|
|
52
|
+
path: "adhoc"
|
|
53
|
+
}), /*#__PURE__*/React.createElement(QueueItemContainer, {
|
|
54
|
+
path: "list/:filter/item/:id"
|
|
55
|
+
}), /*#__PURE__*/React.createElement(QueueItemContainer, {
|
|
56
|
+
path: "team/:filter/item/:id"
|
|
57
|
+
}), /*#__PURE__*/React.createElement(QueueItemContainer, {
|
|
58
|
+
path: "custom/:filter/item/:id"
|
|
59
|
+
}), /*#__PURE__*/React.createElement(QueueItemContainer, {
|
|
60
|
+
path: "adhoc/item/:id"
|
|
61
|
+
}), /*#__PURE__*/React.createElement(QueueItemContainer, {
|
|
62
|
+
path: "item/:id"
|
|
63
|
+
}), /*#__PURE__*/React.createElement(Redirect, {
|
|
64
|
+
from: "/",
|
|
65
|
+
to: "".concat(props.appLocation, "/list/Mine"),
|
|
66
|
+
noThrow: true
|
|
67
|
+
}), /*#__PURE__*/React.createElement(Redirect, {
|
|
68
|
+
from: "submissions/:id",
|
|
69
|
+
to: "".concat(props.appLocation, "/item/:id"),
|
|
70
|
+
noThrow: true
|
|
71
|
+
}), /*#__PURE__*/React.createElement(CustomRedirect, {
|
|
72
|
+
path: "forms/:formSlug/submissions/:id",
|
|
73
|
+
appLocation: props.appLocation
|
|
74
|
+
}), /*#__PURE__*/React.createElement(Redirect, {
|
|
75
|
+
from: "queue/filter/__show__/details/:id/summary",
|
|
76
|
+
to: "".concat(props.appLocation, "/item/:id"),
|
|
77
|
+
noThrow: true
|
|
78
|
+
}), /*#__PURE__*/React.createElement(FormPreview, {
|
|
79
|
+
path: "forms/:formSlug/:id"
|
|
80
|
+
}), /*#__PURE__*/React.createElement(FormPreview, {
|
|
81
|
+
path: "forms/:formSlug"
|
|
82
|
+
})), /*#__PURE__*/React.createElement(NewItemMenuContainer, null), /*#__PURE__*/React.createElement(WorkMenuContainer, null)))
|
|
83
|
+
});
|
|
91
84
|
};
|
|
92
85
|
|
|
93
86
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
@@ -102,21 +95,23 @@ var mapStateToProps = function mapStateToProps(state, props) {
|
|
|
102
95
|
_ = _ref2[0],
|
|
103
96
|
filter = _ref2[1];
|
|
104
97
|
|
|
105
|
-
return [filter.name, state.queue.
|
|
98
|
+
return [filter.name, state.queue.counts.get(filter)];
|
|
106
99
|
}),
|
|
107
100
|
hasTeams: state.queueApp.myTeams.size > 0,
|
|
108
101
|
hasForms: selectMyTeamForms(state).filter(function (form) {
|
|
109
102
|
return form.type === 'Task';
|
|
110
103
|
}).length > 0,
|
|
111
|
-
appLocation: state.app.location
|
|
104
|
+
appLocation: state.app.location,
|
|
105
|
+
pathname: state.router.location.pathname
|
|
112
106
|
};
|
|
113
107
|
};
|
|
114
108
|
|
|
115
109
|
var mapDispatchToProps = {
|
|
110
|
+
setFilter: actions.setFilter,
|
|
116
111
|
fetchAppDataRequest: actions.fetchAppDataRequest,
|
|
117
|
-
|
|
112
|
+
resetList: queueActions.fetchListReset,
|
|
118
113
|
openNewItemMenu: queueActions.openNewItemMenu,
|
|
119
|
-
|
|
114
|
+
fetchListCountRequest: queueActions.fetchListCountRequest,
|
|
120
115
|
fetchFormsRequest: formsActions.fetchFormsRequest
|
|
121
116
|
};
|
|
122
117
|
var enhance = compose(connect(mapStateToProps, mapDispatchToProps), withHandlers({
|
|
@@ -135,10 +130,14 @@ var enhance = compose(connect(mapStateToProps, mapDispatchToProps), withHandlers
|
|
|
135
130
|
var _this = this;
|
|
136
131
|
|
|
137
132
|
if (!this.props.loading && prevProps.loading) {
|
|
133
|
+
// Fetch counts for default lists
|
|
138
134
|
this.props.defaultFilters.filter(function (filter) {
|
|
139
|
-
return !_this.props.
|
|
140
|
-
}).forEach(this.props.
|
|
135
|
+
return !_this.props.filter || !is(filter, _this.props.filter);
|
|
136
|
+
}).forEach(this.props.fetchListCountRequest);
|
|
141
137
|
}
|
|
138
|
+
},
|
|
139
|
+
componentWillUnmount: function componentWillUnmount() {
|
|
140
|
+
this.props.resetList();
|
|
142
141
|
}
|
|
143
142
|
}));
|
|
144
143
|
export var App = enhance(AppComponent);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Redirect } from '@reach/router';
|
|
3
|
+
import { compose, withHandlers, withState } from 'recompose';
|
|
4
|
+
import { CoreForm, I18n } from '@kineticdata/react';
|
|
5
|
+
import { connect } from '../redux/store';
|
|
6
|
+
import { PageTitle } from './shared/PageTitle';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
export var FormPreviewComponent = function FormPreviewComponent(_ref) {
|
|
9
|
+
var hasPreviewAccess = _ref.hasPreviewAccess,
|
|
10
|
+
kappSlug = _ref.kappSlug,
|
|
11
|
+
formSlug = _ref.formSlug,
|
|
12
|
+
id = _ref.id,
|
|
13
|
+
appLocation = _ref.appLocation,
|
|
14
|
+
handleLoaded = _ref.handleLoaded,
|
|
15
|
+
handleCreated = _ref.handleCreated,
|
|
16
|
+
formName = _ref.formName;
|
|
17
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
className: "page-container"
|
|
19
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
className: classNames('page-panel')
|
|
21
|
+
}, /*#__PURE__*/React.createElement(PageTitle, {
|
|
22
|
+
parts: ['Form Preview'],
|
|
23
|
+
breadcrumbs: [{
|
|
24
|
+
label: 'Home',
|
|
25
|
+
to: '/'
|
|
26
|
+
}, {
|
|
27
|
+
label: 'Queue',
|
|
28
|
+
to: appLocation
|
|
29
|
+
}],
|
|
30
|
+
title: /*#__PURE__*/React.createElement("div", null, formName && /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(I18n, null, formName), ' '), /*#__PURE__*/React.createElement("small", null, /*#__PURE__*/React.createElement(I18n, null, "(Form Preview)")))
|
|
31
|
+
}), hasPreviewAccess ? /*#__PURE__*/React.createElement(CoreForm, {
|
|
32
|
+
submission: id,
|
|
33
|
+
kapp: kappSlug,
|
|
34
|
+
form: formSlug,
|
|
35
|
+
loaded: handleLoaded,
|
|
36
|
+
created: handleCreated
|
|
37
|
+
}) : /*#__PURE__*/React.createElement(Redirect, {
|
|
38
|
+
to: appLocation,
|
|
39
|
+
noThrow: true
|
|
40
|
+
})));
|
|
41
|
+
};
|
|
42
|
+
export var handleLoaded = function handleLoaded(props) {
|
|
43
|
+
return function (form) {
|
|
44
|
+
props.setFormName(form.name());
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export var handleCreated = function handleCreated(props) {
|
|
48
|
+
return function (response) {
|
|
49
|
+
props.navigate(response.submission.id);
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export var mapStateToProps = function mapStateToProps(state, props) {
|
|
53
|
+
return {
|
|
54
|
+
kappSlug: state.app.kappSlug,
|
|
55
|
+
appLocation: state.app.location,
|
|
56
|
+
hasPreviewAccess: state.app.profile.spaceAdmin || state.app.kapp.authorization['Form Creation'] || state.app.kapp.authorization['Modification']
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export var FormPreview = compose(connect(mapStateToProps), withState('formName', 'setFormName', ''), withHandlers({
|
|
60
|
+
handleLoaded: handleLoaded,
|
|
61
|
+
handleCreated: handleCreated
|
|
62
|
+
}))(FormPreviewComponent);
|
|
@@ -5,8 +5,7 @@ import { isImmutable, List, Map, OrderedMap } from 'immutable';
|
|
|
5
5
|
import { actions as queueActions } from '../../redux/modules/queue';
|
|
6
6
|
import { actions } from '../../redux/modules/filterMenu';
|
|
7
7
|
import { actions as appActions } from '../../redux/modules/queueApp';
|
|
8
|
-
import {
|
|
9
|
-
import { validateDateRange } from './FilterMenuContainer';
|
|
8
|
+
import { DateRangeSelector } from '@kineticdata/bundle-common';
|
|
10
9
|
import moment from 'moment';
|
|
11
10
|
import { I18n } from '@kineticdata/react';
|
|
12
11
|
import { connect } from '../../redux/store';
|
|
@@ -25,10 +24,17 @@ var SORT_OPTIONS = OrderedMap([['createdAt', {
|
|
|
25
24
|
}], ['closedAt', {
|
|
26
25
|
label: 'Closed At',
|
|
27
26
|
id: 'sorted-by-closed-at'
|
|
28
|
-
}], ['Due Date', {
|
|
27
|
+
}], ['values[Due Date]', {
|
|
29
28
|
label: 'Due Date',
|
|
30
29
|
id: 'sorted-by-due-date'
|
|
31
30
|
}]]);
|
|
31
|
+
var SORT_DIRECTIONS = OrderedMap([['ASC', {
|
|
32
|
+
label: 'Ascending',
|
|
33
|
+
id: 'sorted-ascending'
|
|
34
|
+
}], ['DESC', {
|
|
35
|
+
label: 'Descending',
|
|
36
|
+
id: 'sorted-descending'
|
|
37
|
+
}]]);
|
|
32
38
|
|
|
33
39
|
var convertDateRangeValue = function convertDateRangeValue(dateRange) {
|
|
34
40
|
return !dateRange.custom ? dateRange.preset : {
|
|
@@ -52,11 +58,26 @@ var formatDate = function formatDate(date) {
|
|
|
52
58
|
};
|
|
53
59
|
|
|
54
60
|
var summarizeDateRange = function summarizeDateRange(range) {
|
|
55
|
-
return
|
|
61
|
+
return /*#__PURE__*/React.createElement(I18n, {
|
|
62
|
+
key: "summarizeDateRange",
|
|
63
|
+
render: function render(translate) {
|
|
64
|
+
return range.preset !== '' ? translate("".concat(formatTimeline(range.timeline), " in last ").concat(formatPreset(range.preset))) : range.custom ? "".concat(translate(formatTimeline(range.timeline)), " ").concat(formatDate(range.start), " - ").concat(formatDate(range.end)) : null;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
56
67
|
};
|
|
57
68
|
|
|
58
|
-
var
|
|
59
|
-
|
|
69
|
+
export var validateDateRange = function validateDateRange(filter) {
|
|
70
|
+
if (filter.dateRange.custom) {
|
|
71
|
+
if (filter.dateRange.start === '' && filter.dateRange.end === '') {
|
|
72
|
+
return 'Select a start and end date';
|
|
73
|
+
} else if (filter.dateRange.start === '' && filter.dateRange.end !== '') {
|
|
74
|
+
return 'Select a start date';
|
|
75
|
+
} else if (filter.dateRange.start !== '' && filter.dateRange.end === '') {
|
|
76
|
+
return 'Select an end date';
|
|
77
|
+
} else if (filter.dateRange.end < filter.dateRange.start) {
|
|
78
|
+
return 'Select an end date after the start date';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
60
81
|
};
|
|
61
82
|
|
|
62
83
|
var validateFilterName = function validateFilterName(filter, showing) {
|
|
@@ -150,11 +171,14 @@ var FilterMenuAbstractComponent = function FilterMenuAbstractComponent(props) {
|
|
|
150
171
|
value: convertDateRangeValue(props.currentFilter.dateRange),
|
|
151
172
|
onChange: props.setDateRange
|
|
152
173
|
})),
|
|
153
|
-
sortedByOptions: SORT_OPTIONS.
|
|
174
|
+
sortedByOptions: SORT_OPTIONS.filter(function (data, value) {
|
|
175
|
+
return !props.currentFilter.dateRange.preset && !props.currentFilter.dateRange.current || value === props.currentFilter.sortBy;
|
|
176
|
+
}).map(function (_ref, value) {
|
|
154
177
|
var label = _ref.label,
|
|
155
178
|
id = _ref.id;
|
|
156
|
-
return /*#__PURE__*/React.createElement(
|
|
157
|
-
key: id
|
|
179
|
+
return /*#__PURE__*/React.createElement(Fragment, {
|
|
180
|
+
key: id
|
|
181
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
158
182
|
htmlFor: id
|
|
159
183
|
}, /*#__PURE__*/React.createElement("input", {
|
|
160
184
|
type: "radio",
|
|
@@ -162,56 +186,89 @@ var FilterMenuAbstractComponent = function FilterMenuAbstractComponent(props) {
|
|
|
162
186
|
value: value,
|
|
163
187
|
name: "sorted-by",
|
|
164
188
|
checked: value === props.currentFilter.sortBy,
|
|
165
|
-
onChange: props.changeSortedBy
|
|
166
|
-
|
|
189
|
+
onChange: props.changeSortedBy,
|
|
190
|
+
disabled: props.currentFilter.dateRange.preset || props.currentFilter.dateRange.current
|
|
191
|
+
}), /*#__PURE__*/React.createElement(I18n, null, label)), value === props.currentFilter.sortBy && props.currentFilter.sortBy.startsWith('values') && /*#__PURE__*/React.createElement("small", {
|
|
192
|
+
className: "text-muted"
|
|
193
|
+
}, translate("Sorting by %s will exclude items for which the %s field doesn't exist.").replace(/%s/g, translate(label))));
|
|
194
|
+
}).toList().push(props.currentFilter.dateRange.preset || props.currentFilter.dateRange.current ? /*#__PURE__*/React.createElement("small", {
|
|
195
|
+
key: "info-msg",
|
|
196
|
+
className: "text-muted"
|
|
197
|
+
}, translate('Options restricted due to the selected date range.')) : null),
|
|
198
|
+
sortDirectionOptions: SORT_DIRECTIONS.map(function (_ref2, value) {
|
|
199
|
+
var label = _ref2.label,
|
|
200
|
+
id = _ref2.id;
|
|
201
|
+
return /*#__PURE__*/React.createElement("label", {
|
|
202
|
+
key: id,
|
|
203
|
+
htmlFor: id
|
|
204
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
205
|
+
type: "radio",
|
|
206
|
+
id: id,
|
|
207
|
+
value: value,
|
|
208
|
+
name: "sort-direction",
|
|
209
|
+
checked: value === props.currentFilter.sortDirection,
|
|
210
|
+
onChange: props.changeDirection
|
|
211
|
+
}), translate(label));
|
|
167
212
|
}).toList(),
|
|
168
|
-
groupedByOptions: /*#__PURE__*/React.createElement(AttributeSelectors.FieldSelect, {
|
|
169
|
-
forms: props.forms,
|
|
170
|
-
value: props.currentFilter.groupBy,
|
|
171
|
-
onChange: props.changeGroupedBy
|
|
172
|
-
}),
|
|
173
213
|
saveFilterOptions: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
|
|
174
214
|
htmlFor: "save-filter-name"
|
|
175
|
-
},
|
|
215
|
+
}, translate('Filter Name')), /*#__PURE__*/React.createElement("input", {
|
|
176
216
|
type: "text",
|
|
217
|
+
className: "form-control",
|
|
177
218
|
id: "save-filter-name",
|
|
178
219
|
value: props.currentFilter.name,
|
|
179
|
-
onChange: props.changeFilterName
|
|
220
|
+
onChange: props.changeFilterName,
|
|
221
|
+
placeholder: translate('New Filter Name')
|
|
180
222
|
})),
|
|
223
|
+
// Current Filter Summaries and Errors
|
|
224
|
+
currentTeamSummary: props.currentFilter.teams.map(translate).join(', '),
|
|
225
|
+
currentAssignmentSummary: translate(ASSIGNMENT_LABELS.get(props.currentFilter.assignments)),
|
|
226
|
+
currentStatusSummary: props.currentFilter.status.map(translate).join(', '),
|
|
227
|
+
currentDateRangeSummary: summarizeDateRange(props.currentFilter.dateRange),
|
|
228
|
+
currentSortedBySummary: [translate(SORT_OPTIONS.getIn([props.currentFilter.sortBy, 'label'])), translate(SORT_DIRECTIONS.getIn([props.currentFilter.sortDirection, 'label']))].filter(Boolean).join(' - '),
|
|
229
|
+
currentCreatedByMeChecked: props.currentFilter.createdByMe,
|
|
230
|
+
currentFilterName: props.currentFilter.name,
|
|
231
|
+
dateRangeError: validateDateRange(props.currentFilter),
|
|
232
|
+
filterNameError: validateFilterName(props.currentFilter, props.showing),
|
|
233
|
+
validations: [validateDateRange, validateFilterName].map(function (fn) {
|
|
234
|
+
return fn(props.currentFilter, props.showing);
|
|
235
|
+
}).filter(function (v) {
|
|
236
|
+
return v;
|
|
237
|
+
}),
|
|
238
|
+
messages: [validateDateRange, validateFilterName].map(function (fn) {
|
|
239
|
+
return fn(props.currentFilter, props.showing);
|
|
240
|
+
}).filter(function (v) {
|
|
241
|
+
return v;
|
|
242
|
+
}),
|
|
243
|
+
saveMessages: [props.checkFilterName].map(function (fn) {
|
|
244
|
+
return fn(props.currentFilter);
|
|
245
|
+
}).filter(function (v) {
|
|
246
|
+
return v;
|
|
247
|
+
}),
|
|
248
|
+
// Saved Filter Summaries
|
|
181
249
|
teamSummary: props.filter.teams.map(translate).join(', '),
|
|
182
250
|
assignmentSummary: translate(ASSIGNMENT_LABELS.get(props.filter.assignments)),
|
|
183
251
|
statusSummary: props.filter.status.map(translate).join(', '),
|
|
184
252
|
dateRangeSummary: summarizeDateRange(props.filter.dateRange),
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
groupDirection: props.groupDirection,
|
|
253
|
+
sortedBySummary: translate(SORT_OPTIONS.getIn([props.filter.sortBy, 'label']) || translate('Created At')),
|
|
254
|
+
// Functions and Other Props
|
|
255
|
+
toggleDirection: props.toggleDirection,
|
|
189
256
|
showing: props.showing,
|
|
190
257
|
toggleShowing: props.toggleShowing,
|
|
191
258
|
dirty: !props.currentFilter.equals(props.filter),
|
|
192
259
|
apply: props.applyFilter,
|
|
193
260
|
reset: props.resetFilter,
|
|
194
|
-
validations: [validateDateRange, validateFilterName].map(function (fn) {
|
|
195
|
-
return fn(props.currentFilter, props.showing);
|
|
196
|
-
}).filter(function (v) {
|
|
197
|
-
return v;
|
|
198
|
-
}),
|
|
199
261
|
hasTeams: props.hasTeams,
|
|
200
262
|
clearTeams: props.clearTeams,
|
|
201
263
|
clearAssignments: props.clearAssignments,
|
|
202
264
|
clearStatus: props.clearStatus,
|
|
203
|
-
clearDateRange:
|
|
204
|
-
clearGroupedBy: props.clearGroupedBy,
|
|
265
|
+
clearDateRange: props.clearDateRange,
|
|
205
266
|
toggleCreatedByMe: props.toggleCreatedByMe,
|
|
206
|
-
toggleSortDirection: props.toggleSortDirection,
|
|
207
|
-
toggleGroupDirection: props.toggleGroupDirection,
|
|
208
|
-
saveMessages: [props.checkFilterName].map(function (fn) {
|
|
209
|
-
return fn(props.currentFilter);
|
|
210
|
-
}).filter(function (v) {
|
|
211
|
-
return v;
|
|
212
|
-
}),
|
|
213
267
|
saveFilter: props.saveFilter,
|
|
214
|
-
removeFilter: props.removeFilter
|
|
268
|
+
removeFilter: props.removeFilter,
|
|
269
|
+
isOpen: props.isOpen,
|
|
270
|
+
openFilterMenu: props.openFilterMenu,
|
|
271
|
+
openNewItemMenu: props.openNewItemMenu
|
|
215
272
|
});
|
|
216
273
|
}
|
|
217
274
|
});
|
|
@@ -222,10 +279,9 @@ export var mapStateToProps = function mapStateToProps(state, props) {
|
|
|
222
279
|
myFilters: state.queueApp.myFilters,
|
|
223
280
|
currentFilter: state.filterMenu.get('currentFilter'),
|
|
224
281
|
showing: state.filterMenu.get('activeSection'),
|
|
282
|
+
isOpen: state.filterMenu.get('isOpen'),
|
|
225
283
|
teams: state.queueApp.myTeams,
|
|
226
284
|
hasTeams: state.queueApp.myTeams.size > 0,
|
|
227
|
-
sortDirection: state.queue.sortDirection,
|
|
228
|
-
groupDirection: state.queue.groupDirection,
|
|
229
285
|
forms: state.queueApp.forms,
|
|
230
286
|
location: state.app.location
|
|
231
287
|
};
|
|
@@ -242,16 +298,14 @@ export var mapDispatchToProps = {
|
|
|
242
298
|
setDateRangeTimeline: actions.setDateRangeTimeline,
|
|
243
299
|
setDateRange: actions.setDateRange,
|
|
244
300
|
setSortedBy: actions.setSortedBy,
|
|
245
|
-
|
|
301
|
+
setDirection: actions.setDirection,
|
|
246
302
|
setFilterName: actions.setFilterName,
|
|
247
|
-
setSortDirection: queueActions.setSortDirection,
|
|
248
|
-
setGroupDirection: queueActions.setGroupDirection,
|
|
249
|
-
setOffset: queueActions.setOffset,
|
|
250
303
|
push: push,
|
|
251
304
|
setAdhocFilter: queueActions.setAdhocFilter,
|
|
252
305
|
addPersonalFilter: appActions.addPersonalFilter,
|
|
253
306
|
updatePersonalFilter: appActions.updatePersonalFilter,
|
|
254
|
-
removePersonalFilter: appActions.removePersonalFilter
|
|
307
|
+
removePersonalFilter: appActions.removePersonalFilter,
|
|
308
|
+
openNewItemMenu: queueActions.openNewItemMenu
|
|
255
309
|
};
|
|
256
310
|
|
|
257
311
|
var toggleTeam = function toggleTeam(props) {
|
|
@@ -290,9 +344,9 @@ var changeSortedBy = function changeSortedBy(props) {
|
|
|
290
344
|
};
|
|
291
345
|
};
|
|
292
346
|
|
|
293
|
-
var
|
|
347
|
+
var changeDirection = function changeDirection(props) {
|
|
294
348
|
return function (e) {
|
|
295
|
-
return props.
|
|
349
|
+
return props.setDirection(e.target.value);
|
|
296
350
|
};
|
|
297
351
|
};
|
|
298
352
|
|
|
@@ -304,8 +358,12 @@ var changeFilterName = function changeFilterName(props) {
|
|
|
304
358
|
|
|
305
359
|
var toggleShowing = function toggleShowing(props) {
|
|
306
360
|
return function (name) {
|
|
361
|
+
var persistChanges = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
307
362
|
return function () {
|
|
308
|
-
|
|
363
|
+
if (!persistChanges) {
|
|
364
|
+
props.resetFilter();
|
|
365
|
+
}
|
|
366
|
+
|
|
309
367
|
props.show(props.showing === name ? null : name);
|
|
310
368
|
};
|
|
311
369
|
};
|
|
@@ -343,25 +401,11 @@ var clearDateRange = function clearDateRange(props) {
|
|
|
343
401
|
};
|
|
344
402
|
};
|
|
345
403
|
|
|
346
|
-
var
|
|
347
|
-
return function () {
|
|
348
|
-
return props.applyFilter(props.filter["delete"]('groupBy'));
|
|
349
|
-
};
|
|
350
|
-
}; // const toggleCreatedByMe = props => () =>
|
|
351
|
-
// props.applyFilter(props.filter.update('createdByMe', b => !b));
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
var toggleSortDirection = function toggleSortDirection(props) {
|
|
355
|
-
return function () {
|
|
356
|
-
props.setSortDirection(props.sortDirection === 'ASC' ? 'DESC' : 'ASC');
|
|
357
|
-
props.setOffset(0);
|
|
358
|
-
};
|
|
359
|
-
};
|
|
360
|
-
|
|
361
|
-
var toggleGroupDirection = function toggleGroupDirection(props) {
|
|
404
|
+
var toggleDirection = function toggleDirection(props) {
|
|
362
405
|
return function () {
|
|
363
|
-
props.
|
|
364
|
-
|
|
406
|
+
return props.applyFilter(props.filter.update('sortDirection', function (dir) {
|
|
407
|
+
return dir === 'ASC' ? 'DESC' : 'ASC';
|
|
408
|
+
}));
|
|
365
409
|
};
|
|
366
410
|
};
|
|
367
411
|
|
|
@@ -370,7 +414,7 @@ var checkFilterName = function checkFilterName(props) {
|
|
|
370
414
|
if (props.myFilters.find(function (f) {
|
|
371
415
|
return f.name === filter.name;
|
|
372
416
|
})) {
|
|
373
|
-
return '
|
|
417
|
+
return 'A filter with that name already exists and will be updated';
|
|
374
418
|
}
|
|
375
419
|
};
|
|
376
420
|
};
|
|
@@ -408,15 +452,13 @@ export var FilterMenuAbstract = compose(connect(mapStateToProps, mapDispatchToPr
|
|
|
408
452
|
toggleCreatedByMe: toggleCreatedByMe,
|
|
409
453
|
changeTimeline: changeTimeline,
|
|
410
454
|
changeSortedBy: changeSortedBy,
|
|
411
|
-
|
|
455
|
+
changeDirection: changeDirection,
|
|
412
456
|
changeFilterName: changeFilterName,
|
|
413
|
-
|
|
414
|
-
toggleGroupDirection: toggleGroupDirection,
|
|
457
|
+
toggleDirection: toggleDirection,
|
|
415
458
|
clearTeams: clearTeams,
|
|
416
459
|
clearAssignments: clearAssignments,
|
|
417
460
|
clearStatus: clearStatus,
|
|
418
461
|
clearDateRange: clearDateRange,
|
|
419
|
-
clearGroupedBy: clearGroupedBy,
|
|
420
462
|
checkFilterName: checkFilterName,
|
|
421
463
|
saveFilter: saveFilter,
|
|
422
464
|
removeFilter: removeFilter
|