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 openstack_dashboard.api.base import url_for
|
||||
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
|
||||
|
||||
log = logging.getLogger(__name__)
|
@ -20,7 +20,7 @@ from horizon import messages, exceptions
|
||||
from openstack_dashboard.api import glance
|
||||
import json
|
||||
|
||||
from muranodashboard.panel.services import get_service_choices
|
||||
from muranodashboard.environments.services import get_service_choices
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -14,12 +14,12 @@
|
||||
|
||||
import horizon
|
||||
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")
|
||||
slug = 'murano'
|
||||
slug = 'environments'
|
||||
|
||||
|
||||
dashboard.Project.register(Panel)
|
||||
dashboard.Murano.register(Environments)
|
@ -33,7 +33,7 @@ _last_check_time = 0
|
||||
|
||||
class Service(object):
|
||||
def __init__(self, **kwargs):
|
||||
import muranodashboard.panel.services.forms as services
|
||||
import muranodashboard.environments.services.forms as services
|
||||
for key, value in kwargs.iteritems():
|
||||
if key == 'forms':
|
||||
self.forms = []
|
||||
@ -64,7 +64,7 @@ class Service(object):
|
||||
|
||||
|
||||
def import_service(filename, service_file):
|
||||
from muranodashboard.panel.services.helpers import decamelize
|
||||
from muranodashboard.environments.services.helpers import decamelize
|
||||
try:
|
||||
with open(service_file) as 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 django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.encoding import smart_text
|
||||
from muranodashboard.panel import api
|
||||
from muranodashboard.environments import api
|
||||
from horizon import exceptions, messages
|
||||
from openstack_dashboard.api import glance
|
||||
from openstack_dashboard.api.nova import novaclient
|
@ -17,8 +17,8 @@ import logging
|
||||
from django import forms
|
||||
from django.core.validators import RegexValidator
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
import muranodashboard.panel.services.fields as fields
|
||||
import muranodashboard.panel.services.helpers as helpers
|
||||
import muranodashboard.environments.services.fields as fields
|
||||
import muranodashboard.environments.services.helpers as helpers
|
||||
import yaql
|
||||
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 openstack_dashboard.api import glance
|
||||
|
||||
from muranodashboard.panel import api
|
||||
from muranodashboard.environments import api
|
||||
from muranodashboard.openstack.common import timeutils
|
||||
from consts import STATUS_ID_DEPLOYING
|
||||
from consts import STATUS_CHOICES
|
||||
@ -33,7 +33,7 @@ from consts import DEPLOYMENT_STATUS_DISPLAY_CHOICES
|
||||
class CreateService(tables.LinkAction):
|
||||
name = 'CreateService'
|
||||
verbose_name = _('Create Service')
|
||||
url = 'horizon:project:murano:create'
|
||||
url = 'horizon:murano:environments:create'
|
||||
classes = ('btn-launch', 'ajax-modal')
|
||||
|
||||
def allowed(self, request, environment):
|
||||
@ -47,7 +47,7 @@ class CreateService(tables.LinkAction):
|
||||
class CreateEnvironment(tables.LinkAction):
|
||||
name = 'CreateEnvironment'
|
||||
verbose_name = _('Create Environment')
|
||||
url = 'horizon:project:murano:create_environment'
|
||||
url = 'horizon:murano:environments:create_environment'
|
||||
classes = ('btn-launch', 'ajax-modal')
|
||||
|
||||
def allowed(self, request, datum):
|
||||
@ -60,7 +60,7 @@ class CreateEnvironment(tables.LinkAction):
|
||||
class MuranoImages(tables.LinkAction):
|
||||
name = 'show_images'
|
||||
verbose_name = _('Murano Images')
|
||||
url = 'horizon:project:murano:murano_images'
|
||||
url = 'horizon:murano:environments:murano_images'
|
||||
|
||||
def allowed(self, request, environment):
|
||||
return True
|
||||
@ -88,7 +88,7 @@ class DeleteEnvironment(tables.DeleteAction):
|
||||
class EditEnvironment(tables.LinkAction):
|
||||
name = 'edit'
|
||||
verbose_name = _('Edit Environment')
|
||||
url = 'horizon:project:murano:update_environment'
|
||||
url = 'horizon:murano:environments:update_environment'
|
||||
classes = ('ajax-modal', 'btn-edit')
|
||||
|
||||
def allowed(self, request, environment):
|
||||
@ -119,7 +119,7 @@ class DeleteService(tables.DeleteAction):
|
||||
service_id)
|
||||
except:
|
||||
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)
|
||||
|
||||
|
||||
@ -144,7 +144,7 @@ class DeployEnvironment(tables.BatchAction):
|
||||
api.environment_deploy(request, environment_id)
|
||||
except Exception:
|
||||
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)
|
||||
|
||||
|
||||
@ -172,16 +172,18 @@ class DeployThisEnvironment(tables.Action):
|
||||
messages.success(request, _('Deploy started'))
|
||||
except:
|
||||
msg = _('Unable to deploy. Try again later')
|
||||
exceptions.handle(request, msg,
|
||||
redirect=reverse('horizon:project:murano:index'))
|
||||
return shortcuts.redirect(reverse('horizon:project:murano:services',
|
||||
exceptions.handle(
|
||||
request, msg,
|
||||
redirect=reverse('horizon:murano:environments:index'))
|
||||
return shortcuts.redirect(
|
||||
reverse('horizon:murano:environments:services',
|
||||
args=(environment_id,)))
|
||||
|
||||
|
||||
class ShowEnvironmentServices(tables.LinkAction):
|
||||
name = 'show'
|
||||
verbose_name = _('Services')
|
||||
url = 'horizon:project:murano:services'
|
||||
url = 'horizon:murano:environments:services'
|
||||
|
||||
def allowed(self, request, environment):
|
||||
return True
|
||||
@ -205,7 +207,7 @@ class UpdateServiceRow(tables.Row):
|
||||
class ShowDeployments(tables.LinkAction):
|
||||
name = 'show_deployments'
|
||||
verbose_name = _('Show Deployments')
|
||||
url = 'horizon:project:murano:deployments'
|
||||
url = 'horizon:murano:environments:deployments'
|
||||
|
||||
def allowed(self, request, environment):
|
||||
return environment.status != STATUS_ID_NEW
|
||||
@ -213,7 +215,7 @@ class ShowDeployments(tables.LinkAction):
|
||||
|
||||
class EnvironmentsTable(tables.DataTable):
|
||||
name = tables.Column('name',
|
||||
link='horizon:project:murano:services',
|
||||
link='horizon:murano:environments:services',
|
||||
verbose_name=_('Name'))
|
||||
|
||||
status = tables.Column('status',
|
||||
@ -233,7 +235,7 @@ class EnvironmentsTable(tables.DataTable):
|
||||
|
||||
|
||||
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))
|
||||
|
||||
|
||||
@ -276,7 +278,7 @@ class ShowDeploymentDetails(tables.LinkAction):
|
||||
def get_link_url(self, deployment=None):
|
||||
kwargs = {'environment_id': deployment.environment_id,
|
||||
'deployment_id': deployment.id}
|
||||
return reverse('horizon:project:murano:deployment_details',
|
||||
return reverse('horizon:murano:environments:deployment_details',
|
||||
kwargs=kwargs)
|
||||
|
||||
def allowed(self, request, environment):
|
||||
@ -317,7 +319,7 @@ class EnvConfigTable(tables.DataTable):
|
||||
class AddMuranoImage(tables.LinkAction):
|
||||
name = "add_image"
|
||||
verbose_name = _("Add Image")
|
||||
url = "horizon:project:murano:add_image"
|
||||
url = "horizon:murano:environments:add_image"
|
||||
classes = ("ajax-modal", "btn-create")
|
||||
|
||||
def allowed(self, request, image):
|
@ -17,11 +17,13 @@ import logging
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.datastructures import SortedDict
|
||||
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 muranodashboard.panel import api
|
||||
from muranodashboard.panel.tables import STATUS_DISPLAY_CHOICES, EnvConfigTable
|
||||
from muranodashboard.environments import api
|
||||
from muranodashboard.environments.tables import STATUS_DISPLAY_CHOICES
|
||||
from muranodashboard.environments.tables import EnvConfigTable
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -26,7 +26,7 @@ from services import get_service_checkers
|
||||
from services import make_forms_getter
|
||||
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>[^/]+)'
|
||||
|
||||
|
@ -103,7 +103,7 @@ class Wizard(ModalFormMixin, LazyWizard):
|
||||
link = self.request.__dict__['META']['HTTP_REFERER']
|
||||
|
||||
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,))
|
||||
|
||||
step0_data = form_list[0].cleaned_data
|
||||
@ -118,10 +118,10 @@ class Wizard(ModalFormMixin, LazyWizard):
|
||||
except HTTPForbidden:
|
||||
msg = _('Sorry, you can\'t create service right now.'
|
||||
'The environment is deploying.')
|
||||
redirect = reverse("horizon:project:murano:index")
|
||||
redirect = reverse("horizon:murano:environments:index")
|
||||
exceptions.handle(self.request, msg, redirect=redirect)
|
||||
except Exception:
|
||||
redirect = reverse("horizon:project:murano:index")
|
||||
redirect = reverse("horizon:murano:environments:index")
|
||||
exceptions.handle(self.request,
|
||||
_('Sorry, you can\'t create service right now.'),
|
||||
redirect=redirect)
|
||||
@ -189,26 +189,25 @@ class Services(tables.DataTableView):
|
||||
|
||||
except:
|
||||
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)
|
||||
return context
|
||||
|
||||
def get_data(self):
|
||||
services = []
|
||||
self.environment_id = self.kwargs['environment_id']
|
||||
ns_url = "horizon:murano:environments:index"
|
||||
try:
|
||||
services = api.services_list(self.request, self.environment_id)
|
||||
except HTTPForbidden:
|
||||
msg = _('Unable to retrieve list of services. This environment '
|
||||
'is deploying or already deployed by other user.')
|
||||
exceptions.handle(self.request, msg,
|
||||
redirect=reverse("horizon:project:murano:index"))
|
||||
exceptions.handle(self.request, msg, redirect=reverse(ns_url))
|
||||
|
||||
except HTTPInternalServerError:
|
||||
msg = _('Environment with id %s doesn\'t exist anymore'
|
||||
% self.environment_id)
|
||||
exceptions.handle(self.request, msg,
|
||||
redirect=reverse("horizon:project:murano:index"))
|
||||
exceptions.handle(self.request, msg, redirect=reverse(ns_url))
|
||||
except HTTPUnauthorized:
|
||||
exceptions.handle(self.request)
|
||||
return services
|
||||
@ -237,7 +236,7 @@ class DetailServiceView(tabs.TabView):
|
||||
exceptions.handle(self.request)
|
||||
|
||||
except HTTPForbidden:
|
||||
redirect = reverse('horizon:project:murano:index')
|
||||
redirect = reverse('horizon:murano:environments:index')
|
||||
exceptions.handle(self.request,
|
||||
_('Unable to retrieve details for '
|
||||
'service'),
|
||||
@ -265,7 +264,7 @@ class CreateEnvironmentView(workflows.WorkflowView):
|
||||
class EditEnvironmentView(workflows.WorkflowView):
|
||||
workflow_class = UpdateEnvironment
|
||||
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):
|
||||
context = super(EditEnvironmentView, self).get_context_data(**kwargs)
|
||||
@ -279,7 +278,7 @@ class EditEnvironmentView(workflows.WorkflowView):
|
||||
self._object = \
|
||||
api.environment_get(self.request, environment_id)
|
||||
except:
|
||||
redirect = reverse("horizon:project:murano:index")
|
||||
redirect = reverse("horizon:murano:environments:index")
|
||||
msg = _('Unable to retrieve environment details.')
|
||||
exceptions.handle(self.request, msg, redirect=redirect)
|
||||
return self._object
|
||||
@ -306,27 +305,26 @@ class DeploymentsView(tables.DataTableView):
|
||||
context['environment_name'] = environment_name
|
||||
except:
|
||||
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)
|
||||
return context
|
||||
|
||||
def get_data(self):
|
||||
deployments = []
|
||||
self.environment_id = self.kwargs['environment_id']
|
||||
ns_url = "horizon:murano:environments:index"
|
||||
try:
|
||||
deployments = api.deployments_list(self.request,
|
||||
self.environment_id)
|
||||
|
||||
except HTTPForbidden:
|
||||
msg = _('Unable to retrieve list of deployments')
|
||||
exceptions.handle(self.request, msg,
|
||||
redirect=reverse("horizon:project:murano:index"))
|
||||
exceptions.handle(self.request, msg, redirect=reverse(ns_url))
|
||||
|
||||
except HTTPInternalServerError:
|
||||
msg = _('Environment with id %s doesn\'t exist anymore'
|
||||
% self.environment_id)
|
||||
exceptions.handle(self.request, msg,
|
||||
redirect=reverse("horizon:project:murano:index"))
|
||||
exceptions.handle(self.request, msg, redirect=reverse(ns_url))
|
||||
return deployments
|
||||
|
||||
|
||||
@ -355,7 +353,7 @@ class DeploymentDetailsView(tabs.TabbedTableView):
|
||||
except (HTTPInternalServerError, HTTPNotFound):
|
||||
msg = _('Deployment with id %s doesn\'t exist anymore'
|
||||
% self.deployment_id)
|
||||
redirect = reverse("horizon:project:murano:deployments")
|
||||
redirect = reverse("horizon:murano:environments:deployments")
|
||||
exceptions.handle(self.request, msg, redirect=redirect)
|
||||
return deployment
|
||||
|
||||
@ -368,7 +366,7 @@ class DeploymentDetailsView(tabs.TabbedTableView):
|
||||
except (HTTPInternalServerError, HTTPNotFound):
|
||||
msg = _('Deployment with id %s doesn\'t exist anymore'
|
||||
% self.deployment_id)
|
||||
redirect = reverse("horizon:project:murano:deployments")
|
||||
redirect = reverse("horizon:murano:environments:deployments")
|
||||
exceptions.handle(self.request, msg, redirect=redirect)
|
||||
return logs
|
||||
|
||||
@ -393,8 +391,9 @@ class MuranoImageView(tables.DataTableView):
|
||||
|
||||
except HTTPForbidden:
|
||||
msg = _('Unable to retrieve list of images')
|
||||
exceptions.handle(self.request, msg,
|
||||
redirect=reverse("horizon:project:murano:index"))
|
||||
exceptions.handle(
|
||||
self.request, msg,
|
||||
redirect=reverse("horizon:murano:environments:index"))
|
||||
murano_images = []
|
||||
for image in images:
|
||||
murano_property = image.properties.get('murano_image_info')
|
||||
@ -418,4 +417,4 @@ class AddMuranoImageView(ModalFormView):
|
||||
form_class = AddImageForm
|
||||
template_name = 'images/add.html'
|
||||
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 workflows
|
||||
|
||||
from muranodashboard.panel import api
|
||||
from muranodashboard.environments import api
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -76,7 +76,7 @@ class CreateEnvironment(workflows.Workflow):
|
||||
finalize_button_name = _("Create")
|
||||
success_message = _('Created 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)
|
||||
|
||||
def format_status_message(self, message):
|
||||
@ -133,7 +133,7 @@ class UpdateEnvironment(workflows.Workflow):
|
||||
finalize_button_name = _("Save")
|
||||
success_message = _('Modified environment "%s".')
|
||||
failure_message = _('Unable to modify environment "%s".')
|
||||
success_url = "horizon:project:murano:index"
|
||||
success_url = "horizon:murano:environments:index"
|
||||
default_steps = (UpdateEnvironmentInfo,)
|
||||
|
||||
def format_status_message(self, message):
|
@ -52,15 +52,14 @@ EXTENDED_UNAUTHORIZED_EXCEPTIONS = tuple(
|
||||
|
||||
|
||||
HORIZON_CONFIG = {
|
||||
'dashboards': ('project', 'admin', 'settings',),
|
||||
'default_dashboard': 'project',
|
||||
'user_home': 'openstack_dashboard.views.get_user_home',
|
||||
'dashboards': ('project', 'admin', 'settings', 'murano'),
|
||||
'default_dashboard': 'murano',
|
||||
'user_home': 'muranodashboard.views.get_user_home',
|
||||
'ajax_queue_limit': 10,
|
||||
'help_url': "http://docs.openstack.org",
|
||||
'exceptions': {'recoverable': EXTENDED_RECOVERABLE_EXCEPTIONS,
|
||||
'not_found': EXTENDED_NOT_FOUND_EXCEPTIONS,
|
||||
'unauthorized': EXTENDED_UNAUTHORIZED_EXCEPTIONS},
|
||||
'customization_module': 'panel.overrides'
|
||||
}
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
</h2>
|
||||
|
||||
<h3>
|
||||
<a href=" {% url 'horizon:project:murano:index' %}">
|
||||
<a href=" {% url 'horizon:murano:environments:index' %}">
|
||||
{% blocktrans %}environments{% endblocktrans %}
|
||||
</a> > {{ environment_name }} deployments
|
||||
</h3>
|
||||
|
@ -7,10 +7,10 @@
|
||||
</h2>
|
||||
|
||||
<h3>
|
||||
<a href=" {% url 'horizon:project:murano:index' %}">
|
||||
<a href=" {% url 'horizon:murano:environments:index' %}">
|
||||
{% blocktrans %}environments{% endblocktrans %}
|
||||
</a> >
|
||||
<a href=" {% url 'horizon:project:murano:deployments' environment_id %}">
|
||||
<a href=" {% url 'horizon:murano:environments:deployments' environment_id %}">
|
||||
{% blocktrans %}{{ environment_name }} deployments{% endblocktrans %}
|
||||
</a> >
|
||||
deployment at {{ deployment_start_time }}
|
||||
|
@ -6,10 +6,10 @@
|
||||
<h2> {% blocktrans %}Service Detail: {{ service_name }} {% endblocktrans %}
|
||||
</h2>
|
||||
<h3>
|
||||
<a href=" {% url 'horizon:project:murano:index' %}">
|
||||
<a href=" {% url 'horizon:murano:environments:index' %}">
|
||||
{% blocktrans %}environments{% endblocktrans %}
|
||||
</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 %}
|
||||
</a>
|
||||
{% blocktrans %} > service {{ service_name }}{% endblocktrans %}
|
||||
|
@ -7,7 +7,7 @@
|
||||
</h2>
|
||||
|
||||
<h3>
|
||||
<a href=" {% url 'horizon:project:murano:index' %}">
|
||||
<a href=" {% url 'horizon:murano:environments:index' %}">
|
||||
{% blocktrans %}environments{% endblocktrans %}
|
||||
</a> > environment {{ environment_name }}
|
||||
</h3>
|
||||
|
@ -1,7 +1,7 @@
|
||||
{% extends "common/_modal_form.html" %}
|
||||
{% 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 modal_id %}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
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import horizon
|
||||
|
||||
from muranodashboard.panel.panel import Panel
|
||||
|
||||
project = horizon.get_dashboard('project')
|
||||
project.register(Panel)
|
||||
def get_user_home(user):
|
||||
#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