@truedat/dd 6.8.1 → 6.8.3
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 +6 -6
- package/src/components/DictionaryRoutes.js +5 -1
- package/src/components/GrantRequest.js +6 -3
- package/src/components/PendingStructureNoteRow.js +18 -26
- package/src/components/PendingStructureNotes.js +58 -111
- package/src/components/PendingStructureNotesLabelResults.js +17 -0
- package/src/components/PendingStructureNotesPagination.js +16 -0
- package/src/components/PendingStructureNotesTable.js +44 -35
- package/src/components/StructureNotes.js +1 -1
- package/src/components/SystemCards.js +20 -18
- package/src/components/SystemView.js +7 -4
- package/src/components/__tests__/GrantRequest.spec.js +2 -2
- package/src/components/__tests__/PendingStructureNoteRow.spec.js +95 -18
- package/src/components/__tests__/PendingStructureNotes.spec.js +57 -44
- package/src/components/__tests__/PendingStructureNotesLabelResults.spec.js +44 -0
- package/src/components/__tests__/PendingStructureNotesPagination.spec.js +43 -0
- package/src/components/__tests__/PendingStructureNotesTable.spec.js +52 -38
- package/src/components/__tests__/SystemCards.spec.js +6 -6
- package/src/components/__tests__/__snapshots__/PendingStructureNoteRow.spec.js.snap +8 -3
- package/src/components/__tests__/__snapshots__/PendingStructureNotes.spec.js.snap +159 -77
- package/src/components/__tests__/__snapshots__/PendingStructureNotesLabelResults.spec.js.snap +11 -0
- package/src/components/__tests__/__snapshots__/PendingStructureNotesPagination.spec.js.snap +96 -0
- package/src/components/__tests__/__snapshots__/PendingStructureNotesTable.spec.js.snap +36 -18
- package/src/selectors/__tests__/getSortedStructureNotes.spec.js +4 -4
- package/src/selectors/getSortedStructureNotes.js +5 -1
- package/src/selectors/index.js +4 -0
- package/src/selectors/structureNotesColumnsSelector.js +65 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "6.8.
|
|
3
|
+
"version": "6.8.3",
|
|
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.16.5",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "6.
|
|
37
|
+
"@truedat/test": "6.8.3",
|
|
38
38
|
"babel-jest": "^28.1.0",
|
|
39
39
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
40
40
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -88,9 +88,9 @@
|
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"@apollo/client": "^3.7.1",
|
|
91
|
-
"@truedat/auth": "6.8.
|
|
92
|
-
"@truedat/core": "6.8.
|
|
93
|
-
"@truedat/df": "6.8.
|
|
91
|
+
"@truedat/auth": "6.8.3",
|
|
92
|
+
"@truedat/core": "6.8.3",
|
|
93
|
+
"@truedat/df": "6.8.3",
|
|
94
94
|
"lodash": "^4.17.21",
|
|
95
95
|
"moment": "^2.29.4",
|
|
96
96
|
"path-to-regexp": "^1.7.0",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"react-dom": ">= 16.8.6 < 17",
|
|
116
116
|
"semantic-ui-react": ">= 2.0.3 < 2.2"
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "d3bea8cda996ea5ec5d2a0a75dfeb9a0594269d5"
|
|
119
119
|
}
|
|
@@ -114,7 +114,11 @@ export const DictionaryRoutes = () => {
|
|
|
114
114
|
render={() => (
|
|
115
115
|
<>
|
|
116
116
|
<SystemsLoader />
|
|
117
|
-
<PendingStructureNotes
|
|
117
|
+
<PendingStructureNotes
|
|
118
|
+
defaultFilters={{
|
|
119
|
+
note_status: ["rejected", "draft", "pending_approval"],
|
|
120
|
+
}}
|
|
121
|
+
/>
|
|
118
122
|
</>
|
|
119
123
|
)}
|
|
120
124
|
/>
|
|
@@ -21,7 +21,7 @@ const ConditionSummary = React.lazy(() =>
|
|
|
21
21
|
|
|
22
22
|
export const GrantRequest = ({ grantRequest, template }) => {
|
|
23
23
|
const { formatMessage } = useIntl();
|
|
24
|
-
const
|
|
24
|
+
const dynamic_content = grantRequest?.dynamic_content;
|
|
25
25
|
const data_structure = grantRequest?._embedded?.data_structure;
|
|
26
26
|
const path = _.flow(
|
|
27
27
|
_.map("name"),
|
|
@@ -101,8 +101,11 @@ export const GrantRequest = ({ grantRequest, template }) => {
|
|
|
101
101
|
</List.Description>
|
|
102
102
|
</List.Item>
|
|
103
103
|
</List>
|
|
104
|
-
{
|
|
105
|
-
<DynamicFormViewer
|
|
104
|
+
{dynamic_content && template && (
|
|
105
|
+
<DynamicFormViewer
|
|
106
|
+
template={template}
|
|
107
|
+
content={dynamic_content}
|
|
108
|
+
/>
|
|
106
109
|
)}
|
|
107
110
|
</Segment>
|
|
108
111
|
</Grid.Column>
|
|
@@ -2,41 +2,33 @@ import _ from "lodash/fp";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { Table } from "semantic-ui-react";
|
|
5
|
-
import { useIntl } from "react-intl";
|
|
6
5
|
import { useHistory } from "react-router-dom";
|
|
6
|
+
import { columnDecorator } from "@truedat/core/services";
|
|
7
7
|
import { linkTo } from "@truedat/core/routes";
|
|
8
8
|
|
|
9
|
-
const PendingStructureNoteRow = ({
|
|
10
|
-
const { formatMessage } = useIntl();
|
|
9
|
+
const PendingStructureNoteRow = ({ structure, columns }) => {
|
|
11
10
|
const history = useHistory();
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<Table.Cell
|
|
27
|
-
content={formatMessage({
|
|
28
|
-
id: `structure.notes.status.${structureNote.status}`,
|
|
29
|
-
})}
|
|
30
|
-
/>
|
|
31
|
-
<Table.Cell content={system} />
|
|
32
|
-
<Table.Cell content={domainsNames.join(", ")} />
|
|
33
|
-
<Table.Cell content={path.join(" > ")} />
|
|
11
|
+
return _.isEmpty(columns) || _.isEmpty(structure) ? null : (
|
|
12
|
+
<Table.Row key={structure.id}>
|
|
13
|
+
{columns.map((column, i) => (
|
|
14
|
+
<Table.Cell
|
|
15
|
+
key={i}
|
|
16
|
+
{...(i == 0 && {
|
|
17
|
+
title: columnDecorator(column)(structure),
|
|
18
|
+
className: "structure-cell-overflow",
|
|
19
|
+
})}
|
|
20
|
+
textAlign={column.textAlign}
|
|
21
|
+
content={columnDecorator(column)(structure)}
|
|
22
|
+
onClick={() => history.push(linkTo.STRUCTURE({ id: structure.id }))}
|
|
23
|
+
/>
|
|
24
|
+
))}
|
|
34
25
|
</Table.Row>
|
|
35
26
|
);
|
|
36
27
|
};
|
|
37
28
|
|
|
38
29
|
PendingStructureNoteRow.propTypes = {
|
|
39
|
-
|
|
30
|
+
structure: PropTypes.object.isRequired,
|
|
31
|
+
columns: PropTypes.array.isRequired,
|
|
40
32
|
};
|
|
41
33
|
|
|
42
34
|
export default PendingStructureNoteRow;
|
|
@@ -1,34 +1,25 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React
|
|
2
|
+
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
|
-
import { FormattedMessage
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import { FormattedMessage } from "react-intl";
|
|
6
|
+
import { Dimmer, Loader, Header, Icon, Segment } from "semantic-ui-react";
|
|
7
|
+
import {
|
|
8
|
+
SearchContextProvider,
|
|
9
|
+
useSearchContext,
|
|
10
|
+
} from "@truedat/core/search/SearchContext";
|
|
11
|
+
import SearchWidget from "@truedat/core/search/SearchWidget";
|
|
12
|
+
import {
|
|
13
|
+
useDataStructureFilters,
|
|
14
|
+
useDataStructureSearch,
|
|
15
|
+
} from "../hooks/useStructures";
|
|
16
|
+
import translations from "../utils/structureCustomTranslations";
|
|
17
|
+
import PendingStructureNotesPagination from "./PendingStructureNotesPagination";
|
|
18
|
+
import PendingStructureNotesLabelResults from "./PendingStructureNotesLabelResults";
|
|
11
19
|
import PendingStructureNotesTable from "./PendingStructureNotesTable";
|
|
12
20
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
export const PendingStructureNotes = ({ systems }) => {
|
|
16
|
-
const { formatMessage } = useIntl();
|
|
17
|
-
const [domainsLoading, setDomainsLoading] = useState(true);
|
|
18
|
-
const [filter, setFilter] = useState({
|
|
19
|
-
statuses: STATUS,
|
|
20
|
-
});
|
|
21
|
-
const { loading, error, data } = useQuery(STRUCTURE_NOTES_QUERY, {
|
|
22
|
-
variables: { filter },
|
|
23
|
-
fetchPolicy: "cache-and-network",
|
|
24
|
-
});
|
|
25
|
-
const items = loading || error ? [] : data?.structureNotes;
|
|
26
|
-
const { control } = useForm({
|
|
27
|
-
mode: "all",
|
|
28
|
-
defaultValues: {
|
|
29
|
-
status: STATUS,
|
|
30
|
-
},
|
|
31
|
-
});
|
|
21
|
+
export const PendingStructureNotesContent = () => {
|
|
22
|
+
const { loading } = useSearchContext();
|
|
32
23
|
|
|
33
24
|
return (
|
|
34
25
|
<Segment>
|
|
@@ -41,97 +32,53 @@ export const PendingStructureNotes = ({ systems }) => {
|
|
|
41
32
|
</Header.Subheader>
|
|
42
33
|
</Header.Content>
|
|
43
34
|
</Header>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<label>
|
|
55
|
-
<FormattedMessage id="pendingStructureNotes.props.status" />
|
|
56
|
-
</label>
|
|
57
|
-
{STATUS.map((type, idx) => (
|
|
58
|
-
<Checkbox
|
|
59
|
-
onBlur={onBlur}
|
|
60
|
-
key={idx}
|
|
61
|
-
label={
|
|
62
|
-
<label>
|
|
63
|
-
<FormattedMessage
|
|
64
|
-
id={`structure.notes.status.${type}`}
|
|
65
|
-
defaultMessage={type}
|
|
66
|
-
/>
|
|
67
|
-
</label>
|
|
68
|
-
}
|
|
69
|
-
onChange={() => {
|
|
70
|
-
const statuses = _.includes(type)(value)
|
|
71
|
-
? _.filter((t) => t !== type)(value)
|
|
72
|
-
: [...value, type];
|
|
73
|
-
setFilter({ ...filter, statuses });
|
|
74
|
-
onChange(statuses);
|
|
75
|
-
}}
|
|
76
|
-
checked={_.includes(type)(value)}
|
|
77
|
-
/>
|
|
78
|
-
))}
|
|
79
|
-
</Form.Field>
|
|
80
|
-
)}
|
|
81
|
-
/>
|
|
82
|
-
<Controller
|
|
83
|
-
control={control}
|
|
84
|
-
name="domain_ids"
|
|
85
|
-
render={({ field: { onChange, value } }) => (
|
|
86
|
-
<DomainSelector
|
|
87
|
-
label={formatMessage({ id: "domain.selector.label" })}
|
|
88
|
-
labels
|
|
89
|
-
action="publishStructureNote"
|
|
90
|
-
value={value}
|
|
91
|
-
onChange={(_e, { value }) => {
|
|
92
|
-
const domain_ids = _.isEmpty(value) ? [] : [value];
|
|
93
|
-
setFilter({ ...filter, domain_ids });
|
|
94
|
-
onChange(value);
|
|
95
|
-
}}
|
|
96
|
-
onLoad={() => setDomainsLoading(false)}
|
|
97
|
-
/>
|
|
98
|
-
)}
|
|
99
|
-
/>
|
|
100
|
-
<Controller
|
|
101
|
-
control={control}
|
|
102
|
-
name="system_ids"
|
|
103
|
-
render={({ field: { onBlur, onChange, value } }) => (
|
|
104
|
-
<Form.Dropdown
|
|
105
|
-
label={formatMessage({
|
|
106
|
-
id: "pendingStructureNotes.props.system",
|
|
107
|
-
})}
|
|
108
|
-
onBlur={onBlur}
|
|
109
|
-
onChange={(e, { value }) => {
|
|
110
|
-
setFilter({ ...filter, system_ids: value });
|
|
111
|
-
onChange(value);
|
|
112
|
-
}}
|
|
113
|
-
options={systems.map(({ name, id }) => ({
|
|
114
|
-
text: name,
|
|
115
|
-
key: id,
|
|
116
|
-
value: id,
|
|
117
|
-
}))}
|
|
118
|
-
selection
|
|
119
|
-
clearable
|
|
120
|
-
multiple
|
|
121
|
-
value={value || []}
|
|
122
|
-
/>
|
|
123
|
-
)}
|
|
124
|
-
/>
|
|
125
|
-
</Form>
|
|
126
|
-
<PendingStructureNotesTable structureNotes={items} loading={loading} />
|
|
35
|
+
|
|
36
|
+
<SearchWidget />
|
|
37
|
+
<Dimmer.Dimmable dimmed={loading}>
|
|
38
|
+
<Dimmer active={loading} inverted>
|
|
39
|
+
<Loader />
|
|
40
|
+
</Dimmer>
|
|
41
|
+
<PendingStructureNotesLabelResults />
|
|
42
|
+
<PendingStructureNotesTable />
|
|
43
|
+
<PendingStructureNotesPagination />
|
|
44
|
+
</Dimmer.Dimmable>
|
|
127
45
|
</Segment>
|
|
128
46
|
);
|
|
129
47
|
};
|
|
130
48
|
|
|
49
|
+
export const PendingStructureNotes = (props) => {
|
|
50
|
+
const defaultFilters = _.propOr({}, "defaultFilters")(props);
|
|
51
|
+
const filtersGroup = _.propOr([], "filtersGroup")(props);
|
|
52
|
+
const enrichSearchPayload = {
|
|
53
|
+
my_grant_requests: false,
|
|
54
|
+
with_data_fields: false,
|
|
55
|
+
};
|
|
56
|
+
const searchProps = {
|
|
57
|
+
initialSortColumn: "name.raw",
|
|
58
|
+
initialSortDirection: "ascending",
|
|
59
|
+
useSearch: useDataStructureSearch,
|
|
60
|
+
useFilters: useDataStructureFilters,
|
|
61
|
+
pageSize: 20,
|
|
62
|
+
userFiltersType: "user_search_filters",
|
|
63
|
+
userFilterScope: "data_structure",
|
|
64
|
+
translations,
|
|
65
|
+
filtersGroup,
|
|
66
|
+
defaultFilters,
|
|
67
|
+
enrichSearchPayload,
|
|
68
|
+
};
|
|
69
|
+
return (
|
|
70
|
+
<SearchContextProvider {...searchProps} defaultFilters={defaultFilters}>
|
|
71
|
+
<PendingStructureNotesContent />
|
|
72
|
+
</SearchContextProvider>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
131
76
|
PendingStructureNotes.propTypes = {
|
|
132
|
-
|
|
77
|
+
defaultFilters: PropTypes.object,
|
|
133
78
|
};
|
|
134
79
|
|
|
135
|
-
|
|
80
|
+
const mapStateToProps = (state) => ({
|
|
81
|
+
filtersGroup: state?.pendingStructureNotesFiltersGroup,
|
|
82
|
+
});
|
|
136
83
|
|
|
137
84
|
export default connect(mapStateToProps)(PendingStructureNotes);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FormattedMessage, useIntl } from "react-intl";
|
|
3
|
+
import { Label } from "semantic-ui-react";
|
|
4
|
+
import { useSearchContext } from "@truedat/core/search/SearchContext";
|
|
5
|
+
|
|
6
|
+
export const PendingStructureNotesLabelResults = () => {
|
|
7
|
+
const { formatNumber } = useIntl();
|
|
8
|
+
const { count: originalCount } = useSearchContext();
|
|
9
|
+
const count = formatNumber(originalCount);
|
|
10
|
+
return (
|
|
11
|
+
<Label className="structures-notes-label-results">
|
|
12
|
+
<FormattedMessage id="structures.retrieved.results" values={{ count }} />
|
|
13
|
+
</Label>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default PendingStructureNotesLabelResults;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Pagination } from "@truedat/core/components";
|
|
3
|
+
import { useSearchContext } from "@truedat/core/search/SearchContext";
|
|
4
|
+
|
|
5
|
+
export default function PendingStructureNotesPagination() {
|
|
6
|
+
const { count, size, page, selectPage } = useSearchContext();
|
|
7
|
+
const totalPages = Math.ceil(count / size);
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<Pagination
|
|
11
|
+
totalPages={totalPages}
|
|
12
|
+
activePage={page}
|
|
13
|
+
selectPage={selectPage}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import {
|
|
4
|
+
import { connect } from "react-redux";
|
|
5
|
+
import { FormattedMessage } from "react-intl";
|
|
5
6
|
import { Table, Header, Icon } from "semantic-ui-react";
|
|
7
|
+
import { useSearchContext } from "@truedat/core/search/SearchContext";
|
|
8
|
+
import { getStructureNotesColumnsSelector } from "../selectors/";
|
|
6
9
|
import PendingStructureNoteRow from "./PendingStructureNoteRow";
|
|
7
10
|
|
|
8
|
-
const PendingStructureNotesTable = ({
|
|
9
|
-
const {
|
|
10
|
-
|
|
11
|
+
const PendingStructureNotesTable = ({ columns }) => {
|
|
12
|
+
const { searchData, sortColumn, sortDirection, handleSortSelection } =
|
|
13
|
+
useSearchContext();
|
|
14
|
+
const structures = searchData?.data;
|
|
15
|
+
|
|
16
|
+
return _.isEmpty(structures) ? (
|
|
11
17
|
<Header as="h4">
|
|
12
18
|
<Icon name="search" />
|
|
13
19
|
<Header.Content>
|
|
@@ -15,48 +21,51 @@ const PendingStructureNotesTable = ({ structureNotes, loading }) => {
|
|
|
15
21
|
</Header.Content>
|
|
16
22
|
</Header>
|
|
17
23
|
) : (
|
|
18
|
-
<Table selectable>
|
|
24
|
+
<Table selectable sortable>
|
|
19
25
|
<Table.Header>
|
|
20
26
|
<Table.Row>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
content={formatMessage({
|
|
43
|
-
id: "pendingStructureNotes.props.path",
|
|
44
|
-
})}
|
|
45
|
-
/>
|
|
27
|
+
{columns &&
|
|
28
|
+
columns.map((column, key) => (
|
|
29
|
+
<Table.HeaderCell
|
|
30
|
+
key={key}
|
|
31
|
+
width={column.width}
|
|
32
|
+
content={
|
|
33
|
+
<FormattedMessage
|
|
34
|
+
id={`pendingStructureNotes.props.${
|
|
35
|
+
column.header || column.name
|
|
36
|
+
}`}
|
|
37
|
+
/>
|
|
38
|
+
}
|
|
39
|
+
sorted={
|
|
40
|
+
_.path("sort.name")(column) === sortColumn
|
|
41
|
+
? sortDirection
|
|
42
|
+
: null
|
|
43
|
+
}
|
|
44
|
+
className={_.path("sort.name")(column) ? "" : "disabled"}
|
|
45
|
+
onClick={() => handleSortSelection(_.path("sort.name")(column))}
|
|
46
|
+
/>
|
|
47
|
+
))}
|
|
46
48
|
</Table.Row>
|
|
47
49
|
</Table.Header>
|
|
48
50
|
<Table.Body>
|
|
49
|
-
{
|
|
50
|
-
<PendingStructureNoteRow
|
|
51
|
+
{structures.map((structure, key) => (
|
|
52
|
+
<PendingStructureNoteRow
|
|
53
|
+
key={key}
|
|
54
|
+
structure={structure}
|
|
55
|
+
columns={columns}
|
|
56
|
+
/>
|
|
51
57
|
))}
|
|
52
58
|
</Table.Body>
|
|
53
59
|
</Table>
|
|
54
60
|
);
|
|
55
61
|
};
|
|
56
62
|
|
|
63
|
+
const mapStateToProps = (state) => ({
|
|
64
|
+
columns: getStructureNotesColumnsSelector(state),
|
|
65
|
+
});
|
|
66
|
+
|
|
57
67
|
PendingStructureNotesTable.propTypes = {
|
|
58
|
-
|
|
59
|
-
loading: PropTypes.bool,
|
|
68
|
+
columns: PropTypes.array,
|
|
60
69
|
};
|
|
61
70
|
|
|
62
|
-
export default PendingStructureNotesTable;
|
|
71
|
+
export default connect(mapStateToProps)(PendingStructureNotesTable);
|
|
@@ -76,7 +76,7 @@ const StructureNote = ({ structureNote, template, structure, notesSize }) => {
|
|
|
76
76
|
{!collapsed && (
|
|
77
77
|
<DynamicFormViewer
|
|
78
78
|
template={template}
|
|
79
|
-
content={structureNote.
|
|
79
|
+
content={structureNote.dynamic_content}
|
|
80
80
|
diff={structureNote._diff}
|
|
81
81
|
/>
|
|
82
82
|
)}
|
|
@@ -13,31 +13,33 @@ import { linkTo } from "@truedat/core/routes";
|
|
|
13
13
|
export const SystemCards = ({ systems, structureTypes }) => {
|
|
14
14
|
const groups = _.flow(
|
|
15
15
|
_.map((system) =>
|
|
16
|
-
!system.
|
|
16
|
+
!system.dynamic_content?.system_group?.value
|
|
17
17
|
? _.set(
|
|
18
|
-
"
|
|
18
|
+
"dynamic_content.system_group",
|
|
19
19
|
{ value: "default", origin: "default" },
|
|
20
20
|
system
|
|
21
21
|
)
|
|
22
22
|
: system
|
|
23
23
|
),
|
|
24
|
-
_.groupBy("
|
|
24
|
+
_.groupBy("dynamic_content.system_group.value")
|
|
25
25
|
)(systems);
|
|
26
26
|
|
|
27
27
|
return Object.keys(groups).length > 1 ? (
|
|
28
28
|
<CardGroupsAccordion groups={groups} cardComponent={SystemCard} />
|
|
29
29
|
) : (
|
|
30
30
|
<Card.Group className="structures">
|
|
31
|
-
{_.map(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
{_.map(
|
|
32
|
+
({ id, name, structures_count: structures_count, dynamic_content }) => (
|
|
33
|
+
<SystemCard
|
|
34
|
+
key={id}
|
|
35
|
+
id={id}
|
|
36
|
+
name={name}
|
|
37
|
+
structures_count={structures_count}
|
|
38
|
+
dynamic_content={dynamic_content}
|
|
39
|
+
structureTypes={structureTypes}
|
|
40
|
+
/>
|
|
41
|
+
)
|
|
42
|
+
)(systems)}
|
|
41
43
|
</Card.Group>
|
|
42
44
|
);
|
|
43
45
|
};
|
|
@@ -51,7 +53,7 @@ export const SystemCard = ({
|
|
|
51
53
|
id,
|
|
52
54
|
name,
|
|
53
55
|
structures_count,
|
|
54
|
-
|
|
56
|
+
dynamic_content,
|
|
55
57
|
structureTypes,
|
|
56
58
|
}) => {
|
|
57
59
|
return (
|
|
@@ -64,10 +66,10 @@ export const SystemCard = ({
|
|
|
64
66
|
structureTypes={structureTypes}
|
|
65
67
|
/>
|
|
66
68
|
)}
|
|
67
|
-
{!_.isEmpty(_.get("logo.value")(
|
|
68
|
-
_.startsWith("data:image")(_.get("logo.value")(
|
|
69
|
+
{!_.isEmpty(_.get("logo.value")(dynamic_content)) &&
|
|
70
|
+
_.startsWith("data:image")(_.get("logo.value")(dynamic_content)) && (
|
|
69
71
|
<Image
|
|
70
|
-
src={_.get("logo.value")(
|
|
72
|
+
src={_.get("logo.value")(dynamic_content)}
|
|
71
73
|
className="system-image"
|
|
72
74
|
/>
|
|
73
75
|
)}
|
|
@@ -80,7 +82,7 @@ SystemCard.propTypes = {
|
|
|
80
82
|
id: PropTypes.number,
|
|
81
83
|
name: PropTypes.string,
|
|
82
84
|
structures_count: PropTypes.object,
|
|
83
|
-
|
|
85
|
+
dynamic_content: PropTypes.object,
|
|
84
86
|
structureTypes: PropTypes.array,
|
|
85
87
|
};
|
|
86
88
|
|
|
@@ -11,7 +11,7 @@ const DynamicFormViewer = React.lazy(() =>
|
|
|
11
11
|
);
|
|
12
12
|
|
|
13
13
|
export const SystemView = ({ system, systemTemplate }) => {
|
|
14
|
-
const { name, external_id,
|
|
14
|
+
const { name, external_id, dynamic_content } = system || {};
|
|
15
15
|
const SystemHeader = () => (
|
|
16
16
|
<Header as="h2">
|
|
17
17
|
<Header.Content>
|
|
@@ -24,7 +24,7 @@ export const SystemView = ({ system, systemTemplate }) => {
|
|
|
24
24
|
<div
|
|
25
25
|
style={{
|
|
26
26
|
textAlign: "center",
|
|
27
|
-
paddingBottom: "100px"
|
|
27
|
+
paddingBottom: "100px",
|
|
28
28
|
}}
|
|
29
29
|
>
|
|
30
30
|
<Image className="search" src={searchImage} />
|
|
@@ -38,11 +38,14 @@ export const SystemView = ({ system, systemTemplate }) => {
|
|
|
38
38
|
<Segment>
|
|
39
39
|
<SystemEditButton system={system} />
|
|
40
40
|
<SystemHeader />
|
|
41
|
-
{_.isEmpty(
|
|
41
|
+
{_.isEmpty(dynamic_content || {}) ? (
|
|
42
42
|
<EmptyImage />
|
|
43
43
|
) : (
|
|
44
44
|
systemTemplate && (
|
|
45
|
-
<DynamicFormViewer
|
|
45
|
+
<DynamicFormViewer
|
|
46
|
+
template={systemTemplate}
|
|
47
|
+
content={dynamic_content}
|
|
48
|
+
/>
|
|
46
49
|
)
|
|
47
50
|
)}
|
|
48
51
|
</Segment>
|
|
@@ -22,7 +22,7 @@ describe("<GrantRequest />", () => {
|
|
|
22
22
|
},
|
|
23
23
|
inserted_at: "2021-10-04T07:25:01.041463Z",
|
|
24
24
|
updated_at: "2021-10-04T07:25:01.044005Z",
|
|
25
|
-
|
|
25
|
+
dynamic_content: { bar: { value: "baz", origin: "user" } },
|
|
26
26
|
status: "pending",
|
|
27
27
|
_embedded: {
|
|
28
28
|
data_structure: { id: 1, name: "baz", path: [{ name: "foo" }] },
|
|
@@ -109,7 +109,7 @@ describe("<GrantRequest />", () => {
|
|
|
109
109
|
filters: {},
|
|
110
110
|
inserted_at: "2021-10-04T07:25:01.041463Z",
|
|
111
111
|
updated_at: "2021-10-04T07:25:01.044005Z",
|
|
112
|
-
|
|
112
|
+
dynamic_content: { bar: { value: "baz", origin: "user" } },
|
|
113
113
|
status: "failed",
|
|
114
114
|
status_reason: "there is always a reason",
|
|
115
115
|
_embedded: {
|