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!
瀏覽代碼

Configurable expected status in makeArvadosRequest()

pull/1/head
父節點
當前提交
d37252dded
共有 3 個文件被更改,包括 8 次插入6 次删除
  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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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…
取消
儲存