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!
Browse Source

Configurable expected status in makeArvadosRequest()

pull/1/head
parent
commit
d37252dded
3 changed files with 8 additions and 6 deletions
  1. +2
    -2
      frontend/src/js/dialog/wb-new-project-dialog.js
  2. +5
    -3
      frontend/src/js/misc/make-arvados-request.js
  3. +1
    -1
      frontend/src/js/misc/wb-delete-object.js

+ 2
- 2
frontend/src/js/dialog/wb-new-project-dialog.js View File

@@ -36,9 +36,9 @@ class WBNewProjectDialog extends Component {
'owner_uuid': ownerUuid
};
makeArvadosRequest(arvHost, arvToken,
'/arvados/v1/groups', { 'method': 'POST',
'/arvados/v1/groups?async=true', { 'method': 'POST',
'data': JSON.stringify(group),
'promiseOrdering': false }
'expectedStatus': 202 }
).then(callback);
} }>
<div>


+ 5
- 3
frontend/src/js/misc/make-arvados-request.js View File

@@ -11,13 +11,15 @@ function makeArvadosRequest(arvHost, arvToken, endpoint, params={}) {
'useSsl': true,
'requireToken': true,
'onProgress': () => {},
'promiseOrdering': true
'promiseOrdering': true,
'expectedStatus': 200
};
Object.keys(defaultParams).map(k => (params[k] =
(k in params ? params[k] : defaultParams[k])));
let { method, data, contentType, responseType,
useSsl, requireToken, onProgress, promiseOrdering } = params;
useSsl, requireToken, onProgress, promiseOrdering,
expectedStatus } = params;
if (!(arvHost && (arvToken || !requireToken)))
return new Promise((accept, reject) => reject());
@@ -36,7 +38,7 @@ function makeArvadosRequest(arvHost, arvToken, endpoint, params={}) {
xhr.onreadystatechange = () => {
if (xhr.readyState !== 4)
return;
if (xhr.status !== 200)
if (xhr.status !== expectedStatus)
reject(xhr);
else
accept(xhr);


+ 1
- 1
frontend/src/js/misc/wb-delete-object.js View File

@@ -5,7 +5,7 @@ function wbDeleteObject(arvHost, arvToken, uuid) {
const typeName = arvadosTypeName(uuid);
return makeArvadosRequest(arvHost, arvToken,
'/arvados/v1/' + typeName + 's/' +
uuid, { 'method': 'DELETE', 'promiseOrdering': false });
uuid, { 'method': 'DELETE' });
}
export default wbDeleteObject;

Loading…
Cancel
Save