|
@@ -1,5 +1,5 @@
|
|
|
-import os
|
|
|
import glob
|
|
|
+import os
|
|
|
import threading
|
|
|
|
|
|
from logging.config import dictConfig
|
|
@@ -9,12 +9,18 @@ from flask_socketio import SocketIO
|
|
|
from logging import config
|
|
|
|
|
|
from pycs import app
|
|
|
+
|
|
|
+from pycs.database.Collection import Collection
|
|
|
from pycs.database.Database import Database
|
|
|
+from pycs.database.LabelProvider import LabelProvider
|
|
|
+from pycs.database.Label import Label
|
|
|
+from pycs.database.Model import Model
|
|
|
+from pycs.database.Project import Project
|
|
|
+from pycs.database.Result import Result
|
|
|
+
|
|
|
from pycs.frontend.endpoints.ListJobs import ListJobs
|
|
|
-from pycs.frontend.endpoints.ListLabelProviders import ListLabelProviders
|
|
|
-from pycs.frontend.endpoints.ListModels import ListModels
|
|
|
-from pycs.frontend.endpoints.ListProjects import ListProjects
|
|
|
from pycs.frontend.endpoints.additional.FolderInformation import FolderInformation
|
|
|
+from pycs.frontend.endpoints.base import ListView
|
|
|
from pycs.frontend.endpoints.data.GetFile import GetFile
|
|
|
from pycs.frontend.endpoints.data.GetPreviousAndNextFile import GetPreviousAndNextFile
|
|
|
from pycs.frontend.endpoints.data.GetResizedFile import GetResizedFile
|
|
@@ -24,7 +30,6 @@ from pycs.frontend.endpoints.jobs.RemoveJob import RemoveJob
|
|
|
from pycs.frontend.endpoints.labels.CreateLabel import CreateLabel
|
|
|
from pycs.frontend.endpoints.labels.EditLabelName import EditLabelName
|
|
|
from pycs.frontend.endpoints.labels.EditLabelParent import EditLabelParent
|
|
|
-from pycs.frontend.endpoints.labels.ListLabels import ListLabels
|
|
|
from pycs.frontend.endpoints.labels.RemoveLabel import RemoveLabel
|
|
|
from pycs.frontend.endpoints.pipelines.FitModel import FitModel
|
|
|
from pycs.frontend.endpoints.pipelines.PredictFile import PredictFile
|
|
@@ -35,7 +40,6 @@ from pycs.frontend.endpoints.projects.EditProjectName import EditProjectName
|
|
|
from pycs.frontend.endpoints.projects.ExecuteExternalStorage import ExecuteExternalStorage
|
|
|
from pycs.frontend.endpoints.projects.ExecuteLabelProvider import ExecuteLabelProvider
|
|
|
from pycs.frontend.endpoints.projects.GetProjectModel import GetProjectModel
|
|
|
-from pycs.frontend.endpoints.projects.ListCollections import ListCollections
|
|
|
from pycs.frontend.endpoints.projects.ListFiles import ListFiles
|
|
|
from pycs.frontend.endpoints.projects.RemoveProject import RemoveProject
|
|
|
from pycs.frontend.endpoints.results.ConfirmResult import ConfirmResult
|
|
@@ -189,7 +193,7 @@ class WebServer:
|
|
|
# models
|
|
|
self.app.add_url_rule(
|
|
|
'/models',
|
|
|
- view_func=ListModels.as_view('list_models')
|
|
|
+ view_func=ListView.as_view('list_models', model_cls=Model)
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/projects/<int:identifier>/model',
|
|
@@ -199,11 +203,11 @@ class WebServer:
|
|
|
# labels
|
|
|
self.app.add_url_rule(
|
|
|
'/label_providers',
|
|
|
- view_func=ListLabelProviders.as_view('label_providers')
|
|
|
+ view_func=ListView.as_view('label_providers', model_cls=LabelProvider)
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
- '/projects/<int:identifier>/labels',
|
|
|
- view_func=ListLabels.as_view('list_labels')
|
|
|
+ '/projects/<int:project_id>/labels',
|
|
|
+ view_func=ListView.as_view('list_labels', model_cls=Label)
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/projects/<int:identifier>/labels',
|
|
@@ -225,7 +229,8 @@ class WebServer:
|
|
|
# collections
|
|
|
self.app.add_url_rule(
|
|
|
'/projects/<int:project_id>/collections',
|
|
|
- view_func=ListCollections.as_view('list_collections')
|
|
|
+ view_func=ListView.as_view('list_collections',
|
|
|
+ model_cls=Collection, post_process=Collection.update_autoselect)
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/projects/<int:project_id>/data/<int:collection_id>/<int:start>/<int:length>',
|
|
@@ -265,7 +270,7 @@ class WebServer:
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/data/<int:file_id>/results',
|
|
|
- view_func=GetResults.as_view('get_results')
|
|
|
+ view_func=ListView.as_view('get_results', model_cls=Result)
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/data/<int:file_id>/results',
|
|
@@ -295,7 +300,7 @@ class WebServer:
|
|
|
# projects
|
|
|
self.app.add_url_rule(
|
|
|
'/projects',
|
|
|
- view_func=ListProjects.as_view('list_projects')
|
|
|
+ view_func=ListView.as_view('list_projects', model_cls=Project)
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/projects',
|