コード例 #1
0
ファイル: plugin.py プロジェクト: tarikakyol/WebODM
 def api_mount_points(self):
     return [
         MountPoint('task/(?P<pk>[^/.]+)/shortlink',
                    GetShortLink.as_view()),
         MountPoint('task/(?P<pk>[^/.]+)/edit', EditShortLink.as_view()),
         MountPoint('task/(?P<pk>[^/.]+)/delete', DeleteShortLink.as_view())
     ]
コード例 #2
0
 def api_mount_points(self):
     return [
         MountPoint("task/(?P<pk>[^/.]+)/share", ShareTaskView.as_view()),
         MountPoint("task/(?P<pk>[^/.]+)/refresh",
                    RefreshIonTaskView.as_view()),
         MountPoint("task/(?P<pk>[^/.]+)/clear",
                    ClearErrorsTaskView.as_view()),
     ]
コード例 #3
0
 def api_mount_points(self):
     return [
         MountPoint('task/(?P<pk>[^/.]+)/contours/generate',
                    TaskContoursGenerate.as_view()),
         MountPoint('task/[^/.]+/contours/check/(?P<celery_task_id>.+)',
                    TaskContoursCheck.as_view()),
         MountPoint('task/[^/.]+/contours/download/(?P<celery_task_id>.+)',
                    TaskContoursDownload.as_view()),
     ]
コード例 #4
0
ファイル: plugin.py プロジェクト: K3vin91/Exam1_kev
 def api_mount_points(self):
     return [
         MountPoint('task/(?P<pk>[^/.]+)/volume$', TaskVolume.as_view()),
         MountPoint('task/[^/.]+/volume/check/(?P<celery_task_id>.+)$',
                    TaskVolumeCheck.as_view()),
         MountPoint(
             'task/(?P<pk>[^/.]+)/volume/get/(?P<celery_task_id>.+)$',
             TaskVolumeResult.as_view()),
     ]
コード例 #5
0
ファイル: plugin.py プロジェクト: K3vin91/Exam1_kev
 def api_mount_points(self):
     return [
         MountPoint('task/(?P<pk>[^/.]+)/changedetection/generate',
                    TaskChangeMapGenerate.as_view()),
         MountPoint(
             'task/(?P<pk>[^/.]+)/changedetection/check/(?P<celery_task_id>.+)',
             TaskChangeMapCheck.as_view()),
         MountPoint(
             'task/(?P<pk>[^/.]+)/changedetection/download/(?P<celery_task_id>.+)',
             TaskChangeMapDownload.as_view()),
     ]
コード例 #6
0
    def api_mount_points(self):
        api_views = [api_view for platform in get_all_extended_platforms() for api_view in platform.get_api_views()]
        mount_points = [MountPoint(path, view) for (path, view) in api_views]
        # Add mount points for each extended platform that might require us to do so

        return mount_points + [
            MountPoint("projects/(?P<project_pk>[^/.]+)/tasks/(?P<pk>[^/.]+)/import", ImportFolderTaskView.as_view()),
            MountPoint("projects/(?P<project_pk>[^/.]+)/tasks/(?P<pk>[^/.]+)/checkforurl", CheckUrlTaskView.as_view()),
            MountPoint("platforms/(?P<platform_name>[^/.]+)/verify", PlatformsVerifyTaskView.as_view()),
            MountPoint("platforms", PlatformsTaskView.as_view()),
        ]
コード例 #7
0
 def api_mount_points(self):
     return [
         MountPoint('task/(?P<pk>[^/.]+)/elevationmap/generate',
                    TaskElevationMapGenerate.as_view()),
         MountPoint(
             'task/(?P<pk>[^/.]+)/elevationmap/check/(?P<celery_task_id>.+)',
             TaskElevationMapCheck.as_view()),
         MountPoint(
             'task/(?P<pk>[^/.]+)/elevationmap/download/(?P<celery_task_id>.+)',
             TaskElevationMapDownload.as_view()),
     ]
コード例 #8
0
    def app_mount_points(self):
        def dynamic_cb(request):
            return render(request, self.template_path("app.html"), {
                'title': 'Temperature',
                'form': FileForm(),
                'temp_form': TempForm()
            })

        return [
            MountPoint("$", dynamic_cb),
            MountPoint("process$", ProcessTaskView.as_view()),
            MountPoint("raw$", RawTaskView.as_view()),
            MountPoint("temp$", TempTaskView.as_view()),
        ]
