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
40fbf9c6
Commit
40fbf9c6
authored
6 years ago
by
Jaden DIEFENBAUGH
Browse files
Options
Downloads
Patches
Plain Diff
[js][exp] keep type inference on after choosing data/alg, closes
#127
parent
dd90e8ae
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#24332
passed
6 years ago
Stage: build
Stage: browser-tests
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
conda/js/src/components/experiment/ExperimentEditor.jsx
+10
-7
10 additions, 7 deletions
conda/js/src/components/experiment/ExperimentEditor.jsx
conda/js/src/components/experiment/ExperimentEditor.spec.jsx
+79
-0
79 additions, 0 deletions
conda/js/src/components/experiment/ExperimentEditor.spec.jsx
with
89 additions
and
7 deletions
conda/js/src/components/experiment/ExperimentEditor.jsx
+
10
−
7
View file @
40fbf9c6
...
@@ -141,14 +141,15 @@ const isValidEntity = (
...
@@ -141,14 +141,15 @@ const isValidEntity = (
possibleObj
:
{
inputs
:
any
,
outputs
:
any
}
=
{
inputs
:{},
outputs
:{}},
possibleObj
:
{
inputs
:
any
,
outputs
:
any
}
=
{
inputs
:{},
outputs
:{}},
inferredTypes
=
{}
inferredTypes
=
{}
):
boolean
=>
{
):
boolean
=>
{
if
(
!
blockTcEntity
.
hasOwnProperty
(
'
inputs
'
)
&&
Object
.
keys
(
possibleObj
.
inputs
).
length
>
0
)
const
hasInputs
=
Array
.
isArray
(
blockTcEntity
.
inputs
);
const
hasOutputs
=
Array
.
isArray
(
blockTcEntity
.
outputs
);
if
(
!
hasInputs
&&
Object
.
keys
(
possibleObj
.
inputs
).
length
>
0
)
return
false
;
return
false
;
if
(
!
blockTcEntity
.
hasOwnProperty
(
'
o
utputs
'
)
&&
Object
.
keys
(
possibleObj
.
outputs
).
length
>
0
)
if
(
!
hasO
utputs
&&
Object
.
keys
(
possibleObj
.
outputs
).
length
>
0
)
return
false
;
return
false
;
if
(
blockTcEntity
.
hasOwnProperty
(
'
i
nputs
'
)
&&
blockTcEntity
.
inputs
.
length
!==
Object
.
keys
(
possibleObj
.
inputs
).
length
)
if
(
hasI
nputs
&&
blockTcEntity
.
inputs
.
length
!==
Object
.
keys
(
possibleObj
.
inputs
).
length
)
return
false
;
return
false
;
if
(
blockTcEntity
.
hasOwnProperty
(
'
inputs
'
)
&&
if
(
hasInputs
&&
hasOutputs
&&
blockTcEntity
.
hasOwnProperty
(
'
outputs
'
)
&&
blockTcEntity
.
outputs
.
length
!==
Object
.
keys
(
possibleObj
.
outputs
).
length
blockTcEntity
.
outputs
.
length
!==
Object
.
keys
(
possibleObj
.
outputs
).
length
)
)
return
false
;
return
false
;
...
@@ -590,9 +591,11 @@ export class ExperimentEditor extends React.Component<Props, State> {
...
@@ -590,9 +591,11 @@ export class ExperimentEditor extends React.Component<Props, State> {
const
newDs
=
JSON
.
parse
(
str
);
const
newDs
=
JSON
.
parse
(
str
);
//console.log(newDs);
//console.log(newDs);
this
.
setContents
({...
this
.
props
.
data
.
contents
,
datasets
:
newDs
});
this
.
setContents
({...
this
.
props
.
data
.
contents
,
datasets
:
newDs
});
/*
for(const dataset in this.props.data.contents.datasets){
for(const dataset in this.props.data.contents.datasets){
this.setLockMap(dataset, true);
this.setLockMap(dataset, true);
}
}
*/
}
}
}
}
>
>
<
option
value
=
''
>
Protocol...
</
option
>
<
option
value
=
''
>
Protocol...
</
option
>
...
@@ -692,7 +695,7 @@ export class ExperimentEditor extends React.Component<Props, State> {
...
@@ -692,7 +695,7 @@ export class ExperimentEditor extends React.Component<Props, State> {
const
newDs
=
{...
this
.
props
.
data
.
contents
.
datasets
,
[
name
]:
ds
};
const
newDs
=
{...
this
.
props
.
data
.
contents
.
datasets
,
[
name
]:
ds
};
this
.
setContents
({...
this
.
props
.
data
.
contents
,
datasets
:
newDs
});
this
.
setContents
({...
this
.
props
.
data
.
contents
,
datasets
:
newDs
});
this
.
setLockMap
(
name
,
true
);
//
this.setLockMap(name, true);
}
}
}
}
>
>
<
option
value
=
''
>
Dataset...
</
option
>
<
option
value
=
''
>
Dataset...
</
option
>
...
@@ -897,7 +900,7 @@ export class ExperimentEditor extends React.Component<Props, State> {
...
@@ -897,7 +900,7 @@ export class ExperimentEditor extends React.Component<Props, State> {
};
};
updateBlock
(
thisBlock
,
globals
);
updateBlock
(
thisBlock
,
globals
);
this
.
setLockMap
(
blockName
,
true
);
//
this.setLockMap(blockName, true);
}
}
}
}
>
>
<
option
value
=
''
>
Algorithm...
</
option
>
<
option
value
=
''
>
Algorithm...
</
option
>
...
...
This diff is collapsed.
Click to expand it.
conda/js/src/components/experiment/ExperimentEditor.spec.jsx
+
79
−
0
View file @
40fbf9c6
...
@@ -611,5 +611,84 @@ describe('<ExperimentEditor />', () => {
...
@@ -611,5 +611,84 @@ describe('<ExperimentEditor />', () => {
}
}
});
});
});
});
it
(
`doesnt change the lockMap after an algorithm or dataset is assigned`
,
()
=>
{
const
expName
=
'
user/user/single/1/single_add
'
;
const
saveFunc
=
sinon
.
spy
();
const
_updateFunc
=
(
obj
)
=>
{
wrapper
.
setProps
&&
wrapper
.
setProps
({
data
:
obj
});
};
const
updateFunc
=
sinon
.
spy
(
_updateFunc
);
const
tc
=
testTcs
.
find
(
tc
=>
expName
.
includes
(
tc
.
name
));
wrapper
=
mount
(
<
C
data
=
{
getValidObj
({
name
:
expName
,
contents
:
{}},
tc
,
[...
normalBlocks
,
...
analyzerBlocks
])
}
experiments
=
{
[]
}
normalBlocks
=
{
normalBlocks
}
analyzerBlocks
=
{
analyzerBlocks
}
datasets
=
{
datasets
}
toolchain
=
{
tc
}
saveFunc
=
{
saveFunc
}
environments
=
{
envs
}
updateFunc
=
{
updateFunc
}
/>
);
expect
(
wrapper
.
props
().
data
).
to
.
have
.
property
(
'
name
'
,
expName
);
//console.log('finished name change, doing dataset');
wrapper
.
find
(
'
svg #block_set
'
).
simulate
(
'
click
'
);
wrapper
.
find
(
'
div.dataset0 select
'
).
simulate
(
'
change
'
,
{
target
:
{
value
:
'
protocol/set (simple/1)
'
}});
expect
(
updateFunc
.
callCount
).
to
.
equal
(
1
);
expect
(
wrapper
.
props
().
data
.
contents
).
to
.
have
.
deep
.
property
(
'
datasets
'
,
{
'
set
'
:
{
'
set
'
:
'
set
'
,
'
protocol
'
:
'
protocol
'
,
'
database
'
:
'
simple/1
'
}
});
//console.log('finished dataset, doing block');
wrapper
.
find
(
'
svg #block_echo
'
).
simulate
(
'
click
'
);
expect
(
wrapper
.
find
({
name
:
'
echo
'
,
set
:
'
blocks
'
}).
find
(
'
.tcBlockBackground
'
).
prop
(
'
className
'
)).
to
.
include
(
'
highlighted
'
);
wrapper
.
find
(
'
div.block0 div.algorithm select
'
).
at
(
0
).
simulate
(
'
change
'
,
{
target
:
{
value
:
'
user/integers_add/1
'
}});
expect
(
updateFunc
.
callCount
).
to
.
equal
(
2
);
expect
(
wrapper
.
props
().
data
.
contents
).
to
.
have
.
deep
.
property
(
'
blocks
'
,
{
'
echo
'
:
{
'
inputs
'
:
{
'
in_data
'
:
'
in
'
},
'
algorithm
'
:
'
user/integers_add/1
'
,
'
outputs
'
:
{
'
out_data
'
:
'
out
'
},
parameters
:
{}
}
});
//console.log('finished block, doing analyzer');
wrapper
.
find
(
'
svg #block_analysis
'
).
simulate
(
'
click
'
);
expect
(
wrapper
.
find
({
name
:
'
analysis
'
,
set
:
'
analyzers
'
}).
find
(
'
.tcBlockBackground
'
).
prop
(
'
className
'
)).
to
.
include
(
'
highlighted
'
);
wrapper
.
find
(
'
div.block0 div.algorithm select
'
).
at
(
0
).
simulate
(
'
change
'
,
{
target
:
{
value
:
'
user/integers_echo_analyzer/1
'
}});
expect
(
updateFunc
.
callCount
).
to
.
equal
(
3
);
expect
(
wrapper
.
props
().
data
.
contents
).
to
.
have
.
deep
.
property
(
'
analyzers
'
,
{
'
analysis
'
:
{
'
inputs
'
:
{
'
in_data
'
:
'
in
'
},
'
algorithm
'
:
'
user/integers_echo_analyzer/1
'
,
parameters
:
{},
}
});
expect
(
wrapper
.
state
().
lockMap
).
to
.
deep
.
equal
({
set
:
false
,
echo
:
false
,
analysis
:
false
,
});
});
});
});
});
});
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