hackyhacky
This commit is contained in:
parent
07a2c46227
commit
0ca64316f4
8 changed files with 61 additions and 44 deletions
|
|
@ -19,14 +19,13 @@ CONFIG_DATA = [
|
|||
]
|
||||
|
||||
@api_v1.route('/apps', methods=['GET'])
|
||||
@jwt_required()
|
||||
# @jwt_required()
|
||||
@cross_origin()
|
||||
def get_apps():
|
||||
"""Return data about all apps"""
|
||||
apps = AppsService.get_all_apps()
|
||||
return jsonify(apps)
|
||||
|
||||
|
||||
@api_v1.route('/apps/<string:slug>', methods=['GET'])
|
||||
@jwt_required()
|
||||
def get_app(slug):
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
from .models_lit import LITApp
|
||||
from .models import App, AppRole
|
||||
|
||||
class AppsService:
|
||||
@staticmethod
|
||||
def get_all_apps():
|
||||
apps = App.query.all()
|
||||
apps = [
|
||||
LITApp(id=1, name="Dateiablage", slug="nextcloud", external=True, url="https://cloud.dev.local-it.cloud"),
|
||||
LITApp(id=2, name="Projekte", slug="vikunja", external=True, url="https://vikunja.dev.local-it.cloud"),
|
||||
]
|
||||
# App.query.all()
|
||||
return [app.to_dict() for app in apps]
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -14,4 +19,4 @@ class AppsService:
|
|||
@staticmethod
|
||||
def get_app_roles():
|
||||
app_roles = AppRole.query.all()
|
||||
return [{"user_id": app_role.user_id, "app_id": app_role.app_id, "role_id": app_role.role_id} for app_role in app_roles]
|
||||
return [{"user_id": app_role.user_id, "app_id": app_role.app_id, "role_id": app_role.role_id} for app_role in app_roles]
|
||||
46
backend/areas/apps/models_lit.py
Normal file
46
backend/areas/apps/models_lit.py
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
"""Everything to do with Apps"""
|
||||
|
||||
import os
|
||||
import base64
|
||||
|
||||
from sqlalchemy import ForeignKey, Integer, String, Boolean
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from database import db
|
||||
from .models import App
|
||||
# import helpers.kubernetes as k8s
|
||||
|
||||
|
||||
DEFAULT_APP_SUBDOMAINS = {
|
||||
"nextcloud": "files",
|
||||
"wordpress": "www",
|
||||
"monitoring": "grafana",
|
||||
}
|
||||
|
||||
class LITApp(App):
|
||||
"""
|
||||
"""
|
||||
|
||||
def get_url(self):
|
||||
return self.url
|
||||
|
||||
def to_dict(self):
|
||||
"""
|
||||
represent this object as a dict, compatible for JSON output
|
||||
"""
|
||||
return {"id": self.id,
|
||||
"name": self.name,
|
||||
"slug": self.slug,
|
||||
"external": self.external,
|
||||
"status": self.get_status(),
|
||||
"url": self.get_url()}
|
||||
|
||||
|
||||
|
||||
def get_status(self):
|
||||
"""Returns an AppStatus object that describes the current cluster state"""
|
||||
return {
|
||||
"installed": "",
|
||||
"ready": "",
|
||||
"message": "",
|
||||
}
|
||||
Reference in a new issue