Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
50d8c9a8
Commit
50d8c9a8
authored
9 years ago
by
juanf
Browse files
Options
Downloads
Patches
Plain Diff
SSDM-3044 : Using standard browser links to download and open in new tab files and dataset form.
SVN: 35732
parent
8c8ff09b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/DatasetViewerView.js
+31
-56
31 additions, 56 deletions
...ims/html/js/views/SampleForm/widgets/DatasetViewerView.js
with
31 additions
and
56 deletions
plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/DatasetViewerView.js
+
31
−
56
View file @
50d8c9a8
...
@@ -59,45 +59,43 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) {
...
@@ -59,45 +59,43 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) {
//
//
// Simple Datasets Table
// Simple Datasets Table
//
//
var
tableClass
=
"
table
"
;
var
tableClass
=
"
table table-hover
"
;
if
(
this
.
_dataSetViewerModel
.
enableOpenDataset
)
{
tableClass
+=
"
table-hover
"
;
}
var
$dataSetsTable
=
$
(
"
<table>
"
,
{
class
:
tableClass
});
var
$dataSetsTable
=
$
(
"
<table>
"
,
{
class
:
tableClass
});
$dataSetsTable
.
append
(
$
(
"
<thead>
"
).
append
(
$
(
"
<tr>
"
)
$dataSetsTable
.
append
(
$
(
"
<thead>
"
).
append
(
$
(
"
<tr>
"
)
.
append
(
$
(
"
<th>
"
,
{
"
style
"
:
"
width: 35%;
"
}).
html
(
"
Type
"
))
.
append
(
$
(
"
<th>
"
,
{
"
style
"
:
"
width: 50%;
"
}).
text
(
"
Type
"
))
.
append
(
$
(
"
<th>
"
,
{
"
style
"
:
"
width: 50%;
"
}).
html
(
"
Code
"
))
.
append
(
$
(
"
<th>
"
,
{
"
style
"
:
"
width: 50%;
"
}).
text
(
"
Code
"
))));
.
append
(
$
(
"
<th>
"
,
{
"
style
"
:
"
width: 15%;
"
}).
html
(
"
Operations
"
))));
var
tbody
=
$
(
"
<tbody>
"
);
var
tbody
=
$
(
"
<tbody>
"
);
$dataSetsTable
.
append
(
tbody
);
$dataSetsTable
.
append
(
tbody
);
for
(
var
datasetCode
in
this
.
_dataSetViewerModel
.
sampleDataSets
)
{
for
(
var
datasetCode
in
this
.
_dataSetViewerModel
.
sampleDataSets
)
{
var
dataset
=
this
.
_dataSetViewerModel
.
sampleDataSets
[
datasetCode
];
var
dataset
=
this
.
_dataSetViewerModel
.
sampleDataSets
[
datasetCode
];
var
getDatasetLinkEvent
=
function
(
code
)
{
var
getDatasetLinkEvent
=
function
(
code
)
{
return
function
(
event
)
{
return
function
(
event
)
{
_this
.
updateDirectoryView
(
code
,
"
/
"
);
_this
.
updateDirectoryView
(
code
,
"
/
"
);
event
.
stopPropagation
();
};
}
var
$datasetLink
=
$
(
"
<a>
"
).
text
(
dataset
.
code
).
click
(
getDatasetLinkEvent
(
dataset
.
code
));
var
datasetFormClick
=
function
(
datasetCode
)
{
return
function
(
event
)
{
mainController
.
changeView
(
'
showViewDataSetPageFromPermId
'
,
datasetCode
);
event
.
stopPropagation
();
};
};
}
}
var
$datasetFormClickBtn
=
""
;
var
$datasetFormClickBtn
=
""
;
if
(
this
.
_dataSetViewerModel
.
enableOpenDataset
)
{
if
(
this
.
_dataSetViewerModel
.
enableOpenDataset
)
{
$datasetFormClickBtn
=
$
(
"
<a>
"
).
append
(
$
(
"
<span>
"
).
attr
(
"
class
"
,
"
glyphicon glyphicon-search
"
)).
click
(
datasetFormClick
(
dataset
.
code
));
var
href
=
Util
.
getURLFor
(
mainController
.
sideMenu
.
getCurrentNodeId
(),
'
showViewDataSetPageFromPermId
'
,
datasetCode
);
$datasetFormClickBtn
=
$
(
"
<a>
"
,
{
"
href
"
:
href
,
"
class
"
:
"
browser-compatible-javascript-link
"
}).
append
(
datasetCode
);
var
getDatasetFormClick
=
function
(
datasetCode
)
{
return
function
(
event
)
{
mainController
.
changeView
(
'
showViewDataSetPageFromPermId
'
,
datasetCode
);
};
}
$datasetFormClickBtn
.
click
(
getDatasetFormClick
(
datasetCode
));
}
else
{
$datasetFormClickBtn
=
dataset
.
code
;
}
}
var
tRow
=
$
(
"
<tr>
"
)
var
tRow
=
$
(
"
<tr>
"
,
{
"
style
"
:
"
cursor:pointer;
"
}
)
.
append
(
$
(
"
<td>
"
).
html
(
dataset
.
dataSetTypeCode
))
.
append
(
$
(
"
<td>
"
).
html
(
dataset
.
dataSetTypeCode
))
.
append
(
$
(
"
<td>
"
).
append
(
$datasetLink
))
.
append
(
$
(
"
<td>
"
).
append
(
$datasetFormClickBtn
));
.
append
(
$
(
"
<td>
"
).
append
(
$datasetFormClickBtn
));
tRow
.
click
(
getDatasetLinkEvent
(
dataset
.
code
));
tRow
.
click
(
getDatasetLinkEvent
(
dataset
.
code
));
...
@@ -128,17 +126,13 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) {
...
@@ -128,17 +126,13 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) {
//
//
// Simple Files Table
// Simple Files Table
//
//
var
tableClass
=
"
table
"
;
var
tableClass
=
"
table table-hover
"
;
if
(
this
.
_dataSetViewerModel
.
enableOpenDataset
)
{
tableClass
+=
"
table-hover
"
;
}
var
$dataSetsTable
=
$
(
"
<table>
"
,
{
class
:
tableClass
});
var
$dataSetsTable
=
$
(
"
<table>
"
,
{
class
:
tableClass
});
$dataSetsTable
.
append
(
$dataSetsTable
.
append
(
$
(
"
<thead>
"
).
append
(
$
(
"
<thead>
"
).
append
(
$
(
"
<tr>
"
)
$
(
"
<tr>
"
)
.
append
(
$
(
"
<th>
"
,
{
"
style
"
:
"
width: 70%;
"
}).
html
(
"
Name
"
))
.
append
(
$
(
"
<th>
"
,
{
"
style
"
:
"
width: 80%;
"
}).
html
(
"
Name
"
))
.
append
(
$
(
"
<th>
"
,
{
"
style
"
:
"
width: 15%;
"
}).
html
(
"
Size (MB)
"
))
.
append
(
$
(
"
<th>
"
,
{
"
style
"
:
"
width: 20%;
"
}).
html
(
"
Size (MB)
"
))
.
append
(
$
(
"
<th>
"
,
{
"
style
"
:
"
width: 15%;
"
}).
html
(
"
Operations
"
))
)
)
);
);
...
@@ -161,9 +155,8 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) {
...
@@ -161,9 +155,8 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) {
event
.
stopPropagation
();
event
.
stopPropagation
();
};
};
var
$tableRow
=
$
(
"
<tr>
"
)
var
$tableRow
=
$
(
"
<tr>
"
,
{
"
style
"
:
"
cursor:pointer;
"
})
.
append
(
$
(
"
<td>
"
).
append
(
$
(
"
<a>
"
).
text
(
"
..
"
).
click
(
backClick
)))
.
append
(
$
(
"
<td>
"
).
append
(
"
..
"
).
click
(
backClick
))
.
append
(
$
(
"
<td>
"
))
.
append
(
$
(
"
<td>
"
));
.
append
(
$
(
"
<td>
"
));
$tableRow
.
click
(
backClick
);
$tableRow
.
click
(
backClick
);
$dataSetsTableBody
.
append
(
$tableRow
);
$dataSetsTableBody
.
append
(
$tableRow
);
...
@@ -192,40 +185,22 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) {
...
@@ -192,40 +185,22 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) {
};
};
var
dirFunc
=
getDirectoyClickFuncion
(
datasetCode
,
datasetFiles
[
i
].
pathInDataSet
);
var
dirFunc
=
getDirectoyClickFuncion
(
datasetCode
,
datasetFiles
[
i
].
pathInDataSet
);
var
$directoryLink
=
$
(
"
<a>
"
).
text
(
"
/
"
+
pathInDatasetDisplayName
)
$tableRow
.
attr
(
"
style
"
,
"
cursor:pointer;
"
);
.
click
(
function
(
event
)
{
$tableRow
.
append
(
$
(
"
<td>
"
).
append
(
"
/
"
+
pathInDatasetDisplayName
)).
append
(
$
(
"
<td>
"
));
dirFunc
();
event
.
stopPropagation
();
});
$tableRow
.
append
(
$
(
"
<td>
"
).
append
(
$directoryLink
)).
append
(
$
(
"
<td>
"
)).
append
(
$
(
"
<td>
"
));
$tableRow
.
click
(
dirFunc
);
$tableRow
.
click
(
dirFunc
);
}
else
{
}
else
{
$tableRow
.
append
(
$
(
"
<td>
"
).
append
(
$
(
"
<p>
"
).
text
(
pathInDatasetDisplayName
)));
var
$pathInDatasetDisplayNameWithDownload
=
$
(
"
<a>
"
).
attr
(
"
href
"
,
downloadUrl
)
var
sizeInMb
=
parseInt
(
datasetFiles
[
i
].
fileSize
)
/
1024
/
1024
;
var
sizeInMbThreeDecimals
=
Math
.
floor
(
sizeInMb
*
1000
)
/
1000
;
$tableRow
.
append
(
$
(
"
<td>
"
).
html
(
sizeInMbThreeDecimals
));
var
$previewBtn
=
$
(
"
<a>
"
).
attr
(
"
href
"
,
downloadUrl
)
.
attr
(
"
target
"
,
"
_blank
"
)
.
attr
(
"
target
"
,
"
_blank
"
)
.
append
(
$
(
"
<span>
"
).
attr
(
"
class
"
,
"
glyphicon glyphicon-search
"
)
)
.
append
(
pathInDatasetDisplayName
)
.
click
(
function
(
event
)
{
.
click
(
function
(
event
)
{
event
.
stopPropagation
();
event
.
stopPropagation
();
});
});
var
$downloadBtn
=
$
(
"
<a>
"
).
attr
(
"
href
"
,
downloadUrl
)
$tableRow
.
append
(
$
(
"
<td>
"
).
append
(
$pathInDatasetDisplayNameWithDownload
));
.
attr
(
"
download
"
,
'
download
'
)
.
append
(
$
(
"
<span>
"
).
attr
(
"
class
"
,
"
glyphicon glyphicon-download
"
))
var
sizeInMb
=
parseInt
(
datasetFiles
[
i
].
fileSize
)
/
1024
/
1024
;
.
click
(
function
(
event
)
{
var
sizeInMbThreeDecimals
=
Math
.
floor
(
sizeInMb
*
1000
)
/
1000
;
event
.
stopPropagation
();
$tableRow
.
append
(
$
(
"
<td>
"
).
html
(
sizeInMbThreeDecimals
));
});
if
(
this
.
_dataSetViewerController
.
_isPreviewable
(
datasetFiles
[
i
]))
{
$tableRow
.
append
(
$
(
"
<td>
"
).
append
(
$previewBtn
).
append
(
$downloadBtn
));
}
else
{
$tableRow
.
append
(
$
(
"
<td>
"
).
append
(
$downloadBtn
));
}
}
}
$dataSetsTableBody
.
append
(
$tableRow
);
$dataSetsTableBody
.
append
(
$tableRow
);
...
...
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