@jbrowse/plugin-config 1.7.9 → 2.0.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/dist/ConfigurationEditorWidget/components/CallbackEditor.d.ts +10 -7
- package/dist/ConfigurationEditorWidget/components/CallbackEditor.js +108 -115
- package/dist/ConfigurationEditorWidget/components/CallbackEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/CodeEditor.d.ts +4 -3
- package/dist/ConfigurationEditorWidget/components/CodeEditor.js +78 -73
- package/dist/ConfigurationEditorWidget/components/CodeEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/ColorEditor.d.ts +9 -33
- package/dist/ConfigurationEditorWidget/components/ColorEditor.js +82 -116
- package/dist/ConfigurationEditorWidget/components/ColorEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/ColorPicker.d.ts +0 -7
- package/dist/ConfigurationEditorWidget/components/ColorPicker.js +64 -67
- package/dist/ConfigurationEditorWidget/components/ColorPicker.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.d.ts +7 -3
- package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.js +113 -160
- package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/JsonEditor.js +74 -75
- package/dist/ConfigurationEditorWidget/components/JsonEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/SlotEditor.d.ts +11 -1
- package/dist/ConfigurationEditorWidget/components/SlotEditor.js +228 -423
- package/dist/ConfigurationEditorWidget/components/SlotEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/StringArrayEditor.d.ts +12 -0
- package/dist/ConfigurationEditorWidget/components/StringArrayEditor.js +81 -0
- package/dist/ConfigurationEditorWidget/components/StringArrayEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/TypeSelector.d.ts +8 -6
- package/dist/ConfigurationEditorWidget/components/TypeSelector.js +16 -46
- package/dist/ConfigurationEditorWidget/components/TypeSelector.js.map +1 -0
- package/dist/ConfigurationEditorWidget/index.js +25 -42
- package/dist/ConfigurationEditorWidget/index.js.map +1 -0
- package/dist/ConfigurationEditorWidget/model.js +18 -26
- package/dist/ConfigurationEditorWidget/model.js.map +1 -0
- package/dist/FromConfigAdapter/FromConfigAdapter.js +172 -204
- package/dist/FromConfigAdapter/FromConfigAdapter.js.map +1 -0
- package/dist/FromConfigAdapter/FromConfigRegionsAdapter.js +151 -142
- package/dist/FromConfigAdapter/FromConfigRegionsAdapter.js.map +1 -0
- package/dist/FromConfigAdapter/FromConfigSequenceAdapter.js +182 -181
- package/dist/FromConfigAdapter/FromConfigSequenceAdapter.js.map +1 -0
- package/dist/FromConfigAdapter/configSchema.js +33 -49
- package/dist/FromConfigAdapter/configSchema.js.map +1 -0
- package/dist/FromConfigAdapter/index.js +16 -50
- package/dist/FromConfigAdapter/index.js.map +1 -0
- package/dist/RefNameAliasAdapter/RefNameAliasAdapter.js +111 -123
- package/dist/RefNameAliasAdapter/RefNameAliasAdapter.js.map +1 -0
- package/dist/RefNameAliasAdapter/configSchema.js +16 -25
- package/dist/RefNameAliasAdapter/configSchema.js.map +1 -0
- package/dist/RefNameAliasAdapter/index.js +10 -22
- package/dist/RefNameAliasAdapter/index.js.map +1 -0
- package/dist/index.d.ts +9 -3
- package/dist/index.js +129 -144
- package/dist/index.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/CallbackEditor.d.ts +12 -0
- package/esm/ConfigurationEditorWidget/components/CallbackEditor.js +71 -0
- package/esm/ConfigurationEditorWidget/components/CallbackEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/CodeEditor.d.ts +5 -0
- package/esm/ConfigurationEditorWidget/components/CodeEditor.js +42 -0
- package/esm/ConfigurationEditorWidget/components/CodeEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/ColorEditor.d.ts +20 -0
- package/esm/ConfigurationEditorWidget/components/ColorEditor.js +37 -0
- package/esm/ConfigurationEditorWidget/components/ColorEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/ColorPicker.d.ts +7 -0
- package/esm/ConfigurationEditorWidget/components/ColorPicker.js +26 -0
- package/esm/ConfigurationEditorWidget/components/ColorPicker.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.d.ts +8 -0
- package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.js +83 -0
- package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/JsonEditor.d.ts +9 -0
- package/esm/ConfigurationEditorWidget/components/JsonEditor.js +39 -0
- package/esm/ConfigurationEditorWidget/components/JsonEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/SlotEditor.d.ts +16 -0
- package/esm/ConfigurationEditorWidget/components/SlotEditor.js +176 -0
- package/esm/ConfigurationEditorWidget/components/SlotEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/StringArrayEditor.d.ts +12 -0
- package/esm/ConfigurationEditorWidget/components/StringArrayEditor.js +36 -0
- package/esm/ConfigurationEditorWidget/components/StringArrayEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/TypeSelector.d.ts +9 -0
- package/esm/ConfigurationEditorWidget/components/TypeSelector.js +12 -0
- package/esm/ConfigurationEditorWidget/components/TypeSelector.js.map +1 -0
- package/esm/ConfigurationEditorWidget/index.d.ts +3 -0
- package/esm/ConfigurationEditorWidget/index.js +20 -0
- package/esm/ConfigurationEditorWidget/index.js.map +1 -0
- package/esm/ConfigurationEditorWidget/model.d.ts +8 -0
- package/esm/ConfigurationEditorWidget/model.js +16 -0
- package/esm/ConfigurationEditorWidget/model.js.map +1 -0
- package/esm/FromConfigAdapter/FromConfigAdapter.d.ts +24 -0
- package/esm/FromConfigAdapter/FromConfigAdapter.js +63 -0
- package/esm/FromConfigAdapter/FromConfigAdapter.js.map +1 -0
- package/esm/FromConfigAdapter/FromConfigRegionsAdapter.d.ts +23 -0
- package/esm/FromConfigAdapter/FromConfigRegionsAdapter.js +50 -0
- package/esm/FromConfigAdapter/FromConfigRegionsAdapter.js.map +1 -0
- package/esm/FromConfigAdapter/FromConfigSequenceAdapter.d.ts +25 -0
- package/esm/FromConfigAdapter/FromConfigSequenceAdapter.js +73 -0
- package/esm/FromConfigAdapter/FromConfigSequenceAdapter.js.map +1 -0
- package/esm/FromConfigAdapter/configSchema.d.ts +3 -0
- package/esm/FromConfigAdapter/configSchema.js +32 -0
- package/esm/FromConfigAdapter/configSchema.js.map +1 -0
- package/esm/FromConfigAdapter/index.d.ts +4 -0
- package/esm/FromConfigAdapter/index.js +5 -0
- package/esm/FromConfigAdapter/index.js.map +1 -0
- package/esm/RefNameAliasAdapter/RefNameAliasAdapter.d.ts +8 -0
- package/esm/RefNameAliasAdapter/RefNameAliasAdapter.js +24 -0
- package/esm/RefNameAliasAdapter/RefNameAliasAdapter.js.map +1 -0
- package/esm/RefNameAliasAdapter/configSchema.d.ts +2 -0
- package/esm/RefNameAliasAdapter/configSchema.js +15 -0
- package/esm/RefNameAliasAdapter/configSchema.js.map +1 -0
- package/esm/RefNameAliasAdapter/index.d.ts +2 -0
- package/esm/RefNameAliasAdapter/index.js +3 -0
- package/esm/RefNameAliasAdapter/index.js.map +1 -0
- package/esm/index.d.ts +18 -0
- package/esm/index.js +72 -0
- package/esm/index.js.map +1 -0
- package/package.json +20 -13
- package/src/ConfigurationEditorWidget/components/{CallbackEditor.js → CallbackEditor.tsx} +36 -21
- package/src/ConfigurationEditorWidget/components/CodeEditor.tsx +59 -0
- package/src/ConfigurationEditorWidget/components/ColorEditor.tsx +8 -33
- package/src/ConfigurationEditorWidget/components/ColorPicker.tsx +4 -13
- package/src/ConfigurationEditorWidget/components/ConfigurationEditor.tsx +169 -0
- package/src/ConfigurationEditorWidget/components/JsonEditor.js +4 -8
- package/src/ConfigurationEditorWidget/components/SlotEditor.js +11 -69
- package/src/ConfigurationEditorWidget/components/StringArrayEditor.tsx +115 -0
- package/src/ConfigurationEditorWidget/components/{TypeSelector.js → TypeSelector.tsx} +15 -7
- package/src/ConfigurationEditorWidget/components/__snapshots__/ConfigurationEditor.test.js.snap +883 -691
- package/src/ConfigurationEditorWidget/index.js +2 -2
- package/src/RefNameAliasAdapter/RefNameAliasAdapter.ts +1 -1
- package/src/index.ts +20 -14
- package/dist/ConfigurationEditorWidget/components/ColorEditor.test.js +0 -31
- package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.test.js +0 -121
- package/dist/FromConfigAdapter/FromConfigAdapter.test.js +0 -100
- package/dist/FromConfigAdapter/FromConfigRegionsAdapter.test.js +0 -200
- package/dist/FromConfigAdapter/FromConfigSequenceAdapter.test.js +0 -110
- package/dist/RefNameAliasAdapter/RefNameAliasAdapter.test.js +0 -41
- package/dist/index.test.js +0 -41
- package/src/ConfigurationEditorWidget/components/CodeEditor.js +0 -60
- package/src/ConfigurationEditorWidget/components/ConfigurationEditor.js +0 -154
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
6
|
-
|
|
7
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
|
-
|
|
9
|
-
var _RefNameAliasAdapter = _interopRequireDefault(require("./RefNameAliasAdapter"));
|
|
10
|
-
|
|
11
|
-
var _configSchema = _interopRequireDefault(require("./configSchema"));
|
|
12
|
-
|
|
13
|
-
test('adapter can fetch a simple alias file', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
14
|
-
var adapter, result;
|
|
15
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
16
|
-
while (1) {
|
|
17
|
-
switch (_context.prev = _context.next) {
|
|
18
|
-
case 0:
|
|
19
|
-
adapter = new _RefNameAliasAdapter.default(_configSchema.default.create({
|
|
20
|
-
location: {
|
|
21
|
-
localPath: require.resolve('./test_data/simple_alias.txt'),
|
|
22
|
-
locationType: 'LocalPathLocation'
|
|
23
|
-
}
|
|
24
|
-
}));
|
|
25
|
-
_context.next = 3;
|
|
26
|
-
return adapter.getRefNameAliases();
|
|
27
|
-
|
|
28
|
-
case 3:
|
|
29
|
-
result = _context.sent;
|
|
30
|
-
expect(result[0].refName).toBe('chr1');
|
|
31
|
-
expect(result[0].aliases).toEqual(['1', 'NC_000001.10']);
|
|
32
|
-
expect(result[1].refName).toBe('chr2');
|
|
33
|
-
expect(result[1].aliases).toEqual(['2', 'NC_000002.11']);
|
|
34
|
-
|
|
35
|
-
case 8:
|
|
36
|
-
case "end":
|
|
37
|
-
return _context.stop();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}, _callee);
|
|
41
|
-
})));
|
package/dist/index.test.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _PluginManager = _interopRequireDefault(require("@jbrowse/core/PluginManager"));
|
|
6
|
-
|
|
7
|
-
var _mobxStateTree = require("mobx-state-tree");
|
|
8
|
-
|
|
9
|
-
var _ = _interopRequireDefault(require("."));
|
|
10
|
-
|
|
11
|
-
describe('Config editing', function () {
|
|
12
|
-
var pluginManager;
|
|
13
|
-
beforeAll(function () {
|
|
14
|
-
var originalConsoleWarn = console.warn;
|
|
15
|
-
console.warn = jest.fn();
|
|
16
|
-
pluginManager = new _PluginManager.default([new _.default()]);
|
|
17
|
-
pluginManager.createPluggableElements();
|
|
18
|
-
pluginManager.configure();
|
|
19
|
-
console.warn = originalConsoleWarn;
|
|
20
|
-
});
|
|
21
|
-
it("won't add if already added", function () {
|
|
22
|
-
expect(function () {
|
|
23
|
-
return pluginManager.addPlugin(new _.default());
|
|
24
|
-
}).toThrow(/JBrowse already configured, cannot add plugins/);
|
|
25
|
-
});
|
|
26
|
-
it('adds config editor widget', function () {
|
|
27
|
-
var ConfigurationEditorWidget = pluginManager.getWidgetType('ConfigurationEditorWidget');
|
|
28
|
-
var config = ConfigurationEditorWidget.configSchema.create({
|
|
29
|
-
type: 'ConfigurationEditorWidget'
|
|
30
|
-
});
|
|
31
|
-
expect((0, _mobxStateTree.getSnapshot)(config)).toMatchSnapshot();
|
|
32
|
-
});
|
|
33
|
-
it('creates proper FromConfigAdapter', function () {
|
|
34
|
-
var adapter = pluginManager.getAdapterType('FromConfigAdapter');
|
|
35
|
-
var config = adapter.configSchema.create({
|
|
36
|
-
type: 'FromConfigAdapter',
|
|
37
|
-
adapterId: 'testFromConfigAdapterId'
|
|
38
|
-
});
|
|
39
|
-
expect((0, _mobxStateTree.getSnapshot)(config)).toMatchSnapshot();
|
|
40
|
-
});
|
|
41
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from 'react'
|
|
2
|
-
import Editor from 'react-simple-code-editor'
|
|
3
|
-
import { Light as SyntaxHighlighter } from 'react-syntax-highlighter'
|
|
4
|
-
import json from 'react-syntax-highlighter/dist/cjs/languages/hljs/json'
|
|
5
|
-
import a11yDark from 'react-syntax-highlighter/dist/cjs/styles/hljs/a11y-dark'
|
|
6
|
-
import a11yLight from 'react-syntax-highlighter/dist/cjs/styles/hljs/a11y-light'
|
|
7
|
-
import { useTheme, makeStyles } from '@material-ui/core'
|
|
8
|
-
|
|
9
|
-
// fontSize and fontFamily have to match between Editor and SyntaxHighlighter
|
|
10
|
-
const fontSize = '12px'
|
|
11
|
-
// Optimize by using system default fonts: https://css-tricks.com/snippets/css/font-stacks/
|
|
12
|
-
const fontFamily =
|
|
13
|
-
'Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace'
|
|
14
|
-
|
|
15
|
-
const useStyles = makeStyles(theme => ({
|
|
16
|
-
callbackEditor: {
|
|
17
|
-
fontFamily,
|
|
18
|
-
fontSize,
|
|
19
|
-
background: theme.palette.background.default,
|
|
20
|
-
overflowX: 'auto',
|
|
21
|
-
marginTop: '16px',
|
|
22
|
-
border: '1px solid rgba(0,0,0,0.42)',
|
|
23
|
-
},
|
|
24
|
-
syntaxHighlighter: {
|
|
25
|
-
margin: 0,
|
|
26
|
-
fontFamily,
|
|
27
|
-
fontSize,
|
|
28
|
-
},
|
|
29
|
-
}))
|
|
30
|
-
|
|
31
|
-
// eslint-disable-next-line react/prop-types
|
|
32
|
-
export default function CodeEditor({ contents, setContents }) {
|
|
33
|
-
const classes = useStyles()
|
|
34
|
-
const theme = useTheme()
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
SyntaxHighlighter.registerLanguage('json', json)
|
|
37
|
-
}, [])
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<Editor
|
|
41
|
-
className={classes.callbackEditor}
|
|
42
|
-
value={contents}
|
|
43
|
-
onValueChange={setContents}
|
|
44
|
-
highlight={newCode => (
|
|
45
|
-
<SyntaxHighlighter
|
|
46
|
-
language="json"
|
|
47
|
-
style={theme.palette.type === 'dark' ? a11yDark : a11yLight}
|
|
48
|
-
className={classes.syntaxHighlighter}
|
|
49
|
-
// override some inline style stuff that's higher specificity
|
|
50
|
-
// than className
|
|
51
|
-
customStyle={{ background: 'none', padding: 0 }}
|
|
52
|
-
>
|
|
53
|
-
{newCode}
|
|
54
|
-
</SyntaxHighlighter>
|
|
55
|
-
)}
|
|
56
|
-
padding={10}
|
|
57
|
-
style={{}}
|
|
58
|
-
/>
|
|
59
|
-
)
|
|
60
|
-
}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
readConfObject,
|
|
4
|
-
getTypeNamesFromExplicitlyTypedUnion,
|
|
5
|
-
isConfigurationSchemaType,
|
|
6
|
-
isConfigurationSlotType,
|
|
7
|
-
} from '@jbrowse/core/configuration'
|
|
8
|
-
import {
|
|
9
|
-
FormGroup,
|
|
10
|
-
Accordion,
|
|
11
|
-
AccordionDetails,
|
|
12
|
-
AccordionSummary,
|
|
13
|
-
Typography,
|
|
14
|
-
makeStyles,
|
|
15
|
-
} from '@material-ui/core'
|
|
16
|
-
import { observer } from 'mobx-react'
|
|
17
|
-
import { getMembers } from 'mobx-state-tree'
|
|
18
|
-
import { singular } from 'pluralize'
|
|
19
|
-
|
|
20
|
-
// icons
|
|
21
|
-
import ExpandMoreIcon from '@material-ui/icons/ExpandMore'
|
|
22
|
-
|
|
23
|
-
// locals
|
|
24
|
-
import SlotEditor from './SlotEditor'
|
|
25
|
-
import TypeSelector from './TypeSelector'
|
|
26
|
-
|
|
27
|
-
const useStyles = makeStyles(theme => ({
|
|
28
|
-
expandIcon: {
|
|
29
|
-
color: '#fff',
|
|
30
|
-
},
|
|
31
|
-
root: {
|
|
32
|
-
padding: theme.spacing(1, 3, 1, 1),
|
|
33
|
-
},
|
|
34
|
-
expansionPanelDetails: {
|
|
35
|
-
display: 'block',
|
|
36
|
-
padding: theme.spacing(1),
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
accordion: {
|
|
40
|
-
border: `1px solid ${theme.palette.text.primary}`,
|
|
41
|
-
},
|
|
42
|
-
}))
|
|
43
|
-
|
|
44
|
-
const Member = observer(props => {
|
|
45
|
-
const classes = useStyles()
|
|
46
|
-
const {
|
|
47
|
-
slotName,
|
|
48
|
-
slotSchema,
|
|
49
|
-
schema,
|
|
50
|
-
slot = schema[slotName],
|
|
51
|
-
path = [],
|
|
52
|
-
} = props
|
|
53
|
-
let typeSelector
|
|
54
|
-
if (isConfigurationSchemaType(slotSchema)) {
|
|
55
|
-
if (slot.length) {
|
|
56
|
-
return slot.map((subslot, slotIndex) => {
|
|
57
|
-
const key = `${singular(slotName)} ${slotIndex + 1}`
|
|
58
|
-
return <Member {...props} key={key} slot={subslot} slotName={key} />
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
|
-
// if this is an explicitly typed schema, make a type-selecting dropdown
|
|
62
|
-
// that can be used to change its type
|
|
63
|
-
const typeNameChoices = getTypeNamesFromExplicitlyTypedUnion(slotSchema)
|
|
64
|
-
if (typeNameChoices.length) {
|
|
65
|
-
typeSelector = (
|
|
66
|
-
<TypeSelector
|
|
67
|
-
typeNameChoices={typeNameChoices}
|
|
68
|
-
slotName={slotName}
|
|
69
|
-
slot={slot}
|
|
70
|
-
onChange={evt => {
|
|
71
|
-
if (evt.target.value !== slot.type) {
|
|
72
|
-
schema.setSubschema(slotName, { type: evt.target.value })
|
|
73
|
-
}
|
|
74
|
-
}}
|
|
75
|
-
/>
|
|
76
|
-
)
|
|
77
|
-
}
|
|
78
|
-
return (
|
|
79
|
-
<Accordion
|
|
80
|
-
defaultExpanded
|
|
81
|
-
className={classes.accordion}
|
|
82
|
-
TransitionProps={{ unmountOnExit: true, timeout: 150 }}
|
|
83
|
-
>
|
|
84
|
-
<AccordionSummary
|
|
85
|
-
expandIcon={<ExpandMoreIcon className={classes.expandIcon} />}
|
|
86
|
-
>
|
|
87
|
-
<Typography>{[...path, slotName].join('🡒')}</Typography>
|
|
88
|
-
</AccordionSummary>
|
|
89
|
-
<AccordionDetails className={classes.expansionPanelDetails}>
|
|
90
|
-
{typeSelector}
|
|
91
|
-
<FormGroup>
|
|
92
|
-
<Schema schema={slot} path={[...path, slotName]} />
|
|
93
|
-
</FormGroup>
|
|
94
|
-
</AccordionDetails>
|
|
95
|
-
</Accordion>
|
|
96
|
-
)
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (isConfigurationSlotType(slotSchema)) {
|
|
100
|
-
// this is a regular config slot
|
|
101
|
-
return <SlotEditor key={slotName} slot={slot} slotSchema={slotSchema} />
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return null
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
const Schema = observer(({ schema, path = [] }) => {
|
|
108
|
-
const properties = getMembers(schema).properties
|
|
109
|
-
return Object.entries(properties).map(([slotName, slotSchema]) => (
|
|
110
|
-
<Member
|
|
111
|
-
key={slotName}
|
|
112
|
-
slotName={slotName}
|
|
113
|
-
slotSchema={slotSchema}
|
|
114
|
-
path={path}
|
|
115
|
-
schema={schema}
|
|
116
|
-
/>
|
|
117
|
-
))
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
const ConfigurationEditor = observer(({ model }) => {
|
|
121
|
-
const classes = useStyles()
|
|
122
|
-
// key forces a re-render, otherwise the same field can end up being used
|
|
123
|
-
// for different tracks since only the backing model changes for example
|
|
124
|
-
// see pr #804
|
|
125
|
-
const key = model.target && readConfObject(model.target, 'trackId')
|
|
126
|
-
const name = model.target && readConfObject(model.target, 'name')
|
|
127
|
-
return (
|
|
128
|
-
<>
|
|
129
|
-
<Accordion
|
|
130
|
-
key={key}
|
|
131
|
-
defaultExpanded
|
|
132
|
-
className={classes.accordion}
|
|
133
|
-
TransitionProps={{ unmountOnExit: true, timeout: 150 }}
|
|
134
|
-
>
|
|
135
|
-
<AccordionSummary
|
|
136
|
-
expandIcon={<ExpandMoreIcon className={classes.expandIcon} />}
|
|
137
|
-
>
|
|
138
|
-
<Typography>{name ? name : 'Configuration'}</Typography>
|
|
139
|
-
</AccordionSummary>
|
|
140
|
-
<AccordionDetails
|
|
141
|
-
className={classes.expansionPanelDetails}
|
|
142
|
-
data-testid="configEditor"
|
|
143
|
-
>
|
|
144
|
-
{!model.target ? 'no target set' : <Schema schema={model.target} />}
|
|
145
|
-
</AccordionDetails>
|
|
146
|
-
</Accordion>
|
|
147
|
-
|
|
148
|
-
{/* blank space at the bottom of screen allows scroll */}
|
|
149
|
-
<div style={{ height: 300 }} />
|
|
150
|
-
</>
|
|
151
|
-
)
|
|
152
|
-
})
|
|
153
|
-
|
|
154
|
-
export default ConfigurationEditor
|