@truedat/bg 8.7.4 → 8.7.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/bg",
3
- "version": "8.7.4",
3
+ "version": "8.7.5",
4
4
  "description": "Truedat Web Business Glossary",
5
5
  "sideEffects": [
6
6
  "**/*.css",
@@ -54,7 +54,7 @@
54
54
  "@testing-library/jest-dom": "^6.6.3",
55
55
  "@testing-library/react": "^16.3.0",
56
56
  "@testing-library/user-event": "^14.6.1",
57
- "@truedat/test": "8.7.4",
57
+ "@truedat/test": "8.7.5",
58
58
  "identity-obj-proxy": "^3.0.0",
59
59
  "jest": "^29.7.0",
60
60
  "redux-saga-test-plan": "^4.0.6"
@@ -87,5 +87,5 @@
87
87
  "semantic-ui-react": "^3.0.0-beta.2",
88
88
  "swr": "^2.3.3"
89
89
  },
90
- "gitHead": "74bf59ddf29e05b518dc206271c4f1215d66a942"
90
+ "gitHead": "c6330f05c6d7eb7b601ff861385deedb257efc3d"
91
91
  }
@@ -109,7 +109,7 @@ export const Concept = ({ id, concept }) => {
109
109
  resource_type="business_concept"
110
110
  target_type="business_concept"
111
111
  />
112
- <Grid columns="equal" style={{ marginTop: 0 }}>
112
+ <Grid className="concept-layout" columns="equal">
113
113
  <Grid.Column width={12}>
114
114
  <Segment>
115
115
  <ConceptHeader
@@ -139,13 +139,13 @@ export const Concept = ({ id, concept }) => {
139
139
  {grantView ? (
140
140
  <StructureGrantCart allowEmptyCart />
141
141
  ) : (
142
- <>
142
+ <div className="concept-sidebar-content">
143
143
  <ConceptSummary />
144
144
  <ConceptRelationsSummary />
145
145
  <ConceptTaxonomy />
146
146
  <SharedToDomains />
147
147
  <ConceptCompleteness />
148
- </>
148
+ </div>
149
149
  )}
150
150
  </Grid.Column>
151
151
  </Grid>
@@ -35,8 +35,7 @@ exports[`<Concept /> matches the latest snapshot 1`] = `
35
35
  </span>
36
36
  </div>
37
37
  <div
38
- class="ui equal width grid"
39
- style="margin-top: 0px;"
38
+ class="ui equal width grid concept-layout"
40
39
  >
41
40
  <div
42
41
  class="twelve wide column"
@@ -235,148 +234,152 @@ exports[`<Concept /> matches the latest snapshot 1`] = `
235
234
  class="four wide column"
236
235
  >
237
236
  <div
238
- class="ui segment"
237
+ class="concept-sidebar-content"
239
238
  >
240
- <h3
241
- class="ui dividing header"
242
- >
243
- Resumen
244
- </h3>
245
239
  <div
246
- class="item concept-summary"
247
- role="listitem"
240
+ class="ui segment"
248
241
  >
242
+ <h3
243
+ class="ui dividing header"
244
+ >
245
+ Resumen
246
+ </h3>
249
247
  <div
250
- class="content concept-summary__content"
248
+ class="item concept-summary"
249
+ role="listitem"
251
250
  >
252
251
  <div
253
- class="concept-summary__content-bold"
252
+ class="content concept-summary__content"
254
253
  >
255
- concept.props.status
256
- :
257
- </div>
258
- <div
259
- class="ui olive label"
260
- >
261
- draft
254
+ <div
255
+ class="concept-summary__content-bold"
256
+ >
257
+ concept.props.status
258
+ :
259
+ </div>
260
+ <div
261
+ class="ui olive label"
262
+ >
263
+ draft
264
+ </div>
262
265
  </div>
263
266
  </div>
264
- </div>
265
- <div
266
- class="item concept-summary"
267
- role="listitem"
268
- >
269
267
  <div
270
- class="content concept-summary__content"
268
+ class="item concept-summary"
269
+ role="listitem"
271
270
  >
272
271
  <div
273
- class="concept-summary__content-bold"
274
- >
275
- concept.props.version
276
- :
277
- </div>
278
- <div
279
- class="ui label"
272
+ class="content concept-summary__content"
280
273
  >
281
- <i
282
- aria-hidden="true"
283
- class="grey ellipsis vertical icon"
284
- />
274
+ <div
275
+ class="concept-summary__content-bold"
276
+ >
277
+ concept.props.version
278
+ :
279
+ </div>
280
+ <div
281
+ class="ui label"
282
+ >
283
+ <i
284
+ aria-hidden="true"
285
+ class="grey ellipsis vertical icon"
286
+ />
287
+ </div>
285
288
  </div>
286
289
  </div>
287
- </div>
288
- <div
289
- class="item concept-summary"
290
- role="listitem"
291
- >
292
290
  <div
293
- class="content concept-summary__content"
291
+ class="item concept-summary"
292
+ role="listitem"
294
293
  >
295
294
  <div
296
- class="concept-summary__content-bold"
297
- >
298
- concept.props.last_update_at
299
- :
300
- </div>
301
- <div
302
- class="ui label"
295
+ class="content concept-summary__content"
303
296
  >
304
- <time
305
- datetime="1735725600000"
297
+ <div
298
+ class="concept-summary__content-bold"
299
+ >
300
+ concept.props.last_update_at
301
+ :
302
+ </div>
303
+ <div
304
+ class="ui label"
306
305
  >
307
- 2025-01-01 10:00
308
- </time>
306
+ <time
307
+ datetime="1735725600000"
308
+ >
309
+ 2025-01-01 10:00
310
+ </time>
311
+ </div>
309
312
  </div>
310
313
  </div>
311
- </div>
312
- <div
313
- class="item concept-summary"
314
- role="listitem"
315
- >
316
314
  <div
317
- class="content concept-summary__content"
315
+ class="item concept-summary"
316
+ role="listitem"
318
317
  >
319
318
  <div
320
- class="concept-summary__content-bold"
319
+ class="content concept-summary__content"
321
320
  >
322
- concept.props.last_update_by
323
- :
324
- </div>
325
- <div
326
- class="ui label"
327
- >
328
- <i
329
- aria-hidden="true"
330
- class="grey ellipsis vertical icon"
331
- />
321
+ <div
322
+ class="concept-summary__content-bold"
323
+ >
324
+ concept.props.last_update_by
325
+ :
326
+ </div>
327
+ <div
328
+ class="ui label"
329
+ >
330
+ <i
331
+ aria-hidden="true"
332
+ class="grey ellipsis vertical icon"
333
+ />
334
+ </div>
332
335
  </div>
333
336
  </div>
334
337
  </div>
335
- </div>
336
- <div
337
- class="ui segment completeness"
338
- >
339
- <h3
340
- class="ui dividing header"
341
- >
342
- Completeness
343
-
344
- es
345
- </h3>
346
338
  <div
347
- class="ui progress"
348
- data-percent="0"
339
+ class="ui segment completeness"
349
340
  >
341
+ <h3
342
+ class="ui dividing header"
343
+ >
344
+ Completeness
345
+
346
+ es
347
+ </h3>
350
348
  <div
351
- class="bar"
352
- style="width: 0%;"
349
+ class="ui progress"
350
+ data-percent="0"
353
351
  >
354
352
  <div
355
- class="progress"
353
+ class="bar"
354
+ style="width: 0%;"
356
355
  >
357
- 0%
356
+ <div
357
+ class="progress"
358
+ >
359
+ 0%
360
+ </div>
358
361
  </div>
359
362
  </div>
360
- </div>
361
- <h3
362
- class="ui dividing header"
363
- >
364
- Completeness
365
-
366
- en
367
- </h3>
368
- <div
369
- class="ui error progress"
370
- data-percent="1"
371
- >
363
+ <h3
364
+ class="ui dividing header"
365
+ >
366
+ Completeness
367
+
368
+ en
369
+ </h3>
372
370
  <div
373
- class="bar"
374
- style="width: 1%;"
371
+ class="ui error progress"
372
+ data-percent="1"
375
373
  >
376
374
  <div
377
- class="progress"
375
+ class="bar"
376
+ style="width: 1%;"
378
377
  >
379
- 1%
378
+ <div
379
+ class="progress"
380
+ >
381
+ 1%
382
+ </div>
380
383
  </div>
381
384
  </div>
382
385
  </div>
@@ -421,8 +424,7 @@ exports[`<Concept /> matches the latest snapshot with grantView activated 1`] =
421
424
  </span>
422
425
  </div>
423
426
  <div
424
- class="ui equal width grid"
425
- style="margin-top: 0px;"
427
+ class="ui equal width grid concept-layout"
426
428
  >
427
429
  <div
428
430
  class="twelve wide column"
@@ -2,7 +2,8 @@ import _ from "lodash/fp";
2
2
  import { lazy } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
5
- import { Segment, Grid } from "semantic-ui-react";
5
+ import { FormattedMessage } from "react-intl";
6
+ import { Segment, Grid, Icon } from "semantic-ui-react";
6
7
  import {
7
8
  useDataStructureFilters,
8
9
  useDataStructureSearch,
@@ -60,6 +61,14 @@ const ConceptStructureLinksSegment = ({ groups, visible }) => {
60
61
  targetType="structure"
61
62
  linksActions={LinksActions}
62
63
  />
64
+ {_.isEmpty(groups) ? (
65
+ <div className="concept-structure-links-empty" role="status">
66
+ <Icon name="search" />
67
+ <span className="concept-structure-links-empty__message">
68
+ <FormattedMessage id="conceptStructureLinks.empty" />
69
+ </span>
70
+ </div>
71
+ ) : null}
63
72
  </>
64
73
  )}
65
74
  </Segment>
@@ -1,4 +1,3 @@
1
- import _ from "lodash/fp";
2
1
  import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { useSearchContext } from "@truedat/core/search/SearchContext";
4
3
  import { ConceptStructureLinksPane } from "../ConceptStructureLinks";
@@ -48,6 +47,15 @@ afterAll(() => {
48
47
  });
49
48
 
50
49
  describe("<ConceptStructureLinksPane />", () => {
50
+ const emptyMessage =
51
+ "This concept currently has no relationships with structures.";
52
+ const renderOpts = {
53
+ messages: {
54
+ en: {
55
+ "conceptStructureLinks.empty": emptyMessage,
56
+ },
57
+ },
58
+ };
51
59
  const props = {
52
60
  groups: [[[{ name: "name" }], ["group", [{ name: "foo" }]]]],
53
61
  };
@@ -60,14 +68,38 @@ describe("<ConceptStructureLinksPane />", () => {
60
68
  searchData: [],
61
69
  });
62
70
 
63
- const rendered = render(<ConceptStructureLinksPane {...props} />);
71
+ const rendered = render(
72
+ <ConceptStructureLinksPane {...props} />,
73
+ renderOpts,
74
+ );
64
75
 
65
76
  await waitForLoad(rendered);
66
77
  await rendered.findByText(/foo/i);
67
78
 
79
+ expect(rendered.queryByRole("status")).not.toBeInTheDocument();
68
80
  expect(rendered.container).toMatchSnapshot();
69
81
  });
70
82
 
83
+ it("renders an empty state when the concept has no structure relationships", async () => {
84
+ useConceptContext.mockReturnValue({
85
+ conceptContext: { grantView: false },
86
+ });
87
+ useSearchContext.mockReturnValue({
88
+ searchData: [],
89
+ loading: false,
90
+ });
91
+
92
+ const rendered = render(
93
+ <ConceptStructureLinksPane {...props} groups={[]} />,
94
+ renderOpts,
95
+ );
96
+
97
+ await waitForLoad(rendered);
98
+
99
+ expect(rendered.getByRole("status")).toHaveTextContent(emptyMessage);
100
+ expect(rendered.container.querySelector("table")).not.toBeInTheDocument();
101
+ });
102
+
71
103
  it("matches the latest snapshot with grantView", async () => {
72
104
  useConceptContext.mockReturnValue({
73
105
  conceptContext: { grantView: true },
@@ -89,9 +121,13 @@ describe("<ConceptStructureLinksPane />", () => {
89
121
  loading: false,
90
122
  });
91
123
 
92
- const rendered = render(<ConceptStructureLinksPane {...props} />);
124
+ const rendered = render(
125
+ <ConceptStructureLinksPane {...props} />,
126
+ renderOpts,
127
+ );
93
128
  await waitForLoad(rendered);
94
129
 
130
+ expect(rendered.queryByRole("status")).not.toBeInTheDocument();
95
131
  expect(rendered.container).toMatchSnapshot();
96
132
  });
97
133
  });
@@ -28,11 +28,11 @@ exports[`<ConceptRelationRow /> matches the latest snapshot 1`] = `
28
28
  class="center aligned"
29
29
  >
30
30
  <button
31
- class="ui red mini basic icon button"
31
+ class="ui red mini basic compact icon button relation-actions__delete-button"
32
32
  >
33
33
  <i
34
34
  aria-hidden="true"
35
- class="red trash alternate outline icon"
35
+ class="red trash alternate outline small icon relation-actions__delete-icon"
36
36
  />
37
37
  </button>
38
38
  </td>
@@ -26,36 +26,57 @@ exports[`<ConceptStructureLinksPane /> matches the latest snapshot 1`] = `
26
26
  >
27
27
  conceptRelation.master.table.title
28
28
  </h3>
29
- <table
30
- class="ui table"
29
+ <div
30
+ class="links-pane__table-scroll"
31
31
  >
32
- <thead
33
- class=""
32
+ <table
33
+ class="ui celled sortable unstackable compact table links-pane__table"
34
+ style="--links-pane-table-min-width: 264px;"
34
35
  >
35
- <tr
36
+ <colgroup>
37
+ <col
38
+ class="links-pane__column"
39
+ style="--links-pane-column-width: 264px;"
40
+ />
41
+ </colgroup>
42
+ <thead
36
43
  class=""
37
44
  >
38
- <th
45
+ <tr
39
46
  class=""
40
47
  >
41
- name
42
- </th>
43
- </tr>
44
- </thead>
45
- <tbody
46
- class=""
47
- >
48
- <tr
48
+ <th
49
+ class="links-pane__cell links-pane__cell--header links-pane__cell--wrap"
50
+ style="--links-pane-column-width: 264px;"
51
+ >
52
+ <span
53
+ class="links-pane__filter-label"
54
+ >
55
+ <span
56
+ class="links-pane__filter-label-text"
57
+ >
58
+ name
59
+ </span>
60
+ </span>
61
+ </th>
62
+ </tr>
63
+ </thead>
64
+ <tbody
49
65
  class=""
50
66
  >
51
- <td
67
+ <tr
52
68
  class=""
53
69
  >
54
- foo
55
- </td>
56
- </tr>
57
- </tbody>
58
- </table>
70
+ <td
71
+ class="links-pane__cell links-pane__cell--wrap"
72
+ style="--links-pane-column-width: 264px;"
73
+ >
74
+ foo
75
+ </td>
76
+ </tr>
77
+ </tbody>
78
+ </table>
79
+ </div>
59
80
  </div>
60
81
  </div>
61
82
  </div>
@@ -133,6 +133,6 @@ describe("selectors: getConceptLinks", () => {
133
133
  });
134
134
  it("should return the keys of the concept filters which are not currently active", () => {
135
135
  const columns = _.flow(getConceptLinks, _.map(_.first))(state);
136
- expect(_.map(_.size)(columns)).toEqual([9, 9]);
136
+ expect(_.map(_.size)(columns)).toEqual([8, 8]);
137
137
  });
138
138
  });