コード例 #9
0
ファイル: plugin.py プロジェクト: zhangxl2000/WebODM
    def app_mount_points(self):
        # Show script only if '?print=1' is set
        def dynamic_cb(request):
            if 'print' in request.GET:
                return {'name': 'WebODM'} # Test template substitution
            else:
                return False

        return [
            MountPoint('/app_mountpoint/$', lambda request: render(request, self.template_path("app.html"), {
                'title': 'Test',
                'test_form': TestForm()
            })),
            MountPoint('task/(?P<pk>[^/.]+)/', TestTaskView.as_view()),
            MountPoint('/app_dynamic_script.js$', self.get_dynamic_script('dynamic.js', dynamic_cb))
        ]
コード例 #10
0
 def mount_points(self):
     return [
         MountPoint(
             '$',
             lambda request: render(request, self.template_path("app.html"),
                                    {'title': 'GCP Editor'}))
     ]
コード例 #11
0
ファイル: plugin.py プロジェクト: AIALab/WebODM-1
 def app_mount_points(self):
     return [
         MountPoint(
             '/app_mountpoint/$',
             lambda request: render(request, self.template_path("app.html"),
                                    {'title': 'Test'}))
     ]
コード例 #12
0
ファイル: plugin.py プロジェクト: AuScalableDroneCloud/WebODM
    def app_mount_points(self):
        @login_required
        def diagnostic(request):
            # Disk space
            total_disk_space, used_disk_space, free_disk_space = shutil.disk_usage(
                settings.MEDIA_ROOT)

            template_args = {
                'title': 'Diagnostic',
                'total_disk_space': total_disk_space,
                'used_disk_space': used_disk_space,
                'free_disk_space': free_disk_space
            }

            # Memory (Linux only)
            memory_stats = get_memory_stats()
            if 'free' in memory_stats:
                template_args['free_memory'] = memory_stats['free']
                template_args['used_memory'] = memory_stats['used']
                template_args['total_memory'] = memory_stats['total']

            return render(request, self.template_path("diagnostic.html"),
                          template_args)

        return [MountPoint('$', diagnostic)]
コード例 #13
0
    def app_mount_points(self):
        @login_required
        def diagnostic(request):
            # Load version number
            with open('./package.json') as f:
                package = json.load(f)
                version = package['version']

            # Disk space
            total_disk_space, used_disk_space, free_disk_space = shutil.disk_usage(
                './')

            template_args = {
                'title': 'Diagnostic',
                'version': version,
                'total_disk_space': total_disk_space,
                'used_disk_space': used_disk_space,
                'free_disk_space': free_disk_space
            }

            # Memory (Linux only)
            memory_stats = get_memory_stats()
            if 'free' in memory_stats:
                template_args['free_memory'] = memory_stats['free']
                template_args['used_memory'] = memory_stats['used']
                template_args['total_memory'] = memory_stats['total']

            return render(request, self.template_path("diagnostic.html"),
                          template_args)

        return [MountPoint('$', diagnostic)]
コード例 #14
0
    def app_mount_points(self):
        def load_buttons_cb(request):
            if request.user.is_authenticated:
                ds = self.get_user_data_store(request.user)
                token = ds.get_string('token')
                if token == '':
                    return False

                return {'token': token}
            else:
                return False

        return [
            MountPoint('$', self.home_view()),
            MountPoint(
                'main.js$',
                self.get_dynamic_script('load_buttons.js', load_buttons_cb))
        ]
コード例 #15
0
ファイル: plugin.py プロジェクト: smathermather/WebODM
 def api_mount_points(self):
     return [
         MountPoint(
             "projects/(?P<project_pk>[^/.]+)/tasks/(?P<pk>[^/.]+)/import",
             ImportDatasetTaskView.as_view()),
         MountPoint(
             "projects/(?P<project_pk>[^/.]+)/tasks/(?P<pk>[^/.]+)/checkforurl",
             CheckUrlTaskView.as_view()),
         MountPoint("tasks/(?P<pk>[^/.]+)/status",
                    StatusTaskView.as_view()),
         MountPoint("tasks/(?P<pk>[^/.]+)/share", ShareTaskView.as_view()),
         MountPoint("checkcredentials", CheckCredentialsTaskView.as_view()),
         MountPoint(
             "organizations/(?P<org>[^/.]+)/datasets/(?P<ds>[^/.]+)/folders",
             FoldersTaskView.as_view()),
         MountPoint("organizations/(?P<org>[^/.]+)/datasets",
                    DatasetsTaskView.as_view()),
         MountPoint("organizations", OrganizationsTaskView.as_view()),
         MountPoint("verifyurl", VerifyUrlTaskView.as_view()),
         MountPoint("info", InfoTaskView.as_view()),
     ]
