Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.editor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.editor
Commits
fd1f1078
Commit
fd1f1078
authored
6 years ago
by
Flavio TARSETTI
Browse files
Options
Downloads
Patches
Plain Diff
[js][plotter] added possibility to add libraries
parent
134e1a10
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!29
Fix issues for plotter editor and added unit tests
,
!23
Fix issues plotter editor
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
conda/js/src/components/plotter/PlotterEditor.jsx
+79
-0
79 additions, 0 deletions
conda/js/src/components/plotter/PlotterEditor.jsx
with
79 additions
and
0 deletions
conda/js/src/components/plotter/PlotterEditor.jsx
+
79
−
0
View file @
fd1f1078
...
...
@@ -86,6 +86,81 @@ export class PlotterEditor extends React.Component<Props, State> {
this
.
setContents
({
parameters
:
params
});
}
// helper to change a value in the "contents" subobject of a plotter
// (this is where the vast majority of change happens)
changeContentsVal
=
(
field
:
string
,
val
:
any
)
=>
{
const
newCache
=
{
...
this
.
props
.
data
,
contents
:
{
...
this
.
props
.
data
.
contents
,
[
field
]:
val
}
};
this
.
props
.
updateFunc
(
newCache
);
}
renderLibraries
=
()
=>
(
<
TabPane
tabId
=
'2'
>
<
Row
>
<
Col
sm
=
'12'
>
{
// loop through all the used libs
(
Object
.
entries
(
this
.
props
.
data
.
contents
.
uses
):
[
string
,
any
][])
.
map
(([
name
,
lib
],
i
,
lEntries
)
=>
(
<
TypedField
key
=
{
i
}
name
=
{
name
}
type
=
{
lib
}
types
=
{
this
.
props
.
libraries
.
map
(
l
=>
l
.
name
)
}
existingFields
=
{
lEntries
.
map
(([
n
,
v
])
=>
n
)
}
nameUpdateFunc
=
{
str
=>
{
// update the alias
this
.
changeContentsVal
(
'
uses
'
,
changeObjFieldName
(
this
.
props
.
data
.
contents
.
uses
,
name
,
str
)
);
}
}
typeUpdateFunc
=
{
str
=>
{
// update the chosen library for the alias
const
libs
=
{
...
this
.
props
.
data
.
contents
.
uses
,
[
name
]:
str
};
this
.
changeContentsVal
(
'
uses
'
,
libs
);
}
}
deleteFunc
=
{
()
=>
{
const
libs
=
{
...
this
.
props
.
data
.
contents
.
uses
};
delete
libs
[
name
];
this
.
changeContentsVal
(
'
uses
'
,
libs
);
}
}
/>
))
}
</
Col
>
</
Row
>
<
Button
outline
block
id
=
'newLibraryBtn'
onClick
=
{
()
=>
{
const
newKey
=
generateNewKey
(
'
library
'
,
Object
.
keys
(
this
.
props
.
data
.
contents
.
uses
));
this
.
changeContentsVal
(
'
uses
'
,
{
...
this
.
props
.
data
.
contents
.
uses
,
[
newKey
]:
''
}
);
}
}
>
New Library
</
Button
>
</
TabPane
>
);
render
=
()
=>
{
return
(
<
div
>
...
...
@@ -131,6 +206,10 @@ export class PlotterEditor extends React.Component<Props, State> {
}
</
Input
>
</
FormGroup
>
<
FormGroup
>
<
h5
>
Libraries
</
h5
>
{
this
.
renderLibraries
()
}
</
FormGroup
>
<
FormGroup
>
<
h5
>
Parameters
</
h5
>
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment