Skip to content
Snippets Groups Projects
Verified Commit 5ac175e4 authored by Maarten de Waard's avatar Maarten de Waard :angel:
Browse files

allow deleting external applications

parent 808533fa
No related branches found
No related tags found
1 merge request!55Resolve "Merge dashboard and dashboard-backend repos"
...@@ -25,7 +25,7 @@ class App(db.Model): ...@@ -25,7 +25,7 @@ class App(db.Model):
id = db.Column(Integer, primary_key=True) id = db.Column(Integer, primary_key=True)
name = db.Column(String(length=64)) name = db.Column(String(length=64))
slug = db.Column(String(length=64), unique=True) slug = db.Column(String(length=64), unique=True)
external = db.Column(Boolean, unique=False, nullable=False, default=True, server_default='0') external = db.Column(Boolean, unique=False, nullable=False, server_default='0')
# The URL is only stored in the DB for external applications; otherwise the # The URL is only stored in the DB for external applications; otherwise the
# URL is stored in a configmap (see get_url) # URL is stored in a configmap (see get_url)
url = db.Column(String(length=128), unique=False) url = db.Column(String(length=128), unique=False)
...@@ -229,6 +229,12 @@ class AppStatus(): # pylint: disable=too-few-public-methods ...@@ -229,6 +229,12 @@ class AppStatus(): # pylint: disable=too-few-public-methods
:type app: App :type app: App
""" """
def __init__(self, app): def __init__(self, app):
if app.external:
self.installed = True
self.ready = True
self.message = "App is external"
return
kustomization = app.kustomization kustomization = app.kustomization
if kustomization is not None and "status" in kustomization: if kustomization is not None and "status" in kustomization:
ks_ready, ks_message = AppStatus.check_condition(kustomization['status']) ks_ready, ks_message = AppStatus.check_condition(kustomization['status'])
......
...@@ -105,12 +105,13 @@ def delete_app(slug): ...@@ -105,12 +105,13 @@ def delete_app(slug):
return return
app_status = app_obj.get_status() app_status = app_obj.get_status()
if not app_status.installed: if app_status.installed and not app_obj.external:
app_obj.delete()
current_app.logger.info("Success.")
else:
current_app.logger.info("Can not delete installed application, run" current_app.logger.info("Can not delete installed application, run"
" 'uninstall' first") " 'uninstall' first")
return
app_obj.delete()
current_app.logger.info("Success.")
@app_cli.command( @app_cli.command(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment