Skip to content

Commit

Permalink
Old API support
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-skriabin committed Jan 29, 2021
1 parent e64d3f8 commit 5d1d48b
Show file tree
Hide file tree
Showing 7 changed files with 315 additions and 21,046 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Desktop.ini
.env.development.local
.env.test.local
.env.production.local
htx-env

# Testing
coverage/
Expand Down
2 changes: 1 addition & 1 deletion label_studio/static/dm/js/main.js

Large diffs are not rendered by default.

94 changes: 93 additions & 1 deletion label_studio/static/js/build/index.js

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

2 changes: 1 addition & 1 deletion label_studio/static/js/build/index.js.map

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

94 changes: 93 additions & 1 deletion label_studio/static/js/modules/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,100 @@ const dmRoot = document.querySelector(".datamanager");
if (dmRoot) {
const dm = new DataManager({
root: dmRoot,
apiGateway: "../api",
apiGateway: "/api",
apiVersion: 2,
apiEndpoints: {
/** Project base info */
project: "/project",

/** Available columns/fields of the dataset */
columns: "/project/columns",

/** Tabs (materialized views) */
tabs: "/project/tabs",

/** Update particular tab (POST) */
updateTab: {
path: "/project/tabs/:tabID",
method: "post",
},

/** Delete particular tab (DELETE) */
deleteTab: {
path: "/project/tabs/:tabID",
method: "delete",
},

/** List of tasks (samples) in the dataset */
tasks: "/project/tabs/:tabID/tasks",

/** Per-task annotations (completions, predictions) */
annotations: "/project/tabs/:tabID/annotations",

/** Single task (sample) */
task: "/tasks/:taskID",

/** Next task (labelstream, default sequential) */
nextTask: "/project/next",

/** Sinfle annotation */
completion: "/tasks/:taskID/completions/:id",

/** Mark sample as skipped */
skipTask: {
path: (params) => {
const pathBase = "/tasks/:taskID/completions";
const isNewCompletion = !isDefined(params.completionID);
return isNewCompletion ? pathBase : `${pathBase}/:completionID`;
},
method: "post",
},

/** Submit annotation */
submitCompletion: {
path: "/tasks/:taskID/completions",
method: "post",
},

/** Update annotation */
updateCompletion: {
path: "/tasks/:taskID/completions/:completionID",
method: "post",
},

/** Delete annotation */
deleteCompletion: {
path: "/tasks/:taskID/completions/:completionID",
method: "delete",
},

/** Override selected items list (checkboxes) */
setSelectedItems: {
path: "/project/tabs/:tabID/selected-items",
method: "post",
},

/** Add item to the current selection */
addSelectedItem: {
path: "/project/tabs/:tabID/selected-items",
method: "patch",
},

/** Subtract item from the current selection */
deleteSelectedItem: {
path: "/project/tabs/:tabID/selected-items",
method: "delete",
},

/** List of available actions */
actions: "/project/actions",

/** Invoke a particular action */
invokeAction: {
path: "/project/tabs/:tabID/actions",
method: "post",
},
}
});

console.log(dm);
Expand Down
Loading

0 comments on commit 5d1d48b

Please sign in to comment.