@kineticdata/bundle-queue 5.1.0-rc.2 → 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.
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { compose, withHandlers, withProps, withState } from 'recompose';
|
|
4
3
|
import { connect } from '../../redux/store';
|
|
@@ -18,6 +17,7 @@ export var QueueListSelectionComponent = function QueueListSelectionComponent(_r
|
|
|
18
17
|
toggleSelectedItem = _ref.toggleSelectedItem,
|
|
19
18
|
assignUnavailable = _ref.assignUnavailable,
|
|
20
19
|
assignTooltip = _ref.assignTooltip,
|
|
20
|
+
workHidden = _ref.workHidden,
|
|
21
21
|
workUnavailable = _ref.workUnavailable,
|
|
22
22
|
workTooltip = _ref.workTooltip,
|
|
23
23
|
action = _ref.action,
|
|
@@ -27,8 +27,7 @@ export var QueueListSelectionComponent = function QueueListSelectionComponent(_r
|
|
|
27
27
|
handleWorkSubmit = _ref.handleWorkSubmit,
|
|
28
28
|
assignments = _ref.assignments,
|
|
29
29
|
isMobile = _ref.isMobile,
|
|
30
|
-
refresh = _ref.refresh
|
|
31
|
-
bulkWorkEnabled = _ref.bulkWorkEnabled;
|
|
30
|
+
refresh = _ref.refresh;
|
|
32
31
|
return /*#__PURE__*/React.createElement("div", {
|
|
33
32
|
className: "queue-controls"
|
|
34
33
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -55,7 +54,7 @@ export var QueueListSelectionComponent = function QueueListSelectionComponent(_r
|
|
|
55
54
|
target: "bulk-assign-btn",
|
|
56
55
|
delay: 0,
|
|
57
56
|
trigger: "hover focus"
|
|
58
|
-
}, /*#__PURE__*/React.createElement(I18n, null, assignTooltip)),
|
|
57
|
+
}, /*#__PURE__*/React.createElement(I18n, null, assignTooltip)), !workHidden && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
59
58
|
id: "bulk-work-btn",
|
|
60
59
|
type: "button",
|
|
61
60
|
className: classNames('btn btn-icon', {
|
|
@@ -105,8 +104,7 @@ var mapStateToProps = function mapStateToProps(state, props) {
|
|
|
105
104
|
selectedList: state.queue.selectedList,
|
|
106
105
|
forms: state.queueApp.forms,
|
|
107
106
|
teams: state.queueApp.allTeams,
|
|
108
|
-
isMobile: state.app.layoutSize === 'small'
|
|
109
|
-
bulkWorkEnabled: state.queueApp.bulkWorkEnabled
|
|
107
|
+
isMobile: state.app.layoutSize === 'small'
|
|
110
108
|
};
|
|
111
109
|
};
|
|
112
110
|
|
|
@@ -121,6 +119,7 @@ export var QueueListSelection = compose(connect(mapStateToProps, mapDispatchToPr
|
|
|
121
119
|
var addProps = {
|
|
122
120
|
assignUnavailable: false,
|
|
123
121
|
assignTooltip: null,
|
|
122
|
+
workHidden: true,
|
|
124
123
|
workUnavailable: false,
|
|
125
124
|
workTooltip: null,
|
|
126
125
|
assignments: []
|
|
@@ -133,18 +132,12 @@ export var QueueListSelection = compose(connect(mapStateToProps, mapDispatchToPr
|
|
|
133
132
|
var key = "".concat(item.form.slug, "_").concat(item.values['Assigned Team']);
|
|
134
133
|
|
|
135
134
|
if (!map.has(key)) {
|
|
136
|
-
return map.set(key,
|
|
137
|
-
return form.slug === item.form.slug;
|
|
138
|
-
}), item]);
|
|
135
|
+
return map.set(key, item);
|
|
139
136
|
}
|
|
140
137
|
|
|
141
138
|
return map;
|
|
142
|
-
}, Map()).map(function (
|
|
143
|
-
|
|
144
|
-
form = _ref3[0],
|
|
145
|
-
item = _ref3[1];
|
|
146
|
-
|
|
147
|
-
return selectAssignmentTeams(props.teams, form, item);
|
|
139
|
+
}, Map()).map(function (item) {
|
|
140
|
+
return selectAssignmentTeams(props.teams, item.form, item);
|
|
148
141
|
}).toList(); // If there aren't any teams that all selected items can be assigned to,
|
|
149
142
|
// prevent the assign action.
|
|
150
143
|
|
|
@@ -186,26 +179,25 @@ export var QueueListSelection = compose(connect(mapStateToProps, mapDispatchToPr
|
|
|
186
179
|
return item.form.slug;
|
|
187
180
|
}).toList()); // If all items are for a single form, get the from
|
|
188
181
|
|
|
189
|
-
var selectedForm = uniqueSelectedForms.size === 1 && props.
|
|
190
|
-
return form.slug === uniqueSelectedForms.first();
|
|
191
|
-
}); // If multiple forms have been selected, prevent the work action.
|
|
182
|
+
var selectedForm = uniqueSelectedForms.size === 1 && props.selectedList.first().form; // Show work button if any of the selected items support bulk operations
|
|
192
183
|
|
|
193
|
-
if (
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
// prevent the work action.
|
|
198
|
-
else if (!selectedForm.fields || !selectedForm.fields.some(function (field) {
|
|
199
|
-
return field.name === 'Bulk Action';
|
|
200
|
-
})) {
|
|
201
|
-
addProps.workUnavailable = true;
|
|
202
|
-
addProps.workTooltip = "The form of the selected items doesn't support the bulk work action.";
|
|
203
|
-
} // If the selected items aren't all assigned to me, prevent the work action.
|
|
204
|
-
else if (props.selectedList.some(function (item) {
|
|
205
|
-
return item.values['Assigned Individual'] !== props.profile.username;
|
|
184
|
+
if (!!props.selectedList.find(function (item) {
|
|
185
|
+
return item.form && item.form.fields && item.form.fields.some(function (field) {
|
|
186
|
+
return field.name === 'Bulk Action';
|
|
187
|
+
});
|
|
206
188
|
})) {
|
|
207
|
-
addProps.
|
|
208
|
-
|
|
189
|
+
addProps.workHidden = false; // If multiple forms have been selected, prevent the work action.
|
|
190
|
+
|
|
191
|
+
if (!selectedForm) {
|
|
192
|
+
addProps.workUnavailable = true;
|
|
193
|
+
addProps.workTooltip = 'All selected items must be from the same form, and the form must support bulk work actions.';
|
|
194
|
+
} // If the selected items aren't all assigned to me, prevent the work action.
|
|
195
|
+
else if (props.selectedList.some(function (item) {
|
|
196
|
+
return item.values['Assigned Individual'] !== props.profile.username;
|
|
197
|
+
})) {
|
|
198
|
+
addProps.workUnavailable = true;
|
|
199
|
+
addProps.workTooltip = 'The selected items must all be assigned to you.';
|
|
200
|
+
}
|
|
209
201
|
}
|
|
210
202
|
}
|
|
211
203
|
|
|
@@ -137,7 +137,6 @@ export var State = Record({
|
|
|
137
137
|
teamFilters: List(),
|
|
138
138
|
myFilters: List(),
|
|
139
139
|
forms: List(),
|
|
140
|
-
bulkWorkEnabled: false,
|
|
141
140
|
loading: true,
|
|
142
141
|
error: null
|
|
143
142
|
});
|
|
@@ -176,12 +175,6 @@ export var reducer = function reducer() {
|
|
|
176
175
|
return filter.name;
|
|
177
176
|
})).set('myFilters', List(payload.myFilters)).set('forms', payload.forms.filter(function (f) {
|
|
178
177
|
return f.status === 'Active' || f.status === 'New';
|
|
179
|
-
})).set('bulkWorkEnabled', payload.forms.filter(function (f) {
|
|
180
|
-
return f.status === 'Active' || f.status === 'New';
|
|
181
|
-
}).some(function (f) {
|
|
182
|
-
return f.fields.some(function (field) {
|
|
183
|
-
return field.name === 'Bulk Action';
|
|
184
|
-
});
|
|
185
178
|
})).set('loading', false);
|
|
186
179
|
|
|
187
180
|
case types.FETCH_APP_DATA_FAILURE:
|
package/lib/redux/sagas/queue.js
CHANGED
|
@@ -20,7 +20,7 @@ import { addToastAlert } from '@kineticdata/bundle-common';
|
|
|
20
20
|
import { types, actions } from '../modules/queue';
|
|
21
21
|
export var ERROR_STATUS_STRING = 'There was a problem retrieving items.';
|
|
22
22
|
export var SUBMISSION_INCLUDES = 'details,values,attributes,form,form.kapp,children,children.details,children.form,children.form.kapp,children.values,form.attributes,parent,parent.details,parent.values,parent.form,parent.form.kapp';
|
|
23
|
-
export var SUBMISSION_LIST_INCLUDES = ['details', 'form', 'form.kapp', 'values'];
|
|
23
|
+
export var SUBMISSION_LIST_INCLUDES = ['details', 'form', 'form.kapp', 'form.attributes', 'form.fields', 'form.fields.details', 'values'];
|
|
24
24
|
|
|
25
25
|
var calculateTeams = function calculateTeams(myTeams, teams) {
|
|
26
26
|
return teams.isEmpty() ? myTeams.map(function (t) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kineticdata/bundle-queue",
|
|
3
|
-
"version": "5.1.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"main:src": "./src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"prepublishOnly": "yarn build"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@kineticdata/bundle-common": "5.1.0
|
|
21
|
-
"@kineticdata/react": "5.1.0
|
|
20
|
+
"@kineticdata/bundle-common": "5.1.0",
|
|
21
|
+
"@kineticdata/react": "5.1.0",
|
|
22
22
|
"@reach/router": "git://github.com/kineticdata/router.git",
|
|
23
23
|
"axios": "^0.21.1",
|
|
24
24
|
"bootstrap": "^4.3.1",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"eslintConfig": {
|
|
66
66
|
"extends": "react-app"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "5040d157c5e19e593fc9f9ca36407058a8d927c5"
|
|
69
69
|
}
|