コード例 #16
0
ファイル: plugin.py プロジェクト: smathermather/WebODM
 def app_mount_points(self):
     return [
         MountPoint("$", self.HomeView()),
         MountPoint("load_buttons.js$", LoadButtonsView(self)),
     ]
コード例 #17
0
 def app_mount_points(self):
     return [
         MountPoint('main.js$', self.get_dynamic_script('load_buttons.js'))
     ]
コード例 #18
0
ファイル: plugin.py プロジェクト: MAXONlineXD/WEBODM
    def app_mount_points(self):
        @login_required
        def main(request):
            uds = UserDataStore('lightning', request.user)

            return render(request, self.template_path("index.html"), {
                'title': 'Lightning Network',
                'api_key': uds.get_string("api_key")
            })

        @login_required
        @require_POST
        def save_api_key(request):
            api_key = request.POST.get('api_key')
            if api_key is None:
                return JsonResponse({'error': 'api_key is required'})

            uds = UserDataStore('lightning', request.user)
            uds.set_string('api_key', api_key)

            return JsonResponse({'success': True})

        @login_required
        @require_POST
        def sync_processing_node(request):
            hostname = request.POST.get('hostname')
            port = int(request.POST.get('port'))
            token = request.POST.get('token')

            if hostname is not None and port is not None and token is not None:
                nodes = get_objects_for_user(request.user, 'view_processingnode', ProcessingNode,
                                             accept_global_perms=False)
                matches = [n for n in nodes if n.hostname == hostname and n.port == port and n.token == token]
                if len(matches) == 0:
                    # Add
                    node = ProcessingNode.objects.create(hostname=hostname, port=port, token=token, label="Lightning")
                    assign_perm('view_processingnode', request.user, node)
                    assign_perm('change_processingnode', request.user, node)
                    assign_perm('delete_processingnode', request.user, node)

                    # Keep track of lightning node IDs
                    lightning_nodes = ds.get_json('nodes', [])
                    lightning_nodes.append(node.id)
                    ds.set_json('nodes', lightning_nodes)

                    return get_processing_nodes(request)
                else:
                    # Already added
                    return get_processing_nodes(request)
            else:
                return JsonResponse({'error': 'Invalid call (params missing)'})

        @login_required
        def get_processing_nodes(request):
            nodes = get_objects_for_user(request.user, 'view_processingnode', ProcessingNode,
                                         accept_global_perms=False)
            lightning_node_ids = ds.get_json("nodes", [])

            nodes = [n for n in nodes if n.id in lightning_node_ids]
            serializer = ProcessingNodeSerializer(nodes, many=True)

            return JsonResponse(serializer.data)

        @login_required
        def is_lightning_node(request):
            lightning_node_ids = ds.get_json("nodes", [])
            return JsonResponse({'result': int(request.GET.get('id')) in lightning_node_ids})


        return [
            MountPoint('$', main),
            MountPoint('save_api_key$', save_api_key),
            MountPoint('sync_processing_node$', sync_processing_node),
            MountPoint('get_processing_nodes$', get_processing_nodes),
            MountPoint('is_lightning_node$', is_lightning_node),
        ]
コード例 #19
0
ファイル: plugin.py プロジェクト: tarikakyol/WebODM
 def api_mount_points(self):
     return [
         MountPoint('task/(?P<pk>[^/.]+)/shortlink',
                    GetShortLink.as_view()),
     ]
コード例 #20
0
ファイル: plugin.py プロジェクト: tarikakyol/WebODM
 def root_mount_points(self):
     return [
         MountPoint(r'^s(?P<view_type>[m3])(?P<short_id>[a-z0-9]+)/?$',
                    HandleShortLink)
     ]
コード例 #21
0
 def api_mount_points(self):
     return [
         MountPoint('task/(?P<pk>[^/.]+)/info', Info.as_view()),
         MountPoint('task/(?P<pk>[^/.]+)/share', Share.as_view())
     ]
コード例 #22
0
 def api_mount_points(self):
     return [MountPoint('task/(?P<pk>[^/.]+)/volume', TaskVolume.as_view())]
コード例 #23
0
 def api_mount_points(self):
     return [
         MountPoint('task/(?P<pk>[^/.]+)/dsmcorrect',
                    TaskDSMCorrect.as_view())
     ]
コード例 #24
0
 def root_mount_points(self):
     return [
         MountPoint(r'^s(?P<view_type>[m3])/(?P<username>[^/]+)/(?P<short_id>[A-Za-z0-9_-]+)/?$', HandleShortLink)
     ]