@@ -79,7 +79,6 @@ const withDeletedAttribute = (conceptLinks, columns) =>
79
79
  sort: { name: "deleted_at" },
80
80
  fieldDecorator: dateDecorator,
81
81
  textAlign: "center",
82
- width: 2,
83
82
  }
84
83
  : c,
85
84
  )(columns)
@@ -0,0 +1,27 @@
1
+ .concept-structure-links-empty {
2
+ align-items: center;
3
+ background: #fafbfc;
4
+ border: 1px dashed #cbd2da;
5
+ border-radius: 10px;
6
+ color: #4d5865;
7
+ display: flex;
8
+ flex-direction: column;
9
+ gap: 0.75rem;
10
+ justify-content: center;
11
+ margin-top: 2rem;
12
+ min-height: 140px;
13
+ padding: 2rem 1.25rem;
14
+ text-align: center;
15
+
16
+ > .icon {
17
+ color: #c9d1e0;
18
+ font-size: 2.5rem;
19
+ margin: 0;
20
+ }
21
+
22
+ &__message {
23
+ font-size: 1rem;
24
+ font-weight: 600;
25
+ line-height: 1.4;
26
+ }
27
+ }
@@ -0,0 +1,31 @@
1
+ .ui.grid.concept-layout {
2
+ margin-top: 0;
3
+ }
4
+
5
+ @media (max-width: 1399px) {
6
+ .ui.grid.concept-layout {
7
+ flex-direction: column !important;
8
+ flex-wrap: nowrap !important;
9
+ }
10
+
11
+ .ui.grid.concept-layout > .column:not(.row).twelve.wide,
12
+ .ui.grid.concept-layout > .column:not(.row).four.wide {
13
+ width: 100% !important;
14
+ }
15
+
16
+ .ui.grid.concept-layout > .column:not(.row) {
17
+ flex: 0 0 auto !important;
18
+ }
19
+
20
+ .concept-sidebar-content {
21
+ align-items: start;
22
+ display: grid;
23
+ gap: 1em;
24
+ grid-template-columns: repeat(4, 1fr);
25
+ }
26
+
27
+ .concept-sidebar-content > .ui.segment {
28
+ align-self: start;
29
+ margin-top: 0;
30
+ }
31
+ }