datajunction-ui 0.0.1-a57 → 0.0.1-a58
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
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const AddItemIcon = props => (
|
|
2
|
+
<svg
|
|
3
|
+
enable-background="new 0 0 512 512"
|
|
4
|
+
height="20px"
|
|
5
|
+
id="Layer_1"
|
|
6
|
+
version="1.1"
|
|
7
|
+
viewBox="0 0 512 512"
|
|
8
|
+
width="20px"
|
|
9
|
+
xmlSpace="preserve"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
12
|
+
>
|
|
13
|
+
<path d="M256,512C114.625,512,0,397.391,0,256C0,114.609,114.625,0,256,0c141.391,0,256,114.609,256,256 C512,397.391,397.391,512,256,512z M256,64C149.969,64,64,149.969,64,256s85.969,192,192,192c106.047,0,192-85.969,192-192 S362.047,64,256,64z M288,384h-64v-96h-96v-64h96v-96h64v96h96v64h-96V384z" />
|
|
14
|
+
</svg>
|
|
15
|
+
);
|
|
16
|
+
export default AddItemIcon;
|
|
@@ -2,9 +2,8 @@ import { useContext, useState } from 'react';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import DJClientContext from '../../providers/djclient';
|
|
4
4
|
import { ErrorMessage, Field, Form, Formik } from 'formik';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { displayMessageAfterSubmit, labelize } from '../../../utils/form';
|
|
5
|
+
import AddItemIcon from '../../icons/AddItemIcon';
|
|
6
|
+
import { displayMessageAfterSubmit } from '../../../utils/form';
|
|
8
7
|
|
|
9
8
|
export default function AddNamespacePopover({ namespace }) {
|
|
10
9
|
const djClient = useContext(DJClientContext).DataJunctionAPI;
|
|
@@ -33,7 +32,7 @@ export default function AddNamespacePopover({ namespace }) {
|
|
|
33
32
|
setPopoverAnchor(!popoverAnchor);
|
|
34
33
|
}}
|
|
35
34
|
>
|
|
36
|
-
<
|
|
35
|
+
<AddItemIcon />
|
|
37
36
|
</button>
|
|
38
37
|
<div
|
|
39
38
|
className="popover"
|
|
@@ -48,7 +47,7 @@ export default function AddNamespacePopover({ namespace }) {
|
|
|
48
47
|
>
|
|
49
48
|
<Formik
|
|
50
49
|
initialValues={{
|
|
51
|
-
namespace: '',
|
|
50
|
+
namespace: namespace + '.',
|
|
52
51
|
}}
|
|
53
52
|
onSubmit={addNamespace}
|
|
54
53
|
>
|
|
@@ -64,6 +63,7 @@ export default function AddNamespacePopover({ namespace }) {
|
|
|
64
63
|
name="namespace"
|
|
65
64
|
id="namespace"
|
|
66
65
|
placeholder="New namespace"
|
|
66
|
+
default={namespace}
|
|
67
67
|
/>
|
|
68
68
|
</span>
|
|
69
69
|
<button
|
|
@@ -167,7 +167,7 @@ describe('NamespacePage', () => {
|
|
|
167
167
|
});
|
|
168
168
|
expect(mockDjClient.addNamespace).toHaveBeenCalled();
|
|
169
169
|
expect(mockDjClient.addNamespace).toHaveBeenCalledWith(
|
|
170
|
-
'some.random.namespace',
|
|
170
|
+
'test.namespace.some.random.namespace',
|
|
171
171
|
);
|
|
172
172
|
expect(screen.getByText('Saved')).toBeInTheDocument();
|
|
173
173
|
expect(window.location.reload).toHaveBeenCalled();
|
|
@@ -167,7 +167,7 @@ export function NamespacePage() {
|
|
|
167
167
|
padding: '1rem 1rem 1rem 0',
|
|
168
168
|
}}
|
|
169
169
|
>
|
|
170
|
-
Namespaces <AddNamespacePopover />
|
|
170
|
+
Namespaces <AddNamespacePopover namespace={namespace}/>
|
|
171
171
|
</span>
|
|
172
172
|
{namespaceHierarchy
|
|
173
173
|
? namespaceHierarchy.map(child => (
|