IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Procházet zdrojové kódy

Support [File, Directory] syntax in workflow input type spec

master
Stanislaw Adaszewski před 4 roky
rodič
revize
4217a270c2
5 změnil soubory, kde provedl 25 přidání a 19 odebrání
  1. +1
    -1
      backend/srv.py
  2. +3
    -3
      frontend/src/js/dialog/wb-browse-dialog-collection-content.js
  3. +1
    -1
      frontend/src/js/dialog/wb-browse-dialog-collection-list.js
  4. +3
    -3
      frontend/src/js/dialog/wb-browse-dialog-project-list.js
  5. +17
    -11
      frontend/src/js/page/wb-launch-workflow-page.js

+ 1
- 1
backend/srv.py Zobrazit soubor

@@ -9,7 +9,7 @@ class RequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)
# 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.serve_forever()


+ 3
- 3
frontend/src/js/dialog/wb-browse-dialog-collection-content.js Zobrazit soubor

@@ -73,9 +73,9 @@ class WBBrowseDialogCollectionContent extends Component {
const numPages = Math.ceil(listing.length / itemsPerPage);
const rows = listing.slice(page * itemsPerPage,
(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,
it[0] === 'd' ? (
<a href="#" onclick={ e => {


+ 1
- 1
frontend/src/js/dialog/wb-browse-dialog-collection-list.js Zobrazit soubor

@@ -21,7 +21,7 @@ class WBBrowseDialogCollectionList extends Component {
prepareRows(items) {
const { navigate, selectWhat, makeSelectionCell } = this.props;
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();
navigate('/browse-dialog/content/' + it.uuid + '////'); } }>{ it.name }</a>


+ 3
- 3
frontend/src/js/dialog/wb-browse-dialog-project-list.js Zobrazit soubor

@@ -21,7 +21,7 @@ class WBBrowseDialogProjectList extends Component {
prepareRows(items) {
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 => {
e.preventDefault();
@@ -86,8 +86,8 @@ class WBBrowseDialogProjectList extends Component {
render({ app, navigate, page, selectWhat }, { numPages, rows }) {
return (
<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 } />
<WBPagination numPages={ numPages } activePage={ page }


+ 17
- 11
frontend/src/js/page/wb-launch-workflow-page.js Zobrazit soubor

@@ -25,10 +25,10 @@ function encodeURIComponentIncludingDots(s) {
function inputSpecInfo(inputSpec) {
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[]' ||
(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[]' ||
inputSpec.type.type === 'array');
@@ -36,11 +36,11 @@ function inputSpecInfo(inputSpec) {
return { isFile, isDirectory, isArray };
}
function uuidsToCwl(obj, isFile) {
function uuidsToCwl(obj) {
if (obj instanceof Array) {
const res = {};
const res = [];
for (let k in obj) {
res[k] = uuidsToCwl(obj[k], isFile);
res[k] = uuidsToCwl(obj[k]);
}
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-f]{32}\+[0-9]+/.exec(obj))) {
const isDirectory = obj.endsWith('/');
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 {
fetchData() {
const { app, path } = this.props;
const { app } = this.props;
const { arvHost, arvToken } = app.state;
let { path } = this.props;
if (path.endsWith('/'))
path = path.substr(0, path.length - 1);
let m;
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));
@@ -157,7 +162,9 @@ class WBLaunchWorkflowPage extends Component {
<button class="btn btn-outline-primary"
onclick={ e => {
e.preventDefault();
this.browseDialogRef.current.show(isFile ? 'file' : 'directory', isArray,
this.browseDialogRef.current.show(
[].concat(isFile ? 'file' : []).concat(isDirectory ? 'directory' : []),
isArray,
v => {
this.state.inputs[inputSpec.id] = JSON.stringify(v);
this.setState({});
@@ -212,8 +219,7 @@ class WBLaunchWorkflowPage extends Component {
for (let k in this.state.inputs) {
try {
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('/');
inputs[k] = (val === undefined ? null : val);
} catch (exc) {


Načítá se…
Zrušit
Uložit