datajunction-ui 0.0.16 → 0.0.18
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 +1 -1
- package/src/app/pages/NamespacePage/NodeModeSelect.jsx +27 -0
- package/src/app/pages/NamespacePage/NodeTypeSelect.jsx +1 -1
- package/src/app/pages/NamespacePage/__tests__/index.test.jsx +1 -0
- package/src/app/pages/NamespacePage/index.jsx +33 -2
- package/src/app/services/DJService.js +5 -1
package/package.json
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import Select from 'react-select';
|
|
2
|
+
import Control from './FieldControl';
|
|
3
|
+
|
|
4
|
+
export default function NodeModeSelect({ onChange }) {
|
|
5
|
+
return (
|
|
6
|
+
<span
|
|
7
|
+
className="menu-link"
|
|
8
|
+
style={{ marginLeft: '30px', width: '300px' }}
|
|
9
|
+
data-testid="select-node-mode"
|
|
10
|
+
>
|
|
11
|
+
<Select
|
|
12
|
+
name="node_mode"
|
|
13
|
+
isClearable
|
|
14
|
+
label="Mode"
|
|
15
|
+
components={{ Control }}
|
|
16
|
+
onChange={e => onChange(e)}
|
|
17
|
+
styles={{
|
|
18
|
+
control: styles => ({ ...styles, backgroundColor: 'white' }),
|
|
19
|
+
}}
|
|
20
|
+
options={[
|
|
21
|
+
{ value: 'published', label: 'Published' },
|
|
22
|
+
{ value: 'draft', label: 'Draft' },
|
|
23
|
+
]}
|
|
24
|
+
/>
|
|
25
|
+
</span>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -11,6 +11,7 @@ import FilterIcon from '../../icons/FilterIcon';
|
|
|
11
11
|
import LoadingIcon from '../../icons/LoadingIcon';
|
|
12
12
|
import UserSelect from './UserSelect';
|
|
13
13
|
import NodeTypeSelect from './NodeTypeSelect';
|
|
14
|
+
import NodeModeSelect from './NodeModeSelect';
|
|
14
15
|
import TagSelect from './TagSelect';
|
|
15
16
|
|
|
16
17
|
import 'styles/node-list.css';
|
|
@@ -20,7 +21,7 @@ export function NamespacePage() {
|
|
|
20
21
|
const ASC = 'ascending';
|
|
21
22
|
const DESC = 'descending';
|
|
22
23
|
|
|
23
|
-
const fields = ['name', 'displayName', 'type', 'status', 'updatedAt'];
|
|
24
|
+
const fields = ['name', 'displayName', 'type', 'status', 'mode', 'updatedAt'];
|
|
24
25
|
|
|
25
26
|
const djClient = useContext(DJClientContext).DataJunctionAPI;
|
|
26
27
|
var { namespace } = useParams();
|
|
@@ -36,6 +37,7 @@ export function NamespacePage() {
|
|
|
36
37
|
tags: [],
|
|
37
38
|
node_type: '',
|
|
38
39
|
edited_by: '',
|
|
40
|
+
mode: '',
|
|
39
41
|
});
|
|
40
42
|
|
|
41
43
|
const [namespaceHierarchy, setNamespaceHierarchy] = useState([]);
|
|
@@ -122,6 +124,7 @@ export function NamespacePage() {
|
|
|
122
124
|
after,
|
|
123
125
|
50,
|
|
124
126
|
sortConfig,
|
|
127
|
+
filters.mode ? filters.mode.toUpperCase() : null,
|
|
125
128
|
);
|
|
126
129
|
|
|
127
130
|
setState({
|
|
@@ -198,6 +201,29 @@ export function NamespacePage() {
|
|
|
198
201
|
<td>
|
|
199
202
|
<NodeStatus node={node} revalidate={false} />
|
|
200
203
|
</td>
|
|
204
|
+
<td>
|
|
205
|
+
<span
|
|
206
|
+
style={{
|
|
207
|
+
display: 'inline-flex',
|
|
208
|
+
alignItems: 'center',
|
|
209
|
+
justifyContent: 'center',
|
|
210
|
+
width: '24px',
|
|
211
|
+
height: '24px',
|
|
212
|
+
borderRadius: '50%',
|
|
213
|
+
border: `2px solid ${
|
|
214
|
+
node.current.mode === 'PUBLISHED' ? '#28a745' : '#ffc107'
|
|
215
|
+
}`,
|
|
216
|
+
backgroundColor: 'transparent',
|
|
217
|
+
color:
|
|
218
|
+
node.current.mode === 'PUBLISHED' ? '#28a745' : '#d39e00',
|
|
219
|
+
fontWeight: '600',
|
|
220
|
+
fontSize: '12px',
|
|
221
|
+
}}
|
|
222
|
+
title={node.current.mode === 'PUBLISHED' ? 'Published' : 'Draft'}
|
|
223
|
+
>
|
|
224
|
+
{node.current.mode === 'PUBLISHED' ? 'P' : 'D'}
|
|
225
|
+
</span>
|
|
226
|
+
</td>
|
|
201
227
|
<td>
|
|
202
228
|
<span className="status">
|
|
203
229
|
{new Date(node.current.updatedAt).toLocaleString('en-us')}
|
|
@@ -265,7 +291,7 @@ export function NamespacePage() {
|
|
|
265
291
|
marginRight: '10px',
|
|
266
292
|
}}
|
|
267
293
|
>
|
|
268
|
-
Filter
|
|
294
|
+
Filter
|
|
269
295
|
</div>
|
|
270
296
|
<NodeTypeSelect
|
|
271
297
|
onChange={entry =>
|
|
@@ -286,6 +312,11 @@ export function NamespacePage() {
|
|
|
286
312
|
}
|
|
287
313
|
currentUser={currentUser?.username}
|
|
288
314
|
/>
|
|
315
|
+
<NodeModeSelect
|
|
316
|
+
onChange={entry =>
|
|
317
|
+
setFilters({ ...filters, mode: entry ? entry.value : '' })
|
|
318
|
+
}
|
|
319
|
+
/>
|
|
289
320
|
<AddNodeDropdown namespace={namespace} />
|
|
290
321
|
</div>
|
|
291
322
|
<div className="table-responsive">
|
|
@@ -18,14 +18,16 @@ export const DataJunctionAPI = {
|
|
|
18
18
|
after,
|
|
19
19
|
limit,
|
|
20
20
|
sortConfig,
|
|
21
|
+
mode,
|
|
21
22
|
) {
|
|
22
23
|
const query = `
|
|
23
|
-
query ListNodes($namespace: String, $nodeTypes: [NodeType!], $tags: [String!], $editedBy: String, $before: String, $after: String, $limit: Int, $orderBy: NodeSortField, $ascending: Boolean) {
|
|
24
|
+
query ListNodes($namespace: String, $nodeTypes: [NodeType!], $tags: [String!], $editedBy: String, $mode: NodeMode, $before: String, $after: String, $limit: Int, $orderBy: NodeSortField, $ascending: Boolean) {
|
|
24
25
|
findNodesPaginated(
|
|
25
26
|
namespace: $namespace
|
|
26
27
|
nodeTypes: $nodeTypes
|
|
27
28
|
tags: $tags
|
|
28
29
|
editedBy: $editedBy
|
|
30
|
+
mode: $mode
|
|
29
31
|
limit: $limit
|
|
30
32
|
before: $before
|
|
31
33
|
after: $after
|
|
@@ -51,6 +53,7 @@ export const DataJunctionAPI = {
|
|
|
51
53
|
current {
|
|
52
54
|
displayName
|
|
53
55
|
status
|
|
56
|
+
mode
|
|
54
57
|
updatedAt
|
|
55
58
|
}
|
|
56
59
|
createdBy {
|
|
@@ -83,6 +86,7 @@ export const DataJunctionAPI = {
|
|
|
83
86
|
nodeTypes: nodeTypes,
|
|
84
87
|
tags: tags,
|
|
85
88
|
editedBy: editedBy,
|
|
89
|
+
mode: mode || null,
|
|
86
90
|
before: before,
|
|
87
91
|
after: after,
|
|
88
92
|
limit: limit,
|