@@ -9,7 +9,7 @@ class RequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): | |||||
SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) | SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) | ||||
# RequestHandler, self).do_GET() | # RequestHandler, self).do_GET() | ||||
httpd = BaseHTTPServer.HTTPServer(('0.0.0.0', 4443), RequestHandler) | |||||
httpd = BaseHTTPServer.HTTPServer(('0.0.0.0', 4445), RequestHandler) | |||||
httpd.socket = ssl.wrap_socket (httpd.socket, certfile='/pstore/home/adaszews/workspace/arvados-workbench-advanced/backend/server.pem', server_side=True) | httpd.socket = ssl.wrap_socket (httpd.socket, certfile='/pstore/home/adaszews/workspace/arvados-workbench-advanced/backend/server.pem', server_side=True) | ||||
httpd.serve_forever() | httpd.serve_forever() | ||||
@@ -73,9 +73,9 @@ class WBBrowseDialogCollectionContent extends Component { | |||||
const numPages = Math.ceil(listing.length / itemsPerPage); | const numPages = Math.ceil(listing.length / itemsPerPage); | ||||
const rows = listing.slice(page * itemsPerPage, | const rows = listing.slice(page * itemsPerPage, | ||||
(page + 1) * itemsPerPage).map(it => [ | (page + 1) * itemsPerPage).map(it => [ | ||||
((it[0] === 'd' && selectWhat === 'directory') || | |||||
(it[0] === 'f' && selectWhat === 'file')) ? | |||||
makeSelectionCell(collectionUuid + collectionPath + '/' + it[1]) : | |||||
((it[0] === 'd' && [].concat(selectWhat).indexOf('directory') !== -1) || | |||||
(it[0] === 'f' && [].concat(selectWhat).indexOf('file') !== -1)) ? | |||||
makeSelectionCell(collectionUuid + collectionPath + '/' + it[1] + (it[0] === 'd' ? '/' : '')) : | |||||
null, | null, | ||||
it[0] === 'd' ? ( | it[0] === 'd' ? ( | ||||
<a href="#" onclick={ e => { | <a href="#" onclick={ e => { | ||||
@@ -21,7 +21,7 @@ class WBBrowseDialogCollectionList extends Component { | |||||
prepareRows(items) { | prepareRows(items) { | ||||
const { navigate, selectWhat, makeSelectionCell } = this.props; | const { navigate, selectWhat, makeSelectionCell } = this.props; | ||||
return items.map(it => [ | return items.map(it => [ | ||||
(selectWhat === 'directory' ? makeSelectionCell(it.uuid) : null), | |||||
([].concat(selectWhat).indexOf('directory') !== -1 ? makeSelectionCell(it.uuid + '/') : null), | |||||
( | ( | ||||
<a href="#" onclick={ e => { e.preventDefault(); | <a href="#" onclick={ e => { e.preventDefault(); | ||||
navigate('/browse-dialog/content/' + it.uuid + '////'); } }>{ it.name }</a> | navigate('/browse-dialog/content/' + it.uuid + '////'); } }>{ it.name }</a> | ||||
@@ -21,7 +21,7 @@ class WBBrowseDialogProjectList extends Component { | |||||
prepareRows(items) { | prepareRows(items) { | ||||
const { navigate, selectWhat, makeSelectionCell } = this.props; | const { navigate, selectWhat, makeSelectionCell } = this.props; | ||||
return items.map(it => (selectWhat === 'owner' ? [ makeSelectionCell(it.uuid, 'project') ] : []).concat([ | |||||
return items.map(it => ([].concat(selectWhat).indexOf('owner') !== -1 ? [ makeSelectionCell(it.uuid, 'project') ] : []).concat([ | |||||
( | ( | ||||
<a href="#" onclick={ e => { | <a href="#" onclick={ e => { | ||||
e.preventDefault(); | e.preventDefault(); | ||||
@@ -86,8 +86,8 @@ class WBBrowseDialogProjectList extends Component { | |||||
render({ app, navigate, page, selectWhat }, { numPages, rows }) { | render({ app, navigate, page, selectWhat }, { numPages, rows }) { | ||||
return ( | return ( | ||||
<div> | <div> | ||||
<WBTable columns={ (selectWhat === 'owner' ? [''] : []).concat(['Name', 'UUID']) } | |||||
headerClasses={ selectWhat === 'owner' ? ['col-sm-1', 'col-sm-4', 'col-sm-4'] : [] } | |||||
<WBTable columns={ ([].concat(selectWhat).indexOf('owner') !== -1 ? [''] : []).concat(['Name', 'UUID']) } | |||||
headerClasses={ [].concat(selectWhat).indexOf('owner') !== -1 ? ['col-sm-1', 'col-sm-4', 'col-sm-4'] : [] } | |||||
rows={ rows } /> | rows={ rows } /> | ||||
<WBPagination numPages={ numPages } activePage={ page } | <WBPagination numPages={ numPages } activePage={ page } | ||||
@@ -25,10 +25,10 @@ function encodeURIComponentIncludingDots(s) { | |||||
function inputSpecInfo(inputSpec) { | function inputSpecInfo(inputSpec) { | ||||
const isFile = (inputSpec.type === 'File' || inputSpec.type === 'File[]' || | const isFile = (inputSpec.type === 'File' || inputSpec.type === 'File[]' || | ||||
(inputSpec.type.type === 'array' && inputSpec.type.items === 'File')); | |||||
(inputSpec.type.type === 'array' && [].concat(inputSpec.type.items).indexOf('File') !== -1)); | |||||
const isDirectory = (inputSpec.type === 'Directory' || inputSpec.type === 'Directory[]' || | const isDirectory = (inputSpec.type === 'Directory' || inputSpec.type === 'Directory[]' || | ||||
(inputSpec.type.type === 'array' && inputSpec.type.items === 'Directory')); | |||||
(inputSpec.type.type === 'array' && [].concat(inputSpec.type.items).indexOf('Directory') !== -1)); | |||||
const isArray = (inputSpec.type === 'File[]' || inputSpec.type === 'Directory[]' || | const isArray = (inputSpec.type === 'File[]' || inputSpec.type === 'Directory[]' || | ||||
inputSpec.type.type === 'array'); | inputSpec.type.type === 'array'); | ||||
@@ -36,11 +36,11 @@ function inputSpecInfo(inputSpec) { | |||||
return { isFile, isDirectory, isArray }; | return { isFile, isDirectory, isArray }; | ||||
} | } | ||||
function uuidsToCwl(obj, isFile) { | |||||
function uuidsToCwl(obj) { | |||||
if (obj instanceof Array) { | if (obj instanceof Array) { | ||||
const res = {}; | |||||
const res = []; | |||||
for (let k in obj) { | for (let k in obj) { | ||||
res[k] = uuidsToCwl(obj[k], isFile); | |||||
res[k] = uuidsToCwl(obj[k]); | |||||
} | } | ||||
return res; | return res; | ||||
} | } | ||||
@@ -49,9 +49,11 @@ function uuidsToCwl(obj, isFile) { | |||||
(/^[0-9a-z]{5}-[0-9a-z]{5}-[0-9a-z]{15}/.exec(obj) || | (/^[0-9a-z]{5}-[0-9a-z]{5}-[0-9a-z]{15}/.exec(obj) || | ||||
/^[0-9a-f]{32}\+[0-9]+/.exec(obj))) { | /^[0-9a-f]{32}\+[0-9]+/.exec(obj))) { | ||||
const isDirectory = obj.endsWith('/'); | |||||
return { | return { | ||||
'class': (isFile ? 'File' : 'Directory'), | |||||
'location': 'keep:' + obj | |||||
'class': (isDirectory ? 'Directory' : 'File'), | |||||
'location': 'keep:' + (isDirectory ? obj.substr(0, obj.length - 1) : obj) | |||||
}; | }; | ||||
} | } | ||||
@@ -66,8 +68,11 @@ function parseKeepRef(value) { | |||||
class WBPathDisplay extends Component { | class WBPathDisplay extends Component { | ||||
fetchData() { | fetchData() { | ||||
const { app, path } = this.props; | |||||
const { app } = this.props; | |||||
const { arvHost, arvToken } = app.state; | const { arvHost, arvToken } = app.state; | ||||
let { path } = this.props; | |||||
if (path.endsWith('/')) | |||||
path = path.substr(0, path.length - 1); | |||||
let m; | let m; | ||||
if (m = /^[0-9a-f]{32}\+[0-9]+/.exec(path)); | if (m = /^[0-9a-f]{32}\+[0-9]+/.exec(path)); | ||||
else if (m = /^[a-z0-9]{5}-[a-z0-9]{5}-[a-z0-9]{15}/.exec(path)); | else if (m = /^[a-z0-9]{5}-[a-z0-9]{5}-[a-z0-9]{15}/.exec(path)); | ||||
@@ -157,7 +162,9 @@ class WBLaunchWorkflowPage extends Component { | |||||
<button class="btn btn-outline-primary" | <button class="btn btn-outline-primary" | ||||
onclick={ e => { | onclick={ e => { | ||||
e.preventDefault(); | e.preventDefault(); | ||||
this.browseDialogRef.current.show(isFile ? 'file' : 'directory', isArray, | |||||
this.browseDialogRef.current.show( | |||||
[].concat(isFile ? 'file' : []).concat(isDirectory ? 'directory' : []), | |||||
isArray, | |||||
v => { | v => { | ||||
this.state.inputs[inputSpec.id] = JSON.stringify(v); | this.state.inputs[inputSpec.id] = JSON.stringify(v); | ||||
this.setState({}); | this.setState({}); | ||||
@@ -212,8 +219,7 @@ class WBLaunchWorkflowPage extends Component { | |||||
for (let k in this.state.inputs) { | for (let k in this.state.inputs) { | ||||
try { | try { | ||||
let val = jsyaml.safeLoad(this.state.inputs[k]); | let val = jsyaml.safeLoad(this.state.inputs[k]); | ||||
const { isFile } = inputSpecInfo(main.inputs.find(a => (a.id === k))); | |||||
val = uuidsToCwl(val, isFile); | |||||
val = uuidsToCwl(val); | |||||
k = k.split('/').slice(1).join('/'); | k = k.split('/').slice(1).join('/'); | ||||
inputs[k] = (val === undefined ? null : val); | inputs[k] = (val === undefined ? null : val); | ||||
} catch (exc) { | } catch (exc) { | ||||