@kineticdata/react 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.
Files changed (88) hide show
  1. package/lib/apis/core/attributeDefinitions.js +3 -2
  2. package/lib/apis/core/authentication.js +13 -5
  3. package/lib/apis/core/backgroundJobs.js +22 -39
  4. package/lib/apis/core/fileResources.js +36 -0
  5. package/lib/apis/core/filestores.js +40 -0
  6. package/lib/apis/core/forms.js +21 -36
  7. package/lib/apis/core/forms.test.js +51 -278
  8. package/lib/apis/core/securityPolicyDefinitions.test.js +4 -4
  9. package/lib/apis/core/submissions.js +46 -30
  10. package/lib/apis/core/webhooks.js +1 -2
  11. package/lib/apis/discussions/index.js +2 -1
  12. package/lib/apis/http.js +28 -13
  13. package/lib/apis/http.test.js +13 -15
  14. package/lib/apis/index.js +2 -0
  15. package/lib/apis/system/index.js +86 -1
  16. package/lib/apis/task/index.js +22 -14
  17. package/lib/components/agent/filestore/FilestoreForm.js +132 -0
  18. package/lib/components/agent/filestore/FilestoreTable.js +53 -0
  19. package/lib/components/common/BridgeSelect.js +2 -1
  20. package/lib/components/common/FormSelect.js +2 -1
  21. package/lib/components/common/Scroller.js +6 -6
  22. package/lib/components/common/TableInput.js +74 -29
  23. package/lib/components/common/TeamSelect.js +2 -1
  24. package/lib/components/common/Typeahead.js +7 -4
  25. package/lib/components/common/UserSelect.js +2 -1
  26. package/lib/components/common/authentication/AuthenticationContainer.js +50 -27
  27. package/lib/components/common/code_input/languageHelpers.test.js +1 -1
  28. package/lib/components/core/attribute_definition/AttributeDefinitionForm.js +1 -1
  29. package/lib/components/core/attribute_definition/AttributeDefinitionTable.js +1 -1
  30. package/lib/components/core/core_form/CoreForm.js +10 -10
  31. package/lib/components/core/field_definition/FieldDefinitionForm.js +130 -0
  32. package/lib/components/core/field_definition/FieldDefinitionTable.js +86 -0
  33. package/lib/components/core/file_resource/FileResourceForm.js +180 -0
  34. package/lib/components/core/file_resource/FileResourceTable.js +71 -0
  35. package/lib/components/core/form/FormForm.js +12 -17
  36. package/lib/components/core/form/FormTable.js +3 -8
  37. package/lib/components/core/i18n/I18n.js +15 -15
  38. package/lib/components/core/index_definition/IndexDefinitionForm.js +32 -19
  39. package/lib/components/core/index_definition/IndexDefinitionTable.js +15 -24
  40. package/lib/components/core/index_job/IndexJobTable.js +12 -9
  41. package/lib/components/core/security_definition/SecurityDefinitionForm.js +1 -1
  42. package/lib/components/core/space/SpaceForm.js +59 -10
  43. package/lib/components/core/submission/DatastoreSubmissionTable.js +31 -1
  44. package/lib/components/core/submission/FormSubmissionFilters.js +378 -0
  45. package/lib/components/core/submission/FormSubmissionTable.js +116 -0
  46. package/lib/components/core/submission/KappSubmissionTable.js +250 -0
  47. package/lib/components/core/submission/SubmissionForm.js +124 -0
  48. package/lib/components/core/submission/SubmissionTable.js +35 -249
  49. package/lib/components/core/submission/helpers.js +95 -0
  50. package/lib/components/core/submission/helpers.test.js +96 -0
  51. package/lib/components/core/translation/ContextTable.js +1 -1
  52. package/lib/components/core/user/UserForm.js +2 -2
  53. package/lib/components/core/webapi/WebApiForm.js +111 -126
  54. package/lib/components/core/webhook/WebhookForm.js +1 -1
  55. package/lib/components/form/Form.helpers.js +1 -1
  56. package/lib/components/form/Form.js +200 -144
  57. package/lib/components/index.js +16 -6
  58. package/lib/components/system/SystemBackgroundTasksTable.js +83 -0
  59. package/lib/components/system/SystemSecurityForm.js +69 -0
  60. package/lib/components/system/helpers.js +20 -6
  61. package/lib/components/system/spaces/SystemSpaceForm.js +44 -16
  62. package/lib/components/system/spaces/SystemTenantForm.js +15 -9
  63. package/lib/components/system/spaces/SystemTenantTable.js +21 -16
  64. package/lib/components/table/Table.js +37 -10
  65. package/lib/components/table/Table.redux.js +228 -57
  66. package/lib/components/table/Table.redux.test.js +73 -2
  67. package/lib/components/task/builder/Connector.js +21 -10
  68. package/lib/components/task/builder/ConnectorForm.js +1 -1
  69. package/lib/components/task/builder/Node.js +10 -3
  70. package/lib/components/task/builder/NodeForm.js +54 -22
  71. package/lib/components/task/builder/NodeParametersForm.js +5 -2
  72. package/lib/components/task/builder/SvgCanvas.js +13 -4
  73. package/lib/components/task/builder/TaskDefinitionConfigForm.js +113 -0
  74. package/lib/components/task/builder/TreeBuilder.js +27 -9
  75. package/lib/components/task/builder/builder.redux.js +159 -52
  76. package/lib/components/task/builder/helpers.js +5 -3
  77. package/lib/components/task/builder/models.js +84 -12
  78. package/lib/components/task/errors/RunErrorTable.js +1 -1
  79. package/lib/components/task/runs/CreateManualTriggerForm.js +15 -24
  80. package/lib/components/task/runs/RunTable.js +5 -3
  81. package/lib/components/task/triggers/TriggerTable.js +3 -2
  82. package/lib/components/task/workflows/WorkflowForm.js +67 -85
  83. package/lib/helpers/index.js +19 -2
  84. package/lib/index.js +1 -0
  85. package/lib/models/discussions.js +18 -2
  86. package/lib/models/index.js +1 -1
  87. package/package.json +3 -3
  88. package/proxyhelper.js +19 -6
@@ -1,4 +1,4 @@
1
- import { fetchSources, fetchTaskRuns } from '../../../apis/task';
1
+ import { fetchSources, fetchTaskRuns } from '../../../apis';
2
2
  import { generateTable } from '../../table/Table';
3
3
  import { get, getIn, Map } from 'immutable';
4
4
  var ORDER_BY = Map({
@@ -20,7 +20,8 @@ var dataSource = function dataSource(_ref) {
20
20
  treeName = _ref.treeName,
21
21
  treeType = _ref.treeType,
22
22
  sourceId = _ref.sourceId,
23
- id = _ref.id;
23
+ id = _ref.id,
24
+ count = _ref.count;
24
25
  return {
25
26
  fn: fetchTaskRuns,
26
27
  params: function params(paramData) {
@@ -41,6 +42,7 @@ var dataSource = function dataSource(_ref) {
41
42
  include: 'details',
42
43
  limit: paramData.pageSize,
43
44
  offset: paramData.nextPageToken,
45
+ count: count ? undefined : false,
44
46
  orderBy: ORDER_BY.get(paramData.sortColumn, paramData.sortColumn),
45
47
  direction: paramData.sortColumn ? paramData.sortDirection : undefined
46
48
  }];
@@ -181,7 +183,7 @@ var columns = [{
181
183
  sortable: false
182
184
  }];
183
185
  export var RunTable = generateTable({
184
- tableOptions: ['sourceName', 'sourceGroup', 'treeName', 'sourceId'],
186
+ tableOptions: ['sourceName', 'sourceGroup', 'treeName', 'sourceId', 'count'],
185
187
  columns: columns,
186
188
  filters: filters,
187
189
  dataSource: dataSource,
@@ -1,4 +1,4 @@
1
- import { fetchTaskTriggers, fetchSources } from '../../../apis/task';
1
+ import { fetchTaskTriggers, fetchSources } from '../../../apis';
2
2
  import { generateTable } from '../../table/Table';
3
3
  import { get } from 'immutable';
4
4
 
@@ -33,7 +33,8 @@ var dataSource = function dataSource(_ref) {
33
33
  transform: function transform(result) {
34
34
  return {
35
35
  data: result.triggers,
36
- nextPageToken: result.nextPageToken
36
+ nextPageToken: result.nextPageToken,
37
+ count: result.count
37
38
  };
38
39
  }
39
40
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { fetchTree, fetchSources, fetchSource, updateTree, createTree, fetchTaskCategories } from '../../../apis';
2
+ import { fetchSources, fetchSource, updateTree, createTree, fetchTaskCategories } from '../../../apis';
3
3
  import { Form } from '../../form/Form';
4
4
  import { get, List, Map } from 'immutable'; // bulids a definition id based on a name (similar to slugify)
5
5
 
@@ -10,29 +10,12 @@ var buildDefinitionId = function buildDefinitionId(text) {
10
10
  .replace(/[^A-Za-z0-9_]+/g, '');
11
11
  };
12
12
 
13
- var dataSources = function dataSources(_ref) {
14
- var workflowType = _ref.workflowType,
15
- sourceName = _ref.sourceName,
16
- sourceGroup = _ref.sourceGroup,
17
- name = _ref.name;
13
+ var dataSources = function dataSources() {
18
14
  return {
19
- workflow: {
20
- fn: fetchTree,
21
- params: name && [{
22
- type: workflowType || 'Tree',
23
- sourceName: sourceName,
24
- sourceGroup: sourceGroup,
25
- name: name,
26
- include: 'details,inputs,outputs,categories'
27
- }],
28
- transform: function transform(result) {
29
- return result.tree;
30
- }
31
- },
32
15
  selectedSource: {
33
16
  fn: fetchSource,
34
- params: function params(_ref2) {
35
- var values = _ref2.values;
17
+ params: function params(_ref) {
18
+ var values = _ref.values;
36
19
  return values && values.get('sourceName') && [{
37
20
  sourceName: values.get('sourceName'),
38
21
  include: 'predefinedSourceGroups,predefinedTreeNames'
@@ -64,44 +47,41 @@ var dataSources = function dataSources(_ref) {
64
47
  };
65
48
  };
66
49
 
67
- var handleSubmit = function handleSubmit(_ref3) {
68
- var sourceName = _ref3.sourceName,
69
- sourceGroup = _ref3.sourceGroup,
70
- name = _ref3.name;
50
+ var handleSubmit = function handleSubmit(_ref2) {
51
+ var workflow = _ref2.workflow;
71
52
  return function (values) {
72
- return (name ? updateTree({
73
- sourceName: sourceName,
74
- sourceGroup: sourceGroup,
75
- name: name,
76
- tree: values.toJS()
77
- }) : createTree({
78
- tree: values.toJS()
79
- })).then(function (_ref4) {
80
- var tree = _ref4.tree,
81
- error = _ref4.error;
53
+ if (!workflow) {
54
+ return createTree({
55
+ tree: values.toJS()
56
+ }).then(function (_ref3) {
57
+ var tree = _ref3.tree,
58
+ error = _ref3.error;
82
59
 
83
- if (error) {
84
- throw error.statusCode === 400 && error.message || 'There was an error saving the workflow';
85
- } else {
86
- return tree;
87
- }
88
- });
60
+ if (error) {
61
+ throw error.statusCode === 400 && error.message || 'There was an error saving the workflow';
62
+ } else {
63
+ return tree;
64
+ }
65
+ });
66
+ } else {
67
+ return values.toObject();
68
+ }
89
69
  };
90
70
  };
91
71
 
92
- var fields = function fields(_ref5) {
93
- var name = _ref5.name,
94
- workflowType = _ref5.workflowType;
95
- return function (_ref6) {
96
- var workflow = _ref6.workflow,
97
- categories = _ref6.categories;
72
+ var fields = function fields(_ref4) {
73
+ var name = _ref4.name,
74
+ workflow = _ref4.workflow,
75
+ workflowType = _ref4.workflowType;
76
+ return function (_ref5) {
77
+ var categories = _ref5.categories;
98
78
  return (!name || workflow) && categories && [{
99
79
  name: 'sourceName',
100
80
  label: 'Source',
101
81
  type: 'select',
102
82
  required: true,
103
- options: function options(_ref7) {
104
- var sources = _ref7.sources;
83
+ options: function options(_ref6) {
84
+ var sources = _ref6.sources;
105
85
  return sources;
106
86
  },
107
87
  initialValue: workflow ? workflow.get('sourceName') : workflowType === 'routines' ? '-' : '',
@@ -111,8 +91,8 @@ var fields = function fields(_ref5) {
111
91
  label: 'Source Group',
112
92
  type: 'text',
113
93
  required: true,
114
- options: function options(_ref8) {
115
- var selectedSource = _ref8.selectedSource;
94
+ options: function options(_ref7) {
95
+ var selectedSource = _ref7.selectedSource;
116
96
  return selectedSource ? selectedSource.get('predefinedSourceGroups').map(function (g) {
117
97
  return Map({
118
98
  label: g,
@@ -127,8 +107,8 @@ var fields = function fields(_ref5) {
127
107
  label: 'Name',
128
108
  type: 'text',
129
109
  required: true,
130
- options: function options(_ref9) {
131
- var selectedSource = _ref9.selectedSource;
110
+ options: function options(_ref8) {
111
+ var selectedSource = _ref8.selectedSource;
132
112
  return selectedSource ? selectedSource.get('predefinedTreeNames').map(function (n) {
133
113
  return Map({
134
114
  label: n,
@@ -136,9 +116,9 @@ var fields = function fields(_ref5) {
136
116
  });
137
117
  }) : List();
138
118
  },
139
- onChange: function onChange(_ref10, _ref11) {
140
- var values = _ref10.values;
141
- var setValue = _ref11.setValue;
119
+ onChange: function onChange(_ref9, _ref10) {
120
+ var values = _ref9.values;
121
+ var setValue = _ref10.setValue;
142
122
 
143
123
  if (values.has('definitionId') && values.get('linked')) {
144
124
  setValue('definitionId', buildDefinitionId(values.get('name')), false);
@@ -151,23 +131,23 @@ var fields = function fields(_ref5) {
151
131
  label: 'Linked',
152
132
  type: 'checkbox',
153
133
  "transient": true,
154
- initialValue: !name,
134
+ initialValue: !name && !workflow,
155
135
  visible: false
156
136
  }, workflowType !== 'trees' && {
157
137
  name: 'definitionId',
158
138
  label: 'Definition ID',
159
139
  type: 'text',
160
- enabled: name ? false : true,
140
+ enabled: !name && !workflow,
161
141
  required: true,
162
- onChange: function onChange(_bindings, _ref12) {
163
- var setValue = _ref12.setValue;
142
+ onChange: function onChange(_bindings, _ref11) {
143
+ var setValue = _ref11.setValue;
164
144
  setValue('linked', false);
165
145
  },
166
146
  initialValue: get(workflow, 'definitionId', '') || '',
167
147
  helpText: 'Definition ID is generated by the system and used for API requests',
168
- serialize: function serialize(_ref13) {
169
- var values = _ref13.values;
170
- return name ? values.get('definitionId') : "routine_".concat(values.get('definitionId'));
148
+ serialize: function serialize(_ref12) {
149
+ var values = _ref12.values;
150
+ return name || workflow ? values.get('definitionId') : "routine_".concat(values.get('definitionId'));
171
151
  }
172
152
  }, {
173
153
  name: 'notes',
@@ -202,9 +182,7 @@ var fields = function fields(_ref5) {
202
182
  name: 'categories',
203
183
  label: 'Categories',
204
184
  type: 'select-multi',
205
- initialValue: get(workflow, 'categories', List()).map(function (c) {
206
- return c.get('name');
207
- }),
185
+ initialValue: get(workflow, 'categories', List()),
208
186
  options: categories.sortBy(function (c) {
209
187
  return c.get('name');
210
188
  }).map(function (c) {
@@ -218,6 +196,10 @@ var fields = function fields(_ref5) {
218
196
  label: 'Inputs',
219
197
  type: 'table',
220
198
  options: [{
199
+ name: 'drag',
200
+ label: null,
201
+ type: 'drag'
202
+ }, {
221
203
  name: 'name',
222
204
  label: 'Name',
223
205
  type: 'text'
@@ -234,12 +216,16 @@ var fields = function fields(_ref5) {
234
216
  label: 'Required',
235
217
  type: 'checkbox'
236
218
  }],
237
- initialValue: get(workflow, 'inputs', [])
219
+ initialValue: get(workflow, 'inputs', List())
238
220
  }, workflowType !== 'trees' && {
239
221
  name: 'outputs',
240
222
  label: 'Outputs',
241
223
  type: 'table',
242
224
  options: [{
225
+ name: 'drag',
226
+ label: null,
227
+ type: 'drag'
228
+ }, {
243
229
  name: 'name',
244
230
  label: 'Name',
245
231
  type: 'text'
@@ -248,24 +234,22 @@ var fields = function fields(_ref5) {
248
234
  label: 'Description',
249
235
  type: 'text'
250
236
  }],
251
- initialValue: get(workflow, 'outputs', [])
237
+ initialValue: get(workflow, 'outputs', List())
252
238
  }];
253
239
  };
254
240
  };
255
241
 
256
- export var WorkflowForm = function WorkflowForm(_ref14) {
257
- var addFields = _ref14.addFields,
258
- alterFields = _ref14.alterFields,
259
- fieldSet = _ref14.fieldSet,
260
- formKey = _ref14.formKey,
261
- components = _ref14.components,
262
- onSave = _ref14.onSave,
263
- onError = _ref14.onError,
264
- children = _ref14.children,
265
- workflowType = _ref14.workflowType,
266
- sourceName = _ref14.sourceName,
267
- sourceGroup = _ref14.sourceGroup,
268
- name = _ref14.name;
242
+ export var WorkflowForm = function WorkflowForm(_ref13) {
243
+ var addFields = _ref13.addFields,
244
+ alterFields = _ref13.alterFields,
245
+ fieldSet = _ref13.fieldSet,
246
+ formKey = _ref13.formKey,
247
+ components = _ref13.components,
248
+ onSave = _ref13.onSave,
249
+ onError = _ref13.onError,
250
+ children = _ref13.children,
251
+ workflow = _ref13.workflow,
252
+ workflowType = _ref13.workflowType;
269
253
  return /*#__PURE__*/React.createElement(Form, {
270
254
  addFields: addFields,
271
255
  alterFields: alterFields,
@@ -278,10 +262,8 @@ export var WorkflowForm = function WorkflowForm(_ref14) {
278
262
  dataSources: dataSources,
279
263
  fields: fields,
280
264
  formOptions: {
281
- workflowType: workflowType,
282
- sourceName: sourceName,
283
- sourceGroup: sourceGroup,
284
- name: name
265
+ workflow: workflow,
266
+ workflowType: workflowType
285
267
  }
286
268
  }, children);
287
269
  };
@@ -69,6 +69,7 @@ export var buildDefinitionId = function buildDefinitionId(text) {
69
69
  .replace(/\s+/g, '_') // Remove unwanted chars
70
70
  .replace(/[^A-Za-z0-9_]+/g, '');
71
71
  };
72
+ var FILE_STATIC_BINDINGS = [['Folder', 'folder'], ['Name', 'name'], ['Path', 'path']];
72
73
  var SUBMISSION_STATIC_BINDINGS = [['Anonymous', 'anonymous'], ['Closed At', 'closedAt'], ['Closed By', 'closedBy'], ['Core State', 'coreState'], ['Created At', 'createdAt'], ['Created By', 'createdBy'], ['Current Page', 'currentPage'], ['Id', 'id'], ['Session Token', 'sessionToken'], ['Submitted At', 'submittedAt'], ['Submitted By', 'submittedBy'], ['Type', 'type'], ['Updated At', 'updatedAt'], ['Updated By', 'updatedBy']];
73
74
  var TEAM_STATIC_BINDINGS = [['Name', 'name'], ['Slug', 'slug']];
74
75
  var USER_STATIC_BINDINGS = [['Display Name', 'displayName'], ['Email', 'email'], ['Invited By', 'invitedBy'], ['Space Admin', 'spaceAdmin'], ['Username', 'username']];
@@ -93,7 +94,7 @@ var bindifyProfile = function bindifyProfile(fnName, staticMap, attributes, prof
93
94
  });
94
95
  });
95
96
  var combinedMap = OrderedMap(staticMap).merge(attributesMap).merge(profileAttributesMap);
96
- return combinedMap.map(function (value, label) {
97
+ return combinedMap.map(function (value) {
97
98
  return Map({
98
99
  value: Map.isMap(value) ? value.get('value') : "".concat(fnName, "('").concat(value, "')"),
99
100
  tags: []
@@ -125,6 +126,8 @@ export var buildBindings = function buildBindings(_ref) {
125
126
  profile = _ref.profile;
126
127
  return OrderedMap([['Identity', Map({
127
128
  children: profile && bindifyProfile('identity', IDENTITY_STATIC_BINDINGS, get(profile, 'attributesMap'), get(profile, 'profileAttributesMap'))
129
+ })], ['File Resource', Map({
130
+ children: ['File Resource'].includes(scope) && bindify('file', FILE_STATIC_BINDINGS)
128
131
  })], ['Form', Map({
129
132
  children: ['Datastore Form', 'Datastore Submission', 'Form', 'Submission'].includes(scope) && bindify('form', FORM_STATIC_BINDINGS, scope.startsWith('Datastore') ? get(space, 'datastoreFormAttributeDefinitions') : get(kapp, 'formAttributeDefinitions'))
130
133
  })], ['Kapp', Map({
@@ -151,4 +154,18 @@ export var buildBindings = function buildBindings(_ref) {
151
154
  export var buildAgentPath = function buildAgentPath(options) {
152
155
  return "".concat(bundle.spaceLocation(), "/app/components/agents/").concat(options.agentSlug ? options.agentSlug : 'system');
153
156
  };
154
- export * from './SearchBuilder';
157
+ export * from './SearchBuilder';
158
+ export var handleFormErrors = function handleFormErrors(key) {
159
+ return function (result) {
160
+ var error = result.error;
161
+
162
+ if (error) {
163
+ throw error.statusCode === 400 && error.message || 'There was an error while saving.';
164
+ }
165
+
166
+ return key ? result[key] : result;
167
+ };
168
+ };
169
+ export var INDEX_STATIC_PARTS = ['closedBy', 'coreState', 'createdBy', 'handle', 'submittedBy', 'type', 'updatedBy'].sort();
170
+ export var TIMELINES = ['createdAt', 'updatedAt', 'submittedAt', 'closedAt'].sort();
171
+ export var MAX_PART_LENGTH = 10;
package/lib/index.js CHANGED
@@ -43,6 +43,7 @@ export var KineticLib = function KineticLib(props) {
43
43
  value: DefaultFieldConfig.merge(DefaultTableConfig).merge(remove(props.components || {}, 'fields')).merge(props.components && props.components.fields)
44
44
  }, typeof props.children === 'function' ? /*#__PURE__*/React.createElement(AuthenticationContainer, {
45
45
  noSocket: props.noSocket,
46
+ skipInit: props.skipInit,
46
47
  system: props.system
47
48
  }, props.children) : props.children))));
48
49
  };
@@ -1,5 +1,5 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import { List, Record } from 'immutable';
2
+ import { List, Record, getIn } from 'immutable';
3
3
  import moment from 'moment';
4
4
  export var createDiscussion = function createDiscussion(discussion) {
5
5
  return Discussion(_objectSpread(_objectSpread({}, discussion), {}, {
@@ -10,7 +10,8 @@ export var createDiscussion = function createDiscussion(discussion) {
10
10
  owningUsers: List(discussion.owningUsers),
11
11
  participants: List(discussion.participants),
12
12
  invitations: List(discussion.invitations),
13
- relatedItems: List(discussion.relatedItems)
13
+ relatedItems: List(discussion.relatedItems),
14
+ lastSeenAt: getIn(discussion, ['participants[7].lastSeenAt'])
14
15
  }));
15
16
  };
16
17
  export var createDiscussionList = function createDiscussionList(discussions) {
@@ -57,4 +58,19 @@ export var getGroupedDiscussions = function getGroupedDiscussions(discussions) {
57
58
  return discussions.groupBy(function (discussion) {
58
59
  return moment(getLastMessageAt(discussion)).fromNow();
59
60
  });
61
+ };
62
+ export var getLastSeenAt = function getLastSeenAt(discussion, username) {
63
+ return username && discussion.participants ? getIn(discussion.participants.find(function (participant) {
64
+ return getIn(participant, ['user', 'username']) === username;
65
+ }), ['lastSeenAt']) : null;
66
+ };
67
+ export var getDiscussionLastTimestamps = function getDiscussionLastTimestamps(discussion, username) {
68
+ return {
69
+ lastMessageAt: getLastMessageAt(discussion),
70
+ lastSeenAt: getLastSeenAt(discussion, username)
71
+ };
72
+ };
73
+ export var isLastMessageUnread = function isLastMessageUnread(discussion, username) {
74
+ var timestamps = getDiscussionLastTimestamps(discussion, username);
75
+ return !!timestamps.lastSeenAt && !!timestamps.lastMessageAt && timestamps.lastSeenAt < timestamps.lastMessageAt;
60
76
  };
@@ -1 +1 @@
1
- export { createDiscussionList, getGroupedDiscussions, sortByLastMessageAt } from './discussions';
1
+ export { createDiscussionList, getDiscussionLastTimestamps, getGroupedDiscussions, isLastMessageUnread, sortByLastMessageAt } from './discussions';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kineticdata/react",
3
- "version": "5.0.16",
3
+ "version": "5.1.0",
4
4
  "description": "A React library for the Kinetic Platform",
5
5
  "main": "lib/index.js",
6
6
  "main:src": "src/index.js",
@@ -33,7 +33,7 @@
33
33
  "lodash.isstring": "^4.0.1",
34
34
  "modularscale-sass": "^3.0.8",
35
35
  "moment": "^2.21.0",
36
- "prismjs": "1.17.0",
36
+ "prismjs": "1.23.0",
37
37
  "prop-types": "^15.7.2",
38
38
  "react-autosuggest": "^9.4.3",
39
39
  "react-avatar": "^3.5.0",
@@ -92,5 +92,5 @@
92
92
  "eslintConfig": {
93
93
  "extends": "react-app"
94
94
  },
95
- "gitHead": "08db7a5b4ddbf7aa39e035e8e9e771bab35f6ab2"
95
+ "gitHead": "5040d157c5e19e593fc9f9ca36407058a8d927c5"
96
96
  }
package/proxyhelper.js CHANGED
@@ -69,18 +69,31 @@ module.exports = (
69
69
  ws: true,
70
70
  xfwd: true,
71
71
  onProxyReq: (proxyRequest, originalRequest) => {
72
- if (process.env.PROXY_DEBUGGING)
73
- (proxyLogger || defaultProxyLogger)({
74
- proxyRequest,
75
- originalRequest,
76
- });
77
-
78
72
  // Browsers may send Origin headers even with same-origin
79
73
  // requests. To prevent CORS issues, we have to change
80
74
  // the Origin to match the target URL.
81
75
  if (proxyRequest.getHeader('origin')) {
82
76
  proxyRequest.setHeader('origin', target);
83
77
  }
78
+
79
+ if (
80
+ process.env.REACT_APP_PROXY_SUBDOMAIN &&
81
+ (!proxyRequest.path.endsWith('pack') ||
82
+ !proxyRequest.path.endsWith('favicon.ico'))
83
+ ) {
84
+ proxyRequest.setHeader(
85
+ 'X-Kinetic-Subdomain',
86
+ process.env.REACT_APP_PROXY_SUBDOMAIN,
87
+ );
88
+ proxyRequest.path =
89
+ '/' + process.env.REACT_APP_PROXY_SUBDOMAIN + proxyRequest.path;
90
+ }
91
+
92
+ if (process.env.PROXY_DEBUGGING)
93
+ (proxyLogger || defaultProxyLogger)({
94
+ proxyRequest,
95
+ originalRequest,
96
+ });
84
97
  },
85
98
  onProxyRes: (proxyResponse, originalRequest) => {
86
99
  if (process.env.PROXY_DEBUGGING)