@truedat/dd 4.33.7 → 4.34.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.33.8] 2021-11-29
4
+
5
+ ### Fixed
6
+
7
+ - [TD-4353] Fix Bulk update
8
+
3
9
  ## [4.33.5] 2021-11-28
4
10
 
5
11
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dd",
3
- "version": "4.33.7",
3
+ "version": "4.34.0",
4
4
  "description": "Truedat Web Data Dictionary",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -34,7 +34,7 @@
34
34
  "@testing-library/jest-dom": "^5.14.1",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "4.33.7",
37
+ "@truedat/test": "4.34.0",
38
38
  "babel-jest": "^27.0.6",
39
39
  "babel-plugin-dynamic-import-node": "^2.3.3",
40
40
  "babel-plugin-lodash": "^3.3.4",
@@ -84,9 +84,9 @@
84
84
  ]
85
85
  },
86
86
  "dependencies": {
87
- "@truedat/auth": "4.33.7",
88
- "@truedat/core": "4.33.7",
89
- "@truedat/df": "4.33.7",
87
+ "@truedat/auth": "4.34.0",
88
+ "@truedat/core": "4.34.0",
89
+ "@truedat/df": "4.34.0",
90
90
  "lodash": "^4.17.21",
91
91
  "path-to-regexp": "^1.7.0",
92
92
  "prop-types": "^15.7.2",
@@ -107,5 +107,5 @@
107
107
  "react-dom": ">= 16.8.6 < 17",
108
108
  "semantic-ui-react": ">= 0.88.2 < 2.1"
109
109
  },
110
- "gitHead": "417ace837309731f004f2d56371df420e82a4380"
110
+ "gitHead": "b1fe4f405c612bd342510cf34e8e9d89de0280fb"
111
111
  }
@@ -9,7 +9,7 @@ import { fetchGraph, clearGraph, cancelPoll } from "../routines";
9
9
  export const GraphLoader = ({ clearGraph, fetchGraph, graph, cancelPoll }) => {
10
10
  const match = useRouteMatch(GRAPH);
11
11
  const id = _.path("params.id")(match);
12
-
12
+
13
13
  const history = useHistory();
14
14
 
15
15
  useEffect(() => {
@@ -26,7 +26,7 @@ export const GraphLoader = ({ clearGraph, fetchGraph, graph, cancelPoll }) => {
26
26
  fetchGraph({ id });
27
27
  }
28
28
  }
29
- }, [/*graph, *//*fetchGraph,*/ id]);
29
+ }, [/*graph, */ /*fetchGraph,*/ id]);
30
30
 
