From b7609cae9173a88e6fd5ba09685998eaebde70d1 Mon Sep 17 00:00:00 2001 From: Artyom Zankevich Date: Thu, 15 Aug 2019 19:42:59 +0300 Subject: [PATCH] [NEW-UI]: Create and update task (#612) - Create task - Update task - Upload annotations - Download annotations --- cvat-ui/public/cvat-core.min.js | 22 ++ cvat-ui/public/cvat.min.js | 22 -- cvat-ui/public/index.html | 2 +- cvat-ui/src/actions/annotations.actions.ts | 72 ++++ cvat-ui/src/actions/auth.actions.ts | 2 + cvat-ui/src/actions/server.actions.ts | 106 +++++ cvat-ui/src/actions/tasks.actions.ts | 99 ++++- .../content/dashboard-content.tsx | 262 +++++++++++-- .../dashboard-page/dashboard-page.tsx | 2 +- .../header/dashboard-header.tsx | 52 ++- .../src/components/login-page/login-page.tsx | 2 +- .../modals/task-create/task-create.scss | 8 + .../modals/task-create/task-create.test.tsx | 0 .../modals/task-create/task-create.tsx | 364 ++++++++++++++++++ .../modals/task-update/task-update.scss | 0 .../modals/task-update/task-update.test.tsx | 0 .../modals/task-update/task-update.tsx | 51 +++ .../register-page/register-page.tsx | 2 +- cvat-ui/src/index.scss | 4 + cvat-ui/src/reducers/annotations.reducer.ts | 40 ++ cvat-ui/src/reducers/root.reducer.ts | 4 + cvat-ui/src/reducers/server.reducer.ts | 57 +++ cvat-ui/src/reducers/tasks.reducer.ts | 28 ++ cvat-ui/src/store.ts | 4 +- cvat-ui/src/utils/tasks-dto.ts | 152 ++++++++ .../{tasks-filter-dto.ts => tasks-filter.ts} | 0 .../static/dashboard/js/dashboard.js | 2 +- 27 files changed, 1290 insertions(+), 69 deletions(-) create mode 100644 cvat-ui/public/cvat-core.min.js delete mode 100644 cvat-ui/public/cvat.min.js create mode 100644 cvat-ui/src/actions/annotations.actions.ts create mode 100644 cvat-ui/src/actions/server.actions.ts create mode 100644 cvat-ui/src/components/modals/task-create/task-create.scss create mode 100644 cvat-ui/src/components/modals/task-create/task-create.test.tsx create mode 100644 cvat-ui/src/components/modals/task-create/task-create.tsx create mode 100644 cvat-ui/src/components/modals/task-update/task-update.scss create mode 100644 cvat-ui/src/components/modals/task-update/task-update.test.tsx create mode 100644 cvat-ui/src/components/modals/task-update/task-update.tsx create mode 100644 cvat-ui/src/reducers/annotations.reducer.ts create mode 100644 cvat-ui/src/reducers/server.reducer.ts create mode 100644 cvat-ui/src/utils/tasks-dto.ts rename cvat-ui/src/utils/{tasks-filter-dto.ts => tasks-filter.ts} (100%) diff --git a/cvat-ui/public/cvat-core.min.js b/cvat-ui/public/cvat-core.min.js new file mode 100644 index 00000000..a9c22af0 --- /dev/null +++ b/cvat-ui/public/cvat-core.min.js @@ -0,0 +1,22 @@ +window.cvat=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=89)}([function(t,e,n){(function(e){var n="object",r=function(t){return t&&t.Math==Math&&t};t.exports=r(typeof globalThis==n&&globalThis)||r(typeof window==n&&window)||r(typeof self==n&&self)||r(typeof e==n&&e)||Function("return this")()}).call(this,n(38))},function(t,e,n){var r=n(0),o=n(29),s=n(56),i=n(96),a=r.Symbol,c=o("wks");t.exports=function(t){return c[t]||(c[t]=i&&a[t]||(i?a:s)("Symbol."+t))}},function(t,e,n){"use strict";var r=n(28),o=n(107),s=n(24),i=n(17),a=n(72),c=i.set,u=i.getterFor("Array Iterator");t.exports=a(Array,"Array",function(t,e){c(this,{type:"Array Iterator",target:r(t),index:0,kind:e})},function(){var t=u(this),e=t.target,n=t.kind,r=t.index++;return!e||r>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:e[r],done:!1}:{value:[r,e[r]],done:!1}},"values"),s.Arguments=s.Array,o("keys"),o("values"),o("entries")},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){var r=n(11);t.exports=function(t){if(!r(t))throw TypeError(String(t)+" is not an object");return t}},function(t,e,n){var r=n(0),o=n(111),s=n(2),i=n(12),a=n(1),c=a("iterator"),u=a("toStringTag"),l=s.values;for(var p in o){var f=r[p],h=f&&f.prototype;if(h){if(h[c]!==l)try{i(h,c,l)}catch(t){h[c]=l}if(h[u]||i(h,u,p),o[p])for(var d in s)if(h[d]!==s[d])try{i(h,d,s[d])}catch(t){h[d]=s[d]}}}},function(t,e,n){n(9),(()=>{const e=n(112),r=n(114),o=n(47);class s extends Error{constructor(t){super(t);const n=(new Date).toISOString(),s=e.os.toString(),i=`${e.name} ${e.version}`,a=r.parse(this)[0],c=`${a.fileName}`,u=a.lineNumber,l=a.columnNumber,{jobID:p,taskID:f,clientID:h}=o;Object.defineProperties(this,Object.freeze({system:{get:()=>s},client:{get:()=>i},time:{get:()=>n},jobID:{get:()=>p},taskID:{get:()=>f},projID:{get:()=>void 0},clientID:{get:()=>h},filename:{get:()=>c},line:{get:()=>u},column:{get:()=>l}}))}async save(){const t={system:this.system,client:this.client,time:this.time,job_id:this.jobID,task_id:this.taskID,proj_id:this.projID,client_id:this.clientID,message:this.message,filename:this.filename,line:this.line,column:this.column,stack:this.stack};try{const e=n(18);await e.server.exception(t)}catch(t){}}}t.exports={Exception:s,ArgumentError:class extends s{constructor(t){super(t)}},DataError:class extends s{constructor(t){super(t)}},ScriptingError:class extends s{constructor(t){super(t)}},PluginError:class extends s{constructor(t){super(t)}},ServerError:class extends s{constructor(t,e){super(t),Object.defineProperties(this,Object.freeze({code:{get:()=>e}}))}}}})()},function(t,e,n){"use strict";var r=n(77),o=n(125),s=Object.prototype.toString;function i(t){return"[object Array]"===s.call(t)}function a(t){return null!==t&&"object"==typeof t}function c(t){return"[object Function]"===s.call(t)}function u(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),i(t))for(var n=0,r=t.length;ni;){var a,c,u,l=r[i++],p=s?l.ok:l.fail,f=l.resolve,h=l.reject,d=l.domain;try{p?(s||(2===e.rejection&&et(t,e),e.rejection=1),!0===p?a=o:(d&&d.enter(),a=p(o),d&&(d.exit(),u=!0)),a===l.promise?h(D("Promise-chain cycle")):(c=K(a))?c.call(a,f,h):f(a)):h(o)}catch(t){d&&!u&&d.exit(),h(t)}}e.reactions=[],e.notified=!1,n&&!e.rejection&&Q(t,e)})}},Y=function(t,e,n){var r,o;V?((r=L.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),u.dispatchEvent(r)):r={promise:e,reason:n},(o=u["on"+t])?o(r):"unhandledrejection"===t&&A("Unhandled promise rejection",n)},Q=function(t,e){k.call(u,function(){var n,r=e.value;if(tt(e)&&(n=E(function(){J?B.emit("unhandledRejection",r,t):Y("unhandledrejection",t,r)}),e.rejection=J||tt(e)?2:1,n.error))throw n.value})},tt=function(t){return 1!==t.rejection&&!t.parent},et=function(t,e){k.call(u,function(){J?B.emit("rejectionHandled",t):Y("rejectionhandled",t,e.value)})},nt=function(t,e,n,r){return function(o){t(e,n,o,r)}},rt=function(t,e,n,r){e.done||(e.done=!0,r&&(e=r),e.value=n,e.state=2,Z(t,e,!0))},ot=function(t,e,n,r){if(!e.done){e.done=!0,r&&(e=r);try{if(t===n)throw D("Promise can't be resolved itself");var o=K(n);o?j(function(){var r={done:!1};try{o.call(n,nt(ot,t,r,e),nt(rt,t,r,e))}catch(n){rt(t,r,n,e)}}):(e.value=n,e.state=1,Z(t,e,!1))}catch(n){rt(t,{done:!1},n,e)}}};X&&(R=function(t){y(this,R,_),m(t),r.call(this);var e=N(this);try{t(nt(ot,this,e),nt(rt,this,e))}catch(t){rt(this,e,t)}},(r=function(t){M(this,{type:_,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=h(R.prototype,{then:function(t,e){var n=$(this),r=G(x(this,R));return r.ok="function"!=typeof t||t,r.fail="function"==typeof e&&e,r.domain=J?B.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&Z(this,n,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),o=function(){var t=new r,e=N(t);this.promise=t,this.resolve=nt(ot,t,e),this.reject=nt(rt,t,e)},T.f=G=function(t){return t===R||t===s?new o(t):q(t)},c||"function"!=typeof p||(i=p.prototype.then,f(p.prototype,"then",function(t,e){var n=this;return new R(function(t,e){i.call(n,t,e)}).then(t,e)}),"function"==typeof z&&a({global:!0,enumerable:!0,forced:!0},{fetch:function(t){return S(R,z.apply(u,arguments))}}))),a({global:!0,wrap:!0,forced:X},{Promise:R}),d(R,_,!1,!0),b(_),s=l.Promise,a({target:_,stat:!0,forced:X},{reject:function(t){var e=G(this);return e.reject.call(void 0,t),e.promise}}),a({target:_,stat:!0,forced:c||X},{resolve:function(t){return S(c&&this===s?R:this,t)}}),a({target:_,stat:!0,forced:H},{all:function(t){var e=this,n=G(e),r=n.resolve,o=n.reject,s=E(function(){var n=m(e.resolve),s=[],i=0,a=1;w(t,function(t){var c=i++,u=!1;s.push(void 0),a++,n.call(e,t).then(function(t){u||(u=!0,s[c]=t,--a||r(s))},o)}),--a||r(s)});return s.error&&o(s.value),n.promise},race:function(t){var e=this,n=G(e),r=n.reject,o=E(function(){var o=m(e.resolve);w(t,function(t){o.call(e,t).then(n.resolve,r)})});return o.error&&r(o.value),n.promise}})},function(t,e,n){var r=n(3);t.exports=!r(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){var r=n(10),o=n(14),s=n(27);t.exports=r?function(t,e,n){return o.f(t,e,s(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(0),o=n(39).f,s=n(12),i=n(15),a=n(42),c=n(57),u=n(61);t.exports=function(t,e){var n,l,p,f,h,d=t.target,b=t.global,g=t.stat;if(n=b?r:g?r[d]||a(d,{}):(r[d]||{}).prototype)for(l in e){if(f=e[l],p=t.noTargetGet?(h=o(n,l))&&h.value:n[l],!u(b?l:d+(g?".":"#")+l,t.forced)&&void 0!==p){if(typeof f==typeof p)continue;c(f,p)}(t.sham||p&&p.sham)&&s(f,"sham",!0),i(n,l,f,t)}}},function(t,e,n){var r=n(10),o=n(54),s=n(4),i=n(40),a=Object.defineProperty;e.f=r?a:function(t,e,n){if(s(t),e=i(e,!0),s(n),o)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(0),o=n(29),s=n(12),i=n(8),a=n(42),c=n(55),u=n(17),l=u.get,p=u.enforce,f=String(c).split("toString");o("inspectSource",function(t){return c.call(t)}),(t.exports=function(t,e,n,o){var c=!!o&&!!o.unsafe,u=!!o&&!!o.enumerable,l=!!o&&!!o.noTargetGet;"function"==typeof n&&("string"!=typeof e||i(n,"name")||s(n,"name",e),p(n).source=f.join("string"==typeof e?e:"")),t!==r?(c?!l&&t[e]&&(u=!0):delete t[e],u?t[e]=n:s(t,e,n)):u?t[e]=n:a(e,n)})(Function.prototype,"toString",function(){return"function"==typeof this&&l(this).source||c.call(this)})},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var r,o,s,i=n(90),a=n(0),c=n(11),u=n(12),l=n(8),p=n(43),f=n(44),h=a.WeakMap;if(i){var d=new h,b=d.get,g=d.has,m=d.set;r=function(t,e){return m.call(d,t,e),e},o=function(t){return b.call(d,t)||{}},s=function(t){return g.call(d,t)}}else{var y=p("state");f[y]=!0,r=function(t,e){return u(t,y,e),e},o=function(t){return l(t,y)?t[y]:{}},s=function(t){return l(t,y)}}t.exports={set:r,get:o,has:s,enforce:function(t){return s(t)?o(t):r(t,{})},getterFor:function(t){return function(e){var n;if(!c(e)||(n=o(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}}},function(t,e,n){n(2),n(9),n(116),n(5),(()=>{const e=n(121),{ServerError:r,ScriptingError:o}=n(6),s=n(47);const i=new class{constructor(){const i=n(122),a=n(123);function c(t){a.defaults.headers.delete["X-CSRFToken"]=t,a.defaults.headers.patch["X-CSRFToken"]=t,a.defaults.headers.post["X-CSRFToken"]=t,a.defaults.headers.put["X-CSRFToken"]=t,a.defaults.withCredentials=!0}async function u(t=""){const{backendAPI:e}=s;let n=null;try{n=await a.get(`${e}/tasks?${t}`,{proxy:s.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not get tasks from a server",e)}return n.data.results.count=n.data.count,n.data.results}async function l(t){const{backendAPI:e}=s;try{await a.delete(`${e}/tasks/${t}`)}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not delete the task from the server",e)}}const p=i.get("csrftoken");p&&c(p),Object.defineProperties(this,Object.freeze({server:{value:Object.freeze({about:async function(){const{backendAPI:t}=s;let e=null;try{e=await a.get(`${t}/server/about`,{proxy:s.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r('Could not get "about" information from the server',e)}return e.data},share:async function(t){const{backendAPI:e}=s;t=encodeURIComponent(t);let n=null;try{n=await a.get(`${e}/server/share?directory=${t}`,{proxy:s.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r('Could not get "share" information from the server',e)}return n.data},formats:async function(){const{backendAPI:t}=s;let e=null;try{e=await a.get(`${t}/server/annotation/formats`,{proxy:s.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not get annotation formats from the server",e)}return e.data},exception:async function(t){const{backendAPI:e}=s;try{await a.post(`${e}/server/exception`,JSON.stringify(t),{proxy:s.proxy,headers:{"Content-Type":"application/json"}})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not send an exception to the server",e)}},login:async function(t,e){function n(t){if(t.headers["set-cookie"]){let e="";for(let n of t.headers["set-cookie"]){[n]=n.split(";");const t=n.split("=")[0],r=n.split("=")[1];"csrftoken"===t&&c(r),i.set(t,r),e+=`${n};`}a.defaults.headers.common.Cookie=e}else{let e=t.data.csrf;if(e)c(e),i.set("csrftoken",e);else{if(!(e=i.get("csrftoken")))throw new o("An environment has been detected as a browser, but CSRF token has not been found in cookies");c(e)}}}const u=s.backendAPI.slice(0,-7);let l=null;try{l=await a.get(`${u}/auth/csrf`,{proxy:s.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not get CSRF token from a server",e)}n(l);const p=[`${encodeURIComponent("username")}=${encodeURIComponent(t)}`,`${encodeURIComponent("password")}=${encodeURIComponent(e)}`].join("&").replace(/%20/g,"+");let f=null;try{f=await a.post(`${u}/auth/login`,p,{"Content-Type":"application/x-www-form-urlencoded",proxy:s.proxy,maxRedirects:0})}catch(t){if(302!==t.response.status){const e=t.response?t.response.status:t.code;throw new r("Could not login on a server",e)}f=t.response}if(f.data.includes("didn't match"))throw new r("The pair login/password is invalid",403);n(f)},logout:async function(){const t=s.backendAPI.slice(0,-7);try{await a.get(`${t}/auth/logout`,{proxy:s.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not logout from the server",e)}},authorized:async function(){try{await t.exports.users.getSelf()}catch(t){if(403===t.code)return!1;throw t}return!0}}),writable:!1},tasks:{value:Object.freeze({getTasks:u,saveTask:async function(t,e){const{backendAPI:n}=s;try{await a.patch(`${n}/tasks/${t}`,JSON.stringify(e),{proxy:s.proxy,headers:{"Content-Type":"application/json"}})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not save the task on the server",e)}},createTask:async function(t,n,o){const{backendAPI:i}=s,c=new e;for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t))for(let e=0;e{setTimeout(async function s(){try{const c=await a.get(`${i}/tasks/${t}/status`);["Queued","Started"].includes(c.data.state)?(""!==c.data.message&&o(c.data.message),setTimeout(s,1e3)):"Finished"===c.data.state?e():"Failed"===c.data.state?n(new r("Could not create the task on the server",400)):n(new r(`Unknown task state has been recieved: ${c.data.state}`,500))}catch(t){const e=t.response?t.response.status:t.code;n(new r("Data uploading error occured",e))}},1e3)})}(p.data.id)}catch(t){throw await l(p.data.id),t}return(await u(`?id=${p.id}`))[0]},deleteTask:l}),writable:!1},jobs:{value:Object.freeze({getJob:async function(t){const{backendAPI:e}=s;let n=null;try{n=await a.get(`${e}/jobs/${t}`,{proxy:s.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not get jobs from a server",e)}return n.data},saveJob:async function(t,e){const{backendAPI:n}=s;try{await a.patch(`${n}/jobs/${t}`,JSON.stringify(e),{proxy:s.proxy,headers:{"Content-Type":"application/json"}})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not save the job on the server",e)}}}),writable:!1},users:{value:Object.freeze({getUsers:async function(){const{backendAPI:t}=s;let e=null;try{e=await a.get(`${t}/users`,{proxy:s.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not get users from the server",e)}return e.data.results},getSelf:async function(){const{backendAPI:t}=s;let e=null;try{e=await a.get(`${t}/users/self`,{proxy:s.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not get user data from the server",e)}return e.data}}),writable:!1},frames:{value:Object.freeze({getData:async function(t,e){const{backendAPI:n}=s;let o=null;try{o=await a.get(`${n}/tasks/${t}/frames/${e}`,{proxy:s.proxy,responseType:"blob"})}catch(n){const o=n.response?n.response.status:n.code;throw new r(`Could not get frame ${e} for the task ${t} from the server`,o)}return o.data},getMeta:async function(t){const{backendAPI:e}=s;let n=null;try{n=await a.get(`${e}/tasks/${t}/frames/meta`,{proxy:s.proxy})}catch(e){const n=e.response?e.response.status:e.code;throw new r(`Could not get frame meta info for the task ${t} from the server`,n)}return n.data}}),writable:!1},annotations:{value:Object.freeze({updateAnnotations:async function(t,e,n,o){const{backendAPI:i}=s;let c=null,u=null;"PUT"===o.toUpperCase()?(c=a.put.bind(a),u=`${i}/${t}s/${e}/annotations`):(c=a.patch.bind(a),u=`${i}/${t}s/${e}/annotations?action=${o}`);let l=null;try{l=await c(u,JSON.stringify(n),{proxy:s.proxy,headers:{"Content-Type":"application/json"}})}catch(n){const o=n.response?n.response.status:n.code;throw new r(`Could not updated annotations for the ${t} ${e} on the server`,o)}return l.data},getAnnotations:async function(t,e){const{backendAPI:n}=s;let o=null;try{o=await a.get(`${n}/${t}s/${e}/annotations`,{proxy:s.proxy})}catch(n){const o=n.response?n.response.status:n.code;throw new r(`Could not get annotations for the ${t} ${e} from the server`,o)}return o.data},dumpAnnotations:async function(t,e,n){const{backendAPI:o}=s,i=e.replace(/\//g,"_");let c=`${o}/tasks/${t}/annotations/${i}?format=${n}`;return new Promise((e,n)=>{setTimeout(async function o(){try{202===(await a.get(`${c}`,{proxy:s.proxy})).status?setTimeout(o,3e3):e(c=`${c}&action=download`)}catch(e){const o=e.response?e.response.status:e.code,s=new r(`Could not dump annotations for the task ${t} from the server`,o);n(s)}})})},uploadAnnotations:async function(t,n,o,i){const{backendAPI:c}=s;let u=new e;return u.append("annotation_file",o),new Promise((o,l)=>{setTimeout(async function p(){try{202===(await a.put(`${c}/${t}s/${n}/annotations?format=${i}`,u,{proxy:s.proxy})).status?(u=new e,setTimeout(p,3e3)):o()}catch(e){const o=e.response?e.response.status:e.code,s=new r(`Could not upload annotations for the ${t} ${n}`,o);l(s)}})})}}),writable:!1}}))}};t.exports=i})()},function(t,e){(()=>{const e=Object.freeze({DIR:"DIR",REG:"REG"}),n=Object.freeze({ANNOTATION:"annotation",VALIDATION:"validation",COMPLETED:"completed"}),r=Object.freeze({ANNOTATION:"annotation",INTERPOLATION:"interpolation"}),o=Object.freeze({CHECKBOX:"checkbox",RADIO:"radio",SELECT:"select",NUMBER:"number",TEXT:"text"}),s=Object.freeze({TAG:"tag",SHAPE:"shape",TRACK:"track"}),i=Object.freeze({RECTANGLE:"rectangle",POLYGON:"polygon",POLYLINE:"polyline",POINTS:"points"}),a=Object.freeze({frameDownloaded:0});t.exports={ShareFileType:e,TaskStatus:n,TaskMode:r,AttributeType:o,ObjectType:s,ObjectShape:i,LogType:{pasteObject:0,changeAttribute:1,dragObject:2,deleteObject:3,pressShortcut:4,resizeObject:5,sendLogs:6,saveJob:7,jumpFrame:8,drawObject:9,changeLabel:10,sendTaskInfo:11,loadJob:12,moveImage:13,zoomImage:14,lockObject:15,mergeObjects:16,copyObject:17,propagateObject:18,undoAction:19,redoAction:20,sendUserActivity:21,sendException:22,changeFrame:23,debugInfo:24,fitImage:25,rotateImage:26},EventType:a}})()},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e){t.exports=!1},function(t,e,n){var r=n(14).f,o=n(8),s=n(1)("toStringTag");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,s)&&r(t,s,{configurable:!0,value:e})}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}},function(t,e){t.exports={}},function(t,e,n){n(106),n(2),n(9),n(5),(()=>{const{PluginError:e}=n(6),r=[];class o{static async apiWrapper(t,...n){const r=await o.list();for(const o of r){const r=o.functions.filter(e=>e.callback===t)[0];if(r&&r.enter)try{await r.enter.call(this,o,...n)}catch(t){throw t instanceof e?t:new e(`Exception in plugin ${o.name}: ${t.toString()}`)}}let s=await t.implementation.call(this,...n);for(const o of r){const r=o.functions.filter(e=>e.callback===t)[0];if(r&&r.leave)try{s=await r.leave.call(this,o,s,...n)}catch(t){throw t instanceof e?t:new e(`Exception in plugin ${o.name}: ${t.toString()}`)}}return s}static async register(t){const n=[];if("object"!=typeof t)throw new e(`Plugin should be an object, but got "${typeof t}"`);if(!("name"in t)||"string"!=typeof t.name)throw new e('Plugin must contain a "name" field and it must be a string');if(!("description"in t)||"string"!=typeof t.description)throw new e('Plugin must contain a "description" field and it must be a string');if("functions"in t)throw new e('Plugin must not contain a "functions" field');!function t(e,r){const o={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&("object"==typeof e[n]?Object.prototype.hasOwnProperty.call(r,n)&&t(e[n],r[n]):["enter","leave"].includes(n)&&"function"==typeof r&&(e[n],1)&&(o.callback=r,o[n]=e[n]));Object.keys(o).length&&n.push(o)}(t,{cvat:this}),Object.defineProperty(t,"functions",{value:n,writable:!1}),r.push(t)}static async list(){return r}}t.exports=o})()},function(t,e,n){var r=n(20);t.exports=function(t){return Object(r(t))}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){var r=n(53),o=n(20);t.exports=function(t){return r(o(t))}},function(t,e,n){var r=n(0),o=n(42),s=n(21),i=r["__core-js_shared__"]||o("__core-js_shared__",{});(t.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.2.1",mode:s?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,e,n){var r=n(58),o=n(0),s=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,e){return arguments.length<2?s(r[t])||s(o[t]):r[t]&&r[t][e]||o[t]&&o[t][e]}},function(t,e,n){var r=n(32),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e,n){var r=n(23);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 0:return function(){return t.call(e)};case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e,n){var r=n(99),o=n(24),s=n(1)("iterator");t.exports=function(t){if(null!=t)return t[s]||t["@@iterator"]||o[r(t)]}},function(t,e,n){n(2),n(9),n(141),n(5),n(51),(()=>{const e=n(25),r=n(18),{getFrame:o}=n(144),{ArgumentError:s}=n(6),{TaskStatus:i}=n(19),{Label:a}=n(36);function c(t){Object.defineProperties(t,{annotations:Object.freeze({value:{async upload(n,r){return await e.apiWrapper.call(this,t.annotations.upload,n,r)},async save(){return await e.apiWrapper.call(this,t.annotations.save)},async clear(n=!1){return await e.apiWrapper.call(this,t.annotations.clear,n)},async dump(n,r){return await e.apiWrapper.call(this,t.annotations.dump,n,r)},async statistics(){return await e.apiWrapper.call(this,t.annotations.statistics)},async put(n=[]){return await e.apiWrapper.call(this,t.annotations.put,n)},async get(n,r={}){return await e.apiWrapper.call(this,t.annotations.get,n,r)},async search(n,r,o){return await e.apiWrapper.call(this,t.annotations.search,n,r,o)},async select(n,r,o){return await e.apiWrapper.call(this,t.annotations.select,n,r,o)},async hasUnsavedChanges(){return await e.apiWrapper.call(this,t.annotations.hasUnsavedChanges)},async merge(n){return await e.apiWrapper.call(this,t.annotations.merge,n)},async split(n,r){return await e.apiWrapper.call(this,t.annotations.split,n,r)},async group(n,r=!1){return await e.apiWrapper.call(this,t.annotations.group,n,r)}},writable:!0}),frames:Object.freeze({value:{async get(n){return await e.apiWrapper.call(this,t.frames.get,n)}},writable:!0}),logs:Object.freeze({value:{async put(n,r){return await e.apiWrapper.call(this,t.logs.put,n,r)},async save(n){return await e.apiWrapper.call(this,t.logs.save,n)}},writable:!0}),actions:Object.freeze({value:{async undo(n){return await e.apiWrapper.call(this,t.actions.undo,n)},async redo(n){return await e.apiWrapper.call(this,t.actions.redo,n)},async clear(){return await e.apiWrapper.call(this,t.actions.clear)}},writable:!0}),events:Object.freeze({value:{async subscribe(n,r){return await e.apiWrapper.call(this,t.events.subscribe,n,r)},async unsubscribe(n,r=null){return await e.apiWrapper.call(this,t.events.unsubscribe,n,r)}},writable:!0})})}class u{constructor(){}}class l extends u{constructor(t){super();const e={id:void 0,assignee:void 0,status:void 0,start_frame:void 0,stop_frame:void 0,task:void 0};for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&(n in t&&(e[n]=t[n]),void 0===e[n]))throw new s(`Job field "${n}" was not initialized`);Object.defineProperties(this,Object.freeze({id:{get:()=>e.id},assignee:{get:()=>e.assignee,set:()=>t=>{if(!Number.isInteger(t)||t<0)throw new s("Value must be a non negative integer");e.assignee=t}},status:{get:()=>e.status,set:t=>{const n=i;let r=!1;for(const e in n)if(n[e]===t){r=!0;break}if(!r)throw new s("Value must be a value from the enumeration cvat.enums.TaskStatus");e.status=t}},startFrame:{get:()=>e.start_frame},stopFrame:{get:()=>e.stop_frame},task:{get:()=>e.task}})),this.annotations={get:Object.getPrototypeOf(this).annotations.get.bind(this),put:Object.getPrototypeOf(this).annotations.put.bind(this),save:Object.getPrototypeOf(this).annotations.save.bind(this),dump:Object.getPrototypeOf(this).annotations.dump.bind(this),merge:Object.getPrototypeOf(this).annotations.merge.bind(this),split:Object.getPrototypeOf(this).annotations.split.bind(this),group:Object.getPrototypeOf(this).annotations.group.bind(this),clear:Object.getPrototypeOf(this).annotations.clear.bind(this),upload:Object.getPrototypeOf(this).annotations.upload.bind(this),select:Object.getPrototypeOf(this).annotations.select.bind(this),statistics:Object.getPrototypeOf(this).annotations.statistics.bind(this),hasUnsavedChanges:Object.getPrototypeOf(this).annotations.hasUnsavedChanges.bind(this)},this.frames={get:Object.getPrototypeOf(this).frames.get.bind(this)}}async save(){return await e.apiWrapper.call(this,l.prototype.save)}}class p extends u{constructor(t){super();const e={id:void 0,name:void 0,status:void 0,size:void 0,mode:void 0,owner:void 0,assignee:void 0,created_date:void 0,updated_date:void 0,bug_tracker:void 0,overlap:void 0,segment_size:void 0,z_order:void 0,image_quality:void 0,start_frame:void 0,stop_frame:void 0,frame_filter:void 0};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&n in t&&(e[n]=t[n]);if(e.labels=[],e.jobs=[],e.files=Object.freeze({server_files:[],client_files:[],remote_files:[]}),Array.isArray(t.segments))for(const n of t.segments)if(Array.isArray(n.jobs))for(const t of n.jobs){const r=new l({url:t.url,id:t.id,assignee:t.assignee,status:t.status,start_frame:n.start_frame,stop_frame:n.stop_frame,task:this});e.jobs.push(r)}if(Array.isArray(t.labels))for(const n of t.labels){const t=new a(n);e.labels.push(t)}Object.defineProperties(this,Object.freeze({id:{get:()=>e.id},name:{get:()=>e.name,set:t=>{if(!t.trim().length)throw new s("Value must not be empty");e.name=t}},status:{get:()=>e.status},size:{get:()=>e.size},mode:{get:()=>e.mode},owner:{get:()=>e.owner},assignee:{get:()=>e.assignee,set:()=>t=>{if(!Number.isInteger(t)||t<0)throw new s("Value must be a non negative integer");e.assignee=t}},createdDate:{get:()=>e.created_date},updatedDate:{get:()=>e.updated_date},bugTracker:{get:()=>e.bug_tracker,set:t=>{e.bug_tracker=t}},overlap:{get:()=>e.overlap,set:t=>{if(!Number.isInteger(t)||t<0)throw new s("Value must be a non negative integer");e.overlap=t}},segmentSize:{get:()=>e.segment_size,set:t=>{if(!Number.isInteger(t)||t<0)throw new s("Value must be a positive integer");e.segment_size=t}},zOrder:{get:()=>e.z_order,set:t=>{if("boolean"!=typeof t)throw new s("Value must be a boolean");e.z_order=t}},imageQuality:{get:()=>e.image_quality,set:t=>{if(!Number.isInteger(t)||t<0)throw new s("Value must be a positive integer");e.image_quality=t}},labels:{get:()=>[...e.labels],set:t=>{if(!Array.isArray(t))throw new s("Value must be an array of Labels");for(const e of t)if(!(e instanceof a))throw new s("Each array value must be an instance of Label. "+`${typeof e} was found`);void 0===e.id?e.labels=[...t]:e.labels=e.labels.concat([...t])}},jobs:{get:()=>[...e.jobs]},serverFiles:{get:()=>[...e.files.server_files],set:t=>{if(!Array.isArray(t))throw new s(`Value must be an array. But ${typeof t} has been got.`);for(const e of t)if("string"!=typeof e)throw new s(`Array values must be a string. But ${typeof e} has been got.`);Array.prototype.push.apply(e.files.server_files,t)}},clientFiles:{get:()=>[...e.files.client_files],set:t=>{if(!Array.isArray(t))throw new s(`Value must be an array. But ${typeof t} has been got.`);for(const e of t)if(!(e instanceof File))throw new s(`Array values must be a File. But ${e.constructor.name} has been got.`);Array.prototype.push.apply(e.files.client_files,t)}},remoteFiles:{get:()=>[...e.files.remote_files],set:t=>{if(!Array.isArray(t))throw new s(`Value must be an array. But ${typeof t} has been got.`);for(const e of t)if("string"!=typeof e)throw new s(`Array values must be a string. But ${typeof e} has been got.`);Array.prototype.push.apply(e.files.remote_files,t)}},startFrame:{get:()=>e.start_frame,set:t=>{if(!Number.isInteger(t)||t<0)throw new s("Value must be a not negative integer");e.start_frame=t}},stopFrame:{get:()=>e.stop_frame,set:t=>{if(!Number.isInteger(t)||t<0)throw new s("Value must be a not negative integer");e.stop_frame=t}},frameFilter:{get:()=>e.frame_filter,set:t=>{if("string"!=typeof t)throw new s(`Filter value must be a string. But ${typeof t} has been got.`);e.frame_filter=t}}})),this.annotations={get:Object.getPrototypeOf(this).annotations.get.bind(this),put:Object.getPrototypeOf(this).annotations.put.bind(this),save:Object.getPrototypeOf(this).annotations.save.bind(this),dump:Object.getPrototypeOf(this).annotations.dump.bind(this),merge:Object.getPrototypeOf(this).annotations.merge.bind(this),split:Object.getPrototypeOf(this).annotations.split.bind(this),group:Object.getPrototypeOf(this).annotations.group.bind(this),clear:Object.getPrototypeOf(this).annotations.clear.bind(this),upload:Object.getPrototypeOf(this).annotations.upload.bind(this),select:Object.getPrototypeOf(this).annotations.select.bind(this),statistics:Object.getPrototypeOf(this).annotations.statistics.bind(this),hasUnsavedChanges:Object.getPrototypeOf(this).annotations.hasUnsavedChanges.bind(this)},this.frames={get:Object.getPrototypeOf(this).frames.get.bind(this)}}async save(t=(()=>{})){return await e.apiWrapper.call(this,p.prototype.save,t)}async delete(){return await e.apiWrapper.call(this,p.prototype.delete)}}t.exports={Job:l,Task:p};const{getAnnotations:f,putAnnotations:h,saveAnnotations:d,hasUnsavedChanges:b,mergeAnnotations:g,splitAnnotations:m,groupAnnotations:y,clearAnnotations:v,selectObject:w,annotationsStatistics:O,uploadAnnotations:x,dumpAnnotations:k}=n(146);c(l.prototype),c(p.prototype),l.prototype.save.implementation=async function(){if(this.id){const t={status:this.status};return await r.jobs.saveJob(this.id,t),this}throw new s("Can not save job without and id")},l.prototype.frames.get.implementation=async function(t){if(!Number.isInteger(t)||t<0)throw new s(`Frame must be a positive integer. Got: "${t}"`);if(tthis.stopFrame)throw new s(`The frame with number ${t} is out of the job`);return await o(this.task.id,this.task.mode,t)},l.prototype.annotations.get.implementation=async function(t,e){if(tthis.stopFrame)throw new s(`Frame ${t} does not exist in the job`);return await f(this,t,e)},l.prototype.annotations.save.implementation=async function(t){return await d(this,t)},l.prototype.annotations.merge.implementation=async function(t){return await g(this,t)},l.prototype.annotations.split.implementation=async function(t,e){return await m(this,t,e)},l.prototype.annotations.group.implementation=async function(t,e){return await y(this,t,e)},l.prototype.annotations.hasUnsavedChanges.implementation=function(){return b(this)},l.prototype.annotations.clear.implementation=async function(t){return await v(this,t)},l.prototype.annotations.select.implementation=function(t,e,n){return w(this,t,e,n)},l.prototype.annotations.statistics.implementation=function(){return O(this)},l.prototype.annotations.put.implementation=function(t){return h(this,t)},l.prototype.annotations.upload.implementation=async function(t,e){return await x(this,t,e)},l.prototype.annotations.dump.implementation=async function(t,e){return await k(this,t,e)},p.prototype.save.implementation=async function(t){if(void 0!==this.id){const t={name:this.name,bug_tracker:this.bugTracker,z_order:this.zOrder,labels:[...this.labels.map(t=>t.toJSON())]};return await r.tasks.saveTask(this.id,t),this}const e={name:this.name,labels:this.labels.map(t=>t.toJSON()),image_quality:this.imageQuality,z_order:Boolean(this.zOrder)};this.bugTracker&&(e.bug_tracker=this.bugTracker),this.segmentSize&&(e.segment_size=this.segmentSize),this.overlap&&(e.overlap=this.overlap),this.startFrame&&(e.start_frame=this.startFrame),this.stopFrame&&(e.stop_frame=this.stopFrame),this.frameFilter&&(e.frame_filter=this.frameFilter);const n={client_files:this.clientFiles,server_files:this.serverFiles,remote_files:this.remoteFiles},o=await r.tasks.createTask(e,n,t);return new p(o)},p.prototype.delete.implementation=async function(){return await r.tasks.deleteTask(this.id)},p.prototype.frames.get.implementation=async function(t){if(!Number.isInteger(t)||t<0)throw new s(`Frame must be a positive integer. Got: "${t}"`);if(t>=this.size)throw new s(`The frame with number ${t} is out of the task`);return await o(this.id,this.mode,t)},p.prototype.annotations.get.implementation=async function(t,e){if(!Number.isInteger(t)||t<0)throw new s(`Frame must be a positive integer. Got: "${t}"`);if(t>=this.size)throw new s(`Frame ${t} does not exist in the task`);return await f(this,t,e)},p.prototype.annotations.save.implementation=async function(t){return await d(this,t)},p.prototype.annotations.merge.implementation=async function(t){return await g(this,t)},p.prototype.annotations.split.implementation=async function(t,e){return await m(this,t,e)},p.prototype.annotations.group.implementation=async function(t,e){return await y(this,t,e)},p.prototype.annotations.hasUnsavedChanges.implementation=function(){return b(this)},p.prototype.annotations.clear.implementation=async function(t){return await v(this,t)},p.prototype.annotations.select.implementation=function(t,e,n){return w(this,t,e,n)},p.prototype.annotations.statistics.implementation=function(){return O(this)},p.prototype.annotations.put.implementation=function(t){return h(this,t)},p.prototype.annotations.upload.implementation=async function(t,e){return await x(this,t,e)},p.prototype.annotations.dump.implementation=async function(t,e){return await k(this,t,e)}})()},function(t,e,n){n(2),n(5),n(51),(()=>{const{AttributeType:e}=n(19),{ArgumentError:r}=n(6);class o{constructor(t){const n={id:void 0,default_value:void 0,input_type:void 0,mutable:void 0,name:void 0,values:void 0};for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&Object.prototype.hasOwnProperty.call(t,e)&&(Array.isArray(t[e])?n[e]=[...t[e]]:n[e]=t[e]);if(!Object.values(e).includes(n.input_type))throw new r(`Got invalid attribute type ${n.input_type}`);Object.defineProperties(this,Object.freeze({id:{get:()=>n.id},defaultValue:{get:()=>n.default_value},inputType:{get:()=>n.input_type},mutable:{get:()=>n.mutable},name:{get:()=>n.name},values:{get:()=>[...n.values]}}))}toJSON(){const t={name:this.name,mutable:this.mutable,input_type:this.inputType,default_value:this.defaultValue,values:this.values};return void 0!==this.id&&(t.id=this.id),t}}t.exports={Attribute:o,Label:class{constructor(t){const e={id:void 0,name:void 0};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);if(e.attributes=[],Object.prototype.hasOwnProperty.call(t,"attributes")&&Array.isArray(t.attributes))for(const n of t.attributes)e.attributes.push(new o(n));Object.defineProperties(this,Object.freeze({id:{get:()=>e.id},name:{get:()=>e.name},attributes:{get:()=>[...e.attributes]}}))}toJSON(){const t={name:this.name,attributes:[...this.attributes.map(t=>t.toJSON())]};return void 0!==this.id&&(t.id=this.id),t}}}})()},function(t,e,n){(()=>{const{ArgumentError:e}=n(6);t.exports={isBoolean:function(t){return"boolean"==typeof t},isInteger:function(t){return"number"==typeof t&&Number.isInteger(t)},isEnum:function(t){for(const e in this)if(Object.prototype.hasOwnProperty.call(this,e)&&this[e]===t)return!0;return!1},isString:function(t){return"string"==typeof t},checkFilter:function(t,n){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(!(r in n))throw new e(`Unsupported filter property has been recieved: "${r}"`);if(!n[r](t[r]))throw new e(`Received filter property "${r}" is not satisfied for checker`)}},checkObjectType:function(t,n,r,o){if(r){if(typeof n!==r){if("integer"===r&&Number.isInteger(n))return;throw new e(`"${t}" is expected to be "${r}", but "${typeof n}" has been got.`)}}else if(o&&!(n instanceof o)){if(void 0!==n)throw new e(`"${t}" is expected to be ${o.name}, but `+`"${n.constructor.name}" has been got`);throw new e(`"${t}" is expected to be ${o.name}, but "undefined" has been got.`)}}}})()},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){var r=n(10),o=n(52),s=n(27),i=n(28),a=n(40),c=n(8),u=n(54),l=Object.getOwnPropertyDescriptor;e.f=r?l:function(t,e){if(t=i(t),e=a(e,!0),u)try{return l(t,e)}catch(t){}if(c(t,e))return s(!o.f.call(t,e),t[e])}},function(t,e,n){var r=n(11);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e,n){var r=n(0),o=n(11),s=r.document,i=o(s)&&o(s.createElement);t.exports=function(t){return i?s.createElement(t):{}}},function(t,e,n){var r=n(0),o=n(12);t.exports=function(t,e){try{o(r,t,e)}catch(n){r[t]=e}return e}},function(t,e,n){var r=n(29),o=n(56),s=r("keys");t.exports=function(t){return s[t]||(s[t]=o(t))}},function(t,e){t.exports={}},function(t,e){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(t,e){t.exports=function(t,e,n){if(!(t instanceof e))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return t}},function(t,e){t.exports={backendAPI:"http://localhost:7000/api/v1",proxy:!1,taskID:void 0,jobID:void 0,clientID:+Date.now().toString().substr(-6)}},function(t,e,n){var r=n(32),o=n(20),s=function(t){return function(e,n){var s,i,a=String(o(e)),c=r(n),u=a.length;return c<0||c>=u?t?"":void 0:(s=a.charCodeAt(c))<55296||s>56319||c+1===u||(i=a.charCodeAt(c+1))<56320||i>57343?t?a.charAt(c):s:t?a.slice(c,c+2):i-56320+(s-55296<<10)+65536}};t.exports={codeAt:s(!1),charAt:s(!0)}},function(t,e,n){"use strict";(function(e){var r=n(7),o=n(127),s={"Content-Type":"application/x-www-form-urlencoded"};function i(t,e){!r.isUndefined(t)&&r.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var a,c={adapter:("undefined"!=typeof XMLHttpRequest?a=n(79):void 0!==e&&(a=n(79)),a),transformRequest:[function(t,e){return o(e,"Content-Type"),r.isFormData(t)||r.isArrayBuffer(t)||r.isBuffer(t)||r.isStream(t)||r.isFile(t)||r.isBlob(t)?t:r.isArrayBufferView(t)?t.buffer:r.isURLSearchParams(t)?(i(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):r.isObject(t)?(i(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(t){return t>=200&&t<300}};c.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],function(t){c.headers[t]={}}),r.forEach(["post","put","patch"],function(t){c.headers[t]=r.merge(s)}),t.exports=c}).call(this,n(78))},function(t,e,n){n(2),n(9),n(5),(()=>{const e=n(25),{ArgumentError:r}=n(6);class o{constructor(t){const e={label:null,attributes:{},points:null,outside:null,occluded:null,keyframe:null,group:null,zOrder:null,lock:null,color:null,clientID:t.clientID,serverID:t.serverID,frame:t.frame,objectType:t.objectType,shapeType:t.shapeType,updateFlags:{}};Object.defineProperty(e.updateFlags,"reset",{value:function(){this.label=!1,this.attributes=!1,this.points=!1,this.outside=!1,this.occluded=!1,this.keyframe=!1,this.group=!1,this.zOrder=!1,this.lock=!1,this.color=!1},writable:!1}),Object.defineProperties(this,Object.freeze({updateFlags:{get:()=>e.updateFlags},frame:{get:()=>e.frame},objectType:{get:()=>e.objectType},shapeType:{get:()=>e.shapeType},clientID:{get:()=>e.clientID},serverID:{get:()=>e.serverID},label:{get:()=>e.label,set:t=>{e.updateFlags.label=!0,e.label=t}},color:{get:()=>e.color,set:t=>{e.updateFlags.color=!0,e.color=t}},points:{get:()=>e.points,set:t=>{if(!Array.isArray(t))throw new r("Points are expected to be an array "+`but got ${"object"==typeof t?t.constructor.name:typeof t}`);e.updateFlags.points=!0,e.points=[...t]}},group:{get:()=>e.group,set:t=>{e.updateFlags.group=!0,e.group=t}},zOrder:{get:()=>e.zOrder,set:t=>{e.updateFlags.zOrder=!0,e.zOrder=t}},outside:{get:()=>e.outside,set:t=>{e.updateFlags.outside=!0,e.outside=t}},keyframe:{get:()=>e.keyframe,set:t=>{e.updateFlags.keyframe=!0,e.keyframe=t}},occluded:{get:()=>e.occluded,set:t=>{e.updateFlags.occluded=!0,e.occluded=t}},lock:{get:()=>e.lock,set:t=>{e.updateFlags.lock=!0,e.lock=t}},attributes:{get:()=>e.attributes,set:t=>{if("object"!=typeof t)throw new r("Attributes are expected to be an object "+`but got ${"object"==typeof t?t.constructor.name:typeof t}`);for(const n of Object.keys(t))e.updateFlags.attributes=!0,e.attributes[n]=t[n]}}})),this.label=t.label,this.group=t.group,this.zOrder=t.zOrder,this.outside=t.outside,this.keyframe=t.keyframe,this.occluded=t.occluded,this.color=t.color,this.lock=t.lock,void 0!==t.points&&(this.points=t.points),void 0!==t.attributes&&(this.attributes=t.attributes),e.updateFlags.reset()}async save(){return await e.apiWrapper.call(this,o.prototype.save)}async delete(t=!1){return await e.apiWrapper.call(this,o.prototype.delete,t)}async up(){return await e.apiWrapper.call(this,o.prototype.up)}async down(){return await e.apiWrapper.call(this,o.prototype.down)}}o.prototype.save.implementation=async function(){return this.hidden&&this.hidden.save?this.hidden.save():this},o.prototype.delete.implementation=async function(t){return!(!this.hidden||!this.hidden.delete)&&this.hidden.delete(t)},o.prototype.up.implementation=async function(){return!(!this.hidden||!this.hidden.up)&&this.hidden.up()},o.prototype.down.implementation=async function(){return!(!this.hidden||!this.hidden.down)&&this.hidden.down()},t.exports=o})()},function(t,e,n){"use strict";n(13)({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return URL.prototype.toString.call(this)}})},function(t,e,n){"use strict";var r={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,s=o&&!r.call({1:2},1);e.f=s?function(t){var e=o(this,t);return!!e&&e.enumerable}:r},function(t,e,n){var r=n(3),o=n(16),s="".split;t.exports=r(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return"String"==o(t)?s.call(t,""):Object(t)}:Object},function(t,e,n){var r=n(10),o=n(3),s=n(41);t.exports=!r&&!o(function(){return 7!=Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){var r=n(29);t.exports=r("native-function-to-string",Function.toString)},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++n+r).toString(36)}},function(t,e,n){var r=n(8),o=n(91),s=n(39),i=n(14);t.exports=function(t,e){for(var n=o(e),a=i.f,c=s.f,u=0;uc;)r(a,n=e[c++])&&(~s(u,n)||u.push(n));return u}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,n){var r=n(3),o=/#|\.prototype\./,s=function(t,e){var n=a[i(t)];return n==u||n!=c&&("function"==typeof e?r(e):!!e)},i=s.normalize=function(t){return String(t).replace(o,".").toLowerCase()},a=s.data={},c=s.NATIVE="N",u=s.POLYFILL="P";t.exports=s},function(t,e,n){var r=n(15);t.exports=function(t,e,n){for(var o in e)r(t,o,e[o],n);return t}},function(t,e,n){var r=n(1),o=n(24),s=r("iterator"),i=Array.prototype;t.exports=function(t){return void 0!==t&&(o.Array===t||i[s]===t)}},function(t,e,n){var r=n(4);t.exports=function(t,e,n,o){try{return o?e(r(n)[0],n[1]):e(n)}catch(e){var s=t.return;throw void 0!==s&&r(s.call(t)),e}}},function(t,e,n){var r,o,s,i=n(0),a=n(3),c=n(16),u=n(33),l=n(66),p=n(41),f=i.location,h=i.setImmediate,d=i.clearImmediate,b=i.process,g=i.MessageChannel,m=i.Dispatch,y=0,v={},w=function(t){if(v.hasOwnProperty(t)){var e=v[t];delete v[t],e()}},O=function(t){return function(){w(t)}},x=function(t){w(t.data)},k=function(t){i.postMessage(t+"",f.protocol+"//"+f.host)};h&&d||(h=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return v[++y]=function(){("function"==typeof t?t:Function(t)).apply(void 0,e)},r(y),y},d=function(t){delete v[t]},"process"==c(b)?r=function(t){b.nextTick(O(t))}:m&&m.now?r=function(t){m.now(O(t))}:g?(s=(o=new g).port2,o.port1.onmessage=x,r=u(s.postMessage,s,1)):!i.addEventListener||"function"!=typeof postMessage||i.importScripts||a(k)?r="onreadystatechange"in p("script")?function(t){l.appendChild(p("script")).onreadystatechange=function(){l.removeChild(this),w(t)}}:function(t){setTimeout(O(t),0)}:(r=k,i.addEventListener("message",x,!1))),t.exports={set:h,clear:d}},function(t,e,n){var r=n(30);t.exports=r("document","documentElement")},function(t,e,n){var r=n(30);t.exports=r("navigator","userAgent")||""},function(t,e,n){"use strict";var r=n(23),o=function(t){var e,n;this.promise=new t(function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r}),this.resolve=r(e),this.reject=r(n)};t.exports.f=function(t){return new o(t)}},function(t,e,n){var r=n(4),o=n(70),s=n(45),i=n(44),a=n(66),c=n(41),u=n(43)("IE_PROTO"),l=function(){},p=function(){var t,e=c("iframe"),n=s.length;for(e.style.display="none",a.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(" + diff --git a/cvat-ui/src/actions/annotations.actions.ts b/cvat-ui/src/actions/annotations.actions.ts new file mode 100644 index 00000000..aab52037 --- /dev/null +++ b/cvat-ui/src/actions/annotations.actions.ts @@ -0,0 +1,72 @@ +export const dumpAnnotation = () => (dispatch: any) => { + dispatch({ + type: 'DUMP_ANNOTATION', + }); +} + +export const dumpAnnotationSuccess = (downloadLink: string) => (dispatch: any) => { + dispatch({ + type: 'DUMP_ANNOTATION_SUCCESS', + payload: downloadLink, + }); +} + +export const dumpAnnotationError = (error = {}) => (dispatch: any) => { + dispatch({ + type: 'DUMP_ANNOTATION_ERROR', + payload: error, + }); +} + +export const uploadAnnotation = () => (dispatch: any) => { + dispatch({ + type: 'UPLOAD_ANNOTATION', + }); +} + +export const uploadAnnotationSuccess = () => (dispatch: any) => { + dispatch({ + type: 'UPLOAD_ANNOTATION_SUCCESS', + }); +} + +export const uploadAnnotationError = (error = {}) => (dispatch: any) => { + dispatch({ + type: 'UPLOAD_ANNOTATION_ERROR', + payload: error, + }); +} + +export const dumpAnnotationAsync = (task: any, dumper: any) => { + return (dispatch: any) => { + dispatch(dumpAnnotation()); + + return task.annotations.dump(task.name, dumper).then( + (downloadLink: string) => { + dispatch(dumpAnnotationSuccess(downloadLink)); + }, + (error: any) => { + dispatch(dumpAnnotationError(error)); + + throw error; + }, + ); + }; +} + +export const uploadAnnotationAsync = (task: any, file: File, loader: any) => { + return (dispatch: any) => { + dispatch(uploadAnnotation()); + + return task.annotations.upload(file, loader).then( + (response: any) => { + dispatch(uploadAnnotationSuccess()); + }, + (error: any) => { + dispatch(uploadAnnotationError(error)); + + throw error; + }, + ); + }; +} diff --git a/cvat-ui/src/actions/auth.actions.ts b/cvat-ui/src/actions/auth.actions.ts index 64fe491d..c0275269 100644 --- a/cvat-ui/src/actions/auth.actions.ts +++ b/cvat-ui/src/actions/auth.actions.ts @@ -29,6 +29,8 @@ export const loginAsync = (username: string, password: string, history: any) => }, (error: any) => { dispatch(loginError(error)); + + throw error; }, ); }; diff --git a/cvat-ui/src/actions/server.actions.ts b/cvat-ui/src/actions/server.actions.ts new file mode 100644 index 00000000..cc02e24e --- /dev/null +++ b/cvat-ui/src/actions/server.actions.ts @@ -0,0 +1,106 @@ +export const getServerInfo = () => (dispatch: any) => { + dispatch({ + type: 'GET_SERVER_INFO', + }); +} + +export const getServerInfoSuccess = (information: null) => (dispatch: any) => { + dispatch({ + type: 'GET_SERVER_INFO_SUCCESS', + payload: information, + }); +} + +export const getServerInfoError = (error = {}) => (dispatch: any) => { + dispatch({ + type: 'GET_SERVER_INFO_ERROR', + payload: error, + }); +} + +export const getShareFiles = () => (dispatch: any) => { + dispatch({ + type: 'GET_SHARE_FILES', + }); +} + +export const getShareFilesSuccess = (files: []) => (dispatch: any) => { + dispatch({ + type: 'GET_SHARE_FILES_SUCCESS', + payload: files, + }); +} + +export const getShareFilesError = (error = {}) => (dispatch: any) => { + dispatch({ + type: 'GET_SHARE_FILES_ERROR', + payload: error, + }); +} + +export const getAnnotationFormats = () => (dispatch: any) => { + dispatch({ + type: 'GET_ANNOTATION_FORMATS', + }); +} + +export const getAnnotationFormatsSuccess = (annotationFormats: []) => (dispatch: any) => { + dispatch({ + type: 'GET_ANNOTATION_FORMATS_SUCCESS', + payload: annotationFormats, + }); +} + +export const getAnnotationFormatsError = (error = {}) => (dispatch: any) => { + dispatch({ + type: 'GET_ANNOTATION_FORMATS_ERROR', + payload: error, + }); +} + +export const getServerInfoAsync = () => { + return (dispatch: any) => { + dispatch(getServerInfo()); + + return (window as any).cvat.server.about().then( + (information: any) => { + dispatch(getServerInfoSuccess(information)); + }, + (error: any) => { + dispatch(getServerInfoError(error)); + }, + ); + }; +} + +export const getShareFilesAsync = (directory: string) => { + return (dispatch: any) => { + dispatch(getShareFiles()); + + return (window as any).cvat.server.share(directory).then( + (files: any) => { + dispatch(getShareFilesSuccess(files)); + }, + (error: any) => { + dispatch(getShareFilesError(error)); + }, + ); + }; +} + +export const getAnnotationFormatsAsync = () => { + return (dispatch: any) => { + dispatch(getAnnotationFormats()); + + return (window as any).cvat.server.formats().then( + (formats: any) => { + dispatch(getAnnotationFormatsSuccess(formats)); + }, + (error: any) => { + dispatch(getAnnotationFormatsError(error)); + + throw error; + }, + ); + }; +} diff --git a/cvat-ui/src/actions/tasks.actions.ts b/cvat-ui/src/actions/tasks.actions.ts index 91a072ae..ca683ba8 100644 --- a/cvat-ui/src/actions/tasks.actions.ts +++ b/cvat-ui/src/actions/tasks.actions.ts @@ -1,41 +1,79 @@ import queryString from 'query-string'; -import setQueryObject from '../utils/tasks-filter-dto' +import setQueryObject from '../utils/tasks-filter' -export const getTasks = () => (dispatch: any, getState: any) => { +export const getTasks = () => (dispatch: any) => { dispatch({ type: 'GET_TASKS', }); } -export const getTasksSuccess = (tasks: []) => (dispatch: any, getState: any) => { +export const getTasksSuccess = (tasks: []) => (dispatch: any) => { dispatch({ type: 'GET_TASKS_SUCCESS', payload: tasks, }); } -export const getTasksError = (error: {}) => (dispatch: any, getState: any) => { +export const getTasksError = (error: {}) => (dispatch: any) => { dispatch({ type: 'GET_TASKS_ERROR', payload: error, }); } -export const deleteTask = () => (dispatch: any, getState: any) => { +export const createTask = () => (dispatch: any) => { + dispatch({ + type: 'CREATE_TASK', + }); +} + +export const createTaskSuccess = () => (dispatch: any) => { + dispatch({ + type: 'CREATE_TASK_SUCCESS', + }); +} + +export const createTaskError = (error: {}) => (dispatch: any) => { + dispatch({ + type: 'CREATE_TASK_ERROR', + payload: error, + }); +} + +export const updateTask = () => (dispatch: any) => { + dispatch({ + type: 'UPDATE_TASK', + }); +} + +export const updateTaskSuccess = () => (dispatch: any) => { + dispatch({ + type: 'UPDATE_TASK_SUCCESS', + }); +} + +export const updateTaskError = (error: {}) => (dispatch: any) => { + dispatch({ + type: 'UPDATE_TASK_ERROR', + payload: error, + }); +} + +export const deleteTask = () => (dispatch: any) => { dispatch({ type: 'DELETE_TASK', }); } -export const deleteTaskSuccess = () => (dispatch: any, getState: any) => { +export const deleteTaskSuccess = () => (dispatch: any) => { dispatch({ type: 'DELETE_TASK_SUCCESS', }); } -export const deleteTaskError = (error: {}) => (dispatch: any, getState: any) => { +export const deleteTaskError = (error: {}) => (dispatch: any) => { dispatch({ type: 'DELETE_TASK_ERROR', payload: error, @@ -52,6 +90,46 @@ export const getTasksAsync = (queryObject = {}) => { }, (error: any) => { dispatch(getTasksError(error)); + + throw error; + }, + ); + }; +} + +export const createTaskAsync = (task: any) => { + return (dispatch: any) => { + dispatch(createTask()); + + return task.save().then( + (created: any) => { + dispatch(createTaskSuccess()); + + return dispatch(getTasksAsync()); + }, + (error: any) => { + dispatch(createTaskError(error)); + + throw error; + }, + ); + }; +} + +export const updateTaskAsync = (task: any) => { + return (dispatch: any) => { + dispatch(updateTask()); + + return task.save().then( + (updated: any) => { + dispatch(updateTaskSuccess()); + + return dispatch(getTasksAsync()); + }, + (error: any) => { + dispatch(updateTaskError(error)); + + throw error; }, ); }; @@ -77,14 +155,17 @@ export const deleteTaskAsync = (task: any, history: any) => { history.push({ search: queryString.stringify(queryObject) }); } else if (state.tasks.tasksCount === 1) { - dispatch(getTasksAsync()); + return dispatch(getTasksAsync()); } else { const query = setQueryObject(queryObject); - dispatch(getTasksAsync(query)); + + return dispatch(getTasksAsync(query)); } }, (error: any) => { dispatch(deleteTaskError(error)); + + throw error; }, ); }; diff --git a/cvat-ui/src/components/dashboard-page/content/dashboard-content.tsx b/cvat-ui/src/components/dashboard-page/content/dashboard-content.tsx index ef95db75..b8d69bf1 100644 --- a/cvat-ui/src/components/dashboard-page/content/dashboard-content.tsx +++ b/cvat-ui/src/components/dashboard-page/content/dashboard-content.tsx @@ -3,28 +3,68 @@ import React, { Component } from 'react'; import { withRouter } from 'react-router-dom'; import { connect } from 'react-redux'; -import { deleteTaskAsync } from '../../../actions/tasks.actions'; +import { createTaskAsync, updateTaskAsync, deleteTaskAsync } from '../../../actions/tasks.actions'; +import { getAnnotationFormatsAsync } from '../../../actions/server.actions'; +import { dumpAnnotationAsync, uploadAnnotationAsync } from '../../../actions/annotations.actions'; -import { Layout, Empty, Button, Modal, Col, Row } from 'antd'; +import { Layout, Empty, Button, Modal, Col, Row, Menu, Dropdown, Icon, Upload } from 'antd'; import Title from 'antd/lib/typography/Title'; +import { ClickParam } from 'antd/lib/menu'; +import { UploadChangeParam } from 'antd/lib/upload'; + +import TaskUpdateForm from '../../modals/task-update/task-update'; +import TaskCreateForm from '../../modals/task-create/task-create'; + +import { deserializeLabels, taskDTO } from '../../../utils/tasks-dto'; + import './dashboard-content.scss'; + const { Content } = Layout; -const { confirm } = Modal; class DashboardContent extends Component { hostUrl: string | undefined; apiUrl: string | undefined; + createFormRef: any; + updateFormRef: any; + constructor(props: any) { super(props); - this.state = {}; + this.state = { + dumpers: [], + loaders: [], + selectedLoader: null, + activeTaskId: null, + }; + this.hostUrl = process.env.REACT_APP_API_HOST_URL; this.apiUrl = process.env.REACT_APP_API_FULL_URL; } + componentDidMount() { + this.props.dispatch(getAnnotationFormatsAsync()).then( + (formats: any) => { + const dumpers = []; + const loaders = []; + + for (const format of this.props.annotationFormats) { + for (const dumper of format.dumpers) { + dumpers.push(dumper); + } + + for (const loader of format.loaders) { + loaders.push(loader); + } + } + + this.setState({ dumpers, loaders }); + } + ); + } + render() { return( <> @@ -36,7 +76,7 @@ class DashboardContent extends Component { private renderPlaceholder() { return ( - @@ -44,7 +84,7 @@ class DashboardContent extends Component { } private renderTasks() { - return( + return ( { this.props.tasks.map( @@ -63,17 +103,27 @@ class DashboardContent extends Component { - + + + - + + + - @@ -105,43 +155,201 @@ class DashboardContent extends Component { ); } - private createTask = () => { - console.log('Create task'); + private dumpAnnotationMenu = (task: any) => { + return ( + this.onDumpAnnotation(task, params, this) }> + { + this.state.dumpers.map( + (dumper: any) => ( + + { dumper.name } + + ) + ) + } + + ); + } + + private uploadAnnotationMenu = (task: any) => { + return ( + this.setState({ selectedLoader: params.key, loaderTask: task }) }> + { + this.state.loaders.map( + (loader: any) => ( + + + + + + ), + ) + } + + ); + } + + private setTaskCreateFormRef = (ref: any) => { + this.createFormRef = ref; + } + + private setTaskUpdateFormRef = (ref: any) => { + this.updateFormRef = ref; + } + + private onCreateTask = () => { + Modal.confirm({ + title: 'Create new task', + content: , + centered: true, + className: 'crud-modal', + okText: 'Create', + okType: 'primary', + onOk: () => { + return new Promise((resolve, reject) => { + this.createFormRef.validateFields((error: any, values: any) => { + if (!error) { + const newTask = taskDTO(values); + + this.props.dispatch(createTaskAsync(newTask)).then( + (data: any) => { + resolve(data); + }, + (error: any) => { + reject(error); + Modal.error({ title: error.message, centered: true, okType: 'danger' }); + }, + ); + } else { + reject(error); + } + }); + }); + }, + onCancel: () => { + return; + }, + }); } private onUpdateTask = (task: any) => { - console.log('Update task'); + Modal.confirm({ + title: 'Update task', + content: , + centered: true, + className: 'crud-modal', + okText: 'Update', + okType: 'primary', + onOk: () => { + return new Promise((resolve, reject) => { + this.updateFormRef.validateFields((error: any, values: any) => { + if (!error) { + const deserializedLabels = deserializeLabels(values.newLabels); + const newLabels = deserializedLabels.map(label => new (window as any).cvat.classes.Label(label)); + task.labels = newLabels; + this.props.dispatch(updateTaskAsync(task)).then( + (data: any) => { + resolve(data); + }, + (error: any) => { + reject(error); + Modal.error({ title: error.message, centered: true, okType: 'danger' }); + }, + ); + } else { + reject(error); + } + }); + }); + }, + onCancel: () => { + return; + }, + }); } private onDeleteTask = (task: any) => { - const self = this; - - confirm({ + Modal.confirm({ title: 'Do you want to delete this task?', okText: 'Yes', okType: 'danger', centered: true, - onOk() { - return self.props.dispatch(deleteTaskAsync(task, self.props.history)); + autoFocusButton: 'cancel', + onOk: () => { + return new Promise((resolve, reject) => { + this.props.dispatch(deleteTaskAsync(task, this.props.history)).then( + (deleted: any) => { + resolve(deleted); + }, + (error: any) => { + reject(error); + }, + ); + }); }, cancelText: 'No', - onCancel() { + onCancel: () => { return; }, }); } - private onDumpAnnotation = () => { - console.log('Dump annotatio'); + private onDumpAnnotation = (task: any, event: any, component: DashboardContent) => { + const dumper = component.state.dumpers.find((dumper: any) => dumper.name === event.key); + + component.setState({ activeTaskId: task.id }); + this.props.dispatch(dumpAnnotationAsync(task, dumper)).then( + (data: any) => { + const a = document.createElement('a'); + a.href = component.props.downloadLink; + document.body.appendChild(a); + a.click(); + a.remove(); + }, + (error: any) => { + Modal.error({ title: error.message, centered: true, okType: 'danger' }); + }, + ); + } + + private onUploadAnnotation = (task: any, file: File) => { + const loader = this.state.loaders.find((loader: any) => loader.name === this.state.selectedLoader); + + this.setState({ activeTaskId: task.id }); + this.props.dispatch(uploadAnnotationAsync(task, file, loader)).then( + (data: any) => { + + }, + (error: any) => { + Modal.error({ title: error.message, centered: true, okType: 'danger' }); + }, + ); + + return true; + } + + private onUploaderChange = (info: UploadChangeParam) => { + if (info.file.status === 'uploading') { + this.onUploadAnnotation(this.state.loaderTask, (info.file.originFileObj as File)); + } } - private onUploadAnnotation = () => { - console.log('Upload annotation'); + private simulateRequest = ({ file, onSuccess }: any) => { + setTimeout(() => { + onSuccess(file); + }, 0); } } const mapStateToProps = (state: any) => { - return state.tasks; + return { ...state.tasks, ...state.server, ...state.annotations }; }; export default withRouter(connect(mapStateToProps)(DashboardContent) as any); diff --git a/cvat-ui/src/components/dashboard-page/dashboard-page.tsx b/cvat-ui/src/components/dashboard-page/dashboard-page.tsx index 15429df1..de610a9c 100644 --- a/cvat-ui/src/components/dashboard-page/dashboard-page.tsx +++ b/cvat-ui/src/components/dashboard-page/dashboard-page.tsx @@ -3,7 +3,7 @@ import { Location, Action } from 'history'; import * as queryString from 'query-string'; -import setQueryObject from '../../utils/tasks-filter-dto' +import setQueryObject from '../../utils/tasks-filter' import { connect } from 'react-redux'; import { getTasksAsync } from '../../actions/tasks.actions'; diff --git a/cvat-ui/src/components/dashboard-page/header/dashboard-header.tsx b/cvat-ui/src/components/dashboard-page/header/dashboard-header.tsx index 4473bacc..379cd027 100644 --- a/cvat-ui/src/components/dashboard-page/header/dashboard-header.tsx +++ b/cvat-ui/src/components/dashboard-page/header/dashboard-header.tsx @@ -3,18 +3,26 @@ import React, { Component } from 'react'; import { withRouter } from 'react-router-dom'; import { connect } from 'react-redux'; +import { createTaskAsync } from '../../../actions/tasks.actions'; -import { Layout, Row, Col, Button, Input } from 'antd'; +import { Modal, Layout, Row, Col, Button, Input } from 'antd'; import Title from 'antd/lib/typography/Title'; +import TaskCreateForm from '../../modals/task-create/task-create'; + +import { taskDTO } from '../../../utils/tasks-dto'; + import './dashboard-header.scss'; + const { Header } = Layout; const { Search } = Input; class DashboardHeader extends Component { hostUrl: string | undefined; + createFormRef: any; + constructor(props: any) { super(props); @@ -50,7 +58,7 @@ class DashboardHeader extends Component {