Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React & Antd UI: Model manager #856

Merged
merged 18 commits into from
Nov 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cvat-core/src/api-implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@
return result;
};

cvat.server.request.implementation = async (url, data) => {
const result = await serverProxy.server.request(url, data);
return result;
};

cvat.users.get.implementation = async (filter) => {
checkFilter(filter, {
self: isBoolean,
Expand Down
16 changes: 16 additions & 0 deletions cvat-core/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,22 @@ function build() {
.apiWrapper(cvat.server.authorized);
return result;
},
/**
* Method allows to do requests via cvat-core with authorization headers
* @method request
* @async
* @memberof module:API.cvat.server
* @param {string} url
* @param {Object} data request parameters: method, headers, data, etc.
* @returns {Object | undefined} response data if exist
* @throws {module:API.cvat.exceptions.PluginError}
* @throws {module:API.cvat.exceptions.ServerError}
*/
async request(url, data) {
const result = await PluginRegistry
.apiWrapper(cvat.server.request, url, data);
return result;
},
},
/**
* Namespace is used for getting tasks
Expand Down
12 changes: 12 additions & 0 deletions cvat-core/src/server-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,17 @@
return true;
}

async function serverRequest(url, data) {
try {
return (await Axios({
url,
...data,
})).data;
} catch (errorData) {
throw generateError(errorData, 'Could not have done the request');
}
}

async function getTasks(filter = '') {
const { backendAPI } = config;

Expand Down Expand Up @@ -560,6 +571,7 @@
logout,
authorized,
register,
request: serverRequest,
}),
writable: false,
},
Expand Down
94 changes: 30 additions & 64 deletions cvat-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cvat-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@types/react-router": "^5.0.5",
"@types/react-router-dom": "^5.1.0",
"@types/react-share": "^3.0.1",
"antd": "^3.24.2",
"antd": "^3.25.2",
"dotenv-webpack": "^1.7.0",
"moment": "^2.24.0",
"prop-types": "^15.7.2",
Expand Down
Loading