31
31
  useEffect(() => {
32
32
  return () => {
@@ -52,4 +52,3 @@ const mapStateToProps = ({ graph }) => ({ graph });
52
52
  export default connect(mapStateToProps, { clearGraph, fetchGraph, cancelPoll })(
53
53
  GraphLoader
54
54
  );
55
-
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { Header, Icon, Segment, Dimmer, Loader } from "semantic-ui-react";
3
3
  import { FormattedMessage } from "react-intl";
4
- import LineageEventsTable from "./LineageEventsTable"
4
+ import LineageEventsTable from "./LineageEventsTable";
5
5
 
6
6
  export const LineageEvents = () => (
7
7
  <Segment>
@@ -3,7 +3,7 @@ import React, { useEffect } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { FormattedMessage } from "react-intl";
5
5
  import { Header, Icon, Table } from "semantic-ui-react";
6
- import { useHistory, } from "react-router-dom";
6
+ import { useHistory } from "react-router-dom";
7
7
  import { connect } from "react-redux";
8
8
  import { useIntl } from "react-intl";
9
9
  import { columnDecorator } from "@truedat/core/services";
@@ -11,8 +11,11 @@ import { linkTo } from "@truedat/core/routes";
11
11
  import { lineageEventColumns as columns } from "../selectors/getLineageEventColumns";
12
12
  import { fetchLineageEvents } from "../routines";
13
13
 
14
-
15
- export const LineageEventsTable = ({ fetchLineageEvents, lineageEvents, lineageEventsLoading }) => {
14
+ export const LineageEventsTable = ({
15
+ fetchLineageEvents,
16
+ lineageEvents,
17
+ lineageEventsLoading,
18
+ }) => {
16
19
  const { formatMessage } = useIntl();
17
20
  const history = useHistory();
18
21
 
@@ -58,7 +58,7 @@ export const LineageForm = ({
58
58
  _.isNil(levels)
59
59
  ? createGraph({ ids: selectedResources, type })
60
60
  : createGraph({ ids: selectedResources, type, levels });
61
- }
61
+ };
62
62
  const disabled = _.isEmpty(selectedResources);
63
63
  useEffect(() => {
64
64
  setOpen(!graphLoading && _.isEmpty(graph));
@@ -98,7 +98,8 @@ export const LineageGraph = ({
98
98
  id:
99
99
  _.toLower(loadingInfo?.data?.status) === "already_started"
100
100
  ? "lineage.graph.loading.background.existing"
101
- : _.toLower(loadingInfo?.data?.status) === "just_started" &&
101
+ : _.toLower(loadingInfo?.data?.status) ===
102
+ "just_started" &&
102
103
  "lineage.graph.loading.background.launched",
103
104
  })}
104
105
  </p>
@@ -182,4 +183,6 @@ const mapStateToProps = (
182
183
  };
183
184
  };
184
185
 
185
- export default connect(mapStateToProps, { clearNode, cancelPoll })(LineageGraph);
186
+ export default connect(mapStateToProps, { clearNode, cancelPoll })(
187
+ LineageGraph
188
+ );
@@ -3,7 +3,7 @@ import { Route } from "react-router-dom";
3
3
  import { Unauthorized } from "@truedat/core/components";
4
4
  import { useAuthorized } from "@truedat/core/hooks";
5
5
  import { GRAPH, GRAPHS, LINEAGE_EVENTS, SAMPLE } from "@truedat/core/routes";
6
- import LineageEvents from "./LineageEvents"
6
+ import LineageEvents from "./LineageEvents";
7
7
  import LineageGraph from "./LineageGraph";
8
8
  import LineageSample from "./LineageSample";
9
9
  import LineageForm from "./LineageForm";
@@ -15,7 +15,6 @@ import { FormattedMessage } from "react-intl";
15
15
  import { ConfirmModal, HistoryBackButton } from "@truedat/core/components";
16
16
  import { selectTemplate } from "@truedat/df/routines";
17
17
  import { applyTemplateWithoutDefaults } from "@truedat/df/utils";
18
- import { composeProviders } from "redux-saga-test-plan/providers";
19
18
  import { compose } from "redux";
20
19
  import { withRouter } from "react-router-dom";
21
20
  import { bulkUpdateStructures } from "../routines";
@@ -82,7 +81,7 @@ export class StructuresBulkUpdate extends React.Component {
82
81
  template: PropTypes.object,
83
82
  templateId: PropTypes.number,
84
83
  templatesLoaded: PropTypes.bool,
85
- location: PropTypes.object,
84
+ canAutoPublish: PropTypes.bool,
86
85
  };
87
86
 
88
87
  state = initialState;
@@ -123,15 +122,24 @@ export class StructuresBulkUpdate extends React.Component {
123
122
  };
124
123
 
125
124
  render() {
126
- const { loading, template, templateId, structureCount, templatesLoaded } =
127
- this.props;
125
+ const {
126
+ loading,
127
+ template,
128
+ templateId,
129
+ structureCount,
130
+ templatesLoaded,
131
+ canAutoPublish,
132
+ structureActiveFilters,
133
+ } = this.props;
128
134
  const { content } = this.state;
129
135
  const disableAction = !template || _.isEmpty(template);
130
136
 
131
137
  return templatesLoaded ? (
132
138
  <Container as={Segment} text>
133
139
  <TemplateLoader />
134
- {!_.isEmpty(template) && structureCount != 0 ? (
140
+ {!_.isEmpty(template) &&
141
+ structureCount != 0 &&
142
+ _.has("type.raw")(structureActiveFilters) ? (
135
143
  <>
136
144
  <Header as="h2">
137
145
  <Icon name="book" />
@@ -161,10 +169,7 @@ export class StructuresBulkUpdate extends React.Component {
161
169
  />
162
170
  )}
163
171
  <ConfirmModal
164
- actions={actions(
165
- this.handleSubmit,
166
- this.props.location?.state.canAutoPublish
167
- )}
172
+ actions={actions(this.handleSubmit, canAutoPublish)}
168
173
  trigger={
169
174
  <Button
170
175
  primary
@@ -231,6 +236,8 @@ const mapStateToProps = ({
231
236
  structures,
232
237
  structureTypes,
233
238
  structureTypesLoading,
239
+ userDomains,
240
+ structureActiveFilters,
234
241
  }) => {
235
242
  const structure = _.head(structures);
236
243
  const templateId = findTemplate(structureTypes, templates, structure);
@@ -242,6 +249,13 @@ const mapStateToProps = ({
242
249
  structureCount,
243
250
  structureTypesLoaded: !structureTypesLoading,
244
251
  templatesLoaded: !templatesLoading && !_.isEmpty(templates),
252
+ userDomains,
253
+ canAutoPublish: _.any(
254
+ ({ domains, permission }) =>
255
+ !_.isEmpty(domains) &&
256
+ ["publish_structure_note_from_draft"].includes(permission)
257
+ )(userDomains),
258
+ structureActiveFilters,
245
259
  };
246
260
  };
247
261
 
@@ -88,6 +88,13 @@ const AuthorizedRoutes = () => {
88
88
  path={STRUCTURES_BULK_UPDATE}
89
89
  render={() => (
90
90
  <>
91
+ <UserDomainsLoader
92
+ permissions={[
93
+ "publish_structure_note_from_draft",
94
+ "edit_structure_note",
95
+ "create_structure_note",
96
+ ]}
97
+ />
91
98
  <StructureCrumbs
92
99
  name={formatMessage({ id: "structures.bulkUpdate.crumbs.top" })}
93
100
  />
@@ -3,7 +3,6 @@ import { render } from "@truedat/test/render";
3
3
  import { LineageEventsTable } from "../LineageEventsTable";
4
4
  import en from "../../messages/en";
5
5
 
6
-
7
6
  describe("<LineageEventsTable />", () => {
8
7
  const lineageEvents = [
9
8
  {
@@ -17,6 +17,7 @@ describe("<StructuresBulkUpdate />", () => {
17
17
  templatesLoaded: true,
18
18
  structureTypes: [{ name: "doc", template_id: 1 }],
19
19
  structureTypesLoaded: true,
20
+ structureActiveFilters: { "type.raw": "booo" },
20
21
  };
21
22
 
22
23
  it("matches the latest snapshot", () => {
@@ -136,6 +137,7 @@ describe("<StructuresBulkUpdate />", () => {
136
137
  selectedDomain: { id: 1 },
137
138
  templatesLoaded: true,
138
139
  bulkUpdateStructures: jest.fn(),
140
+ structureActiveFilters: { "type.raw": "booo" },
139
141
  };
140
142
  const wrapper = shallow(<StructuresBulkUpdate {...props} />);
141
143
  wrapper.setState({
@@ -250,72 +250,76 @@ exports[`<GrantRequest /> matches the latest snapshot with approve actions 1`] =
250
250
  filters
251
251
  </div>
252
252
  </h3>
253
- <table
254
- class="ui very basic table"
253
+ <div
254
+ class="ui segment"
255
255
  >
256
- <thead
257
- class=""
256
+ <table
257
+ class="ui very basic table"
258
258
  >
259
- <tr
259
+ <thead
260
260
  class=""
261
261
  >
262
- <th
262
+ <tr
263
263
  class=""
264
264
  >
265
- field
266
- </th>
267
- <th
268
- class=""
269
- >
270
- operator
271
- </th>
272
- <th
273
- class=""
274
- >
275
- values
276
- </th>
277
- </tr>
278
- </thead>
279
- <tbody
280
- class=""
281
- >
282
- <tr
265
+ <th
266
+ class=""
267
+ >
268
+ field
269
+ </th>
270
+ <th
271
+ class=""
272
+ >
273
+ operator
274
+ </th>
275
+ <th
276
+ class=""
277
+ >
278
+ values
279
+ </th>
280
+ </tr>
281
+ </thead>
282
+ <tbody
283
283
  class=""
284
284
  >
285
- <td
286
- class="five wide"
285
+ <tr
286
+ class=""
287
287
  >
288
- <a
289
- href="/structures/1"
288
+ <td
289
+ class="five wide"
290
+ >
291
+ <a
292
+ href="/structures/1"
293
+ >
294
+ <span
295
+ class="highlighted"
296
+ >
297
+ "foo"
298
+ </span>
299
+ </a>
300
+ </td>
301
+ <td
302
+ class="five wide"
290
303
  >
291
304
  <span
292
305
  class="highlighted"
293
306
  >
294
- "foo"
307
+ "eq"
295
308
  </span>
296
- </a>
297
- </td>
298
- <td
299
- class="five wide"
300
- >
301
- <span
302
- class="highlighted"
303
- >
304
- "eq"
305
- </span>
306
- </td>
307
- <td
308
- class="five wide"
309
- >
310
- <span
311
- class="highlighted"
309
+ </td>
310
+ <td
311
+ class="five wide"
312
312
  >
313
- "2021-10-05 08:15:00 "
314
- </span>
315
- </td>
316
- </tr>
317
- </tbody>
318
- </table>
313
+ <span
314
+ class="highlighted"
315
+ >
316
+ "2021-10-05 08:15:00 "
317
+ </span>
318
+ </td>
319
+ </tr>
320
+ </tbody>
321
+ </table>
322
+ </div>
319
323
  </div>
320
324
  </div>
321
325
  </div>
@@ -512,72 +516,76 @@ exports[`<GrantRequest /> matches the latest snapshot with failed status 1`] = `
512
516
  filters
513
517
  </div>
514
518
  </h3>
515
- <table
516
- class="ui very basic table"
519
+ <div
520
+ class="ui segment"
517
521
  >
518
- <thead
519
- class=""
522
+ <table
523
+ class="ui very basic table"
520
524
  >
521
- <tr
525
+ <thead
522
526
  class=""
523
527
  >
524
- <th
528
+ <tr
525
529
  class=""
526
530
  >
527
- field
528
- </th>
529
- <th
530
- class=""
531
- >
532
- operator
533
- </th>
534
- <th
535
- class=""
536
- >
537
- values
538
- </th>
539
- </tr>
540
- </thead>
541
- <tbody
542
- class=""
543
- >
544
- <tr
531
+ <th
532
+ class=""
533
+ >
534
+ field
535
+ </th>
536
+ <th
537
+ class=""
538
+ >
539
+ operator
540
+ </th>
541
+ <th
542
+ class=""
543
+ >
544
+ values
545
+ </th>
546
+ </tr>
547
+ </thead>
548
+ <tbody
545
549
  class=""
546
550
  >
547
- <td
548
- class="five wide"
551
+ <tr
552
+ class=""
549
553
  >
550
- <a
551
- href="/structures/1"
554
+ <td
555
+ class="five wide"
556
+ >
557
+ <a
558
+ href="/structures/1"
559
+ >
560
+ <span
561
+ class="highlighted"
562
+ >
563
+ "foo"
564
+ </span>
565
+ </a>
566
+ </td>
567
+ <td
568
+ class="five wide"
552
569
  >
553
570
  <span
554
571
  class="highlighted"
555
572
  >
556
- "foo"
573
+ "eq"
557
574
  </span>
558
- </a>
559
- </td>
560
- <td
561
- class="five wide"
562
- >
563
- <span
564
- class="highlighted"
565
- >
566
- "eq"
567
- </span>
568
- </td>
569
- <td
570
- class="five wide"
571
- >
572
- <span
573
- class="highlighted"
575
+ </td>
576
+ <td
577
+ class="five wide"
574
578
  >
575
- "2021-10-05 08:15:00 "
576
- </span>
577
- </td>
578
- </tr>
579
- </tbody>
580
- </table>
579
+ <span
580
+ class="highlighted"
581
+ >
582
+ "2021-10-05 08:15:00 "
583
+ </span>
584
+ </td>
585
+ </tr>
586
+ </tbody>
587
+ </table>
588
+ </div>
581
589
  </div>
582
590
  </div>
583
591
  </div>
@@ -9,13 +9,15 @@ describe("reducers: lineageEventsLoading", () => {
9
9
  });
10
10
 
11
11
  it("returns to initial state on fetchLineageEvents.FULFILL action", () => {
12
- expect(lineageEventsLoading(fooState, { type: fetchLineageEvents.FULFILL })).toBe(
13
- false
14
- );
12
+ expect(
13
+ lineageEventsLoading(fooState, { type: fetchLineageEvents.FULFILL })
14
+ ).toBe(false);
15
15
  });
16
16
 
17
17
  it("returns true on fetchLineageEvents.REQUEST action", () => {
18
- expect(lineageEventsLoading(fooState, { type: fetchLineageEvents.REQUEST })).toBe(true);
18
+ expect(
19
+ lineageEventsLoading(fooState, { type: fetchLineageEvents.REQUEST })
20
+ ).toBe(true);
19
21
  });
20
22
 
21
23
  it("should ignore unhandled actions", () => {
@@ -4,7 +4,7 @@ import {
4
4
  clearStructure,
5
5
  fetchGraph,
6
6
  fetchStructure,
7
- createGraph
7
+ createGraph,
8
8
  } from "../routines";
9
9
 
10
10
  export const initialState = {};
@@ -51,7 +51,7 @@ describe("sagas: createGraphRequestSaga", () => {
51
51
  .next()
52
52
  .all([
53
53
  takeLatest(createGraph.TRIGGER, createGraphSaga),
54
- takeLatest(excludeNode.TRIGGER, createGraphSaga)
54
+ takeLatest(excludeNode.TRIGGER, createGraphSaga),
55
55
  ])
56
56
  .finish()
57
57
  .isDone();
@@ -103,7 +103,6 @@ describe("sagas: createGraphSaga", () => {
103
103
  });
104
104
 
105
105
  it("should fork a polling task when uuids are requested and a 202 (accepted) graph hash response is returned. Then, wait for task cancellation.", () => {
106
-
107
106
  expect(() => {
108
107
  testSaga(createGraphSaga)
109
108
  .next()
@@ -221,7 +220,7 @@ describe("generator: polling", () => {
221
220
  .next()
222
221
  .cancelled()
223
222
  .next(true)
224
- .put(createGraph.failure(POLLING_CANCELLED))
223
+ .put(createGraph.failure(POLLING_CANCELLED));
225
224
  }).not.toThrow();
226
225
  });
227
226
  });
@@ -120,6 +120,6 @@ export function* polling(graphAccepted) {
120
120
  export function* createGraphRequestSaga() {
121
121
  yield all([
122
122
  takeLatest(createGraph.TRIGGER, createGraphSaga),
123
- takeLatest(excludeNode.TRIGGER, createGraphSaga)
123
+ takeLatest(excludeNode.TRIGGER, createGraphSaga),
124
124
  ]);
125
125
  }
@@ -1,6 +1,7 @@
1
1
  import _ from "lodash/fp";
2
2
  import React from "react";
3
3
  import { render } from "@truedat/test/render";
4
+ import moment from "moment";
4
5
  import {
5
6
  defaultGrantsColumns,
6
7
  defaultGrantsTableColumns,
@@ -1,45 +0,0 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
- import { connect } from "react-redux";
4
- import { Button, Popup } from "semantic-ui-react";
5
- import { Link } from "react-router-dom";
6
- import { FormattedMessage } from "react-intl";
7
- import { useAuthorized } from "@truedat/core/hooks";
8
- import { STRUCTURES_BULK_UPDATE } from "@truedat/core/routes";
9
- import { bulkUpdateDisabledSelector } from "../selectors";
10
-
11
- export const StructuresUpdateButton = ({ disabled, canAutoPublish }) => {
12
- const authorized = useAuthorized();
13
-
14
- return authorized ? (
15
- <Popup
16
- content={<FormattedMessage id="structures.actions.bulk_update.popup" />}
17
- position="top right"
18
- trigger={
19
- <span className="button-update">
20
- <Link
21
- className={`ui secondary button ${disabled ? "disabled" : ""}`}
22
- role="button"
23
- to={{
24
- pathname: STRUCTURES_BULK_UPDATE,
25
- state: { canAutoPublish },
26
- }}
27
- >
28
- <FormattedMessage id="actions.update" />
29
- </Link>
30
- </span>
31
- }
32
- />
33
- ) : null;
34
- };
35
-
36
- StructuresUpdateButton.propTypes = {
37
- disabled: PropTypes.bool,
38
- canAutoPublish: PropTypes.bool,
39
- };
40
-
41
- const mapStateToProps = (state) => ({
42
- disabled: bulkUpdateDisabledSelector(state),
43
- });
44
-
45
- export default connect(mapStateToProps)(StructuresUpdateButton);