Move Murano panel (named 'Environments') to a separate dashboard.
Change-Id: I1c0c6bd250c8f4f6ab57ba611d5d56224ef9fbfb
This commit is contained in:
parent
8c9bd18613
commit
446a9bc7c7
32
muranodashboard/dashboard.py
Normal file
32
muranodashboard/dashboard.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# Copyright (c) 2013 Mirantis, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
import horizon
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
|
||||||
|
class DeployPanels(horizon.PanelGroup):
|
||||||
|
slug = "deployment_group"
|
||||||
|
name = _("Deployment")
|
||||||
|
panels = ('environments',)
|
||||||
|
|
||||||
|
|
||||||
|
class Murano(horizon.Dashboard):
|
||||||
|
name = _("Murano")
|
||||||
|
slug = "murano"
|
||||||
|
panels = (DeployPanels,)
|
||||||
|
default_panel = 'environments'
|
||||||
|
supports_tenants = True
|
||||||
|
|
||||||
|
|
||||||
|
horizon.register(Murano)
|
@ -20,7 +20,7 @@ from horizon.exceptions import ServiceCatalogException
|
|||||||
from muranoclient.common.exceptions import HTTPForbidden, HTTPNotFound
|
from muranoclient.common.exceptions import HTTPForbidden, HTTPNotFound
|
||||||
from openstack_dashboard.api.base import url_for
|
from openstack_dashboard.api.base import url_for
|
||||||
from muranoclient.v1.client import Client
|
from muranoclient.v1.client import Client
|
||||||
from muranodashboard.panel.services import get_service_name
|
from muranodashboard.environments.services import get_service_name
|
||||||
from consts import STATUS_ID_READY, STATUS_ID_NEW
|
from consts import STATUS_ID_READY, STATUS_ID_NEW
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
@ -20,7 +20,7 @@ from horizon import messages, exceptions
|
|||||||
from openstack_dashboard.api import glance
|
from openstack_dashboard.api import glance
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from muranodashboard.panel.services import get_service_choices
|
from muranodashboard.environments.services import get_service_choices
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
@ -14,12 +14,12 @@
|
|||||||
|
|
||||||
import horizon
|
import horizon
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from openstack_dashboard.dashboards.project import dashboard
|
from muranodashboard import dashboard
|
||||||
|
|
||||||
|
|
||||||
class Panel(horizon.Panel):
|
class Environments(horizon.Panel):
|
||||||
name = _("Environments")
|
name = _("Environments")
|
||||||
slug = 'murano'
|
slug = 'environments'
|
||||||
|
|
||||||
|
|
||||||
dashboard.Project.register(Panel)
|
dashboard.Murano.register(Environments)
|
@ -33,7 +33,7 @@ _last_check_time = 0
|
|||||||
|
|
||||||
class Service(object):
|
class Service(object):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
import muranodashboard.panel.services.forms as services
|
import muranodashboard.environments.services.forms as services
|
||||||
for key, value in kwargs.iteritems():
|
for key, value in kwargs.iteritems():
|
||||||
if key == 'forms':
|
if key == 'forms':
|
||||||
self.forms = []
|
self.forms = []
|
||||||
@ -64,7 +64,7 @@ class Service(object):
|
|||||||
|
|
||||||
|
|
||||||
def import_service(filename, service_file):
|
def import_service(filename, service_file):
|
||||||
from muranodashboard.panel.services.helpers import decamelize
|
from muranodashboard.environments.services.helpers import decamelize
|
||||||
try:
|
try:
|
||||||
with open(service_file) as stream:
|
with open(service_file) as stream:
|
||||||
yaml_desc = yaml.load(stream)
|
yaml_desc = yaml.load(stream)
|
@ -19,7 +19,7 @@ from django.core.validators import RegexValidator, validate_ipv4_address
|
|||||||
from netaddr import all_matching_cidrs
|
from netaddr import all_matching_cidrs
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.utils.encoding import smart_text
|
from django.utils.encoding import smart_text
|
||||||
from muranodashboard.panel import api
|
from muranodashboard.environments import api
|
||||||
from horizon import exceptions, messages
|
from horizon import exceptions, messages
|
||||||
from openstack_dashboard.api import glance
|
from openstack_dashboard.api import glance
|
||||||
from openstack_dashboard.api.nova import novaclient
|
from openstack_dashboard.api.nova import novaclient
|
@ -17,8 +17,8 @@ import logging
|
|||||||
from django import forms
|
from django import forms
|
||||||
from django.core.validators import RegexValidator
|
from django.core.validators import RegexValidator
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
import muranodashboard.panel.services.fields as fields
|
import muranodashboard.environments.services.fields as fields
|
||||||
import muranodashboard.panel.services.helpers as helpers
|
import muranodashboard.environments.services.helpers as helpers
|
||||||
import yaql
|
import yaql
|
||||||
import types
|
import types
|
||||||
|
|
122
muranodashboard/environments/services/metadata.py
Normal file
122
muranodashboard/environments/services/metadata.py
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
# Copyright (c) 2013 Mirantis, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
import tempfile
|
||||||
|
from django.conf import settings
|
||||||
|
import os.path
|
||||||
|
import os
|
||||||
|
import tarfile
|
||||||
|
import logging
|
||||||
|
import shutil
|
||||||
|
import hashlib
|
||||||
|
|
||||||
|
|
||||||
|
CHUNK_SIZE = 1 << 20 # 1MB
|
||||||
|
ARCHIVE_PKG_NAME = 'archive.tar.gz'
|
||||||
|
ARCHIVE_SUBDIR = 'service_forms'
|
||||||
|
CACHE_DIR = getattr(settings, 'UI_METADATA_CACHE_DIR',
|
||||||
|
os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
||||||
|
'../../cache/'))
|
||||||
|
if not os.path.exists(CACHE_DIR):
|
||||||
|
os.mkdir(CACHE_DIR)
|
||||||
|
|
||||||
|
ARCHIVE_PKG_PATH = os.path.join(CACHE_DIR, ARCHIVE_PKG_NAME)
|
||||||
|
ARCHIVE_SUBDIR_PATH = os.path.join(CACHE_DIR, ARCHIVE_SUBDIR)
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
from horizon.exceptions import ServiceCatalogException
|
||||||
|
from openstack_dashboard.api.base import url_for
|
||||||
|
from metadataclient.v1.client import Client
|
||||||
|
|
||||||
|
|
||||||
|
def get_endpoint(request):
|
||||||
|
# prefer location specified in settings for dev purposes
|
||||||
|
endpoint = getattr(settings, 'MURANO_METADATA_URL', None)
|
||||||
|
|
||||||
|
if not endpoint:
|
||||||
|
try:
|
||||||
|
endpoint = url_for(request, 'murano-metadata')
|
||||||
|
except ServiceCatalogException:
|
||||||
|
endpoint = 'http://localhost:5000'
|
||||||
|
log.warning(
|
||||||
|
'Murano Metadata API location could not be found in Service '
|
||||||
|
'Catalog, using default: {0}'.format(endpoint))
|
||||||
|
return endpoint
|
||||||
|
|
||||||
|
|
||||||
|
def metadataclient(request):
|
||||||
|
endpoint = get_endpoint(request)
|
||||||
|
token_id = request.user.token.id
|
||||||
|
log.debug('Murano::Client <Url: {0}, '
|
||||||
|
'TokenId: {1}>'.format(endpoint, token_id))
|
||||||
|
|
||||||
|
return Client(endpoint=endpoint, token=token_id)
|
||||||
|
|
||||||
|
|
||||||
|
def get_hash(archive_path):
|
||||||
|
"""Calculate SHA1-hash of archive file.
|
||||||
|
|
||||||
|
SHA-1 take a bit more time than MD5 (see http://tinyurl.com/kpj5jy7),
|
||||||
|
but is more secure.
|
||||||
|
"""
|
||||||
|
if os.path.exists(archive_path):
|
||||||
|
sha1 = hashlib.sha1()
|
||||||
|
with open(archive_path) as f:
|
||||||
|
buf = f.read(CHUNK_SIZE)
|
||||||
|
while buf:
|
||||||
|
sha1.update(buf)
|
||||||
|
buf = f.read(CHUNK_SIZE)
|
||||||
|
hsum = sha1.hexdigest()
|
||||||
|
log.debug("Archive '{0}' has hash-sum {1}".format(archive_path, hsum))
|
||||||
|
return hsum
|
||||||
|
else:
|
||||||
|
log.info("Archive '{0}' doesn't exist, no hash to calculate".format(
|
||||||
|
archive_path))
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def unpack_ui_package(archive_path):
|
||||||
|
if not tarfile.is_tarfile(archive_path):
|
||||||
|
raise RuntimeError("{0} is not valid tarfile!".format(archive_path))
|
||||||
|
dst_dir = os.path.dirname(os.path.abspath(archive_path))
|
||||||
|
with tarfile.open(archive_path, 'r:gz') as tar:
|
||||||
|
tar.extractall(path=dst_dir)
|
||||||
|
return os.path.join(dst_dir, ARCHIVE_SUBDIR)
|
||||||
|
|
||||||
|
|
||||||
|
def get_ui_metadata(request):
|
||||||
|
"""Returns directory with unpacked definitions provided by Metadata
|
||||||
|
Repository at `endpoint' URL or, if it was not found or some error has
|
||||||
|
occurred, returns None.
|
||||||
|
"""
|
||||||
|
log.debug("Retrieving metadata from Repository")
|
||||||
|
response, body_iter = metadataclient(request).metadata_client.get_ui_data(
|
||||||
|
get_hash(ARCHIVE_PKG_PATH))
|
||||||
|
code = response.status
|
||||||
|
if code == 200:
|
||||||
|
with tempfile.NamedTemporaryFile(delete=False) as out:
|
||||||
|
for chunk in body_iter:
|
||||||
|
out.write(chunk)
|
||||||
|
if os.path.exists(ARCHIVE_PKG_PATH):
|
||||||
|
os.remove(ARCHIVE_PKG_PATH)
|
||||||
|
shutil.move(out.name, ARCHIVE_PKG_PATH)
|
||||||
|
log.info("Successfully downloaded new metadata package to {0}".format(
|
||||||
|
ARCHIVE_PKG_PATH))
|
||||||
|
return unpack_ui_package(ARCHIVE_PKG_PATH), True
|
||||||
|
elif code == 304:
|
||||||
|
log.info("Metadata package hash-sum hasn't changed, doing nothing")
|
||||||
|
return ARCHIVE_SUBDIR_PATH, False
|
||||||
|
else:
|
||||||
|
raise RuntimeError('Unexpected response received: {0}'.format(code))
|
@ -21,7 +21,7 @@ from horizon import tables
|
|||||||
from horizon import messages
|
from horizon import messages
|
||||||
from openstack_dashboard.api import glance
|
from openstack_dashboard.api import glance
|
||||||
|
|
||||||
from muranodashboard.panel import api
|
from muranodashboard.environments import api
|
||||||
from muranodashboard.openstack.common import timeutils
|
from muranodashboard.openstack.common import timeutils
|
||||||
from consts import STATUS_ID_DEPLOYING
|
from consts import STATUS_ID_DEPLOYING
|
||||||
from consts import STATUS_CHOICES
|
from consts import STATUS_CHOICES
|
||||||
@ -33,7 +33,7 @@ from consts import DEPLOYMENT_STATUS_DISPLAY_CHOICES
|
|||||||
class CreateService(tables.LinkAction):
|
class CreateService(tables.LinkAction):
|
||||||
name = 'CreateService'
|
name = 'CreateService'
|
||||||
verbose_name = _('Create Service')
|
verbose_name = _('Create Service')
|
||||||
url = 'horizon:project:murano:create'
|
url = 'horizon:murano:environments:create'
|
||||||
classes = ('btn-launch', 'ajax-modal')
|
classes = ('btn-launch', 'ajax-modal')
|
||||||
|
|
||||||
def allowed(self, request, environment):
|
def allowed(self, request, environment):
|
||||||
@ -47,7 +47,7 @@ class CreateService(tables.LinkAction):
|
|||||||
class CreateEnvironment(tables.LinkAction):
|
class CreateEnvironment(tables.LinkAction):
|
||||||
name = 'CreateEnvironment'
|
name = 'CreateEnvironment'
|
||||||
verbose_name = _('Create Environment')
|
verbose_name = _('Create Environment')
|
||||||
url = 'horizon:project:murano:create_environment'
|
url = 'horizon:murano:environments:create_environment'
|
||||||
classes = ('btn-launch', 'ajax-modal')
|
classes = ('btn-launch', 'ajax-modal')
|
||||||
|
|
||||||
def allowed(self, request, datum):
|
def allowed(self, request, datum):
|
||||||
@ -60,7 +60,7 @@ class CreateEnvironment(tables.LinkAction):
|
|||||||
class MuranoImages(tables.LinkAction):
|
class MuranoImages(tables.LinkAction):
|
||||||
name = 'show_images'
|
name = 'show_images'
|
||||||
verbose_name = _('Murano Images')
|
verbose_name = _('Murano Images')
|
||||||
url = 'horizon:project:murano:murano_images'
|
url = 'horizon:murano:environments:murano_images'
|
||||||
|
|
||||||
def allowed(self, request, environment):
|
def allowed(self, request, environment):
|
||||||
return True
|
return True
|
||||||
@ -88,7 +88,7 @@ class DeleteEnvironment(tables.DeleteAction):
|
|||||||
class EditEnvironment(tables.LinkAction):
|
class EditEnvironment(tables.LinkAction):
|
||||||
name = 'edit'
|
name = 'edit'
|
||||||
verbose_name = _('Edit Environment')
|
verbose_name = _('Edit Environment')
|
||||||
url = 'horizon:project:murano:update_environment'
|
url = 'horizon:murano:environments:update_environment'
|
||||||
classes = ('ajax-modal', 'btn-edit')
|
classes = ('ajax-modal', 'btn-edit')
|
||||||
|
|
||||||
def allowed(self, request, environment):
|
def allowed(self, request, environment):
|
||||||
@ -119,7 +119,7 @@ class DeleteService(tables.DeleteAction):
|
|||||||
service_id)
|
service_id)
|
||||||
except:
|
except:
|
||||||
msg = _('Sorry, you can\'t delete service right now')
|
msg = _('Sorry, you can\'t delete service right now')
|
||||||
redirect = reverse("horizon:project:murano:index")
|
redirect = reverse("horizon:murano:environments:index")
|
||||||
exceptions.handle(request, msg, redirect=redirect)
|
exceptions.handle(request, msg, redirect=redirect)
|
||||||
|
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ class DeployEnvironment(tables.BatchAction):
|
|||||||
api.environment_deploy(request, environment_id)
|
api.environment_deploy(request, environment_id)
|
||||||
except Exception:
|
except Exception:
|
||||||
msg = _('Unable to deploy. Try again later')
|
msg = _('Unable to deploy. Try again later')
|
||||||
redirect = reverse('horizon:project:murano:index')
|
redirect = reverse('horizon:murano:environments:index')
|
||||||
exceptions.handle(request, msg, redirect=redirect)
|
exceptions.handle(request, msg, redirect=redirect)
|
||||||
|
|
||||||
|
|
||||||
@ -172,16 +172,18 @@ class DeployThisEnvironment(tables.Action):
|
|||||||
messages.success(request, _('Deploy started'))
|
messages.success(request, _('Deploy started'))
|
||||||
except:
|
except:
|
||||||
msg = _('Unable to deploy. Try again later')
|
msg = _('Unable to deploy. Try again later')
|
||||||
exceptions.handle(request, msg,
|
exceptions.handle(
|
||||||
redirect=reverse('horizon:project:murano:index'))
|
request, msg,
|
||||||
return shortcuts.redirect(reverse('horizon:project:murano:services',
|
redirect=reverse('horizon:murano:environments:index'))
|
||||||
|
return shortcuts.redirect(
|
||||||
|
reverse('horizon:murano:environments:services',
|
||||||
args=(environment_id,)))
|
args=(environment_id,)))
|
||||||
|
|
||||||
|
|
||||||
class ShowEnvironmentServices(tables.LinkAction):
|
class ShowEnvironmentServices(tables.LinkAction):
|
||||||
name = 'show'
|
name = 'show'
|
||||||
verbose_name = _('Services')
|
verbose_name = _('Services')
|
||||||
url = 'horizon:project:murano:services'
|
url = 'horizon:murano:environments:services'
|
||||||
|
|
||||||
def allowed(self, request, environment):
|
def allowed(self, request, environment):
|
||||||
return True
|
return True
|
||||||
@ -205,7 +207,7 @@ class UpdateServiceRow(tables.Row):
|
|||||||
class ShowDeployments(tables.LinkAction):
|
class ShowDeployments(tables.LinkAction):
|
||||||
name = 'show_deployments'
|
name = 'show_deployments'
|
||||||
verbose_name = _('Show Deployments')
|
verbose_name = _('Show Deployments')
|
||||||
url = 'horizon:project:murano:deployments'
|
url = 'horizon:murano:environments:deployments'
|
||||||
|
|
||||||
def allowed(self, request, environment):
|
def allowed(self, request, environment):
|
||||||
return environment.status != STATUS_ID_NEW
|
return environment.status != STATUS_ID_NEW
|
||||||
@ -213,7 +215,7 @@ class ShowDeployments(tables.LinkAction):
|
|||||||
|
|
||||||
class EnvironmentsTable(tables.DataTable):
|
class EnvironmentsTable(tables.DataTable):
|
||||||
name = tables.Column('name',
|
name = tables.Column('name',
|
||||||
link='horizon:project:murano:services',
|
link='horizon:murano:environments:services',
|
||||||
verbose_name=_('Name'))
|
verbose_name=_('Name'))
|
||||||
|
|
||||||
status = tables.Column('status',
|
status = tables.Column('status',
|
||||||
@ -233,7 +235,7 @@ class EnvironmentsTable(tables.DataTable):
|
|||||||
|
|
||||||
|
|
||||||
def get_service_details_link(service):
|
def get_service_details_link(service):
|
||||||
return reverse('horizon:project:murano:service_details',
|
return reverse('horizon:murano:environments:service_details',
|
||||||
args=(service.environment_id, service.id))
|
args=(service.environment_id, service.id))
|
||||||
|
|
||||||
|
|
||||||
@ -276,7 +278,7 @@ class ShowDeploymentDetails(tables.LinkAction):
|
|||||||
def get_link_url(self, deployment=None):
|
def get_link_url(self, deployment=None):
|
||||||
kwargs = {'environment_id': deployment.environment_id,
|
kwargs = {'environment_id': deployment.environment_id,
|
||||||
'deployment_id': deployment.id}
|
'deployment_id': deployment.id}
|
||||||
return reverse('horizon:project:murano:deployment_details',
|
return reverse('horizon:murano:environments:deployment_details',
|
||||||
kwargs=kwargs)
|
kwargs=kwargs)
|
||||||
|
|
||||||
def allowed(self, request, environment):
|
def allowed(self, request, environment):
|
||||||
@ -317,7 +319,7 @@ class EnvConfigTable(tables.DataTable):
|
|||||||
class AddMuranoImage(tables.LinkAction):
|
class AddMuranoImage(tables.LinkAction):
|
||||||
name = "add_image"
|
name = "add_image"
|
||||||
verbose_name = _("Add Image")
|
verbose_name = _("Add Image")
|
||||||
url = "horizon:project:murano:add_image"
|
url = "horizon:murano:environments:add_image"
|
||||||
classes = ("ajax-modal", "btn-create")
|
classes = ("ajax-modal", "btn-create")
|
||||||
|
|
||||||
def allowed(self, request, image):
|
def allowed(self, request, image):
|
@ -17,11 +17,13 @@ import logging
|
|||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.utils.datastructures import SortedDict
|
from django.utils.datastructures import SortedDict
|
||||||
from horizon import tabs
|
from horizon import tabs
|
||||||
from muranodashboard.panel.consts import LOG_LEVEL_TO_COLOR, LOG_LEVEL_TO_TEXT
|
from muranodashboard.environments.consts import LOG_LEVEL_TO_COLOR
|
||||||
|
from muranodashboard.environments.consts import LOG_LEVEL_TO_TEXT
|
||||||
from openstack_dashboard.api import nova as nova_api
|
from openstack_dashboard.api import nova as nova_api
|
||||||
|
|
||||||
from muranodashboard.panel import api
|
from muranodashboard.environments import api
|
||||||
from muranodashboard.panel.tables import STATUS_DISPLAY_CHOICES, EnvConfigTable
|
from muranodashboard.environments.tables import STATUS_DISPLAY_CHOICES
|
||||||
|
from muranodashboard.environments.tables import EnvConfigTable
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
@ -26,7 +26,7 @@ from services import get_service_checkers
|
|||||||
from services import make_forms_getter
|
from services import make_forms_getter
|
||||||
from openstack_dashboard.dashboards.project.instances.views import DetailView
|
from openstack_dashboard.dashboards.project.instances.views import DetailView
|
||||||
|
|
||||||
VIEW_MOD = 'openstack_dashboard.dashboards.project.murano.views'
|
VIEW_MOD = 'muranodashboard.environments.views'
|
||||||
ENVIRONMENT_ID = r'^(?P<environment_id>[^/]+)'
|
ENVIRONMENT_ID = r'^(?P<environment_id>[^/]+)'
|
||||||
|
|
||||||
|
|
@ -103,7 +103,7 @@ class Wizard(ModalFormMixin, LazyWizard):
|
|||||||
link = self.request.__dict__['META']['HTTP_REFERER']
|
link = self.request.__dict__['META']['HTTP_REFERER']
|
||||||
|
|
||||||
environment_id = re.search('murano/(\w+)', link).group(0)[7:]
|
environment_id = re.search('murano/(\w+)', link).group(0)[7:]
|
||||||
url = reverse('horizon:project:murano:services',
|
url = reverse('horizon:murano:environments:services',
|
||||||
args=(environment_id,))
|
args=(environment_id,))
|
||||||
|
|
||||||
step0_data = form_list[0].cleaned_data
|
step0_data = form_list[0].cleaned_data
|
||||||
@ -118,10 +118,10 @@ class Wizard(ModalFormMixin, LazyWizard):
|
|||||||
except HTTPForbidden:
|
except HTTPForbidden:
|
||||||
msg = _('Sorry, you can\'t create service right now.'
|
msg = _('Sorry, you can\'t create service right now.'
|
||||||
'The environment is deploying.')
|
'The environment is deploying.')
|
||||||
redirect = reverse("horizon:project:murano:index")
|
redirect = reverse("horizon:murano:environments:index")
|
||||||
exceptions.handle(self.request, msg, redirect=redirect)
|
exceptions.handle(self.request, msg, redirect=redirect)
|
||||||
except Exception:
|
except Exception:
|
||||||
redirect = reverse("horizon:project:murano:index")
|
redirect = reverse("horizon:murano:environments:index")
|
||||||
exceptions.handle(self.request,
|
exceptions.handle(self.request,
|
||||||
_('Sorry, you can\'t create service right now.'),
|
_('Sorry, you can\'t create service right now.'),
|
||||||
redirect=redirect)
|
redirect=redirect)
|
||||||
@ -189,26 +189,25 @@ class Services(tables.DataTableView):
|
|||||||
|
|
||||||
except:
|
except:
|
||||||
msg = _('Sorry, this environment does\'t exist anymore')
|
msg = _('Sorry, this environment does\'t exist anymore')
|
||||||
redirect = reverse("horizon:project:murano:index")
|
redirect = reverse("horizon:murano:environments:index")
|
||||||
exceptions.handle(self.request, msg, redirect=redirect)
|
exceptions.handle(self.request, msg, redirect=redirect)
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def get_data(self):
|
def get_data(self):
|
||||||
services = []
|
services = []
|
||||||
self.environment_id = self.kwargs['environment_id']
|
self.environment_id = self.kwargs['environment_id']
|
||||||
|
ns_url = "horizon:murano:environments:index"
|
||||||
try:
|
try:
|
||||||
services = api.services_list(self.request, self.environment_id)
|
services = api.services_list(self.request, self.environment_id)
|
||||||
except HTTPForbidden:
|
except HTTPForbidden:
|
||||||
msg = _('Unable to retrieve list of services. This environment '
|
msg = _('Unable to retrieve list of services. This environment '
|
||||||
'is deploying or already deployed by other user.')
|
'is deploying or already deployed by other user.')
|
||||||
exceptions.handle(self.request, msg,
|
exceptions.handle(self.request, msg, redirect=reverse(ns_url))
|
||||||
redirect=reverse("horizon:project:murano:index"))
|
|
||||||
|
|
||||||
except HTTPInternalServerError:
|
except HTTPInternalServerError:
|
||||||
msg = _('Environment with id %s doesn\'t exist anymore'
|
msg = _('Environment with id %s doesn\'t exist anymore'
|
||||||
% self.environment_id)
|
% self.environment_id)
|
||||||
exceptions.handle(self.request, msg,
|
exceptions.handle(self.request, msg, redirect=reverse(ns_url))
|
||||||
redirect=reverse("horizon:project:murano:index"))
|
|
||||||
except HTTPUnauthorized:
|
except HTTPUnauthorized:
|
||||||
exceptions.handle(self.request)
|
exceptions.handle(self.request)
|
||||||
return services
|
return services
|
||||||
@ -237,7 +236,7 @@ class DetailServiceView(tabs.TabView):
|
|||||||
exceptions.handle(self.request)
|
exceptions.handle(self.request)
|
||||||
|
|
||||||
except HTTPForbidden:
|
except HTTPForbidden:
|
||||||
redirect = reverse('horizon:project:murano:index')
|
redirect = reverse('horizon:murano:environments:index')
|
||||||
exceptions.handle(self.request,
|
exceptions.handle(self.request,
|
||||||
_('Unable to retrieve details for '
|
_('Unable to retrieve details for '
|
||||||
'service'),
|
'service'),
|
||||||
@ -265,7 +264,7 @@ class CreateEnvironmentView(workflows.WorkflowView):
|
|||||||
class EditEnvironmentView(workflows.WorkflowView):
|
class EditEnvironmentView(workflows.WorkflowView):
|
||||||
workflow_class = UpdateEnvironment
|
workflow_class = UpdateEnvironment
|
||||||
template_name = 'environments/update.html'
|
template_name = 'environments/update.html'
|
||||||
success_url = reverse_lazy("horizon:project:murano:index")
|
success_url = reverse_lazy("horizon:murano:environments:index")
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(EditEnvironmentView, self).get_context_data(**kwargs)
|
context = super(EditEnvironmentView, self).get_context_data(**kwargs)
|
||||||
@ -279,7 +278,7 @@ class EditEnvironmentView(workflows.WorkflowView):
|
|||||||
self._object = \
|
self._object = \
|
||||||
api.environment_get(self.request, environment_id)
|
api.environment_get(self.request, environment_id)
|
||||||
except:
|
except:
|
||||||
redirect = reverse("horizon:project:murano:index")
|
redirect = reverse("horizon:murano:environments:index")
|
||||||
msg = _('Unable to retrieve environment details.')
|
msg = _('Unable to retrieve environment details.')
|
||||||
exceptions.handle(self.request, msg, redirect=redirect)
|
exceptions.handle(self.request, msg, redirect=redirect)
|
||||||
return self._object
|
return self._object
|
||||||
@ -306,27 +305,26 @@ class DeploymentsView(tables.DataTableView):
|
|||||||
context['environment_name'] = environment_name
|
context['environment_name'] = environment_name
|
||||||
except:
|
except:
|
||||||
msg = _('Sorry, this environment does\'t exist anymore')
|
msg = _('Sorry, this environment does\'t exist anymore')
|
||||||
redirect = reverse("horizon:project:murano:index")
|
redirect = reverse("horizon:murano:environments:index")
|
||||||
exceptions.handle(self.request, msg, redirect=redirect)
|
exceptions.handle(self.request, msg, redirect=redirect)
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def get_data(self):
|
def get_data(self):
|
||||||
deployments = []
|
deployments = []
|
||||||
self.environment_id = self.kwargs['environment_id']
|
self.environment_id = self.kwargs['environment_id']
|
||||||
|
ns_url = "horizon:murano:environments:index"
|
||||||
try:
|
try:
|
||||||
deployments = api.deployments_list(self.request,
|
deployments = api.deployments_list(self.request,
|
||||||
self.environment_id)
|
self.environment_id)
|
||||||
|
|
||||||
except HTTPForbidden:
|
except HTTPForbidden:
|
||||||
msg = _('Unable to retrieve list of deployments')
|
msg = _('Unable to retrieve list of deployments')
|
||||||
exceptions.handle(self.request, msg,
|
exceptions.handle(self.request, msg, redirect=reverse(ns_url))
|
||||||
redirect=reverse("horizon:project:murano:index"))
|
|
||||||
|
|
||||||
except HTTPInternalServerError:
|
except HTTPInternalServerError:
|
||||||
msg = _('Environment with id %s doesn\'t exist anymore'
|
msg = _('Environment with id %s doesn\'t exist anymore'
|
||||||
% self.environment_id)
|
% self.environment_id)
|
||||||
exceptions.handle(self.request, msg,
|
exceptions.handle(self.request, msg, redirect=reverse(ns_url))
|
||||||
redirect=reverse("horizon:project:murano:index"))
|
|
||||||
return deployments
|
return deployments
|
||||||
|
|
||||||
|
|
||||||
@ -355,7 +353,7 @@ class DeploymentDetailsView(tabs.TabbedTableView):
|
|||||||
except (HTTPInternalServerError, HTTPNotFound):
|
except (HTTPInternalServerError, HTTPNotFound):
|
||||||
msg = _('Deployment with id %s doesn\'t exist anymore'
|
msg = _('Deployment with id %s doesn\'t exist anymore'
|
||||||
% self.deployment_id)
|
% self.deployment_id)
|
||||||
redirect = reverse("horizon:project:murano:deployments")
|
redirect = reverse("horizon:murano:environments:deployments")
|
||||||
exceptions.handle(self.request, msg, redirect=redirect)
|
exceptions.handle(self.request, msg, redirect=redirect)
|
||||||
return deployment
|
return deployment
|
||||||
|
|
||||||
@ -368,7 +366,7 @@ class DeploymentDetailsView(tabs.TabbedTableView):
|
|||||||
except (HTTPInternalServerError, HTTPNotFound):
|
except (HTTPInternalServerError, HTTPNotFound):
|
||||||
msg = _('Deployment with id %s doesn\'t exist anymore'
|
msg = _('Deployment with id %s doesn\'t exist anymore'
|
||||||
% self.deployment_id)
|
% self.deployment_id)
|
||||||
redirect = reverse("horizon:project:murano:deployments")
|
redirect = reverse("horizon:murano:environments:deployments")
|
||||||
exceptions.handle(self.request, msg, redirect=redirect)
|
exceptions.handle(self.request, msg, redirect=redirect)
|
||||||
return logs
|
return logs
|
||||||
|
|
||||||
@ -393,8 +391,9 @@ class MuranoImageView(tables.DataTableView):
|
|||||||
|
|
||||||
except HTTPForbidden:
|
except HTTPForbidden:
|
||||||
msg = _('Unable to retrieve list of images')
|
msg = _('Unable to retrieve list of images')
|
||||||
exceptions.handle(self.request, msg,
|
exceptions.handle(
|
||||||
redirect=reverse("horizon:project:murano:index"))
|
self.request, msg,
|
||||||
|
redirect=reverse("horizon:murano:environments:index"))
|
||||||
murano_images = []
|
murano_images = []
|
||||||
for image in images:
|
for image in images:
|
||||||
murano_property = image.properties.get('murano_image_info')
|
murano_property = image.properties.get('murano_image_info')
|
||||||
@ -418,4 +417,4 @@ class AddMuranoImageView(ModalFormView):
|
|||||||
form_class = AddImageForm
|
form_class = AddImageForm
|
||||||
template_name = 'images/add.html'
|
template_name = 'images/add.html'
|
||||||
context_object_name = 'image'
|
context_object_name = 'image'
|
||||||
success_url = reverse_lazy("horizon:project:murano:murano_images")
|
success_url = reverse_lazy("horizon:murano:environments:murano_images")
|
@ -20,7 +20,7 @@ from horizon import exceptions
|
|||||||
from horizon import forms
|
from horizon import forms
|
||||||
from horizon import workflows
|
from horizon import workflows
|
||||||
|
|
||||||
from muranodashboard.panel import api
|
from muranodashboard.environments import api
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -76,7 +76,7 @@ class CreateEnvironment(workflows.Workflow):
|
|||||||
finalize_button_name = _("Create")
|
finalize_button_name = _("Create")
|
||||||
success_message = _('Created environment "%s".')
|
success_message = _('Created environment "%s".')
|
||||||
failure_message = _('Unable to create environment "%s".')
|
failure_message = _('Unable to create environment "%s".')
|
||||||
success_url = "horizon:project:murano:index"
|
success_url = "horizon:murano:environments:index"
|
||||||
default_steps = (SelectProjectUser, ConfigureEnvironment)
|
default_steps = (SelectProjectUser, ConfigureEnvironment)
|
||||||
|
|
||||||
def format_status_message(self, message):
|
def format_status_message(self, message):
|
||||||
@ -133,7 +133,7 @@ class UpdateEnvironment(workflows.Workflow):
|
|||||||
finalize_button_name = _("Save")
|
finalize_button_name = _("Save")
|
||||||
success_message = _('Modified environment "%s".')
|
success_message = _('Modified environment "%s".')
|
||||||
failure_message = _('Unable to modify environment "%s".')
|
failure_message = _('Unable to modify environment "%s".')
|
||||||
success_url = "horizon:project:murano:index"
|
success_url = "horizon:murano:environments:index"
|
||||||
default_steps = (UpdateEnvironmentInfo,)
|
default_steps = (UpdateEnvironmentInfo,)
|
||||||
|
|
||||||
def format_status_message(self, message):
|
def format_status_message(self, message):
|
@ -52,15 +52,14 @@ EXTENDED_UNAUTHORIZED_EXCEPTIONS = tuple(
|
|||||||
|
|
||||||
|
|
||||||
HORIZON_CONFIG = {
|
HORIZON_CONFIG = {
|
||||||
'dashboards': ('project', 'admin', 'settings',),
|
'dashboards': ('project', 'admin', 'settings', 'murano'),
|
||||||
'default_dashboard': 'project',
|
'default_dashboard': 'murano',
|
||||||
'user_home': 'openstack_dashboard.views.get_user_home',
|
'user_home': 'muranodashboard.views.get_user_home',
|
||||||
'ajax_queue_limit': 10,
|
'ajax_queue_limit': 10,
|
||||||
'help_url': "http://docs.openstack.org",
|
'help_url': "http://docs.openstack.org",
|
||||||
'exceptions': {'recoverable': EXTENDED_RECOVERABLE_EXCEPTIONS,
|
'exceptions': {'recoverable': EXTENDED_RECOVERABLE_EXCEPTIONS,
|
||||||
'not_found': EXTENDED_NOT_FOUND_EXCEPTIONS,
|
'not_found': EXTENDED_NOT_FOUND_EXCEPTIONS,
|
||||||
'unauthorized': EXTENDED_UNAUTHORIZED_EXCEPTIONS},
|
'unauthorized': EXTENDED_UNAUTHORIZED_EXCEPTIONS},
|
||||||
'customization_module': 'panel.overrides'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<h3>
|
<h3>
|
||||||
<a href=" {% url 'horizon:project:murano:index' %}">
|
<a href=" {% url 'horizon:murano:environments:index' %}">
|
||||||
{% blocktrans %}environments{% endblocktrans %}
|
{% blocktrans %}environments{% endblocktrans %}
|
||||||
</a> > {{ environment_name }} deployments
|
</a> > {{ environment_name }} deployments
|
||||||
</h3>
|
</h3>
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<h3>
|
<h3>
|
||||||
<a href=" {% url 'horizon:project:murano:index' %}">
|
<a href=" {% url 'horizon:murano:environments:index' %}">
|
||||||
{% blocktrans %}environments{% endblocktrans %}
|
{% blocktrans %}environments{% endblocktrans %}
|
||||||
</a> >
|
</a> >
|
||||||
<a href=" {% url 'horizon:project:murano:deployments' environment_id %}">
|
<a href=" {% url 'horizon:murano:environments:deployments' environment_id %}">
|
||||||
{% blocktrans %}{{ environment_name }} deployments{% endblocktrans %}
|
{% blocktrans %}{{ environment_name }} deployments{% endblocktrans %}
|
||||||
</a> >
|
</a> >
|
||||||
deployment at {{ deployment_start_time }}
|
deployment at {{ deployment_start_time }}
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
<h2> {% blocktrans %}Service Detail: {{ service_name }} {% endblocktrans %}
|
<h2> {% blocktrans %}Service Detail: {{ service_name }} {% endblocktrans %}
|
||||||
</h2>
|
</h2>
|
||||||
<h3>
|
<h3>
|
||||||
<a href=" {% url 'horizon:project:murano:index' %}">
|
<a href=" {% url 'horizon:murano:environments:index' %}">
|
||||||
{% blocktrans %}environments{% endblocktrans %}
|
{% blocktrans %}environments{% endblocktrans %}
|
||||||
</a> >
|
</a> >
|
||||||
<a href=" {% url 'horizon:project:murano:services' service.environment_id %}">
|
<a href=" {% url 'horizon:murano:environments:services' service.environment_id %}">
|
||||||
{% blocktrans %}environment {{ environment_name }}{% endblocktrans %}
|
{% blocktrans %}environment {{ environment_name }}{% endblocktrans %}
|
||||||
</a>
|
</a>
|
||||||
{% blocktrans %} > service {{ service_name }}{% endblocktrans %}
|
{% blocktrans %} > service {{ service_name }}{% endblocktrans %}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<h3>
|
<h3>
|
||||||
<a href=" {% url 'horizon:project:murano:index' %}">
|
<a href=" {% url 'horizon:murano:environments:index' %}">
|
||||||
{% blocktrans %}environments{% endblocktrans %}
|
{% blocktrans %}environments{% endblocktrans %}
|
||||||
</a> > environment {{ environment_name }}
|
</a> > environment {{ environment_name }}
|
||||||
</h3>
|
</h3>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{% extends "common/_modal_form.html" %}
|
{% extends "common/_modal_form.html" %}
|
||||||
{% load i18n humanize %}
|
{% load i18n humanize %}
|
||||||
|
|
||||||
{% block form_action %}{% url horizon:project:murano:create %}{% endblock %}
|
{% block form_action %}{% url horizon:murano:environments:create %}{% endblock %}
|
||||||
{% block form_id %}create_service_form{% endblock %}
|
{% block form_id %}create_service_form{% endblock %}
|
||||||
{% block modal_id %}create_service{% endblock %}
|
{% block modal_id %}create_service{% endblock %}
|
||||||
{% block modal-header %}{% trans "Create Service" %}{% endblock %}
|
{% block modal-header %}{% trans "Create Service" %}{% endblock %}
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import horizon
|
import horizon
|
||||||
|
|
||||||
from muranodashboard.panel.panel import Panel
|
|
||||||
|
|
||||||
project = horizon.get_dashboard('project')
|
def get_user_home(user):
|
||||||
project.register(Panel)
|
#if user.is_superuser:
|
||||||
|
# return horizon.get_dashboard('admin').get_absolute_url()
|
||||||
|
return horizon.get_dashboard('murano').get_absolute_url()
|
Loading…
Reference in New Issue
Block a user