Processed feedback
This commit is contained in:
parent
3e0e4ee846
commit
7da5761d66
3 changed files with 19 additions and 7 deletions
|
@ -9,6 +9,8 @@ from database import db
|
|||
|
||||
from areas import api_v1
|
||||
|
||||
from constants import APP_NOT_INSTALLED_STATUS
|
||||
|
||||
CONFIG_DATA = [
|
||||
{
|
||||
"id": "values.yml",
|
||||
|
@ -29,7 +31,6 @@ APPS_DATA = [
|
|||
|
||||
APP_DATA = {"id": 1, "name": "Nextcloud", "selected": True, "status": "ON for everyone", "config": CONFIG_DATA},
|
||||
|
||||
APP_NOT_INSTALLED_STATUS = "Not installed"
|
||||
|
||||
|
||||
@api_v1.route('/apps', methods=['GET'])
|
||||
|
|
|
@ -4,12 +4,12 @@ class AppsService:
|
|||
@staticmethod
|
||||
def get_all_apps():
|
||||
apps = App.query.all()
|
||||
return [{"id": app.id, "name": app.name, "slug": app.slug, "external": app.external, "url": app.get_url(), "status": app.get_status()} for app in apps]
|
||||
return [app.to_json() for app in apps]
|
||||
|
||||
@staticmethod
|
||||
def get_app(slug):
|
||||
app = App.query.filter_by(slug=slug).first()
|
||||
return {"id": app.id, "name": app.name, "slug": app.slug, "external": app.external, "url": app.get_url(), "status": app.get_status()}
|
||||
return app.to_json()
|
||||
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -8,10 +8,10 @@ from sqlalchemy.orm import relationship
|
|||
from database import db
|
||||
import helpers.kubernetes as k8s
|
||||
|
||||
# Circular import, need fixing
|
||||
#from .apps import APP_NOT_INSTALLED_STATUS
|
||||
from flask import current_app
|
||||
|
||||
from constants import APP_NOT_INSTALLED_STATUS
|
||||
|
||||
APP_NOT_INSTALLED_STATUS = "Not installed"
|
||||
DEFAULT_APP_SUBDOMAINS = {
|
||||
"nextcloud": "files",
|
||||
"wordpress": "www",
|
||||
|
@ -138,7 +138,6 @@ class App(db.Model):
|
|||
# Delete all roles first
|
||||
for role in self.roles:
|
||||
db.session.delete(role)
|
||||
#role.delete()
|
||||
db.session.commit()
|
||||
|
||||
db.session.delete(self)
|
||||
|
@ -228,6 +227,18 @@ class App(db.Model):
|
|||
return condition["status"] == "True", condition["message"]
|
||||
return False, "Condition with type 'Ready' not found"
|
||||
|
||||
def to_json(self):
|
||||
"""
|
||||
represent this object as a json object. Return JSON object
|
||||
"""
|
||||
|
||||
return {"id": self.id,
|
||||
"name": self.name,
|
||||
"slug": self.slug,
|
||||
"external": self.external,
|
||||
"url": self.get_url(),
|
||||
"status": self.get_status()}
|
||||
|
||||
|
||||
class AppRole(db.Model): # pylint: disable=too-few-public-methods
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue