Have not registered yet? Register here.
+ {% autoescape off %} + {{ note }} + {% endautoescape %} {% endblock %} \ No newline at end of file diff --git a/cvat/apps/authentication/templates/login_ldap.html b/cvat/apps/authentication/templates/login_ldap.html deleted file mode 100644 index 8cba181db5fd..000000000000 --- a/cvat/apps/authentication/templates/login_ldap.html +++ /dev/null @@ -1,27 +0,0 @@ - -{% extends "auth_base.html" %} - -{% block title %}Login{% endblock %} - -{% block content %} --
\ No newline at end of file diff --git a/cvat/apps/authentication/urls.py b/cvat/apps/authentication/urls.py index d12271719054..e05d734035f9 100644 --- a/cvat/apps/authentication/urls.py +++ b/cvat/apps/authentication/urls.py @@ -4,17 +4,20 @@ # SPDX-License-Identifier: MIT from django.urls import path -import os - from django.contrib.auth import views as auth_views +from django.conf import settings + from . import forms from . import views -from .settings.authentication import DJANGO_AUTH_TYPE - -login_page = 'login{}.html'.format('_ldap' if DJANGO_AUTH_TYPE == 'LDAP' else '') urlpatterns = [ - path('login', auth_views.LoginView.as_view(form_class=forms.AuthForm, template_name=login_page), name='login'), + path('login', auth_views.LoginView.as_view(form_class=forms.AuthForm, + template_name='login.html', extra_context={'note': settings.AUTH_LOGIN_NOTE}), + name='login'), path('logout', auth_views.LogoutView.as_view(next_page='login'), name='logout'), - path('register', views.register_user, name='register'), ] + +if settings.DJANGO_AUTH_TYPE == 'BASIC': + urlpatterns += [ + path('register', views.register_user, name='register'), + ] diff --git a/cvat/apps/authentication/views.py b/cvat/apps/authentication/views.py index 2964cf4b82a7..c8effb07c3de 100644 --- a/cvat/apps/authentication/views.py +++ b/cvat/apps/authentication/views.py @@ -3,13 +3,12 @@ # # SPDX-License-Identifier: MIT -from django.shortcuts import render -from django.contrib.auth.views import LoginView -from django.http import HttpResponseRedirect +from django.shortcuts import render, redirect +from django.conf import settings +from django.contrib.auth import login, authenticate + from . import forms -from django.contrib.auth import login, authenticate -from django.shortcuts import render, redirect def register_user(request): if request.method == 'POST': @@ -20,7 +19,7 @@ def register_user(request): raw_password = form.cleaned_data.get('password1') user = authenticate(username=username, password=raw_password) login(request, user) - return redirect('/') + return redirect(settings.LOGIN_REDIRECT_URL) else: form = forms.NewUserForm() return render(request, 'register.html', {'form': form}) diff --git a/cvat/apps/dashboard/__init__.py b/cvat/apps/dashboard/__init__.py index d8e62e54b356..da270801d9c5 100644 --- a/cvat/apps/dashboard/__init__.py +++ b/cvat/apps/dashboard/__init__.py @@ -3,3 +3,6 @@ # # SPDX-License-Identifier: MIT +from cvat.settings.base import JS_3RDPARTY + +JS_3RDPARTY['engine'] = JS_3RDPARTY.get('engine', []) + ['dashboard/js/enginePlugin.js'] diff --git a/cvat/apps/dashboard/static/dashboard/js/dashboard.js b/cvat/apps/dashboard/static/dashboard/js/dashboard.js index 4a8986668ca4..d3815969891a 100644 --- a/cvat/apps/dashboard/static/dashboard/js/dashboard.js +++ b/cvat/apps/dashboard/static/dashboard/js/dashboard.js @@ -524,12 +524,16 @@ function uploadAnnotationRequest() { $.ajax({ url: '/get/task/' + window.cvat.dashboard.taskID, success: function(data) { - let annotationParser = new AnnotationParser({ - start: 0, - stop: data.size, - image_meta_data: data.image_meta_data, - flipped: data.flipped - }, new LabelsInfo(data.spec)); + let annotationParser = new AnnotationParser( + { + start: 0, + stop: data.size, + image_meta_data: data.image_meta_data, + flipped: data.flipped + }, + new LabelsInfo(data.spec), + new ConstIdGenerator(-1) + ); let asyncParse = function() { let parsed = null; @@ -538,28 +542,64 @@ function uploadAnnotationRequest() { } catch(error) { overlay.remove(); - showMessage("Parsing errors was occured. " + error); + showMessage("Parsing errors was occurred. " + error); return; } let asyncSave = function() { $.ajax({ - url: '/save/annotation/task/' + window.cvat.dashboard.taskID, - type: 'POST', - data: JSON.stringify(parsed), - contentType: 'application/json', + url: '/delete/annotation/task/' + window.cvat.dashboard.taskID, + type: 'DELETE', success: function() { - let message = 'Annotation successfully uploaded'; - showMessage(message); + asyncSaveChunk(0); }, error: function(response) { - let message = 'Annotation uploading errors was occured. ' + response.responseText; + let message = 'Previous annotations cannot be deleted: ' + + response.responseText; showMessage(message); + overlay.remove(); }, - complete: () => overlay.remove() }); }; + let asyncSaveChunk = function(start) { + const CHUNK_SIZE = 100000; + let end = start + CHUNK_SIZE; + let chunk = {}; + let next = false; + for (let prop in parsed) { + if (parsed.hasOwnProperty(prop)) { + chunk[prop] = parsed[prop].slice(start, end); + next |= chunk[prop].length > 0; + } + } + + if (next) { + let exportData = createExportContainer(); + exportData.create = chunk; + + $.ajax({ + url: '/save/annotation/task/' + window.cvat.dashboard.taskID, + type: 'POST', + data: JSON.stringify(exportData), + contentType: 'application/json', + success: function() { + asyncSaveChunk(end); + }, + error: function(response) { + let message = 'Annotations uploading errors were occurred: ' + + response.responseText; + showMessage(message); + overlay.remove(); + }, + }); + } else { + let message = 'Annotations were uploaded successfully'; + showMessage(message); + overlay.remove(); + } + }; + overlay.setMessage('Annotation is being saved..'); setTimeout(asyncSave); }; diff --git a/cvat/apps/dashboard/static/dashboard/js/enginePlugin.js b/cvat/apps/dashboard/static/dashboard/js/enginePlugin.js new file mode 100644 index 000000000000..4c95fa66bff7 --- /dev/null +++ b/cvat/apps/dashboard/static/dashboard/js/enginePlugin.js @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2018 Intel Corporation + * + * SPDX-License-Identifier: MIT + */ + +"use strict"; + +window.addEventListener('DOMContentLoaded', () => { + $(``).on('click', () => { + let win = window.open(`${window.location.origin }/dashboard/?jid=${window.cvat.job.id}`, '_blank'); + win.focus(); + }).prependTo('#engineMenuButtons'); +}); + diff --git a/cvat/apps/dashboard/templates/dashboard/task.html b/cvat/apps/dashboard/templates/dashboard/task.html index 46f10255cc7c..da017006b59c 100644 --- a/cvat/apps/dashboard/templates/dashboard/task.html +++ b/cvat/apps/dashboard/templates/dashboard/task.html @@ -3,22 +3,22 @@ SPDX-License-Identifier: MIT --> -{{segment.url}} | -
{{base_url}}?id={{job.id}} | +
al1HXuuC%Iat2TJUieTjc1@x^|ui{gkwnj!y5S zN~(uW)`OCWqMprZ3eqj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