Skip to content

Commit

Permalink
move plugins to serverViewSet
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryagapov committed Sep 22, 2020
1 parent c8a37d1 commit 842b34e
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 51 deletions.
16 changes: 8 additions & 8 deletions components/analytics/docker-compose.analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ services:
context: ./components/analytics/kibana
args:
ELK_VERSION: 6.4.0
depends_on: [ 'cvat_elasticsearch' ]
depends_on: ['cvat_elasticsearch']
restart: always

cvat_kibana_setup:
container_name: cvat_kibana_setup
image: cvat/server
volumes: [ './components/analytics/kibana:/home/django/kibana:ro' ]
depends_on: [ 'cvat' ]
volumes: ['./components/analytics/kibana:/home/django/kibana:ro']
depends_on: ['cvat']
working_dir: '/home/django'
entrypoint: [ 'bash', 'wait-for-it.sh', 'elasticsearch:9200', '-t', '0', '--',
'/bin/bash', 'wait-for-it.sh', 'kibana:5601', '-t', '0', '--',
'/usr/bin/python3', 'kibana/setup.py', 'kibana/export.json' ]
entrypoint: ['bash', 'wait-for-it.sh', 'elasticsearch:9200', '-t', '0', '--',
'/bin/bash', 'wait-for-it.sh', 'kibana:5601', '-t', '0', '--',
'/usr/bin/python3', 'kibana/setup.py', 'kibana/export.json']
environment:
no_proxy: elasticsearch,kibana,${no_proxy}

Expand All @@ -52,9 +52,9 @@ services:
context: ./components/analytics/logstash
args:
ELK_VERSION: 6.4.0
http_proxy: ${http_proxy}
http_proxy: ${http_proxy}
https_proxy: ${https_proxy}
depends_on: [ 'cvat_elasticsearch' ]
depends_on: ['cvat_elasticsearch']
restart: always

cvat:
Expand Down
2 changes: 1 addition & 1 deletion cvat-core/src/server-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@
async function installedApps() {
const { backendAPI } = config;
try {
const response = await Axios.get(`${backendAPI}/plugins/`, {
const response = await Axios.get(`${backendAPI}/server/plugins`, {
proxy: config.proxy,
});
return response.data;
Expand Down
5 changes: 5 additions & 0 deletions cvat/apps/engine/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,11 @@ class FrameMetaSerializer(serializers.Serializer):
height = serializers.IntegerField()
name = serializers.CharField(max_length=1024)

class PluginsSerializer(serializers.Serializer):
GIT_INTEGRATION = serializers.BooleanField()
ANALYTICS = serializers.BooleanField()
MODELS = serializers.BooleanField()

class DataMetaSerializer(serializers.ModelSerializer):
frames = FrameMetaSerializer(many=True, allow_null=True)
image_quality = serializers.IntegerField(min_value=0, max_value=100)
Expand Down
22 changes: 21 additions & 1 deletion cvat/apps/engine/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
import shutil
import traceback
from datetime import datetime
from distutils.util import strtobool
from tempfile import mkstemp

import django_rq
from django.apps import apps
from django.conf import settings
from django.contrib.auth.models import User
from django.db import IntegrityError
Expand Down Expand Up @@ -40,7 +42,8 @@
DataMetaSerializer, DataSerializer, ExceptionSerializer,
FileInfoSerializer, JobSerializer, LabeledDataSerializer,
LogEventSerializer, ProjectSerializer, RqStatusSerializer,
TaskSerializer, UserSerializer)
TaskSerializer, UserSerializer, PluginsSerializer,
)
from cvat.apps.engine.utils import av_scan_paths

from . import models, task
Expand Down Expand Up @@ -168,6 +171,23 @@ def annotation_formats(request):
data = dm.views.get_all_formats()
return Response(DatasetFormatsSerializer(data).data)

@staticmethod
@swagger_auto_schema(method='get', operation_summary='Method provides allowed plugins.',
responses={'200': PluginsSerializer()})
@action(detail=False, methods=['GET'], url_path='plugins', serializer_class=PluginsSerializer)
def plugins(request):
response = {
'GIT_INTEGRATION': apps.is_installed('cvat.apps.git'),
'ANALYTICS': False,
'MODELS': False,
}
if strtobool(os.environ.get("CVAT_ANALYTICS", '0')):
response['ANALYTICS'] = True
if strtobool(os.environ.get("CVAT_SERVERLESS", '0')):
response['MODELS'] = True
return Response(response)


class ProjectFilter(filters.FilterSet):
name = filters.CharFilter(field_name="name", lookup_expr="icontains")
owner = filters.CharFilter(field_name="owner__username", lookup_expr="icontains")
Expand Down
3 changes: 1 addition & 2 deletions cvat/apps/lambda_manager/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#
# SPDX-License-Identifier: MIT

from django.urls import include
from django.urls import path
from django.urls import include, path
from rest_framework import routers

from . import views
Expand Down
Empty file removed cvat/apps/plugins/__init__.py
Empty file.
5 changes: 0 additions & 5 deletions cvat/apps/plugins/apps.py

This file was deleted.

Empty file.
8 changes: 0 additions & 8 deletions cvat/apps/plugins/urls.py

This file was deleted.

24 changes: 0 additions & 24 deletions cvat/apps/plugins/views.py

This file was deleted.

1 change: 0 additions & 1 deletion cvat/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def generate_ssh_keys():
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'cvat.apps.plugins',
'cvat.apps.authentication',
'cvat.apps.documentation',
'cvat.apps.dataset_manager',
Expand Down
1 change: 0 additions & 1 deletion cvat/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
path('', include('cvat.apps.engine.urls')),
path('django-rq/', include('django_rq.urls')),
path('documentation/', include('cvat.apps.documentation.urls')),
path('api/v1/plugins/', include('cvat.apps.plugins.urls')),
]

if apps.is_installed('cvat.apps.git'):
Expand Down

0 comments on commit 842b34e

Please sign in to comment.