Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
minerva
core
Commits
fc9dc925
Commit
fc9dc925
authored
5 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
when uploading data overlay without specified type set default GENERIC
parent
7f3507aa
No related branches found
No related tags found
1 merge request
!904
Resolve "TYPE Genetic variant does not change on generic during data overlay upload"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend-js/src/main/js/gui/AddOverlayDialog.js
+26
-3
26 additions, 3 deletions
frontend-js/src/main/js/gui/AddOverlayDialog.js
frontend-js/src/test/js/gui/AddOverlayDialog-test.js
+37
-0
37 additions, 0 deletions
frontend-js/src/test/js/gui/AddOverlayDialog-test.js
with
63 additions
and
3 deletions
frontend-js/src/main/js/gui/AddOverlayDialog.js
+
26
−
3
View file @
fc9dc925
...
...
@@ -146,7 +146,6 @@ AddOverlayDialog.prototype.processFile = function (file) {
var
overlay
=
overlayParser
.
parse
(
evt
.
target
.
result
);
var
nameInput
=
$
(
"
[name='overlay-name']
"
,
self
.
getElement
())[
0
];
var
descriptionInput
=
$
(
"
[name='overlay-description']
"
,
self
.
getElement
())[
0
];
var
typeSelect
=
$
(
"
[name='overlay-type']
"
,
self
.
getElement
());
if
(
overlay
.
getName
()
!==
undefined
)
{
nameInput
.
value
=
overlay
.
getName
();
}
else
{
...
...
@@ -163,9 +162,13 @@ AddOverlayDialog.prototype.processFile = function (file) {
if
(
overlay
.
getDescription
()
!==
undefined
)
{
descriptionInput
.
value
=
overlay
.
getDescription
();
}
if
(
overlay
.
getType
()
!==
undefined
)
{
typeSelect
.
val
(
overlay
.
getType
());
self
.
setType
(
overlay
.
getType
());
}
else
{
self
.
setType
(
"
GENERIC
"
);
}
if
(
overlayParser
.
containsMixedNewLineCharacters
(
evt
.
target
.
result
))
{
GuiConnector
.
warn
(
"
Selected file contains new line characters from different operating systems
"
+
"
(MAC/Windows/Linux). This might cause confusion when reading the file in the editor later on.
"
)
...
...
@@ -187,7 +190,7 @@ AddOverlayDialog.prototype.processFile = function (file) {
/**
*
* @param {string} fileContent
* @param {
?null|
string} fileContent
*/
AddOverlayDialog
.
prototype
.
setFileContent
=
function
(
fileContent
)
{
if
(
typeof
fileContent
===
'
string
'
||
fileContent
instanceof
String
)
{
...
...
@@ -324,4 +327,24 @@ AddOverlayDialog.prototype.open = function () {
$
(
div
).
dialog
(
"
open
"
);
};
/**
*
* @param {string} type
*/
AddOverlayDialog
.
prototype
.
setType
=
function
(
type
)
{
var
self
=
this
;
if
(
type
!==
undefined
)
{
var
typeSelect
=
$
(
"
[name='overlay-type']
"
,
self
.
getElement
());
typeSelect
.
val
(
type
);
}
};
/**
*
* @return {string}
*/
AddOverlayDialog
.
prototype
.
getType
=
function
()
{
var
self
=
this
;
return
$
(
"
[name='overlay-type']
"
,
self
.
getElement
()).
val
();
};
module
.
exports
=
AddOverlayDialog
;
This diff is collapsed.
Click to expand it.
frontend-js/src/test/js/gui/AddOverlayDialog-test.js
+
37
−
0
View file @
fc9dc925
"
use strict
"
;
var
Readable
=
require
(
'
stream
'
).
Readable
;
var
toBlob
=
require
(
'
stream-to-blob
'
);
require
(
"
../mocha-config
"
);
var
$
=
require
(
'
jquery
'
);
...
...
@@ -10,6 +13,7 @@ var chai = require('chai');
var
assert
=
chai
.
assert
;
var
logger
=
require
(
'
../logger
'
);
describe
(
'
AddOverlayDialog
'
,
function
()
{
it
(
'
addOverlay
'
,
function
()
{
...
...
@@ -57,4 +61,37 @@ describe('AddOverlayDialog', function () {
});
});
describe
(
'
processFile
'
,
function
()
{
it
(
'
set default type
'
,
function
()
{
var
dialog
;
var
file
;
return
ServerConnector
.
getProject
().
then
(
function
(
project
)
{
dialog
=
createDialog
(
project
);
return
dialog
.
init
();
}).
then
(
function
()
{
dialog
.
setType
(
"
GENETIC_VARIANT
"
);
assert
.
equal
(
"
GENETIC_VARIANT
"
,
dialog
.
getType
());
var
stream
=
new
Readable
;
stream
.
push
(
"
s1
\n
"
);
stream
.
push
(
null
);
return
new
Promise
(
function
(
resolve
,
reject
)
{
toBlob
(
stream
,
function
(
err
,
blob
)
{
if
(
err
)
return
reject
(
err
.
message
);
file
=
blob
;
file
.
name
=
"
test.txt
"
;
resolve
(
blob
);
})
});
}).
then
(
function
()
{
return
dialog
.
processFile
(
file
);
}).
then
(
function
()
{
assert
.
equal
(
"
GENERIC
"
,
dialog
.
getType
());
});
});
});
});
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