diff --git a/.gitignore b/.gitignore index 5138969c..4ee919e1 100644 --- a/.gitignore +++ b/.gitignore @@ -17,22 +17,6 @@ nosetests.xml pep8.txt pylint.txt # Files created by releasenotes build -releasenotes/build -reports -openstack_dashboard/local/* -!openstack_dashboard/local/local_settings.py.example -!openstack_dashboard/local/enabled/_50__settings.py.example -!openstack_dashboard/local/local_settings.d -openstack_dashboard/local/local_settings.d/* -!openstack_dashboard/local/local_settings.d/*.example -openstack_dashboard/test/.secret_key_store -openstack_dashboard/test/integration_tests/local-horizon.conf -openstack_dashboard/test/integration_tests/test_reports/ -openstack_dashboard/wsgi/horizon.wsgi -doc/build/ -doc/source/sourcecode -/static/ -integration_tests_screenshots/ .venv .tox node_modules diff --git a/cgcs_dashboard/api/ceilometer.py b/cgcs_dashboard/api/ceilometer.py deleted file mode 100644 index 7be295be..00000000 --- a/cgcs_dashboard/api/ceilometer.py +++ /dev/null @@ -1,52 +0,0 @@ -# -# Copyright (c) 2013-2017 Wind River Systems, Inc. -# -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# - -from ceilometerclient import client as ceilometer_client -from django.conf import settings -from openstack_dashboard.api import base - -from horizon.utils.memoized import memoized # noqa - - -class Pipeline(base.APIResourceWrapper): - """Represents one Ceilometer pipeline entry.""" - - _attrs = ['name', 'enabled', 'meters', 'location', 'max_bytes', - 'backup_count', 'compress'] - - def __init__(self, apipipeline): - super(Pipeline, self).__init__(apipipeline) - - -@memoized -def ceilometerclient(request): - """Initialization of Ceilometer client.""" - - endpoint = base.url_for(request, 'metering') - insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False) - cacert = getattr(settings, 'OPENSTACK_SSL_CACERT', None) - return ceilometer_client.Client('2', endpoint, - token=(lambda: request.user.token.id), - insecure=insecure, - cacert=cacert) - - -def pipeline_list(request): - """List the configured pipeline.""" - pipeline_entries = ceilometerclient(request).pipelines.list() - pipelines = [Pipeline(p) for p in pipeline_entries] - return pipelines - - -def pipeline_update(request, pipeline_name, some_dict): - pipeline = ceilometerclient(request).pipelines.update(pipeline_name, - **some_dict) - if not pipeline: - raise ValueError( - 'No match found for pipeline_name "%s".' % pipeline_name) - return Pipeline(pipeline) diff --git a/cgcs_dashboard/api/ceph.py b/cgcs_dashboard/api/ceph.py deleted file mode 100755 index b2834f8a..00000000 --- a/cgcs_dashboard/api/ceph.py +++ /dev/null @@ -1,187 +0,0 @@ -# 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. -# -# Copyright (c) 2013-2014 Wind River Systems, Inc. -# -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# - -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -from __future__ import absolute_import - -import logging - -from cephclient import wrapper - -from openstack_dashboard.api import base - -LOG = logging.getLogger(__name__) - - -# TODO(wrs) this can be instancized once, or will need to pass request per -# user? -def cephwrapper(): - return wrapper.CephWrapper() - - -class Monitor(base.APIDictWrapper): - __attrs = ['host', 'rank'] - - def __init__(self, apidict): - super(Monitor, self).__init__(apidict) - - -class OSD(base.APIDictWrapper): - __attrs = ['id', 'name', 'host', 'status'] - - def __init__(self, apidict): - super(OSD, self).__init__(apidict) - - -class Cluster(base.APIDictWrapper): - _attrs = ['fsid', 'status', 'health', 'detail'] - - def __init__(self, apidict): - super(Cluster, self).__init__(apidict) - - -class Storage(base.APIDictWrapper): - _attrs = ['total', 'used', 'available', - 'writes_per_sec', 'operations_per_sec'] - - def __init__(self, apidict): - super(Storage, self).__init__(apidict) - - -def _Bytes_to_MiB(value_B): - return (value_B / (1024 * 1024)) - - -def _Bytes_to_GiB(value_B): - return (value_B / (1024 * 1024 * 1024)) - - -def cluster_get(): - # the json response doesn't give all the information - response, text_body = cephwrapper().health(body='text') - # ceph is not up, raise exception - if not response.ok: - response.raise_for_status() - health_info = text_body.split(' ', 1) - - # if health is ok, there will be no details so just show HEALTH_OK - if len(health_info) > 1: - detail = health_info[1] - else: - detail = health_info[0] - - response, cluster_uuid = cephwrapper().fsid(body='text') - if not response.ok: - cluster_uuid = None - - cluster = { - 'fsid': cluster_uuid, - 'health': health_info[0], - 'detail': detail, - } - - return Cluster(cluster) - - -def storage_get(): - # # Space info - response, body = cephwrapper().df(body='json') - # return no space info - if not response.ok: - response.raise_for_status() - stats = body['output']['stats'] - space = { - 'total': _Bytes_to_GiB(stats['total_bytes']), - 'used': _Bytes_to_MiB(stats['total_used_bytes']), - 'available': _Bytes_to_GiB(stats['total_avail_bytes']), - } - - # # I/O info - response, body = cephwrapper().osd_pool_stats(body='json', - name='cinder-volumes') - if not response.ok: - response.raise_for_status() - stats = body['output'][0]['client_io_rate'] - # not showing reads/sec at the moment - # reads_per_sec = stats['read_bytes_sec'] if ( - # 'read_bytes_sec' in stats) else 0 - writes_per_sec = stats['write_bytes_sec'] if ( - 'write_bytes_sec' in stats) else 0 - operations_per_sec = stats['op_per_sec'] if ('op_per_sec' in stats) else 0 - io = { - 'writes_per_sec': writes_per_sec / 1024, - 'operations_per_sec': operations_per_sec - } - - storage = {} - storage.update(space) - storage.update(io) - - return Storage(storage) - - -def _get_quorum_status(mon, quorums): - if mon['rank'] in quorums: - status = 'up' - else: - status = 'down' - return status - - -def monitor_list(): - response, body = cephwrapper().mon_dump(body='json') - # return no monitors info - if not response.ok: - response.raise_for_status() - - quorums = body['output']['quorum'] - - mons = [] - for mon in body['output']['mons']: - status = _get_quorum_status(mon, quorums) - mons.append( - {'host': mon['name'], 'rank': mon['rank'], 'status': status}) - return [Monitor(m) for m in mons] - - -def osd_list(): - # would use osd_find, but it doesn't give osd's name - response, tree = cephwrapper().osd_tree(body='json') - if not response.ok: - response.raise_for_status() - - osds = [] - for node in tree['output']['nodes']: - # found osd - if node['type'] == 'osd': - osd = {} - osd['id'] = node['id'] - osd['name'] = node['name'] - osd['status'] = node['status'] - - # check if osd belongs to host - response, body = cephwrapper().osd_find(body='json', id=osd['id']) - if response.ok and 'host' in body['output']['crush_location']: - osd['host'] = body['output']['crush_location']['host'] - # else dont set hostname - - osds.append(osd) - - return [OSD(o) for o in osds] diff --git a/cgcs_dashboard/api/rest/__init__.py b/cgcs_dashboard/api/rest/__init__.py deleted file mode 100755 index 4cd383da..00000000 --- a/cgcs_dashboard/api/rest/__init__.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2014, Rackspace, US, 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. -"""This package holds the REST API that supports the Horizon dashboard -Javascript code. - -It is not intended to be used outside of Horizon, and makes no promises of -stability or fitness for purpose outside of that scope. - -It does not promise to adhere to the general OpenStack API Guidelines set out -in https://wiki.openstack.org/wiki/APIChangeGuidelines. -""" - -from openstack_dashboard.api.rest import dc_manager -from openstack_dashboard.api.rest import sysinv - - -__all__ = [ - 'dc_manager', - 'sysinv', -] diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/_createphysicalvolume.html b/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/_createphysicalvolume.html deleted file mode 100755 index 6c2b5cee..00000000 --- a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/_createphysicalvolume.html +++ /dev/null @@ -1,27 +0,0 @@ -{% extends "horizon/common/_modal_form.html" %} -{% load i18n %} - -{% block form_id %}add_physicalvolume_form{% endblock %} -{% block form_action %}{% url 'horizon:admin:inventory:addphysicalvolume' host_id %}{% endblock %} - -{% block modal-header %}{% trans "Create Physical Volume" %}{% endblock %} -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
-

{% trans "Description" %}:

-

{% trans "From here you can define the configuration of a new physical volume." %}

-
-{% endblock %} - -{% block modal-footer %} - Cancel - -{% endblock %} - - - - diff --git a/setup.cfg b/setup.cfg index 3015b1f0..407c6f0f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,11 +1,9 @@ [metadata] -name = cgcs-dashboard -summary = CGCS Dashboard -description-file = - README.rst +name = starlingx-dashboard +summary = StarlingX Dashboard Panels author = OpenStack -author-email = openstack-dev@lists.openstack.org -home-page = http://docs.openstack.org/developer/horizon/ +author_email = openstack-dev@lists.openstack.org +home-page = https://wiki.openstack.org/wiki/StarlingX classifier = Environment :: OpenStack Framework :: Django @@ -21,7 +19,7 @@ classifier = [files] packages = - wrs_dashboard + starlingx_dashboard [build_sphinx] all_files = 1 diff --git a/setup.py b/setup.py index 782bb21f..5751d32e 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. +# Copyright (c) 2018 Intel Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -26,4 +26,4 @@ except ImportError: setuptools.setup( setup_requires=['pbr>=1.8'], - pbr=True) + pbr=True) \ No newline at end of file diff --git a/cgcs_dashboard/__init__.py b/starlingx_dashboard/__init__.py similarity index 100% rename from cgcs_dashboard/__init__.py rename to starlingx_dashboard/__init__.py diff --git a/cgcs_dashboard/api/__init__.py b/starlingx_dashboard/api/__init__.py similarity index 56% rename from cgcs_dashboard/api/__init__.py rename to starlingx_dashboard/api/__init__.py index fd2aaad6..07ad166b 100755 --- a/cgcs_dashboard/api/__init__.py +++ b/starlingx_dashboard/api/__init__.py @@ -10,22 +10,28 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +# +# Copyright (c) 2017 Wind River Systems, Inc. +# -from cgcs_dashboard.api import ceilometer -from cgcs_dashboard.api import ceph -from cgcs_dashboard.api import dc_manager -from cgcs_dashboard.api import iservice -from cgcs_dashboard.api import patch -from cgcs_dashboard.api import sysinv -from cgcs_dashboard.api import vim - +#from cgcs_dashboard.api import dc_manager +#from cgcs_dashboard.api import iservice +#from cgcs_dashboard.api import sysinv +from starlingx_dashboard.api import vim +from starlingx_dashboard.api import sysinv +from starlingx_dashboard.api import patch +# TODO (ediardo): cleanup the imports below __all__ = [ - "ceilometer", - "ceph", - "dc_manager", - "iservice", - "patch", + "nova", "sysinv", "vim", + "patch" +# "ceilometer", +# "ceph", +# "dc_manager", +# "iservice", +# "patch", +# "sysinv", +# "vim", ] diff --git a/starlingx_dashboard/api/base.py b/starlingx_dashboard/api/base.py new file mode 100644 index 00000000..bbf38e68 --- /dev/null +++ b/starlingx_dashboard/api/base.py @@ -0,0 +1,17 @@ +# +# Copyright (c) 2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 +# + +from django.conf import settings +from horizon import exceptions +import six + +def get_request_page_size(request, limit=None): + default_limit = getattr(settings, 'API_RESULT_LIMIT', 1000) + try: + return min(int(limit), default_limit) + except Exception: + default_page_size = getattr(settings, 'API_RESULT_PAGE_SIZE', 20) + return request.session.get('horizon_pagesize', default_page_size) diff --git a/cgcs_dashboard/api/dc_manager.py b/starlingx_dashboard/api/dc_manager.py similarity index 77% rename from cgcs_dashboard/api/dc_manager.py rename to starlingx_dashboard/api/dc_manager.py index 7ac5f745..3cd1a2e1 100755 --- a/cgcs_dashboard/api/dc_manager.py +++ b/starlingx_dashboard/api/dc_manager.py @@ -1,73 +1,79 @@ -# -# Copyright (c) 2017 Wind River Systems, Inc. -# -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# - - -import logging - -from dcmanagerclient.api.v1 import client - -from horizon.utils.memoized import memoized # noqa - -from openstack_dashboard.api import base - -LOG = logging.getLogger(__name__) - - -@memoized -def dcmanagerclient(request): - endpoint = base.url_for(request, 'dcmanager', 'adminURL') - c = client.Client(project_id=request.user.project_id, - user_id=request.user.id, - auth_token=request.user.token.id, - dcmanager_url=endpoint) - return c - - -class Summary(base.APIResourceWrapper): - _attrs = ['name', 'critical', 'major', 'minor', 'warnings', 'status'] - - -def alarm_summary_list(request): - summaries = dcmanagerclient(request).alarm_manager.list_alarms() - return [Summary(summary) for summary in summaries] - - -class Subcloud(base.APIResourceWrapper): - _attrs = ['subcloud_id', 'name', 'description', 'location', - 'software_version', 'management_subnet', 'management_state', - 'availability_status', 'management_start_ip', - 'management_end_ip', 'management_gateway_ip', - 'systemcontroller_gateway_ip', 'created_at', 'updated_at', - 'sync_status', 'endpoint_sync_status', ] - - -def subcloud_list(request): - subclouds = dcmanagerclient(request).subcloud_manager.list_subclouds() - return [Subcloud(subcloud) for subcloud in subclouds] - - -def subcloud_create(request, data): - return dcmanagerclient(request).subcloud_manager.add_subcloud( - **data.get('data')) - - -def subcloud_update(request, subcloud_id, changes): - response = dcmanagerclient(request).subcloud_manager.update_subcloud( - subcloud_id, **changes.get('updated')) - # Updating returns a list of subclouds for some reason - return [Subcloud(subcloud) for subcloud in response] - - -def subcloud_delete(request, subcloud_id): - return dcmanagerclient(request).subcloud_manager.delete_subcloud( - subcloud_id) - - -def subcloud_generate_config(request, subcloud_id, data): - return dcmanagerclient(request).subcloud_manager.generate_config_subcloud( - subcloud_id, **data) +# 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. +# +# Copyright (c) 2017 Wind River Systems, Inc. +# + +import logging + +from dcmanagerclient.api.v1 import client + +from horizon.utils.memoized import memoized # noqa + +from openstack_dashboard.api import base + +LOG = logging.getLogger(__name__) + + +@memoized +def dcmanagerclient(request): + endpoint = base.url_for(request, 'dcmanager', 'adminURL') + c = client.Client(project_id=request.user.project_id, + user_id=request.user.id, + auth_token=request.user.token.id, + dcmanager_url=endpoint) + return c + + +class Summary(base.APIResourceWrapper): + _attrs = ['name', 'critical', 'major', 'minor', 'warnings', 'status'] + + +def alarm_summary_list(request): + summaries = dcmanagerclient(request).alarm_manager.list_alarms() + return [Summary(summary) for summary in summaries] + + +class Subcloud(base.APIResourceWrapper): + _attrs = ['subcloud_id', 'name', 'description', 'location', + 'software_version', 'management_subnet', 'management_state', + 'availability_status', 'management_start_ip', + 'management_end_ip', 'management_gateway_ip', + 'systemcontroller_gateway_ip', 'created_at', 'updated_at', + 'sync_status', 'endpoint_sync_status', ] + + +def subcloud_list(request): + subclouds = dcmanagerclient(request).subcloud_manager.list_subclouds() + return [Subcloud(subcloud) for subcloud in subclouds] + + +def subcloud_create(request, data): + return dcmanagerclient(request).subcloud_manager.add_subcloud( + **data.get('data')) + + +def subcloud_update(request, subcloud_id, changes): + response = dcmanagerclient(request).subcloud_manager.update_subcloud( + subcloud_id, **changes.get('updated')) + # Updating returns a list of subclouds for some reason + return [Subcloud(subcloud) for subcloud in response] + + +def subcloud_delete(request, subcloud_id): + return dcmanagerclient(request).subcloud_manager.delete_subcloud( + subcloud_id) + + +def subcloud_generate_config(request, subcloud_id, data): + return dcmanagerclient(request).subcloud_manager.generate_config_subcloud( + subcloud_id, **data) diff --git a/cgcs_dashboard/api/iservice.py b/starlingx_dashboard/api/iservice.py similarity index 88% rename from cgcs_dashboard/api/iservice.py rename to starlingx_dashboard/api/iservice.py index 7754bfb5..803a3308 100755 --- a/cgcs_dashboard/api/iservice.py +++ b/starlingx_dashboard/api/iservice.py @@ -12,12 +12,6 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# - -# vim: tabstop=4 shiftwidth=4 softtabstop=4 from __future__ import absolute_import diff --git a/starlingx_dashboard/api/nova.py b/starlingx_dashboard/api/nova.py new file mode 100644 index 00000000..11410678 --- /dev/null +++ b/starlingx_dashboard/api/nova.py @@ -0,0 +1,10 @@ +# +# Copyright (c) 2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 +# + +from openstack_dashboard.api.nova import * + +def server_group_create(request, **kwargs): + return novaclient(request).server_groups.create(**kwargs) \ No newline at end of file diff --git a/cgcs_dashboard/api/patch.py b/starlingx_dashboard/api/patch.py similarity index 97% rename from cgcs_dashboard/api/patch.py rename to starlingx_dashboard/api/patch.py index bdb08561..3d90fb41 100755 --- a/cgcs_dashboard/api/patch.py +++ b/starlingx_dashboard/api/patch.py @@ -12,10 +12,6 @@ # # Copyright (c) 2014 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# import logging import urlparse diff --git a/starlingx_dashboard/api/rest/__init__.py b/starlingx_dashboard/api/rest/__init__.py new file mode 100755 index 00000000..4ec8b9da --- /dev/null +++ b/starlingx_dashboard/api/rest/__init__.py @@ -0,0 +1,24 @@ +# Copyright 2014, Rackspace, US, 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. +# +# Copyright (c) 2014 Wind River Systems, Inc. +# + +from openstack_dashboard.api.rest import dc_manager +from openstack_dashboard.api.rest import sysinv + + +__all__ = [ + 'dc_manager', + 'sysinv', +] diff --git a/cgcs_dashboard/api/rest/dc_manager.py b/starlingx_dashboard/api/rest/dc_manager.py similarity index 82% rename from cgcs_dashboard/api/rest/dc_manager.py rename to starlingx_dashboard/api/rest/dc_manager.py index 966693c2..2f8ca721 100755 --- a/cgcs_dashboard/api/rest/dc_manager.py +++ b/starlingx_dashboard/api/rest/dc_manager.py @@ -1,10 +1,17 @@ +# 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. # # Copyright (c) 2017 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# import logging diff --git a/cgcs_dashboard/api/rest/sysinv.py b/starlingx_dashboard/api/rest/sysinv.py similarity index 62% rename from cgcs_dashboard/api/rest/sysinv.py rename to starlingx_dashboard/api/rest/sysinv.py index 1926694e..450b4ab3 100755 --- a/cgcs_dashboard/api/rest/sysinv.py +++ b/starlingx_dashboard/api/rest/sysinv.py @@ -1,10 +1,18 @@ +# 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. # # Copyright (c) 2017 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# + from django.views import generic diff --git a/cgcs_dashboard/api/sysinv.py b/starlingx_dashboard/api/sysinv.py similarity index 96% rename from cgcs_dashboard/api/sysinv.py rename to starlingx_dashboard/api/sysinv.py index b462ccf4..41d51be3 100755 --- a/cgcs_dashboard/api/sysinv.py +++ b/starlingx_dashboard/api/sysinv.py @@ -10,14 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. # -# Copyright (c) 2013-2017 Wind River Systems, Inc. +# Copyright (c) 2013-2018 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# - -# vim: tabstop=4 shiftwidth=4 softtabstop=4 from __future__ import absolute_import @@ -31,6 +25,7 @@ from django.conf import settings from django.utils.translation import ugettext_lazy as _ from openstack_dashboard.api import base +from starlingx_dashboard.api import base as stx_base import cgcs_patch.constants as patch_constants import sysinv.common.constants as constants @@ -142,7 +137,7 @@ def cgtsclient(request): cacert = getattr(settings, 'OPENSTACK_SSL_CACERT', None) # FIXME this returns the wrong URL - endpoint = base.url_for(request, 'platform', 'adminURL') + endpoint = base.url_for(request, 'platform', 'publicURL') version = 1 LOG.debug('cgtsclient connection created using token "%s" and url "%s"', @@ -153,7 +148,7 @@ def cgtsclient(request): return cgts_client.Client(version=version, endpoint=endpoint, auth_url=base.url_for(request, 'identity', - 'adminURL'), + 'publicURL'), token=request.user.token.id, # os_auth_token username=request.user.username, password=request.user.token.id, @@ -169,9 +164,6 @@ class Memory(base.APIResourceWrapper): 'platform_reserved_mib', 'memavail_mib', 'hugepages_configured', - 'avs_hugepages_size_mib', - 'avs_hugepages_nr', - 'avs_hugepages_avail', 'vm_hugepages_nr_2M_pending', 'vm_hugepages_avail_2M', 'vm_hugepages_nr_1G_pending', @@ -288,6 +280,7 @@ class StorageVolume(base.APIResourceWrapper): 'capabilities', 'idisk_uuid', 'ihost_uuid', + 'tier_name', 'journal_path', 'journal_size_mib', 'journal_location'] @@ -1066,7 +1059,7 @@ def alarm_list(request, search_opts=None): marker = search_opts.get('marker', None) sort_key = search_opts.get('sort_key', None) sort_dir = search_opts.get('sort_dir', None) - page_size = base.get_request_page_size(request, limit) + page_size = stx_base.get_request_page_size(request, limit) if "suppression" in search_opts: suppression = search_opts.pop('suppression') @@ -1400,17 +1393,94 @@ def extoam_list(request): return [EXTOAM(n) for n in extoam] +class Cluster(base.APIResourceWrapper): + """...""" + _attrs = ['uuid', 'cluster_uuid', 'type', 'name'] + + def __init__(self, apiresource): + super(Cluster, self).__init__(apiresource) + + if hasattr(self, 'uuid'): + self._uuid = self.uuid + self._name = self.name + self._type = self.type + self._cluster_uuid = self.cluster_uuid + else: + self._uuid = None + self._name = None + self._type = None + self._cluster_uuid = None + + @property + def uuid(self): + return self._uuid + + @property + def name(self): + return self._name + + @property + def type(self): + return self._type + + @property + def cluster_uuid(self): + return self._cluster_uuid + + +def cluster_list(request): + clusters = cgtsclient(request).cluster.list() + + return [Cluster(n) for n in clusters] + + +class StorageTier(base.APIResourceWrapper): + """...""" + _attrs = ['uuid', 'name', 'type', 'status'] + + def __init__(self, apiresource): + super(StorageTier, self).__init__(apiresource) + + if hasattr(self, 'uuid'): + self._uuid = self.uuid + self._name = self.name + self._type = self.type + self._status = self.status + else: + self._uuid = None + self._name = None + self._type = None + self._status = None + + @property + def uuid(self): + return self._uuid + + @property + def name(self): + return self._name + + @property + def type(self): + return self._type + + @property + def status(self): + return self._status + + class StorageCeph(base.APIResourceWrapper): """...""" _attrs = ['cinder_pool_gib', 'glance_pool_gib', 'ephemeral_pool_gib', - 'object_pool_gib', 'object_gateway', 'uuid', 'link', + 'object_pool_gib', 'object_gateway', 'uuid', 'tier_name', 'link', 'ceph_total_space_gib'] def __init__(self, apiresource): super(StorageCeph, self).__init__(apiresource) if hasattr(self, 'uuid'): + self._tier_name = self.tier_name self._cinder_pool_gib = self.cinder_pool_gib self._glance_pool_gib = self.glance_pool_gib self._ephemeral_pool_gib = self.ephemeral_pool_gib @@ -1418,6 +1488,7 @@ class StorageCeph(base.APIResourceWrapper): self._object_gateway = self.object_gateway self._ceph_total_space_gib = self.ceph_total_space_gib else: + self._tier_name = None self._cinder_pool_gib = None self._glance_pool_gib = None self._ephemeral_pool_gib = None @@ -1425,6 +1496,10 @@ class StorageCeph(base.APIResourceWrapper): self._object_gateway = None self._ceph_total_space_gib = None + @property + def tier_name(self): + return self._tier_name + @property def cinder_pool_gib(self): return self._cinder_pool_gib @@ -1452,12 +1527,14 @@ class StorageCeph(base.APIResourceWrapper): class StorageBackend(base.APIResourceWrapper): """...""" - _attrs = ['isystem_uuid', 'backend', 'state', 'task', 'uuid', 'link'] + _attrs = ['isystem_uuid', 'name', 'backend', + 'state', 'task', 'uuid', 'link'] def __init__(self, apiresource): super(StorageBackend, self).__init__(apiresource) if hasattr(self, 'uuid'): + self._name = self.name self._backend = self.backend self._state = self.state self._task = self.task @@ -1466,6 +1543,10 @@ class StorageBackend(base.APIResourceWrapper): self._state = None self._task = None + @property + def name(self): + return self._name + @property def backend(self): return self._backend @@ -1554,37 +1635,20 @@ class CephMon(base.APIResourceWrapper): class STORAGE(base.APIResourceWrapper): """...""" _attrs = ['isystem_uuid', 'backup_gib', 'scratch_gib', 'cgcs_gib', - 'img_conversions_gib', 'database_gib', - 'uuid', 'link', 'backend', 'glance_backend', - 'cinder_pool_gib', 'glance_pool_gib', 'ephemeral_pool_gib', - 'object_pool_gib', 'ceph_mon_gib', 'ceph_total_space_gib'] + 'img_conversions_gib', 'database_gib', 'uuid', 'link'] - def __init__(self, controller_fs, ceph_mon, storage_ceph): + def __init__(self, controller_fs, ceph_mon): if controller_fs: super(STORAGE, self).__init__(controller_fs) - elif storage_ceph: - super(STORAGE, self).__init__(storage_ceph) self._backup_gib = None self._scratch_gib = None self._cgcs_gib = None self._img_conversions_gib = None self._database_gib = None - self._backend = None - self._cinder_pool_gib = None - self._glance_pool_gib = None - self._ephemeral_pool_gib = None self._ceph_mon_gib = None - self._ceph_total_space_gib = None if hasattr(self, 'uuid'): - if storage_ceph: - self._glance_pool_gib = storage_ceph.glance_pool_gib - self._ephemeral_pool_gib = storage_ceph.ephemeral_pool_gib - self._cinder_pool_gib = storage_ceph.cinder_pool_gib - self._object_pool_gib = storage_ceph.object_pool_gib - self._ceph_total_space_gib = storage_ceph.ceph_total_space_gib - if controller_fs: self._backup_gib = controller_fs.backup_gib self._scratch_gib = controller_fs.scratch_gib @@ -1617,34 +1681,10 @@ class STORAGE(base.APIResourceWrapper): def img_conversions_gib(self): return self._img_conversions_gib - @property - def backend(self): - return self._backend - - @property - def glance_backend(self): - return self._glance_backend - - @property - def cinder_pool_gib(self): - return self._cinder_pool_gib - - @property - def glance_pool_gib(self): - return self._glance_pool_gib - - @property - def ephemeral_pool_gib(self): - return self._ephemeral_pool_gib - @property def ceph_mon_gib(self): return self._ceph_mon_gib - @property - def ceph_total_space_gib(self): - return self._ceph_total_space_gib - def storfs_update(request, controller_fs_id, **kwargs): LOG.info("Updating controller fs storage with kwargs=%s", kwargs) @@ -1752,7 +1792,7 @@ def storagefs_list(request): if ceph_mon_list: ceph_mon_obj = ceph_mon_list[0] - return [STORAGE(controllerfs_obj, ceph_mon_obj, None)] + return [STORAGE(controllerfs_obj, ceph_mon_obj)] def controllerfs_list(request): @@ -1765,6 +1805,12 @@ def controllerfs_list(request): return [ControllerFS(n) for n in controllerfs] +def storage_tier_list(request, cluster_id): + storage_tiers = cgtsclient(request).storage_tier.list(cluster_id) + + return [StorageTier(n) for n in storage_tiers] + + def storage_backend_list(request): backends = cgtsclient(request).storage_backend.list() @@ -1982,8 +2028,7 @@ def host_interface_delete(request, interface_id): class Address(base.APIResourceWrapper): """Wrapper for Inventory Addresses""" - _attrs = ['uuid', 'interface_uuid', 'networktype', 'address', 'prefix', - 'enable_dad'] + _attrs = ['uuid', 'interface_uuid', 'address', 'prefix', 'enable_dad'] def __init__(self, apiresource): super(Address, self).__init__(apiresource) @@ -2317,7 +2362,7 @@ def event_log_list(request, search_opts=None): limit = search_opts.get('limit', None) marker = search_opts.get('marker', None) - page_size = base.get_request_page_size(request, limit) + page_size = stx_base.get_request_page_size(request, limit) if 'paginate' in search_opts: paginate = search_opts.pop('paginate') diff --git a/cgcs_dashboard/api/vim.py b/starlingx_dashboard/api/vim.py similarity index 88% rename from cgcs_dashboard/api/vim.py rename to starlingx_dashboard/api/vim.py index 8e136fa9..dd14f8a4 100755 --- a/cgcs_dashboard/api/vim.py +++ b/starlingx_dashboard/api/vim.py @@ -1,10 +1,17 @@ +# 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. # # Copyright (c) 2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# import logging import urlparse diff --git a/cgcs_dashboard/dashboards/__init__.py b/starlingx_dashboard/dashboards/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/__init__.py rename to starlingx_dashboard/dashboards/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/__init__.py b/starlingx_dashboard/dashboards/admin/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/__init__.py rename to starlingx_dashboard/dashboards/admin/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/fault_management/__init__.py b/starlingx_dashboard/dashboards/admin/fault_management/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/fault_management/__init__.py rename to starlingx_dashboard/dashboards/admin/fault_management/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/fault_management/panel.py b/starlingx_dashboard/dashboards/admin/fault_management/panel.py similarity index 88% rename from cgcs_dashboard/dashboards/admin/fault_management/panel.py rename to starlingx_dashboard/dashboards/admin/fault_management/panel.py index da127cee..ada7b052 100755 --- a/cgcs_dashboard/dashboards/admin/fault_management/panel.py +++ b/starlingx_dashboard/dashboards/admin/fault_management/panel.py @@ -18,9 +18,6 @@ # # Copyright (c) 2013-2017 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. from django.utils.translation import ugettext_lazy as _ # noqa @@ -35,12 +32,16 @@ class FaultManagement(horizon.Panel): permissions = ('openstack.services.platform',) def allowed(self, context): + if context['request'].user.services_region == 'SystemController': + return False if not base.is_service_enabled(context['request'], 'platform'): return False else: return super(FaultManagement, self).allowed(context) def nav(self, context): + if context['request'].user.services_region == 'SystemController': + return False if not base.is_service_enabled(context['request'], 'platform'): return False else: diff --git a/cgcs_dashboard/dashboards/admin/fault_management/tables.py b/starlingx_dashboard/dashboards/admin/fault_management/tables.py similarity index 86% rename from cgcs_dashboard/dashboards/admin/fault_management/tables.py rename to starlingx_dashboard/dashboards/admin/fault_management/tables.py index 17c62866..7af6f667 100755 --- a/cgcs_dashboard/dashboards/admin/fault_management/tables.py +++ b/starlingx_dashboard/dashboards/admin/fault_management/tables.py @@ -18,9 +18,6 @@ # # Copyright (c) 2013-2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. from django.utils.html import escape as escape_html @@ -32,9 +29,10 @@ from django.utils.translation import ungettext_lazy from horizon import exceptions from horizon import tables +from starlingx_dashboard.horizon import tables as stx_tables from horizon.utils import filters as utils_filters from openstack_dashboard import api -from openstack_dashboard.api import sysinv +from starlingx_dashboard import api as stx_api SUPPRESSION_STATUS_CHOICES = ( ("suppressed", False), @@ -50,21 +48,21 @@ SUPPRESSION_STATUS_DISPLAY_CHOICES = ( ) -class AlarmsLimitAction(tables.LimitAction): +class AlarmsLimitAction(stx_tables.LimitAction): verbose_name = _("Alarms") -class AlarmFilterAction(tables.FixedWithQueryFilter): +class AlarmFilterAction(stx_tables.FixedWithQueryFilter): def __init__(self, **kwargs): super(AlarmFilterAction, self).__init__(**kwargs) self.filter_choices = [ ( - (sysinv.FM_SUPPRESS_SHOW, _("Show Suppressed"), True), - (sysinv.FM_SUPPRESS_HIDE, _('Hide Suppressed'), True) + (stx_api.sysinv.FM_SUPPRESS_SHOW, _("Show Suppressed"), True), + (stx_api.sysinv.FM_SUPPRESS_HIDE, _('Hide Suppressed'), True) ) ] - self.default_value = sysinv.FM_SUPPRESS_HIDE + self.default_value = stx_api.sysinv.FM_SUPPRESS_HIDE self.disabled_choices = ['enabled'] @@ -105,26 +103,26 @@ class AlarmsTable(tables.DataTable): hidden_title = False -class EventLogsLimitAction(tables.LimitAction): +class EventLogsLimitAction(stx_tables.LimitAction): verbose_name = _("Events") -class EventLogsFilterAction(tables.FixedWithQueryFilter): +class EventLogsFilterAction(stx_tables.FixedWithQueryFilter): def __init__(self, **kwargs): super(EventLogsFilterAction, self).__init__(**kwargs) self.filter_choices = [ ( - (sysinv.FM_ALL, _("All Events"), True), - (sysinv.FM_ALARM, _('Alarm Events'), True), - (sysinv.FM_LOG, _('Log Events'), True), + (stx_api.sysinv.FM_ALL, _("All Events"), True), + (stx_api.sysinv.FM_ALARM, _('Alarm Events'), True), + (stx_api.sysinv.FM_LOG, _('Log Events'), True), ), ( - (sysinv.FM_SUPPRESS_SHOW, _("Show Suppressed"), True), - (sysinv.FM_SUPPRESS_HIDE, _('Hide Suppressed'), True) + (stx_api.sysinv.FM_SUPPRESS_SHOW, _("Show Suppressed"), True), + (stx_api.sysinv.FM_SUPPRESS_HIDE, _('Hide Suppressed'), True) ) ] - self.default_value = sysinv.FM_ALL_SUPPRESS_HIDE + self.default_value = stx_api.sysinv.FM_ALL_SUPPRESS_HIDE self.disabled_choices = ['enabled', 'enabled'] @@ -190,16 +188,16 @@ class SuppressEvent(tables.BatchAction): def allowed(self, request, datum): """Allow suppress action if Alarm ID is unsuppressed.""" - if datum.suppression_status == sysinv.FM_SUPPRESSED: + if datum.suppression_status == stx_api.sysinv.FM_SUPPRESSED: return False return True def action(self, request, obj_id): - kwargs = {"suppression_status": sysinv.FM_SUPPRESSED} + kwargs = {"suppression_status": stx_api.sysinv.FM_SUPPRESSED} try: - api.sysinv.event_suppression_update(request, obj_id, **kwargs) + stx_api.sysinv.event_suppression_update(request, obj_id, **kwargs) except Exception: exceptions.handle(request, _('Unable to set specified alarm type to \ @@ -230,16 +228,16 @@ class UnsuppressEvent(tables.BatchAction): def allowed(self, request, datum): """Allow unsuppress action if Alarm ID is suppressed.""" - if datum.suppression_status == sysinv.FM_UNSUPPRESSED: + if datum.suppression_status == stx_api.sysinv.FM_UNSUPPRESSED: return False return True def action(self, request, obj_id): - kwargs = {"suppression_status": sysinv.FM_UNSUPPRESSED} + kwargs = {"suppression_status": stx_api.sysinv.FM_UNSUPPRESSED} try: - api.sysinv.event_suppression_update(request, obj_id, **kwargs) + stx_api.sysinv.event_suppression_update(request, obj_id, **kwargs) except Exception: exceptions.handle(request, _('Unable to set specified alarm type to \ diff --git a/cgcs_dashboard/dashboards/admin/fault_management/tabs.py b/starlingx_dashboard/dashboards/admin/fault_management/tabs.py similarity index 88% rename from cgcs_dashboard/dashboards/admin/fault_management/tabs.py rename to starlingx_dashboard/dashboards/admin/fault_management/tabs.py index 56d652de..6ae0d766 100755 --- a/cgcs_dashboard/dashboards/admin/fault_management/tabs.py +++ b/starlingx_dashboard/dashboards/admin/fault_management/tabs.py @@ -18,9 +18,6 @@ # # Copyright (c) 2013-2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. from django.utils.translation import ugettext_lazy as _ # noqa @@ -28,8 +25,8 @@ from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tabs from openstack_dashboard import api -from openstack_dashboard.api import sysinv -from openstack_dashboard.dashboards.admin.fault_management import tables +from starlingx_dashboard import api as stx_api +from starlingx_dashboard.dashboards.admin.fault_management import tables ALARMS_SUPPRESSION_FILTER_GROUP = 0 EVENT_SUPPRESSION_FILTER_GROUP = 1 @@ -61,7 +58,7 @@ class ActiveAlarmsTab(tabs.TableTab): def get_context_data(self, request): context = super(ActiveAlarmsTab, self).get_context_data(request) - summary = api.sysinv.alarm_summary_get( + summary = stx_api.sysinv.alarm_summary_get( self.request, include_suppress=False) context["total"] = summary.critical + summary.major + summary.minor \ + summary.warnings @@ -86,7 +83,7 @@ class ActiveAlarmsTab(tabs.TableTab): self.set_suppression_filter('disabled') alarms_table.columns["suppression_status"]\ .classes.append('hidden') - elif suppress_filter_state == sysinv.FM_SUPPRESS_HIDE: + elif suppress_filter_state == stx_api.sysinv.FM_SUPPRESS_HIDE: self.set_suppression_filter('enabled') alarms_table.columns["suppression_status"].classes\ .append('hidden') @@ -95,7 +92,7 @@ class ActiveAlarmsTab(tabs.TableTab): self.set_suppression_filter('disabled') else: self.set_suppression_filter('enabled') - if suppress_filter_state == sysinv.FM_SUPPRESS_SHOW: + if suppress_filter_state == stx_api.sysinv.FM_SUPPRESS_SHOW: alarms_table.columns["suppression_status"].classes\ .remove('hidden') @@ -117,18 +114,16 @@ class ActiveAlarmsTab(tabs.TableTab): def get_alarms_data(self): search_opts = {} - # get retrieve parameters from request/session env - marker = \ - self.request.GET.get(tables.AlarmsTable._meta.pagination_param, - None) - limit = \ - self.request.GET.get(tables.AlarmsTable._meta.limit_param, - None) + #marker = \ + # self.request.GET.get(tables.AlarmsTable._meta.pagination_param, + # None) + #limit = \ + # self.request.GET.get(tables.AlarmsTable._meta.limit_param, + # None) search_opts = self.get_filters() - search_opts.update({'marker': marker, - 'limit': limit, + search_opts.update({ 'paginate': True, 'sort_key': 'severity,entity_instance_id', 'sort_dir': 'asc'}) @@ -136,10 +131,10 @@ class ActiveAlarmsTab(tabs.TableTab): alarms = [] try: if 'paginate' in search_opts: - alarms, self._more = api.sysinv.alarm_list( + alarms, self._more = stx_api.sysinv.alarm_list( self.request, search_opts=search_opts) else: - alarms = api.sysinv.alarm_list( + alarms = stx_api.sysinv.alarm_list( self.request, search_opts=search_opts) self._limit = limit except Exception: @@ -155,7 +150,7 @@ class ActiveAlarmsTab(tabs.TableTab): try: if 'suppression_list' not in self.tab_group.kwargs: self.tab_group.kwargs['suppression_list'] = \ - api.sysinv.event_suppression_list(self.request) + stx_api.sysinv.event_suppression_list(self.request) event_types = self.tab_group.kwargs['suppression_list'] except Exception: exceptions.handle(self.request, @@ -212,7 +207,7 @@ class EventLogTab(tabs.TableTab): self.set_suppression_filter('disabled') event_log_table.columns["suppression_status"]\ .classes.append('hidden') - elif suppress_filter_state == sysinv.FM_SUPPRESS_HIDE: + elif suppress_filter_state == stx_api.sysinv.FM_SUPPRESS_HIDE: self.set_suppression_filter('enabled') event_log_table.columns["suppression_status"].\ classes.append('hidden') @@ -221,7 +216,7 @@ class EventLogTab(tabs.TableTab): self.set_suppression_filter('disabled') else: self.set_suppression_filter('enabled') - if suppress_filter_state == sysinv.FM_SUPPRESS_SHOW: + if suppress_filter_state == stx_api.sysinv.FM_SUPPRESS_SHOW: event_log_table.columns["suppression_status"]\ .classes.remove('hidden') @@ -258,7 +253,7 @@ class EventLogTab(tabs.TableTab): try: # now retrieve data from rest API events, self._more = \ - api.sysinv.event_log_list(self.request, + stx_api.sysinv.event_log_list(self.request, search_opts=search_opts) self._limit = limit return events @@ -278,7 +273,7 @@ class EventLogTab(tabs.TableTab): try: if 'suppression_list' not in self.tab_group.kwargs: self.tab_group.kwargs['suppression_list'] = \ - api.sysinv.event_suppression_list(self.request) + stx_api.sysinv.event_suppression_list(self.request) event_types = self.tab_group.kwargs['suppression_list'] except Exception: exceptions.handle(self.request, @@ -300,7 +295,7 @@ class EventsSuppressionTab(tabs.TableTab): try: if 'suppression_list' not in self.tab_group.kwargs: self.tab_group.kwargs['suppression_list'] = \ - api.sysinv.event_suppression_list(self.request) + stx_api.sysinv.event_suppression_list(self.request) event_suppression_list = self.tab_group.kwargs['suppression_list'] except Exception: exceptions.handle(self.request, diff --git a/cgcs_dashboard/dashboards/admin/fault_management/templates/fault_management/_active_alarms.html b/starlingx_dashboard/dashboards/admin/fault_management/templates/fault_management/_active_alarms.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/fault_management/templates/fault_management/_active_alarms.html rename to starlingx_dashboard/dashboards/admin/fault_management/templates/fault_management/_active_alarms.html diff --git a/cgcs_dashboard/dashboards/admin/fault_management/templates/fault_management/_detail_history.html b/starlingx_dashboard/dashboards/admin/fault_management/templates/fault_management/_detail_history.html similarity index 97% rename from cgcs_dashboard/dashboards/admin/fault_management/templates/fault_management/_detail_history.html rename to starlingx_dashboard/dashboards/admin/fault_management/templates/fault_management/_detail_history.html index 2a328fd6..65ee0861 100755 --- a/cgcs_dashboard/dashboards/admin/fault_management/templates/fault_management/_detail_history.html +++ b/starlingx_dashboard/dashboards/admin/fault_management/templates/fault_management/_detail_history.html @@ -1,58 +1,58 @@ -{% extends 'base.html' %} -{% load i18n breadcrumb_nav %} -{% block title %}{% trans "Historical Alarm Details" %}{% endblock %} - -{% block main %} -{% if history.event_log_id == '' or history.event_log_id == ' ' %} -

{{history.reason_text }}

-{% else %} -

{{history.state }} - {{history.event_log_id }} - {{history.reason_text }}

-{% endif %} - -
-
-
-

{% trans "Info" %}

-
-
-
{% trans "Alarm UUID" %}
-
{{ history.uuid }}
- {% if history.event_log_id != '' and history.event_log_id != ' ' %} -
{% trans "Alarm ID" %}
-
{{ history.event_log_id }}
- {% endif %} -
{% trans "Severity" %}
-
{{ history.severity }}
-
{% trans "Alarm State" %}
-
{{ history.state }}
-
{% trans "Alarm Type" %}
-
{{ history.event_log_type }}
-
{% trans "Timestamp" %}
-
{{ history.timestamp|parse_isotime }}
-
{% trans "Suppression" %}
-
{{ history.suppression }}
-
-
-
{% trans "Entity Instance ID" %}
-
{{ history.entity_instance_id }}
- {% if history.entity_type_id != '' and history.entity_type_id != ' ' %} -
{% trans "Entity Type ID" %}
-
{{ history.entity_type_id }}
- {% endif %} -
{% trans "Probable Cause" %}
-
{{ history.probable_cause }}
- {% if history.proposed_repair_action != '' and history.proposed_repair_action != ' ' %} -
{% trans "Proposed Repair Action" %}
-
{{ history.proposed_repair_action }}
- {% endif %} -
{% trans "Service Affecting" %}
-
{{ history.service_affecting }}
- {% if history.reason_text != '' and history.reason_text != ' ' %} -
{% trans "Reason" %}
-
{{ history.reason_text }}
- {% endif %} -
-
-
-
-{% endblock %} +{% extends 'base.html' %} +{% load i18n breadcrumb_nav %} +{% block title %}{% trans "Historical Alarm Details" %}{% endblock %} + +{% block main %} +{% if history.event_log_id == '' or history.event_log_id == ' ' %} +

{{history.reason_text }}

+{% else %} +

{{history.state }} - {{history.event_log_id }} - {{history.reason_text }}

+{% endif %} + +
+
+
+

{% trans "Info" %}

+
+
+
{% trans "Alarm UUID" %}
+
{{ history.uuid }}
+ {% if history.event_log_id != '' and history.event_log_id != ' ' %} +
{% trans "Alarm ID" %}
+
{{ history.event_log_id }}
+ {% endif %} +
{% trans "Severity" %}
+
{{ history.severity }}
+
{% trans "Alarm State" %}
+
{{ history.state }}
+
{% trans "Alarm Type" %}
+
{{ history.event_log_type }}
+
{% trans "Timestamp" %}
+
{{ history.timestamp|parse_isotime }}
+
{% trans "Suppression" %}
+
{{ history.suppression }}
+
+
+
{% trans "Entity Instance ID" %}
+
{{ history.entity_instance_id }}
+ {% if history.entity_type_id != '' and history.entity_type_id != ' ' %} +
{% trans "Entity Type ID" %}
+
{{ history.entity_type_id }}
+ {% endif %} +
{% trans "Probable Cause" %}
+
{{ history.probable_cause }}
+ {% if history.proposed_repair_action != '' and history.proposed_repair_action != ' ' %} +
{% trans "Proposed Repair Action" %}
+
{{ history.proposed_repair_action }}
+ {% endif %} +
{% trans "Service Affecting" %}
+
{{ history.service_affecting }}
+ {% if history.reason_text != '' and history.reason_text != ' ' %} +
{% trans "Reason" %}
+
{{ history.reason_text }}
+ {% endif %} +
+
+
+
+{% endblock %} diff --git a/cgcs_dashboard/dashboards/admin/fault_management/templates/fault_management/_detail_log.html b/starlingx_dashboard/dashboards/admin/fault_management/templates/fault_management/_detail_log.html similarity index 96% rename from cgcs_dashboard/dashboards/admin/fault_management/templates/fault_management/_detail_log.html rename to starlingx_dashboard/dashboards/admin/fault_management/templates/fault_management/_detail_log.html index 4ea38e19..19cfb0dc 100755 --- a/cgcs_dashboard/dashboards/admin/fault_management/templates/fault_management/_detail_log.html +++ b/starlingx_dashboard/dashboards/admin/fault_management/templates/fault_management/_detail_log.html @@ -1,50 +1,50 @@ -{% extends 'base.html' %} -{% load i18n breadcrumb_nav %} -{% block title %}{% trans "Customer Log Details" %}{% endblock %} - -{% block main %} -{% if log.event_log_id == '' or log.event_log_id == ' ' %} -

{{log.reason_text }}

-{% else %} -

{{log.event_log_id }} - {{log.reason_text }}

-{% endif %} - -
-
-
-

{% trans "Info" %}

-
-
-
{% trans "Log UUID" %}
-
{{ log.uuid }}
- {% if log.event_log_id != '' and log.event_log_id != ' ' %} -
{% trans "Log ID" %}
-
{{ log.event_log_id }}
- {% endif %} -
{% trans "Severity" %}
-
{{ log.severity }}
-
{% trans "Log Type" %}
-
{{ log.event_log_type }}
-
{% trans "Timestamp" %}
-
{{ log.timestamp|parse_isotime }}
-
-
-
{% trans "Entity Instance ID" %}
-
{{ log.entity_instance_id }}
- {% if log.entity_type_id != '' and log.entity_type_id != ' ' %} -
{% trans "Entity Type ID" %}
-
{{ log.entity_type_id }}
- {% endif %} -
{% trans "Probable Cause" %}
-
{{ log.probable_cause }}
-
{% trans "Service Affecting" %}
-
{{ log.service_affecting }}
- {% if log.reason_text != '' and log.reason_text != ' ' %} -
{% trans "Reason" %}
-
{{ log.reason_text }}
- {% endif %} -
-
-
-
-{% endblock %} +{% extends 'base.html' %} +{% load i18n breadcrumb_nav %} +{% block title %}{% trans "Customer Log Details" %}{% endblock %} + +{% block main %} +{% if log.event_log_id == '' or log.event_log_id == ' ' %} +

{{log.reason_text }}

+{% else %} +

{{log.event_log_id }} - {{log.reason_text }}

+{% endif %} + +
+
+
+

{% trans "Info" %}

+
+
+
{% trans "Log UUID" %}
+
{{ log.uuid }}
+ {% if log.event_log_id != '' and log.event_log_id != ' ' %} +
{% trans "Log ID" %}
+
{{ log.event_log_id }}
+ {% endif %} +
{% trans "Severity" %}
+
{{ log.severity }}
+
{% trans "Log Type" %}
+
{{ log.event_log_type }}
+
{% trans "Timestamp" %}
+
{{ log.timestamp|parse_isotime }}
+
+
+
{% trans "Entity Instance ID" %}
+
{{ log.entity_instance_id }}
+ {% if log.entity_type_id != '' and log.entity_type_id != ' ' %} +
{% trans "Entity Type ID" %}
+
{{ log.entity_type_id }}
+ {% endif %} +
{% trans "Probable Cause" %}
+
{{ log.probable_cause }}
+
{% trans "Service Affecting" %}
+
{{ log.service_affecting }}
+ {% if log.reason_text != '' and log.reason_text != ' ' %} +
{% trans "Reason" %}
+
{{ log.reason_text }}
+ {% endif %} +
+
+
+
+{% endblock %} diff --git a/cgcs_dashboard/dashboards/admin/fault_management/templates/fault_management/_detail_overview.html b/starlingx_dashboard/dashboards/admin/fault_management/templates/fault_management/_detail_overview.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/fault_management/templates/fault_management/_detail_overview.html rename to starlingx_dashboard/dashboards/admin/fault_management/templates/fault_management/_detail_overview.html diff --git a/cgcs_dashboard/dashboards/admin/fault_management/templates/fault_management/_summary.html b/starlingx_dashboard/dashboards/admin/fault_management/templates/fault_management/_summary.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/fault_management/templates/fault_management/_summary.html rename to starlingx_dashboard/dashboards/admin/fault_management/templates/fault_management/_summary.html diff --git a/cgcs_dashboard/dashboards/admin/fault_management/templates/fault_management/index.html b/starlingx_dashboard/dashboards/admin/fault_management/templates/fault_management/index.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/fault_management/templates/fault_management/index.html rename to starlingx_dashboard/dashboards/admin/fault_management/templates/fault_management/index.html diff --git a/cgcs_dashboard/dashboards/admin/fault_management/urls.py b/starlingx_dashboard/dashboards/admin/fault_management/urls.py similarity index 83% rename from cgcs_dashboard/dashboards/admin/fault_management/urls.py rename to starlingx_dashboard/dashboards/admin/fault_management/urls.py index d3d9f98e..76d8e1e9 100755 --- a/cgcs_dashboard/dashboards/admin/fault_management/urls.py +++ b/starlingx_dashboard/dashboards/admin/fault_management/urls.py @@ -18,14 +18,11 @@ # # Copyright (c) 2013-2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. from django.conf.urls import url # noqa -from openstack_dashboard.dashboards.admin.fault_management import views +from starlingx_dashboard.dashboards.admin.fault_management import views urlpatterns = [ url(r'^$', views.IndexView.as_view(), name='index'), diff --git a/cgcs_dashboard/dashboards/admin/fault_management/views.py b/starlingx_dashboard/dashboards/admin/fault_management/views.py similarity index 91% rename from cgcs_dashboard/dashboards/admin/fault_management/views.py rename to starlingx_dashboard/dashboards/admin/fault_management/views.py index d4219694..a0ba5d6e 100755 --- a/cgcs_dashboard/dashboards/admin/fault_management/views.py +++ b/starlingx_dashboard/dashboards/admin/fault_management/views.py @@ -18,9 +18,6 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. import logging @@ -32,8 +29,9 @@ from django.views.generic import TemplateView from horizon import exceptions from horizon import tabs from horizon import views -from openstack_dashboard import api -from openstack_dashboard.dashboards.admin.fault_management import \ +from openstack_dashboard.api.base import is_service_enabled +from starlingx_dashboard import api as stx_api +from starlingx_dashboard.dashboards.admin.fault_management import \ tabs as project_tabs LOG = logging.getLogger(__name__) @@ -58,7 +56,7 @@ class DetailView(views.HorizonTemplateView): if not hasattr(self, "_alarm"): alarm_uuid = self.kwargs['id'] try: - alarm = api.sysinv.alarm_get(self.request, alarm_uuid) + alarm = stx_api.sysinv.alarm_get(self.request, alarm_uuid) except Exception: redirect = reverse('horizon:admin:fault_management:index') @@ -120,7 +118,7 @@ class EventLogDetailView(views.HorizonTemplateView): if not hasattr(self, "_eventlog"): uuid = self.kwargs['id'] try: - self._eventlog = api.sysinv.event_log_get(self.request, uuid) + self._eventlog = stx_api.sysinv.event_log_get(self.request, uuid) self._detectEventLogType() except Exception: redirect = reverse('horizon:admin:fault_management:index') @@ -157,7 +155,7 @@ class BannerView(TemplateView): [s for s in summaries if s.status == 'critical']) context["disabled"] = len( [s for s in summaries if s.status == 'disabled']) - elif api.base.is_TiS_region(self.request): + elif is_service_enabled(self.request, 'platform'): context["summary"] = self.get_data() context["alarmbanner"] = True return context @@ -165,11 +163,11 @@ class BannerView(TemplateView): def get_data(self): summary = None try: - summary = api.sysinv.alarm_summary_get(self.request) + summary = stx_api.sysinv.alarm_summary_get(self.request) except Exception: exceptions.handle(self.request, _('Unable to retrieve alarm summary.')) return summary def get_subcloud_data(self): - return api.dc_manager.alarm_summary_list(self.request) + return stx_api.dc_manager.alarm_summary_list(self.request) diff --git a/cgcs_dashboard/dashboards/admin/host_topology/__init__.py b/starlingx_dashboard/dashboards/admin/host_topology/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/host_topology/__init__.py rename to starlingx_dashboard/dashboards/admin/host_topology/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/host_topology/panel.py b/starlingx_dashboard/dashboards/admin/host_topology/panel.py similarity index 70% rename from cgcs_dashboard/dashboards/admin/host_topology/panel.py rename to starlingx_dashboard/dashboards/admin/host_topology/panel.py index abfb43a7..8d32f98e 100755 --- a/cgcs_dashboard/dashboards/admin/host_topology/panel.py +++ b/starlingx_dashboard/dashboards/admin/host_topology/panel.py @@ -1,9 +1,7 @@ # # Copyright (c) 2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # @@ -17,15 +15,19 @@ from openstack_dashboard.dashboards.admin import dashboard class HostTopology(horizon.Panel): name = _("Provider Network Topology") slug = 'host_topology' - permissions = ('openstack.services.platform',) + permissions = ('openstack.services.platform', 'openstack.services.network') def allowed(self, context): + if context['request'].user.services_region == 'SystemController': + return False if not base.is_service_enabled(context['request'], 'platform'): return False else: return super(HostTopology, self).allowed(context) def nav(self, context): + if context['request'].user.services_region == 'SystemController': + return False if not base.is_service_enabled(context['request'], 'platform'): return False else: diff --git a/cgcs_dashboard/dashboards/admin/host_topology/tables.py b/starlingx_dashboard/dashboards/admin/host_topology/tables.py similarity index 86% rename from cgcs_dashboard/dashboards/admin/host_topology/tables.py rename to starlingx_dashboard/dashboards/admin/host_topology/tables.py index a8523008..e6a28c12 100755 --- a/cgcs_dashboard/dashboards/admin/host_topology/tables.py +++ b/starlingx_dashboard/dashboards/admin/host_topology/tables.py @@ -1,9 +1,7 @@ # # Copyright (c) 2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # import logging diff --git a/cgcs_dashboard/dashboards/admin/host_topology/tabs.py b/starlingx_dashboard/dashboards/admin/host_topology/tabs.py similarity index 96% rename from cgcs_dashboard/dashboards/admin/host_topology/tabs.py rename to starlingx_dashboard/dashboards/admin/host_topology/tabs.py index b7438e0a..9373a30f 100755 --- a/cgcs_dashboard/dashboards/admin/host_topology/tabs.py +++ b/starlingx_dashboard/dashboards/admin/host_topology/tabs.py @@ -1,8 +1,6 @@ # Copyright (c) 2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # diff --git a/cgcs_dashboard/dashboards/admin/host_topology/templates/host_topology/_svg_element.html b/starlingx_dashboard/dashboards/admin/host_topology/templates/host_topology/_svg_element.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/host_topology/templates/host_topology/_svg_element.html rename to starlingx_dashboard/dashboards/admin/host_topology/templates/host_topology/_svg_element.html diff --git a/cgcs_dashboard/dashboards/admin/host_topology/templates/host_topology/detail/_detail_alarms.html b/starlingx_dashboard/dashboards/admin/host_topology/templates/host_topology/detail/_detail_alarms.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/host_topology/templates/host_topology/detail/_detail_alarms.html rename to starlingx_dashboard/dashboards/admin/host_topology/templates/host_topology/detail/_detail_alarms.html diff --git a/cgcs_dashboard/dashboards/admin/host_topology/templates/host_topology/detail/providernet.html b/starlingx_dashboard/dashboards/admin/host_topology/templates/host_topology/detail/providernet.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/host_topology/templates/host_topology/detail/providernet.html rename to starlingx_dashboard/dashboards/admin/host_topology/templates/host_topology/detail/providernet.html diff --git a/cgcs_dashboard/dashboards/admin/host_topology/templates/host_topology/detail/tabbed_detail.html b/starlingx_dashboard/dashboards/admin/host_topology/templates/host_topology/detail/tabbed_detail.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/host_topology/templates/host_topology/detail/tabbed_detail.html rename to starlingx_dashboard/dashboards/admin/host_topology/templates/host_topology/detail/tabbed_detail.html diff --git a/cgcs_dashboard/dashboards/admin/host_topology/templates/host_topology/index.html b/starlingx_dashboard/dashboards/admin/host_topology/templates/host_topology/index.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/host_topology/templates/host_topology/index.html rename to starlingx_dashboard/dashboards/admin/host_topology/templates/host_topology/index.html diff --git a/cgcs_dashboard/dashboards/admin/host_topology/urls.py b/starlingx_dashboard/dashboards/admin/host_topology/urls.py similarity index 74% rename from cgcs_dashboard/dashboards/admin/host_topology/urls.py rename to starlingx_dashboard/dashboards/admin/host_topology/urls.py index abd05a54..250d6baa 100755 --- a/cgcs_dashboard/dashboards/admin/host_topology/urls.py +++ b/starlingx_dashboard/dashboards/admin/host_topology/urls.py @@ -1,9 +1,7 @@ # # Copyright (c) 2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # diff --git a/cgcs_dashboard/dashboards/admin/host_topology/views.py b/starlingx_dashboard/dashboards/admin/host_topology/views.py similarity index 97% rename from cgcs_dashboard/dashboards/admin/host_topology/views.py rename to starlingx_dashboard/dashboards/admin/host_topology/views.py index e5959cd4..04d8a80b 100755 --- a/cgcs_dashboard/dashboards/admin/host_topology/views.py +++ b/starlingx_dashboard/dashboards/admin/host_topology/views.py @@ -1,9 +1,7 @@ # # Copyright (c) 2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # diff --git a/cgcs_dashboard/dashboards/admin/inventory/__init__.py b/starlingx_dashboard/dashboards/admin/inventory/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/__init__.py rename to starlingx_dashboard/dashboards/admin/inventory/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/inventory/cpu_functions/__init__.py b/starlingx_dashboard/dashboards/admin/inventory/cpu_functions/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/cpu_functions/__init__.py rename to starlingx_dashboard/dashboards/admin/inventory/cpu_functions/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/inventory/cpu_functions/forms.py b/starlingx_dashboard/dashboards/admin/inventory/cpu_functions/forms.py similarity index 98% rename from cgcs_dashboard/dashboards/admin/inventory/cpu_functions/forms.py rename to starlingx_dashboard/dashboards/admin/inventory/cpu_functions/forms.py index 3b18aef1..ba215e5c 100644 --- a/cgcs_dashboard/dashboards/admin/inventory/cpu_functions/forms.py +++ b/starlingx_dashboard/dashboards/admin/inventory/cpu_functions/forms.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 diff --git a/cgcs_dashboard/dashboards/admin/inventory/cpu_functions/tables.py b/starlingx_dashboard/dashboards/admin/inventory/cpu_functions/tables.py similarity index 93% rename from cgcs_dashboard/dashboards/admin/inventory/cpu_functions/tables.py rename to starlingx_dashboard/dashboards/admin/inventory/cpu_functions/tables.py index 71b3deca..7f2d4e5d 100644 --- a/cgcs_dashboard/dashboards/admin/inventory/cpu_functions/tables.py +++ b/starlingx_dashboard/dashboards/admin/inventory/cpu_functions/tables.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # import logging diff --git a/cgcs_dashboard/dashboards/admin/inventory/cpu_functions/utils.py b/starlingx_dashboard/dashboards/admin/inventory/cpu_functions/utils.py similarity index 97% rename from cgcs_dashboard/dashboards/admin/inventory/cpu_functions/utils.py rename to starlingx_dashboard/dashboards/admin/inventory/cpu_functions/utils.py index 40625432..510e8e73 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/cpu_functions/utils.py +++ b/starlingx_dashboard/dashboards/admin/inventory/cpu_functions/utils.py @@ -1,9 +1,8 @@ # # Copyright (c) 2013-2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 +# from django.utils.translation import ugettext_lazy as _ diff --git a/cgcs_dashboard/dashboards/admin/inventory/cpu_functions/views.py b/starlingx_dashboard/dashboards/admin/inventory/cpu_functions/views.py similarity index 97% rename from cgcs_dashboard/dashboards/admin/inventory/cpu_functions/views.py rename to starlingx_dashboard/dashboards/admin/inventory/cpu_functions/views.py index ead04e6a..4bcad4c9 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/cpu_functions/views.py +++ b/starlingx_dashboard/dashboards/admin/inventory/cpu_functions/views.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 diff --git a/cgcs_dashboard/dashboards/admin/inventory/devices/__init__.py b/starlingx_dashboard/dashboards/admin/inventory/devices/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/devices/__init__.py rename to starlingx_dashboard/dashboards/admin/inventory/devices/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/inventory/devices/forms.py b/starlingx_dashboard/dashboards/admin/inventory/devices/forms.py similarity index 93% rename from cgcs_dashboard/dashboards/admin/inventory/devices/forms.py rename to starlingx_dashboard/dashboards/admin/inventory/devices/forms.py index a2da6267..bd723a87 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/devices/forms.py +++ b/starlingx_dashboard/dashboards/admin/inventory/devices/forms.py @@ -1,9 +1,7 @@ # # Copyright (c) 2014-2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 diff --git a/cgcs_dashboard/dashboards/admin/inventory/devices/tables.py b/starlingx_dashboard/dashboards/admin/inventory/devices/tables.py similarity index 96% rename from cgcs_dashboard/dashboards/admin/inventory/devices/tables.py rename to starlingx_dashboard/dashboards/admin/inventory/devices/tables.py index 173ca30b..58698640 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/devices/tables.py +++ b/starlingx_dashboard/dashboards/admin/inventory/devices/tables.py @@ -1,9 +1,7 @@ # # Copyright (c) 2014-2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 diff --git a/cgcs_dashboard/dashboards/admin/inventory/devices/views.py b/starlingx_dashboard/dashboards/admin/inventory/devices/views.py similarity index 97% rename from cgcs_dashboard/dashboards/admin/inventory/devices/views.py rename to starlingx_dashboard/dashboards/admin/inventory/devices/views.py index b0aa45ca..022be791 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/devices/views.py +++ b/starlingx_dashboard/dashboards/admin/inventory/devices/views.py @@ -1,9 +1,7 @@ # # Copyright (c) 2014-2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 diff --git a/cgcs_dashboard/dashboards/admin/inventory/interfaces/__init__.py b/starlingx_dashboard/dashboards/admin/inventory/interfaces/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/interfaces/__init__.py rename to starlingx_dashboard/dashboards/admin/inventory/interfaces/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/inventory/interfaces/address/__init__.py b/starlingx_dashboard/dashboards/admin/inventory/interfaces/address/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/interfaces/address/__init__.py rename to starlingx_dashboard/dashboards/admin/inventory/interfaces/address/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/inventory/interfaces/address/forms.py b/starlingx_dashboard/dashboards/admin/inventory/interfaces/address/forms.py similarity index 93% rename from cgcs_dashboard/dashboards/admin/inventory/interfaces/address/forms.py rename to starlingx_dashboard/dashboards/admin/inventory/interfaces/address/forms.py index 690ecee3..8de0d0d6 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/interfaces/address/forms.py +++ b/starlingx_dashboard/dashboards/admin/inventory/interfaces/address/forms.py @@ -14,10 +14,6 @@ # # Copyright (c) 2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# import logging diff --git a/cgcs_dashboard/dashboards/admin/inventory/interfaces/address/tables.py b/starlingx_dashboard/dashboards/admin/inventory/interfaces/address/tables.py similarity index 92% rename from cgcs_dashboard/dashboards/admin/inventory/interfaces/address/tables.py rename to starlingx_dashboard/dashboards/admin/inventory/interfaces/address/tables.py index 0c8d2df2..973bc24d 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/interfaces/address/tables.py +++ b/starlingx_dashboard/dashboards/admin/inventory/interfaces/address/tables.py @@ -1,4 +1,4 @@ -# Copyright 2015 Wind River Systems, Inc +# Copyright 2015-2018 Wind River Systems, 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 @@ -71,14 +71,16 @@ class CreateAddress(tables.LinkAction): def allowed(self, request, datum=None): interface = self.table.get_interface() - supported = interface.networktype.split(',') if not interface: return False - if any(t in supported for t in ALLOWED_INTERFACE_TYPES): + + if interface.networktype: + supported = interface.networktype.split(',') + if any(t in supported for t in ALLOWED_INTERFACE_TYPES): + return True + if getattr(interface, 'ipv4_mode', '') == 'static': return True - if interface.ipv4_mode in ['static']: - return True - if interface.ipv6_mode in ['static']: + if getattr(interface, 'ipv6_mode', '') == 'static': return True return False diff --git a/cgcs_dashboard/dashboards/admin/inventory/interfaces/address/views.py b/starlingx_dashboard/dashboards/admin/inventory/interfaces/address/views.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/interfaces/address/views.py rename to starlingx_dashboard/dashboards/admin/inventory/interfaces/address/views.py diff --git a/cgcs_dashboard/dashboards/admin/inventory/interfaces/forms.py b/starlingx_dashboard/dashboards/admin/inventory/interfaces/forms.py similarity index 99% rename from cgcs_dashboard/dashboards/admin/inventory/interfaces/forms.py rename to starlingx_dashboard/dashboards/admin/inventory/interfaces/forms.py index 525832da..4dbca9d1 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/interfaces/forms.py +++ b/starlingx_dashboard/dashboards/admin/inventory/interfaces/forms.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 diff --git a/cgcs_dashboard/dashboards/admin/inventory/interfaces/route/__init__.py b/starlingx_dashboard/dashboards/admin/inventory/interfaces/route/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/interfaces/route/__init__.py rename to starlingx_dashboard/dashboards/admin/inventory/interfaces/route/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/inventory/interfaces/route/forms.py b/starlingx_dashboard/dashboards/admin/inventory/interfaces/route/forms.py similarity index 94% rename from cgcs_dashboard/dashboards/admin/inventory/interfaces/route/forms.py rename to starlingx_dashboard/dashboards/admin/inventory/interfaces/route/forms.py index 175cab8c..f251e2ad 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/interfaces/route/forms.py +++ b/starlingx_dashboard/dashboards/admin/inventory/interfaces/route/forms.py @@ -14,10 +14,6 @@ # # Copyright (c) 2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# import logging diff --git a/cgcs_dashboard/dashboards/admin/inventory/interfaces/route/tables.py b/starlingx_dashboard/dashboards/admin/inventory/interfaces/route/tables.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/interfaces/route/tables.py rename to starlingx_dashboard/dashboards/admin/inventory/interfaces/route/tables.py diff --git a/cgcs_dashboard/dashboards/admin/inventory/interfaces/route/views.py b/starlingx_dashboard/dashboards/admin/inventory/interfaces/route/views.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/interfaces/route/views.py rename to starlingx_dashboard/dashboards/admin/inventory/interfaces/route/views.py diff --git a/cgcs_dashboard/dashboards/admin/inventory/interfaces/tables.py b/starlingx_dashboard/dashboards/admin/inventory/interfaces/tables.py similarity index 96% rename from cgcs_dashboard/dashboards/admin/inventory/interfaces/tables.py rename to starlingx_dashboard/dashboards/admin/inventory/interfaces/tables.py index b774966e..e6d89141 100644 --- a/cgcs_dashboard/dashboards/admin/inventory/interfaces/tables.py +++ b/starlingx_dashboard/dashboards/admin/inventory/interfaces/tables.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # import logging @@ -130,7 +128,7 @@ def get_attributes(interface): attrs.remove(a) attr_str = ",".join(attrs) - if 'False' in interface.dpdksupport: + if False in interface.dpdksupport: attr_str = "%s, accelerated=%s" % (attr_str, 'False') else: attr_str = "%s, accelerated=%s" % (attr_str, 'True') diff --git a/cgcs_dashboard/dashboards/admin/inventory/interfaces/tabs.py b/starlingx_dashboard/dashboards/admin/inventory/interfaces/tabs.py similarity index 86% rename from cgcs_dashboard/dashboards/admin/inventory/interfaces/tabs.py rename to starlingx_dashboard/dashboards/admin/inventory/interfaces/tabs.py index 30b12d3e..c263a3d5 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/interfaces/tabs.py +++ b/starlingx_dashboard/dashboards/admin/inventory/interfaces/tabs.py @@ -16,10 +16,6 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# from django.utils.translation import ugettext_lazy as _ # noqa diff --git a/cgcs_dashboard/dashboards/admin/inventory/interfaces/views.py b/starlingx_dashboard/dashboards/admin/inventory/interfaces/views.py similarity index 98% rename from cgcs_dashboard/dashboards/admin/inventory/interfaces/views.py rename to starlingx_dashboard/dashboards/admin/inventory/interfaces/views.py index b4aeb6df..17a3c1ad 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/interfaces/views.py +++ b/starlingx_dashboard/dashboards/admin/inventory/interfaces/views.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 diff --git a/cgcs_dashboard/dashboards/admin/inventory/lldp/__init__.py b/starlingx_dashboard/dashboards/admin/inventory/lldp/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/lldp/__init__.py rename to starlingx_dashboard/dashboards/admin/inventory/lldp/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/inventory/lldp/tables.py b/starlingx_dashboard/dashboards/admin/inventory/lldp/tables.py similarity index 88% rename from cgcs_dashboard/dashboards/admin/inventory/lldp/tables.py rename to starlingx_dashboard/dashboards/admin/inventory/lldp/tables.py index d1e89343..11a5c3d1 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/lldp/tables.py +++ b/starlingx_dashboard/dashboards/admin/inventory/lldp/tables.py @@ -1,9 +1,7 @@ # # Copyright (c) 2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # import logging diff --git a/cgcs_dashboard/dashboards/admin/inventory/lldp/views.py b/starlingx_dashboard/dashboards/admin/inventory/lldp/views.py similarity index 95% rename from cgcs_dashboard/dashboards/admin/inventory/lldp/views.py rename to starlingx_dashboard/dashboards/admin/inventory/lldp/views.py index 7c4fb6b2..6476cf45 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/lldp/views.py +++ b/starlingx_dashboard/dashboards/admin/inventory/lldp/views.py @@ -1,9 +1,7 @@ # # Copyright (c) 2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 diff --git a/cgcs_dashboard/dashboards/admin/inventory/memorys/__init__.py b/starlingx_dashboard/dashboards/admin/inventory/memorys/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/memorys/__init__.py rename to starlingx_dashboard/dashboards/admin/inventory/memorys/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/inventory/memorys/forms.py b/starlingx_dashboard/dashboards/admin/inventory/memorys/forms.py similarity index 98% rename from cgcs_dashboard/dashboards/admin/inventory/memorys/forms.py rename to starlingx_dashboard/dashboards/admin/inventory/memorys/forms.py index d1cb81d7..f89a24ce 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/memorys/forms.py +++ b/starlingx_dashboard/dashboards/admin/inventory/memorys/forms.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 diff --git a/cgcs_dashboard/dashboards/admin/inventory/memorys/tables.py b/starlingx_dashboard/dashboards/admin/inventory/memorys/tables.py similarity index 83% rename from cgcs_dashboard/dashboards/admin/inventory/memorys/tables.py rename to starlingx_dashboard/dashboards/admin/inventory/memorys/tables.py index 02035a1e..b8ee31af 100644 --- a/cgcs_dashboard/dashboards/admin/inventory/memorys/tables.py +++ b/starlingx_dashboard/dashboards/admin/inventory/memorys/tables.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # import logging @@ -64,12 +62,6 @@ def get_processor_memory(memory): return template.loader.render_to_string(template_name, context) -def get_vswitch_hugepages(memory): - template_name = 'admin/inventory/memorys/_vswitchfunction_hugepages.html' - context = {"memory": memory} - return template.loader.render_to_string(template_name, context) - - def get_vm_hugepages(memory): template_name = 'admin/inventory/memorys/_vmfunction_hugepages.html' context = {"memory": memory} @@ -83,9 +75,6 @@ class MemorysTable(tables.DataTable): memory = tables.Column(get_processor_memory, verbose_name=_('Memory')) - vswitch_huge = tables.Column(get_vswitch_hugepages, - verbose_name=_('VSwitch Huge Pages')) - vm_huge = tables.Column(get_vm_hugepages, verbose_name=_('VM Pages')) diff --git a/cgcs_dashboard/dashboards/admin/inventory/memorys/views.py b/starlingx_dashboard/dashboards/admin/inventory/memorys/views.py similarity index 95% rename from cgcs_dashboard/dashboards/admin/inventory/memorys/views.py rename to starlingx_dashboard/dashboards/admin/inventory/memorys/views.py index 370769a0..3039e477 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/memorys/views.py +++ b/starlingx_dashboard/dashboards/admin/inventory/memorys/views.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 diff --git a/cgcs_dashboard/dashboards/admin/inventory/panel.py b/starlingx_dashboard/dashboards/admin/inventory/panel.py similarity index 78% rename from cgcs_dashboard/dashboards/admin/inventory/panel.py rename to starlingx_dashboard/dashboards/admin/inventory/panel.py index dd3dc371..c65ecc13 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/panel.py +++ b/starlingx_dashboard/dashboards/admin/inventory/panel.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 @@ -22,12 +20,16 @@ class Inventory(horizon.Panel): permissions = ('openstack.services.platform',) def allowed(self, context): + if context['request'].user.services_region == 'SystemController': + return False if not base.is_service_enabled(context['request'], 'platform'): return False else: return super(Inventory, self).allowed(context) def nav(self, context): + if context['request'].user.services_region == 'SystemController': + return False if not base.is_service_enabled(context['request'], 'platform'): return False else: diff --git a/cgcs_dashboard/dashboards/admin/inventory/ports/__init__.py b/starlingx_dashboard/dashboards/admin/inventory/ports/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/ports/__init__.py rename to starlingx_dashboard/dashboards/admin/inventory/ports/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/inventory/ports/forms.py b/starlingx_dashboard/dashboards/admin/inventory/ports/forms.py similarity index 95% rename from cgcs_dashboard/dashboards/admin/inventory/ports/forms.py rename to starlingx_dashboard/dashboards/admin/inventory/ports/forms.py index 70284230..69292502 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/ports/forms.py +++ b/starlingx_dashboard/dashboards/admin/inventory/ports/forms.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 diff --git a/cgcs_dashboard/dashboards/admin/inventory/ports/tables.py b/starlingx_dashboard/dashboards/admin/inventory/ports/tables.py similarity index 93% rename from cgcs_dashboard/dashboards/admin/inventory/ports/tables.py rename to starlingx_dashboard/dashboards/admin/inventory/ports/tables.py index 99a72af8..fce3b940 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/ports/tables.py +++ b/starlingx_dashboard/dashboards/admin/inventory/ports/tables.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # import logging diff --git a/cgcs_dashboard/dashboards/admin/inventory/ports/tabs.py b/starlingx_dashboard/dashboards/admin/inventory/ports/tabs.py similarity index 85% rename from cgcs_dashboard/dashboards/admin/inventory/ports/tabs.py rename to starlingx_dashboard/dashboards/admin/inventory/ports/tabs.py index 8b0e4654..03d87444 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/ports/tabs.py +++ b/starlingx_dashboard/dashboards/admin/inventory/ports/tabs.py @@ -16,10 +16,6 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# from django.utils.translation import ugettext_lazy as _ # noqa diff --git a/cgcs_dashboard/dashboards/admin/inventory/ports/views.py b/starlingx_dashboard/dashboards/admin/inventory/ports/views.py similarity index 96% rename from cgcs_dashboard/dashboards/admin/inventory/ports/views.py rename to starlingx_dashboard/dashboards/admin/inventory/ports/views.py index 76941a63..2ea01b95 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/ports/views.py +++ b/starlingx_dashboard/dashboards/admin/inventory/ports/views.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 diff --git a/cgcs_dashboard/dashboards/admin/inventory/sensors/__init__.py b/starlingx_dashboard/dashboards/admin/inventory/sensors/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/sensors/__init__.py rename to starlingx_dashboard/dashboards/admin/inventory/sensors/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/inventory/sensors/forms.py b/starlingx_dashboard/dashboards/admin/inventory/sensors/forms.py similarity index 97% rename from cgcs_dashboard/dashboards/admin/inventory/sensors/forms.py rename to starlingx_dashboard/dashboards/admin/inventory/sensors/forms.py index f6782b08..7eeb6b60 100644 --- a/cgcs_dashboard/dashboards/admin/inventory/sensors/forms.py +++ b/starlingx_dashboard/dashboards/admin/inventory/sensors/forms.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 diff --git a/cgcs_dashboard/dashboards/admin/inventory/sensors/tables.py b/starlingx_dashboard/dashboards/admin/inventory/sensors/tables.py similarity index 98% rename from cgcs_dashboard/dashboards/admin/inventory/sensors/tables.py rename to starlingx_dashboard/dashboards/admin/inventory/sensors/tables.py index 5b02af27..0960b51e 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/sensors/tables.py +++ b/starlingx_dashboard/dashboards/admin/inventory/sensors/tables.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # import logging diff --git a/cgcs_dashboard/dashboards/admin/inventory/sensors/views.py b/starlingx_dashboard/dashboards/admin/inventory/sensors/views.py similarity index 97% rename from cgcs_dashboard/dashboards/admin/inventory/sensors/views.py rename to starlingx_dashboard/dashboards/admin/inventory/sensors/views.py index 506c3287..dec8a7f9 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/sensors/views.py +++ b/starlingx_dashboard/dashboards/admin/inventory/sensors/views.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 diff --git a/cgcs_dashboard/dashboards/admin/inventory/storages/__init__.py b/starlingx_dashboard/dashboards/admin/inventory/storages/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/storages/__init__.py rename to starlingx_dashboard/dashboards/admin/inventory/storages/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/inventory/storages/forms.py b/starlingx_dashboard/dashboards/admin/inventory/storages/forms.py similarity index 94% rename from cgcs_dashboard/dashboards/admin/inventory/storages/forms.py rename to starlingx_dashboard/dashboards/admin/inventory/storages/forms.py index 6c6657d1..a57a50bc 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/storages/forms.py +++ b/starlingx_dashboard/dashboards/admin/inventory/storages/forms.py @@ -1,9 +1,7 @@ # -# Copyright (c) 2013-2014, 2017 Wind River Systems, Inc. +# Copyright (c) 2013-2018 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 @@ -183,6 +181,10 @@ class AddStorageVolume(forms.SelfHandlingForm): initial='idisk_uuid', widget=forms.widgets.HiddenInput) + tier_uuid = forms.CharField(label=_("tier_uuid"), + initial='tier_uuid', + widget=forms.widgets.HiddenInput) + hostname = forms.CharField(label=_("Hostname"), initial='hostname', widget=forms.TextInput(attrs={ @@ -200,7 +202,7 @@ class AddStorageVolume(forms.SelfHandlingForm): widget=forms.Select(attrs={ 'class': 'switchable', 'data-slug': 'disk'}), - help_text=_("Assign disk to storage volume.")) + help_text=_("Assign disk to a storage volume.")) journal_locations = forms.ChoiceField(label=_("Journal"), required=False, @@ -209,8 +211,9 @@ class AddStorageVolume(forms.SelfHandlingForm): 'data-switch-on': 'function', 'data-function-osd': _( "Journal")}), - help_text=_("Assign disk to journal " - "storage volume.")) + help_text=_("Assign disk to a " + "journal storage " + "volume.")) journal_size_mib = forms.CharField(label=_("Journal Size MiB"), required=False, @@ -223,6 +226,15 @@ class AddStorageVolume(forms.SelfHandlingForm): help_text=_("Journal's size for the" "current OSD.")) + tiers = forms.ChoiceField(label=_("Storage Tier"), + required=False, + widget=forms.Select(attrs={ + 'class': 'switched', + 'data-switch-on': 'function', + 'data-function-osd': + _("Storage Tier")}), + help_text=_("Assign OSD to a storage tier.")) + failure_url = 'horizon:admin:inventory:detail' def __init__(self, *args, **kwargs): @@ -260,6 +272,15 @@ class AddStorageVolume(forms.SelfHandlingForm): disk_model, d.device_type))) + # Get the cluster + cluster_list = api.sysinv.cluster_list(self.request) + cluster_uuid = cluster_list[0].uuid + + # Populate the available tiers for OSD assignment + avail_tier_list = api.sysinv.storage_tier_list(self.request, + cluster_uuid) + tier_tuple_list = [(t.uuid, t.name) for t in avail_tier_list] + # Populate available journal choices. If no journal is available, # then the journal is collocated. if ceph_caching: @@ -285,6 +306,7 @@ class AddStorageVolume(forms.SelfHandlingForm): self.fields['disks'].choices = disk_tuple_list self.fields['journal_locations'].choices = journal_tuple_list + self.fields['tiers'].choices = tier_tuple_list def clean(self): cleaned_data = super(AddStorageVolume, self).clean() @@ -299,10 +321,14 @@ class AddStorageVolume(forms.SelfHandlingForm): host_id = data['host_id'] # host_uuid = data['ihost_uuid'] disks = data['disks'][:] # copy + tiers = data['tiers'][:] # copy # GUI only allows one disk to be picked data['idisk_uuid'] = disks + # GUI only allows one tier to be picked + data['tier_uuid'] = tiers + # Obtain journal information. journal = data['journal_locations'][:] @@ -315,6 +341,7 @@ class AddStorageVolume(forms.SelfHandlingForm): try: del data['host_id'] del data['disks'] + del data['tiers'] del data['hostname'] del data['journal_locations'] @@ -539,9 +566,16 @@ class AddPhysicalVolume(forms.SelfHandlingForm): partitions_tuple_list = [] ilvg_tuple_list = [] + pv_cinder_volumes = next( + (pv for pv in ipv_list + if pv.lvm_vg_name == api.sysinv.LVG_CINDER_VOLUMES), None) + for lvg in ilvg_list: if (lvg.lvm_vg_name in compatible_lvgs and lvg.vg_state in [api.sysinv.LVG_ADD, api.sysinv.LVG_PROV]): + if (lvg.lvm_vg_name == api.sysinv.LVG_CINDER_VOLUMES and + pv_cinder_volumes): + continue ilvg_tuple_list.append((lvg.uuid, lvg.lvm_vg_name)) for disk in avail_disk_list: diff --git a/cgcs_dashboard/dashboards/admin/inventory/storages/lvg_params/__init__.py b/starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/storages/lvg_params/__init__.py rename to starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/inventory/storages/lvg_params/forms.py b/starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/forms.py similarity index 98% rename from cgcs_dashboard/dashboards/admin/inventory/storages/lvg_params/forms.py rename to starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/forms.py index a7940537..951cd679 100644 --- a/cgcs_dashboard/dashboards/admin/inventory/storages/lvg_params/forms.py +++ b/starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/forms.py @@ -2,9 +2,7 @@ # Copyright (c) 2015-2017 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # import logging diff --git a/cgcs_dashboard/dashboards/admin/inventory/storages/lvg_params/tables.py b/starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/tables.py similarity index 91% rename from cgcs_dashboard/dashboards/admin/inventory/storages/lvg_params/tables.py rename to starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/tables.py index 1a5c36cf..12b15ca0 100644 --- a/cgcs_dashboard/dashboards/admin/inventory/storages/lvg_params/tables.py +++ b/starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/tables.py @@ -2,9 +2,7 @@ # Copyright (c) 2015-2017 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # from django.core.urlresolvers import reverse # noqa diff --git a/cgcs_dashboard/dashboards/admin/inventory/storages/lvg_params/urls.py b/starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/urls.py similarity index 65% rename from cgcs_dashboard/dashboards/admin/inventory/storages/lvg_params/urls.py rename to starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/urls.py index c7d4a27d..b1d8675a 100644 --- a/cgcs_dashboard/dashboards/admin/inventory/storages/lvg_params/urls.py +++ b/starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/urls.py @@ -2,9 +2,7 @@ # Copyright (c) 2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # from django.conf.urls import url # noqa diff --git a/cgcs_dashboard/dashboards/admin/inventory/storages/lvg_params/views.py b/starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/views.py similarity index 90% rename from cgcs_dashboard/dashboards/admin/inventory/storages/lvg_params/views.py rename to starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/views.py index 3928c330..3d3224f6 100644 --- a/cgcs_dashboard/dashboards/admin/inventory/storages/lvg_params/views.py +++ b/starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/views.py @@ -2,9 +2,7 @@ # Copyright (c) 2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # import logging diff --git a/cgcs_dashboard/dashboards/admin/inventory/storages/tables.py b/starlingx_dashboard/dashboards/admin/inventory/storages/tables.py similarity index 92% rename from cgcs_dashboard/dashboards/admin/inventory/storages/tables.py rename to starlingx_dashboard/dashboards/admin/inventory/storages/tables.py index 59a6768c..279a2d16 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/storages/tables.py +++ b/starlingx_dashboard/dashboards/admin/inventory/storages/tables.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2015, 2017 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # import logging @@ -176,15 +174,26 @@ class EditPartition(tables.LinkAction): PARTITION_STATUS_MSG = api.sysinv.PARTITION_STATUS_MSG if partition: + pv = None + if partition.type_guid != api.sysinv.USER_PARTITION_PHYS_VOL: return False + if partition.ipv_uuid: + pv = api.sysinv.host_pv_get( + request, partition.ipv_uuid) + if pv.lvm_vg_name == api.sysinv.LVG_CINDER_VOLUMES: + if (host.personality == "Controller-Active" and + host._administrative == 'unlocked'): + return False + else: + return False + if (partition.status == PARTITION_STATUS_MSG[PARTITION_IN_USE_STATUS]): - return False - - if partition.ipv_uuid: - return False + if not (pv and + pv.lvm_vg_name == api.sysinv.LVG_CINDER_VOLUMES): + return False # Get all the partitions from the same disk. disk_partitions = \ @@ -421,14 +430,18 @@ class RemoveLocalVolumeGroup(tables.DeleteAction): def allowed(self, request, lvg=None): host = self.table.kwargs['host'] - return ((((host._administrative == 'locked') or - (('compute' in host._subfunctions) and - (host.compute_config_required is True))) and - (lvg.lvm_vg_name == api.sysinv.LVG_NOVA_LOCAL)) or - ((api.sysinv.CINDER_BACKEND_LVM in - api.sysinv.get_cinder_backend(request)) and - (lvg.lvm_vg_name == api.sysinv.LVG_CINDER_VOLUMES) and - (api.sysinv.LVG_ADD in lvg.vg_state))) + cinder_backend = api.sysinv.get_cinder_backend(request) + + if lvg.lvm_vg_name == api.sysinv.LVG_NOVA_LOCAL: + return ((host._administrative == 'locked') + or + (('compute' in host._subfunctions) and + (host.compute_config_required is True))) + elif lvg.lvm_vg_name == api.sysinv.LVG_CINDER_VOLUMES: + return (api.sysinv.CINDER_BACKEND_LVM not in cinder_backend and + api.sysinv.LVG_ADD in lvg.vg_state) + + return False def delete(self, request, lvg_id): host_id = self.table.kwargs['host_id'] @@ -539,14 +552,18 @@ class RemovePhysicalVolume(tables.DeleteAction): def allowed(self, request, pv=None): host = self.table.kwargs['host'] - return ((((host._administrative == 'locked') or - (('compute' in host._subfunctions) and - (host.compute_config_required is True))) and - (pv.lvm_vg_name == api.sysinv.LVG_NOVA_LOCAL)) or - ((api.sysinv.CINDER_BACKEND_LVM in - api.sysinv.get_cinder_backend(request)) and - ((pv.lvm_vg_name == api.sysinv.LVG_CINDER_VOLUMES) and - (api.sysinv.PV_ADD in pv.pv_state)))) + cinder_backend = api.sysinv.get_cinder_backend(request) + + if pv.lvm_vg_name == api.sysinv.LVG_NOVA_LOCAL: + return ((host._administrative == 'locked') + or + (('compute' in host._subfunctions) and + (host.compute_config_required is True))) + elif pv.lvm_vg_name == api.sysinv.LVG_CINDER_VOLUMES: + return (api.sysinv.CINDER_BACKEND_LVM not in cinder_backend and + api.sysinv.PV_ADD in pv.pv_state) + + return False def delete(self, request, pv_id): host_id = self.table.kwargs['host_id'] diff --git a/cgcs_dashboard/dashboards/admin/inventory/storages/tabs.py b/starlingx_dashboard/dashboards/admin/inventory/storages/tabs.py similarity index 91% rename from cgcs_dashboard/dashboards/admin/inventory/storages/tabs.py rename to starlingx_dashboard/dashboards/admin/inventory/storages/tabs.py index 52d95020..299e2bf3 100644 --- a/cgcs_dashboard/dashboards/admin/inventory/storages/tabs.py +++ b/starlingx_dashboard/dashboards/admin/inventory/storages/tabs.py @@ -2,9 +2,7 @@ # Copyright (c) 2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # import logging diff --git a/cgcs_dashboard/dashboards/admin/inventory/storages/urls.py b/starlingx_dashboard/dashboards/admin/inventory/storages/urls.py similarity index 68% rename from cgcs_dashboard/dashboards/admin/inventory/storages/urls.py rename to starlingx_dashboard/dashboards/admin/inventory/storages/urls.py index aab3c1d7..14970fe0 100644 --- a/cgcs_dashboard/dashboards/admin/inventory/storages/urls.py +++ b/starlingx_dashboard/dashboards/admin/inventory/storages/urls.py @@ -2,9 +2,7 @@ # Copyright (c) 2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # from django.conf.urls import include # noqa diff --git a/cgcs_dashboard/dashboards/admin/inventory/storages/views.py b/starlingx_dashboard/dashboards/admin/inventory/storages/views.py similarity index 98% rename from cgcs_dashboard/dashboards/admin/inventory/storages/views.py rename to starlingx_dashboard/dashboards/admin/inventory/storages/views.py index d74fd135..032ceb31 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/storages/views.py +++ b/starlingx_dashboard/dashboards/admin/inventory/storages/views.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2015, 2017 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 @@ -168,6 +166,7 @@ class AddDiskProfileView(forms.ModalFormView): if count > 1: setattr(s, "count", journals[s.journal_location]) + setattr(s, "tier_name", s.tier_name) s.disks = [d.device_path for d in all_disks if diff --git a/cgcs_dashboard/dashboards/admin/inventory/tables.py b/starlingx_dashboard/dashboards/admin/inventory/tables.py similarity index 99% rename from cgcs_dashboard/dashboards/admin/inventory/tables.py rename to starlingx_dashboard/dashboards/admin/inventory/tables.py index 29e2eda7..34e42a2a 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/tables.py +++ b/starlingx_dashboard/dashboards/admin/inventory/tables.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2017 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # import logging diff --git a/cgcs_dashboard/dashboards/admin/inventory/tabs.py b/starlingx_dashboard/dashboards/admin/inventory/tabs.py similarity index 99% rename from cgcs_dashboard/dashboards/admin/inventory/tabs.py rename to starlingx_dashboard/dashboards/admin/inventory/tabs.py index 2b1759bc..f72a9dc1 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/tabs.py +++ b/starlingx_dashboard/dashboards/admin/inventory/tabs.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2017 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_cpuprofiles.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_cpuprofiles.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_cpuprofiles.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_cpuprofiles.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_cpuprofiles_cpuassignments.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_cpuprofiles_cpuassignments.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_cpuprofiles_cpuassignments.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_cpuprofiles_cpuassignments.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_create.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_create.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_create.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_create.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_cpufunctions.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_cpufunctions.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_cpufunctions.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_cpufunctions.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_devices.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_devices.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_devices.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_devices.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_interfaces.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_interfaces.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_interfaces.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_interfaces.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_lldp.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_lldp.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_lldp.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_lldp.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_local_volume_group.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_local_volume_group.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_local_volume_group.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_local_volume_group.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_local_volume_group_overview.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_local_volume_group_overview.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_local_volume_group_overview.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_local_volume_group_overview.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_memorys.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_memorys.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_memorys.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_memorys.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_neighbour.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_neighbour.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_neighbour.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_neighbour.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_overview.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_overview.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_overview.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_overview.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_physical_volume.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_physical_volume.html similarity index 96% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_physical_volume.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_physical_volume.html index d94ba4e5..5b161ff2 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_physical_volume.html +++ b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_physical_volume.html @@ -1,54 +1,54 @@ -{% extends 'base.html' %} -{% load i18n breadcrumb_nav %} -{% block title %}{% trans "Physical Volume Details" %}{% endblock %} - -{% block main %} -

{{ pv.lvm_pv_name }}

- -
-
-
-

{% trans "Info" %}

-
-
-
{% trans "UUID" %}
-
{{ pv.uuid }}
-
{% trans "State" %}
-
{{ pv.pv_state }}
-
{% trans "Type" %}
-
{{ pv.pv_type }}
-
{% trans "Volume Group Name" %}
-
{{ pv.lvm_vg_name }}
-
-
-
{% trans "Physical Volume UUID" %}
-
{{ pv.lvm_pv_uuid }}
-
{% trans "Physical Volume Name" %}
-
{{ pv.lvm_pv_name }}
-
{% trans "Physical Volume Size" %}
-
{{ pv.lvm_pv_size | filesizeformat }}
-
{% trans "Physical Extents Total" %}
-
{{ pv.lvm_pe_total }}
-
{% trans "Physical Extents Allocated" %}
-
{{ pv.lvm_pe_alloced }}
-
-
-
{% trans "Disk or Partition UUID" %}
-
{{ pv.disk_or_part_uuid }}
-
{% trans "Disk or Partition Node" %}
-
{{ pv.disk_or_part_device_node }}
-
{% trans "Disk or Partition Path" %}
-
{{ pv.disk_or_part_device_path }}
-
-
-
{% trans "Created At" %}
-
{{ pv.created_at }}
-
{% trans "Updated At" %}
-
{{ pv.updated_at }}
-
-
-
-
-{% endblock %} - - +{% extends 'base.html' %} +{% load i18n breadcrumb_nav %} +{% block title %}{% trans "Physical Volume Details" %}{% endblock %} + +{% block main %} +

{{ pv.lvm_pv_name }}

+ +
+
+
+

{% trans "Info" %}

+
+
+
{% trans "UUID" %}
+
{{ pv.uuid }}
+
{% trans "State" %}
+
{{ pv.pv_state }}
+
{% trans "Type" %}
+
{{ pv.pv_type }}
+
{% trans "Volume Group Name" %}
+
{{ pv.lvm_vg_name }}
+
+
+
{% trans "Physical Volume UUID" %}
+
{{ pv.lvm_pv_uuid }}
+
{% trans "Physical Volume Name" %}
+
{{ pv.lvm_pv_name }}
+
{% trans "Physical Volume Size" %}
+
{{ pv.lvm_pv_size | filesizeformat }}
+
{% trans "Physical Extents Total" %}
+
{{ pv.lvm_pe_total }}
+
{% trans "Physical Extents Allocated" %}
+
{{ pv.lvm_pe_alloced }}
+
+
+
{% trans "Disk or Partition UUID" %}
+
{{ pv.disk_or_part_uuid }}
+
{% trans "Disk or Partition Node" %}
+
{{ pv.disk_or_part_device_node }}
+
{% trans "Disk or Partition Path" %}
+
{{ pv.disk_or_part_device_path }}
+
+
+
{% trans "Created At" %}
+
{{ pv.created_at }}
+
{% trans "Updated At" %}
+
{{ pv.updated_at }}
+
+
+
+
+{% endblock %} + + diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_ports.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_ports.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_ports.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_ports.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_sensor.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_sensor.html similarity index 96% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_sensor.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_sensor.html index f2cd609c..19af11b6 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_sensor.html +++ b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_sensor.html @@ -1,56 +1,56 @@ -{% extends 'base.html' %} -{% load i18n breadcrumb_nav %} -{% block title %}{% trans "Sensor Details" %}{% endblock %} - -{% block main %} -

{{ sensor.sensorname }}

- -
-
-
-

{% trans "Info" %}

-
-
-
{% trans "UUID" %}
-
{{ sensor.uuid }}
-
{% trans "Status" %}
-
{{ sensor.status }}
-
{% trans "State" %}
-
{{ sensor.state }}
-
{% trans "SensorType" %}
-
{{ sensor.sensortype }}
-
{% trans "DataType" %}
-
{{ sensor.datatype }}
-
-
-
{% trans "Sensor UUID" %}
-
{{ sensor.uuid }}
-
{% trans "Sensor Name" %}
-
{{ sensor.sensorname }}
-
-
-
{% trans "Suppressed" %}
-
{{ sensor.suppress }}
-
{% trans "Minor Actions" %}
-
{{ sensor.actions_minor }}
-
{% trans "Major Actions" %}
-
{{ sensor.actions_major }}
-
{% trans "Critical Actions" %}
-
{{ sensor.actions_critical }}
-
-
-
{% trans "Sensor Group UUID" %}
-
{{ sensor.sensorgroup_uuid }}
-
-
-
{% trans "Created At" %}
-
{{ sensor.created_at }}
-
{% trans "Updated At" %}
-
{{ sensor.updated_at }}
-
-
-
-
-{% endblock %} - - +{% extends 'base.html' %} +{% load i18n breadcrumb_nav %} +{% block title %}{% trans "Sensor Details" %}{% endblock %} + +{% block main %} +

{{ sensor.sensorname }}

+ +
+
+
+

{% trans "Info" %}

+
+
+
{% trans "UUID" %}
+
{{ sensor.uuid }}
+
{% trans "Status" %}
+
{{ sensor.status }}
+
{% trans "State" %}
+
{{ sensor.state }}
+
{% trans "SensorType" %}
+
{{ sensor.sensortype }}
+
{% trans "DataType" %}
+
{{ sensor.datatype }}
+
+
+
{% trans "Sensor UUID" %}
+
{{ sensor.uuid }}
+
{% trans "Sensor Name" %}
+
{{ sensor.sensorname }}
+
+
+
{% trans "Suppressed" %}
+
{{ sensor.suppress }}
+
{% trans "Minor Actions" %}
+
{{ sensor.actions_minor }}
+
{% trans "Major Actions" %}
+
{{ sensor.actions_major }}
+
{% trans "Critical Actions" %}
+
{{ sensor.actions_critical }}
+
+
+
{% trans "Sensor Group UUID" %}
+
{{ sensor.sensorgroup_uuid }}
+
+
+
{% trans "Created At" %}
+
{{ sensor.created_at }}
+
{% trans "Updated At" %}
+
{{ sensor.updated_at }}
+
+
+
+
+{% endblock %} + + diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_sensor_group.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_sensor_group.html similarity index 96% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_sensor_group.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_sensor_group.html index 9ae8fe9f..88af9e97 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_sensor_group.html +++ b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_sensor_group.html @@ -1,48 +1,48 @@ -{% extends 'base.html' %} -{% load i18n breadcrumb_nav %} -{% block title %}{% trans "Sensor Group Details" %}{% endblock %} - -{% block main %} -

{{ sensorgroup.sensorgroupname }}

- -
-
-
-

{% trans "Info" %}

-
-
-
{% trans "UUID" %}
-
{{ sensorgroup.uuid }}
-
{% trans "Group Name" %}
-
{{ sensorgroup.sensorgroupname }}
-
{% trans "Group Type" %}
-
{{ sensorgroup.sensortype }}
-
{% trans "State" %}
-
{{ sensorgroup.state }}
-
-
-
{% trans "Datatype" %}
-
{{ sensorgroup.datatype }}
-
{% trans "Audit Interval (secs)" %}
-
{{ sensorgroup.audit_interval_group }}
-
{% trans "Algorithm" %}
-
{{ sensorgroup.algorithm }}
-
{% trans "Actions Minor" %}
-
{{ sensorgroup.actions_minor_group }}
-
{% trans "Actions Major" %}
-
{{ sensorgroup.actions_major_group }}
-
{% trans "Actions Critical" %}
-
{{ sensorgroup.actions_critical_group }}
-
-
-
{% trans "Created At" %}
-
{{ sensorgroup.created_at }}
-
{% trans "Updated At" %}
-
{{ sensorgroup.updated_at }}
-
-
-
-
-{% endblock %} - - +{% extends 'base.html' %} +{% load i18n breadcrumb_nav %} +{% block title %}{% trans "Sensor Group Details" %}{% endblock %} + +{% block main %} +

{{ sensorgroup.sensorgroupname }}

+ +
+
+
+

{% trans "Info" %}

+
+
+
{% trans "UUID" %}
+
{{ sensorgroup.uuid }}
+
{% trans "Group Name" %}
+
{{ sensorgroup.sensorgroupname }}
+
{% trans "Group Type" %}
+
{{ sensorgroup.sensortype }}
+
{% trans "State" %}
+
{{ sensorgroup.state }}
+
+
+
{% trans "Datatype" %}
+
{{ sensorgroup.datatype }}
+
{% trans "Audit Interval (secs)" %}
+
{{ sensorgroup.audit_interval_group }}
+
{% trans "Algorithm" %}
+
{{ sensorgroup.algorithm }}
+
{% trans "Actions Minor" %}
+
{{ sensorgroup.actions_minor_group }}
+
{% trans "Actions Major" %}
+
{{ sensorgroup.actions_major_group }}
+
{% trans "Actions Critical" %}
+
{{ sensorgroup.actions_critical_group }}
+
+
+
{% trans "Created At" %}
+
{{ sensorgroup.created_at }}
+
{% trans "Updated At" %}
+
{{ sensorgroup.updated_at }}
+
+
+
+
+{% endblock %} + + diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_sensors.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_sensors.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_sensors.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_sensors.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_storages.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_storages.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_detail_storages.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_detail_storages.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_deviceusage.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_deviceusage.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_deviceusage.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_deviceusage.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_disk_info.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_disk_info.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_disk_info.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_disk_info.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_diskconfig.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_diskconfig.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_diskconfig.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_diskconfig.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_diskconfig_obs.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_diskconfig_obs.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_diskconfig_obs.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_diskconfig_obs.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_lvgconfig.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_lvgconfig.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_lvgconfig.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_lvgconfig.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_partitionconfig.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_partitionconfig.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_partitionconfig.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_partitionconfig.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_storconfig.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_storconfig.html similarity index 90% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_storconfig.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_storconfig.html index 1fa58e13..b6bd0ed1 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_storconfig.html +++ b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_diskprofiles_storconfig.html @@ -16,9 +16,10 @@ {% else %} {{ "on journal stor" }} {{stor.count}} {% endif %} + {{", for tier:"}} {{stor.tier_name}} {% else %} {{ stor.function }} {{"stor"}} {{stor.count}} - {% endif %} + {% endif %} {% endif %} diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_hosts.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_hosts.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_hosts.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_hosts.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_interfaceprofiles.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_interfaceprofiles.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_interfaceprofiles.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_interfaceprofiles.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_interfaceprofiles_interfaceconfig.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_interfaceprofiles_interfaceconfig.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_interfaceprofiles_interfaceconfig.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_interfaceprofiles_interfaceconfig.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_interfaceprofiles_portconfig.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_interfaceprofiles_portconfig.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_interfaceprofiles_portconfig.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_interfaceprofiles_portconfig.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_memoryprofiles.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_memoryprofiles.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_memoryprofiles.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_memoryprofiles.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_memoryprofiles_memoryassignments.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_memoryprofiles_memoryassignments.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_memoryprofiles_memoryassignments.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_memoryprofiles_memoryassignments.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_update.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_update.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/_update.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/_update.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/banner.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/banner.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/banner.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/banner.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/cpu_functions/_cpufunction_processorcores.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/cpu_functions/_cpufunction_processorcores.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/cpu_functions/_cpufunction_processorcores.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/cpu_functions/_cpufunction_processorcores.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/cpu_functions/_createprofile.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/cpu_functions/_createprofile.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/cpu_functions/_createprofile.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/cpu_functions/_createprofile.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/cpu_functions/_update.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/cpu_functions/_update.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/cpu_functions/_update.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/cpu_functions/_update.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/cpu_functions/createprofile.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/cpu_functions/createprofile.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/cpu_functions/createprofile.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/cpu_functions/createprofile.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/cpu_functions/update.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/cpu_functions/update.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/cpu_functions/update.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/cpu_functions/update.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/create.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/create.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/create.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/create.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/detail.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/detail.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/detail.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/detail.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/devices/_detail_overview.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/devices/_detail_overview.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/devices/_detail_overview.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/devices/_detail_overview.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/devices/_update.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/devices/_update.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/devices/_update.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/devices/_update.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/devices/_usage.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/devices/_usage.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/devices/_usage.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/devices/_usage.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/devices/detail.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/devices/detail.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/devices/detail.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/devices/detail.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/devices/update.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/devices/update.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/devices/update.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/devices/update.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/devices/usage.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/devices/usage.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/devices/usage.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/devices/usage.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/index.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/index.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/index.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/index.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/_create.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/_create.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/_create.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/_create.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/_createprofile.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/_createprofile.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/_createprofile.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/_createprofile.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/_detail_overview.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/_detail_overview.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/_detail_overview.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/_detail_overview.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/_update.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/_update.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/_update.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/_update.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/address/_create.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/address/_create.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/address/_create.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/address/_create.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/address/create.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/address/create.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/address/create.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/address/create.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/create.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/create.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/create.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/create.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/createprofile.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/createprofile.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/createprofile.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/createprofile.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/detail.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/detail.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/detail.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/detail.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/route/_create.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/route/_create.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/route/_create.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/route/_create.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/route/create.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/route/create.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/route/create.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/route/create.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/update.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/update.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/update.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/interfaces/update.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_createprofile.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_createprofile.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_createprofile.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_createprofile.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_edit_hp_memory.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_edit_hp_memory.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_edit_hp_memory.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_edit_hp_memory.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_memoryfunction_hugepages.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_memoryfunction_hugepages.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_memoryfunction_hugepages.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_memoryfunction_hugepages.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_memoryfunction_hugepages_other.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_memoryfunction_hugepages_other.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_memoryfunction_hugepages_other.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_memoryfunction_hugepages_other.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_vmfunction_hugepages.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_vmfunction_hugepages.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_vmfunction_hugepages.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_vmfunction_hugepages.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_vswitchfunction_hugepages.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_vswitchfunction_hugepages.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_vswitchfunction_hugepages.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/memorys/_vswitchfunction_hugepages.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/memorys/createprofile.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/memorys/createprofile.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/memorys/createprofile.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/memorys/createprofile.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/memorys/edit_hp_memory.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/memorys/edit_hp_memory.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/memorys/edit_hp_memory.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/memorys/edit_hp_memory.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/ports/_detail_overview.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/ports/_detail_overview.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/ports/_detail_overview.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/ports/_detail_overview.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/ports/_ports_devicetype.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/ports/_ports_devicetype.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/ports/_ports_devicetype.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/ports/_ports_devicetype.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/ports/_update.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/ports/_update.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/ports/_update.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/ports/_update.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/ports/detail.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/ports/detail.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/ports/detail.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/ports/detail.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/ports/update.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/ports/update.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/ports/update.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/ports/update.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/sensors/_createsensorgroup.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/sensors/_createsensorgroup.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/sensors/_createsensorgroup.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/sensors/_createsensorgroup.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/sensors/_sensor_actions.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/sensors/_sensor_actions.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/sensors/_sensor_actions.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/sensors/_sensor_actions.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/sensors/_sensorgroup_actions.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/sensors/_sensorgroup_actions.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/sensors/_sensorgroup_actions.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/sensors/_sensorgroup_actions.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/sensors/_updatesensorgroup.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/sensors/_updatesensorgroup.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/sensors/_updatesensorgroup.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/sensors/_updatesensorgroup.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/sensors/createsensorgroup.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/sensors/createsensorgroup.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/sensors/createsensorgroup.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/sensors/createsensorgroup.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/sensors/updatesensorgroup.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/sensors/updatesensorgroup.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/sensors/updatesensorgroup.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/sensors/updatesensorgroup.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/_creatediskprofile.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_creatediskprofile.html similarity index 98% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/_creatediskprofile.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_creatediskprofile.html index 687cf0de..abd0743e 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/_creatediskprofile.html +++ b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_creatediskprofile.html @@ -40,6 +40,7 @@ {% else %} {{ "on journal stor" }} {{stor.count}} {% endif %} + {{", for tier:"}} {{stor.tier_name}} {% else %} {{ stor.function }} {{"stor"}} {{stor.count}} {% endif %} diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/_createlocalvolumegroup.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_createlocalvolumegroup.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/_createlocalvolumegroup.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_createlocalvolumegroup.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/_createpartition.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_createpartition.html similarity index 90% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/_createpartition.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_createpartition.html index 716fce4c..63012c2b 100644 --- a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/_createpartition.html +++ b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_createpartition.html @@ -13,7 +13,7 @@

{% trans "Description" %}:

-

{% trans "From here you can create a new partition." %}

+

{% trans "From here you can create a new disk partition." %}

{% endblock %} diff --git a/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_createphysicalvolume.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_createphysicalvolume.html new file mode 100755 index 00000000..7bdbf9fb --- /dev/null +++ b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_createphysicalvolume.html @@ -0,0 +1,68 @@ +{% extends "horizon/common/_modal_form.html" %} +{% load i18n %} + +{% block form_id %}add_physicalvolume_form{% endblock %} +{% block form_action %}{% url 'horizon:admin:inventory:addphysicalvolume' host_id %}{% endblock %} + +{% block modal-header %}{% trans "Create Physical Volume" %}{% endblock %} +{% block modal-body %} +
+
+ {% include "horizon/common/_form_fields.html" %} +
+ +
+
+

{% trans "Description" %}:

+

{% trans "From here you can define the configuration of a new physical volume." %}

+
+{% endblock %} + +{% block modal-footer %} + Cancel + +{% endblock %} + diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/_createstoragevolume.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_createstoragevolume.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/_createstoragevolume.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_createstoragevolume.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/_editpartition.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_editpartition.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/_editpartition.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_editpartition.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/_editstoragevolume.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_editstoragevolume.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/_editstoragevolume.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_editstoragevolume.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/creatediskprofile.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/creatediskprofile.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/creatediskprofile.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/creatediskprofile.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/createlocalvolumegroup.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/createlocalvolumegroup.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/createlocalvolumegroup.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/createlocalvolumegroup.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/createpartition.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/createpartition.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/createpartition.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/createpartition.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/createphysicalvolume.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/createphysicalvolume.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/createphysicalvolume.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/createphysicalvolume.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/createstoragevolume.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/createstoragevolume.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/createstoragevolume.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/createstoragevolume.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/editpartition.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/editpartition.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/editpartition.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/editpartition.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/editstoragevolume.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/editstoragevolume.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/editstoragevolume.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/editstoragevolume.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/lvg/_edit.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/lvg/_edit.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/lvg/_edit.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/lvg/_edit.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/lvg/edit.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/lvg/edit.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/storages/lvg/edit.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/lvg/edit.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/templates/inventory/update.html b/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/update.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/inventory/templates/inventory/update.html rename to starlingx_dashboard/dashboards/admin/inventory/templates/inventory/update.html diff --git a/cgcs_dashboard/dashboards/admin/inventory/urls.py b/starlingx_dashboard/dashboards/admin/inventory/urls.py similarity index 97% rename from cgcs_dashboard/dashboards/admin/inventory/urls.py rename to starlingx_dashboard/dashboards/admin/inventory/urls.py index 694b1811..a8bc78f9 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/urls.py +++ b/starlingx_dashboard/dashboards/admin/inventory/urls.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2017 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 diff --git a/cgcs_dashboard/dashboards/admin/inventory/views.py b/starlingx_dashboard/dashboards/admin/inventory/views.py similarity index 97% rename from cgcs_dashboard/dashboards/admin/inventory/views.py rename to starlingx_dashboard/dashboards/admin/inventory/views.py index e84fa4f5..14921a43 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/views.py +++ b/starlingx_dashboard/dashboards/admin/inventory/views.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2017 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 diff --git a/cgcs_dashboard/dashboards/admin/inventory/workflows.py b/starlingx_dashboard/dashboards/admin/inventory/workflows.py similarity index 99% rename from cgcs_dashboard/dashboards/admin/inventory/workflows.py rename to starlingx_dashboard/dashboards/admin/inventory/workflows.py index 23f26bd9..90c9b4ee 100755 --- a/cgcs_dashboard/dashboards/admin/inventory/workflows.py +++ b/starlingx_dashboard/dashboards/admin/inventory/workflows.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # # vim: tabstop=4 shiftwidth=4 softtabstop=4 diff --git a/cgcs_dashboard/dashboards/admin/providernets/__init__.py b/starlingx_dashboard/dashboards/admin/providernets/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/providernets/__init__.py rename to starlingx_dashboard/dashboards/admin/providernets/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/providernets/panel.py b/starlingx_dashboard/dashboards/admin/providernets/panel.py similarity index 69% rename from cgcs_dashboard/dashboards/admin/providernets/panel.py rename to starlingx_dashboard/dashboards/admin/providernets/panel.py index 0424a21d..5eccc564 100755 --- a/cgcs_dashboard/dashboards/admin/providernets/panel.py +++ b/starlingx_dashboard/dashboards/admin/providernets/panel.py @@ -1,9 +1,7 @@ # # Copyright (c) 2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # from django.utils.translation import ugettext_lazy as _ @@ -16,15 +14,19 @@ from openstack_dashboard.dashboards.admin import dashboard class Providernets(horizon.Panel): name = _("Provider Networks") slug = 'providernets' - permissions = ('openstack.services.platform',) + permissions = ('openstack.services.platform', 'openstack.services.network') def allowed(self, context): + if context['request'].user.services_region == 'SystemController': + return False if not base.is_service_enabled(context['request'], 'platform'): return False else: return super(Providernets, self).allowed(context) def nav(self, context): + if context['request'].user.services_region == 'SystemController': + return False if not base.is_service_enabled(context['request'], 'platform'): return False else: diff --git a/cgcs_dashboard/dashboards/admin/providernets/providernets/__init__.py b/starlingx_dashboard/dashboards/admin/providernets/providernets/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/providernets/providernets/__init__.py rename to starlingx_dashboard/dashboards/admin/providernets/providernets/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/providernets/providernets/forms.py b/starlingx_dashboard/dashboards/admin/providernets/providernets/forms.py similarity index 96% rename from cgcs_dashboard/dashboards/admin/providernets/providernets/forms.py rename to starlingx_dashboard/dashboards/admin/providernets/providernets/forms.py index f474c2c3..f6b1e58f 100755 --- a/cgcs_dashboard/dashboards/admin/providernets/providernets/forms.py +++ b/starlingx_dashboard/dashboards/admin/providernets/providernets/forms.py @@ -1,5 +1,3 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - # Copyright 2012 NEC Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -16,10 +14,6 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# import logging diff --git a/cgcs_dashboard/dashboards/admin/providernets/providernets/ranges/__init__.py b/starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/providernets/providernets/ranges/__init__.py rename to starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/providernets/providernets/ranges/forms.py b/starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/forms.py similarity index 98% rename from cgcs_dashboard/dashboards/admin/providernets/providernets/ranges/forms.py rename to starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/forms.py index 8fa76781..eef818b0 100755 --- a/cgcs_dashboard/dashboards/admin/providernets/providernets/ranges/forms.py +++ b/starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/forms.py @@ -1,5 +1,3 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - # Copyright 2012 NEC Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -16,10 +14,6 @@ # # Copyright (c) 2013-2015,2017 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# import logging diff --git a/cgcs_dashboard/dashboards/admin/providernets/providernets/ranges/tables.py b/starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/tables.py similarity index 96% rename from cgcs_dashboard/dashboards/admin/providernets/providernets/ranges/tables.py rename to starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/tables.py index 5accf0c2..f8662532 100755 --- a/cgcs_dashboard/dashboards/admin/providernets/providernets/ranges/tables.py +++ b/starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/tables.py @@ -16,10 +16,6 @@ # # Copyright (c) 2013-2014,2017 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# import logging diff --git a/cgcs_dashboard/dashboards/admin/providernets/providernets/ranges/tabs.py b/starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/tabs.py similarity index 87% rename from cgcs_dashboard/dashboards/admin/providernets/providernets/ranges/tabs.py rename to starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/tabs.py index d7f0a289..a6b68bcc 100755 --- a/cgcs_dashboard/dashboards/admin/providernets/providernets/ranges/tabs.py +++ b/starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/tabs.py @@ -16,10 +16,6 @@ # # Copyright (c) 2013-2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# from django.utils.translation import ugettext_lazy as _ # noqa diff --git a/cgcs_dashboard/dashboards/admin/providernets/providernets/ranges/urls.py b/starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/urls.py similarity index 84% rename from cgcs_dashboard/dashboards/admin/providernets/providernets/ranges/urls.py rename to starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/urls.py index 6882f1b1..09c6f22b 100755 --- a/cgcs_dashboard/dashboards/admin/providernets/providernets/ranges/urls.py +++ b/starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/urls.py @@ -16,10 +16,6 @@ # # Copyright (c) 2013-2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# from django.conf.urls import url # noqa diff --git a/cgcs_dashboard/dashboards/admin/providernets/providernets/ranges/views.py b/starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/views.py similarity index 97% rename from cgcs_dashboard/dashboards/admin/providernets/providernets/ranges/views.py rename to starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/views.py index 8b8a824f..52612841 100755 --- a/cgcs_dashboard/dashboards/admin/providernets/providernets/ranges/views.py +++ b/starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/views.py @@ -16,10 +16,6 @@ # # Copyright (c) 2013-2017 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# from django.core.urlresolvers import reverse # noqa diff --git a/cgcs_dashboard/dashboards/admin/providernets/providernets/tables.py b/starlingx_dashboard/dashboards/admin/providernets/providernets/tables.py similarity index 96% rename from cgcs_dashboard/dashboards/admin/providernets/providernets/tables.py rename to starlingx_dashboard/dashboards/admin/providernets/providernets/tables.py index e5677ddf..92af980b 100755 --- a/cgcs_dashboard/dashboards/admin/providernets/providernets/tables.py +++ b/starlingx_dashboard/dashboards/admin/providernets/providernets/tables.py @@ -1,5 +1,3 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - # Copyright 2012 NEC Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -16,10 +14,6 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# import logging diff --git a/cgcs_dashboard/dashboards/admin/providernets/providernets/urls.py b/starlingx_dashboard/dashboards/admin/providernets/providernets/urls.py similarity index 89% rename from cgcs_dashboard/dashboards/admin/providernets/providernets/urls.py rename to starlingx_dashboard/dashboards/admin/providernets/providernets/urls.py index 55434714..eb519726 100755 --- a/cgcs_dashboard/dashboards/admin/providernets/providernets/urls.py +++ b/starlingx_dashboard/dashboards/admin/providernets/providernets/urls.py @@ -1,5 +1,3 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - # Copyright 2012 NEC Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -16,10 +14,6 @@ # # Copyright (c) 2013-2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# from django.conf.urls import include # noqa diff --git a/cgcs_dashboard/dashboards/admin/providernets/providernets/views.py b/starlingx_dashboard/dashboards/admin/providernets/providernets/views.py similarity index 97% rename from cgcs_dashboard/dashboards/admin/providernets/providernets/views.py rename to starlingx_dashboard/dashboards/admin/providernets/providernets/views.py index 6c6b86a2..d79b9ffe 100755 --- a/cgcs_dashboard/dashboards/admin/providernets/providernets/views.py +++ b/starlingx_dashboard/dashboards/admin/providernets/providernets/views.py @@ -1,5 +1,3 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - # Copyright 2012 NEC Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -16,10 +14,6 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# from collections import OrderedDict diff --git a/cgcs_dashboard/dashboards/admin/providernets/tabs.py b/starlingx_dashboard/dashboards/admin/providernets/tabs.py similarity index 87% rename from cgcs_dashboard/dashboards/admin/providernets/tabs.py rename to starlingx_dashboard/dashboards/admin/providernets/tabs.py index 0a508581..0c020429 100755 --- a/cgcs_dashboard/dashboards/admin/providernets/tabs.py +++ b/starlingx_dashboard/dashboards/admin/providernets/tabs.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # diff --git a/cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/_add_range.html b/starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/_add_range.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/_add_range.html rename to starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/_add_range.html diff --git a/cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/_create.html b/starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/_create.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/_create.html rename to starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/_create.html diff --git a/cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/_detail_overview.html b/starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/_detail_overview.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/_detail_overview.html rename to starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/_detail_overview.html diff --git a/cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/_update.html b/starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/_update.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/_update.html rename to starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/_update.html diff --git a/cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/add_range.html b/starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/add_range.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/add_range.html rename to starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/add_range.html diff --git a/cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/create.html b/starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/create.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/create.html rename to starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/create.html diff --git a/cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/detail.html b/starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/detail.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/detail.html rename to starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/detail.html diff --git a/cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/_create.html b/starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/_create.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/_create.html rename to starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/_create.html diff --git a/cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/_detail_overview.html b/starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/_detail_overview.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/_detail_overview.html rename to starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/_detail_overview.html diff --git a/cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/_update.html b/starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/_update.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/_update.html rename to starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/_update.html diff --git a/cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/_vxlan.html b/starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/_vxlan.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/_vxlan.html rename to starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/_vxlan.html diff --git a/cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/create.html b/starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/create.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/create.html rename to starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/create.html diff --git a/cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/detail.html b/starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/detail.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/detail.html rename to starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/detail.html diff --git a/cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/update.html b/starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/update.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/update.html rename to starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/ranges/update.html diff --git a/cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/update.html b/starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/update.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/providernets/templates/providernets/providernets/update.html rename to starlingx_dashboard/dashboards/admin/providernets/templates/providernets/providernets/update.html diff --git a/cgcs_dashboard/dashboards/admin/providernets/templates/providernets/tabs.html b/starlingx_dashboard/dashboards/admin/providernets/templates/providernets/tabs.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/providernets/templates/providernets/tabs.html rename to starlingx_dashboard/dashboards/admin/providernets/templates/providernets/tabs.html diff --git a/cgcs_dashboard/dashboards/admin/providernets/urls.py b/starlingx_dashboard/dashboards/admin/providernets/urls.py similarity index 74% rename from cgcs_dashboard/dashboards/admin/providernets/urls.py rename to starlingx_dashboard/dashboards/admin/providernets/urls.py index afadd4c0..b459b047 100755 --- a/cgcs_dashboard/dashboards/admin/providernets/urls.py +++ b/starlingx_dashboard/dashboards/admin/providernets/urls.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # from django.conf.urls import include diff --git a/cgcs_dashboard/dashboards/admin/providernets/views.py b/starlingx_dashboard/dashboards/admin/providernets/views.py similarity index 70% rename from cgcs_dashboard/dashboards/admin/providernets/views.py rename to starlingx_dashboard/dashboards/admin/providernets/views.py index e75bfdf2..71b67f6c 100755 --- a/cgcs_dashboard/dashboards/admin/providernets/views.py +++ b/starlingx_dashboard/dashboards/admin/providernets/views.py @@ -1,9 +1,7 @@ # # Copyright (c) 2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # from django.utils.translation import ugettext_lazy as _ diff --git a/cgcs_dashboard/dashboards/admin/server_groups/__init__.py b/starlingx_dashboard/dashboards/admin/server_groups/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/server_groups/__init__.py rename to starlingx_dashboard/dashboards/admin/server_groups/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/server_groups/forms.py b/starlingx_dashboard/dashboards/admin/server_groups/forms.py similarity index 94% rename from cgcs_dashboard/dashboards/admin/server_groups/forms.py rename to starlingx_dashboard/dashboards/admin/server_groups/forms.py index 1d99fd02..1a591716 100755 --- a/cgcs_dashboard/dashboards/admin/server_groups/forms.py +++ b/starlingx_dashboard/dashboards/admin/server_groups/forms.py @@ -1,200 +1,194 @@ -# 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. -# -# Copyright (c) 2013-2017 Wind River Systems, Inc. -# -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# - -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2012 Nebula, Inc. -# All rights reserved. - -""" -Views for managing volumes. -""" - -from django.conf import settings -from django.core.urlresolvers import reverse -from django.forms import ValidationError -from django.utils.translation import ugettext_lazy as _ # noqa - -from horizon import exceptions -from horizon import forms -from horizon import messages - -from openstack_dashboard import api -from openstack_dashboard.api import cinder -from openstack_dashboard.api import nova -from openstack_dashboard.dashboards.project.instances import tables - - -class CreateForm(forms.SelfHandlingForm): - tenantP = forms.ChoiceField(label=_("Project"), required=True) - name = forms.CharField(max_length="255", label=_("Server Group Name")) - policy = forms.ChoiceField(label=_("Policy"), - required=False, - widget=forms.Select( - attrs={ - 'class': 'switchable', - 'data-slug': 'policy_ht'})) - - is_best_effort = forms.BooleanField(label=_("Best Effort"), required=False) - - group_size = forms.IntegerField( - min_value=1, - label=_("Max Group Size (Instances)"), - required=False, - widget=forms.TextInput( - attrs={ - 'class': 'switchable switched', - 'data-switch-on': 'policy_ht', - 'data-policy_ht-anti-affinity': 'Max Group Size (Instances)', - 'data-policy_ht-affinity': 'Max Group Size (Instances)'})) - - group_size_ht = forms.IntegerField( - label=_("Max Group Size (Instances)"), - required=False, - widget=forms.TextInput( - attrs={ - 'readonly': 'readonly', - 'class': 'switchable switched', - 'data-switch-on': 'policy_ht', - 'data-policy_ht-affinity-hyperthread': - 'Max Group Size (Instances)'})) - - def __init__(self, request, *args, **kwargs): - super(CreateForm, self).__init__(request, *args, **kwargs) - self.fields['policy'].choices = [("anti-affinity", "anti-affinity"), - ("affinity", "affinity")] - - # Populate available project_id/name choices - all_projects = [] - try: - # Get list of available projects. - all_projects, has_more = api.keystone.tenant_list(request) - - projects_list = [(project.id, project.name) - for project in all_projects] - - except Exception: - projects_list = [] - exceptions.handle(self.request, - _('Unable to retrieve list of tenants.')) - - self.fields['tenantP'].choices = projects_list - - def handle(self, request, data): - try: - policy = data['policy'] - policies = [] - if policy: - policies.append(policy) - metadata = {} - if data['is_best_effort']: - metadata['wrs-sg:best_effort'] = "true" - group_size = data['group_size'] - group_size_ht = data['group_size_ht'] - if group_size: - metadata['wrs-sg:group_size'] = str(group_size) - elif group_size_ht: - metadata['wrs-sg:group_size'] = str(group_size_ht) - - kwargs = {'name': data['name'], - 'policies': policies, - 'metadata': metadata} - - server_group = nova.server_group_create(request, **kwargs) - return server_group - - except ValidationError as e: - self.api_error(e.messages[0]) - return False - except Exception: - exceptions.handle(request, ignore=True) - self.api_error(_("Unable to create server group.")) - return False - - -class AttachForm(forms.SelfHandlingForm): - instance = forms.ChoiceField(label=_("Attach to Server Group"), - help_text=_("Select an server group to " - "attach to.")) - device = forms.CharField(label=_("Device Name")) - - def __init__(self, *args, **kwargs): - super(AttachForm, self).__init__(*args, **kwargs) - - # Hide the device field if the hypervisor doesn't support it. - hypervisor_features = getattr(settings, - "OPENSTACK_HYPERVISOR_FEATURES", {}) - can_set_mount_point = hypervisor_features.get("can_set_mount_point", - True) - if not can_set_mount_point: - self.fields['device'].widget = forms.widgets.HiddenInput() - self.fields['device'].required = False - - # populate volume_id - volume = kwargs.get('initial', {}).get("volume", None) - if volume: - volume_id = volume.id - else: - volume_id = None - self.fields['volume_id'] = forms.CharField(widget=forms.HiddenInput(), - initial=volume_id) - - # Populate instance choices - instance_list = kwargs.get('initial', {}).get('instances', []) - instances = [] - for instance in instance_list: - if instance.status in tables.ACTIVE_STATES and \ - not any(instance.id == att["server_id"] - for att in volume.attachments): - instances.append((instance.id, '%s (%s)' % (instance.name, - instance.id))) - if instances: - instances.insert(0, ("", _("Select an instance"))) - else: - instances = (("", _("No instances available")),) - self.fields['instance'].choices = instances - - def handle(self, request, data): - instance_choices = dict(self.fields['instance'].choices) - instance_name = instance_choices.get(data['instance'], - _("Unknown instance (None)")) - # The name of the instance in the choices list has the ID appended to - # it, so let's slice that off... - instance_name = instance_name.rsplit(" (")[0] - try: - attach = api.nova.instance_volume_attach(request, - data['volume_id'], - data['instance'], - data.get('device', '')) - volume = cinder.volume_get(request, data['volume_id']) - if not volume.display_name: - volume_name = volume.id - else: - volume_name = volume.display_name - message = _('Attaching volume %(vol)s to instance ' - '%(inst)s on %(dev)s.') % {"vol": volume_name, - "inst": instance_name, - "dev": attach.device} - messages.info(request, message) - return True - except Exception: - redirect = reverse("horizon:project:volumes:index") - exceptions.handle(request, - _('Unable to attach volume.'), - redirect=redirect) +# 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. +# +# Copyright (c) 2013-2017 Wind River Systems, Inc. +# +# Copyright 2012 Nebula, Inc. +# All rights reserved. + +""" +Views for managing volumes. +""" + +from django.conf import settings +from django.core.urlresolvers import reverse +from django.forms import ValidationError +from django.utils.translation import ugettext_lazy as _ # noqa + +from horizon import exceptions +from horizon import forms +from horizon import messages + +from openstack_dashboard import api +from openstack_dashboard.api import cinder +from openstack_dashboard.api import nova +from openstack_dashboard.dashboards.project.instances import tables + + +class CreateForm(forms.SelfHandlingForm): + tenantP = forms.ChoiceField(label=_("Project"), required=True) + name = forms.CharField(max_length="255", label=_("Server Group Name")) + policy = forms.ChoiceField(label=_("Policy"), + required=False, + widget=forms.Select( + attrs={ + 'class': 'switchable', + 'data-slug': 'policy_ht'})) + + is_best_effort = forms.BooleanField(label=_("Best Effort"), required=False) + + group_size = forms.IntegerField( + min_value=1, + label=_("Max Group Size (Instances)"), + required=False, + widget=forms.TextInput( + attrs={ + 'class': 'switchable switched', + 'data-switch-on': 'policy_ht', + 'data-policy_ht-anti-affinity': 'Max Group Size (Instances)', + 'data-policy_ht-affinity': 'Max Group Size (Instances)'})) + + group_size_ht = forms.IntegerField( + label=_("Max Group Size (Instances)"), + required=False, + widget=forms.TextInput( + attrs={ + 'readonly': 'readonly', + 'class': 'switchable switched', + 'data-switch-on': 'policy_ht', + 'data-policy_ht-affinity-hyperthread': + 'Max Group Size (Instances)'})) + + def __init__(self, request, *args, **kwargs): + super(CreateForm, self).__init__(request, *args, **kwargs) + self.fields['policy'].choices = [("anti-affinity", "anti-affinity"), + ("affinity", "affinity")] + + # Populate available project_id/name choices + all_projects = [] + try: + # Get list of available projects. + all_projects, has_more = api.keystone.tenant_list(request) + + projects_list = [(project.id, project.name) + for project in all_projects] + + except Exception: + projects_list = [] + exceptions.handle(self.request, + _('Unable to retrieve list of tenants.')) + + self.fields['tenantP'].choices = projects_list + + def handle(self, request, data): + try: + policy = data['policy'] + policies = [] + if policy: + policies.append(policy) + metadata = {} + if data['is_best_effort']: + metadata['wrs-sg:best_effort'] = "true" + group_size = data['group_size'] + group_size_ht = data['group_size_ht'] + if group_size: + metadata['wrs-sg:group_size'] = str(group_size) + elif group_size_ht: + metadata['wrs-sg:group_size'] = str(group_size_ht) + + project_id = None + if data['tenantP']: + project_id = data['tenantP'] + + server_group = nova.server_group_create( + request, data['name'], project_id, metadata, policies) + return server_group + + except ValidationError as e: + self.api_error(e.messages[0]) + return False + except Exception as e: + exceptions.handle(request, ignore=True) + self.api_error(_("Unable to create server group.")) + return False + + +class AttachForm(forms.SelfHandlingForm): + instance = forms.ChoiceField(label=_("Attach to Server Group"), + help_text=_("Select an server group to " + "attach to.")) + device = forms.CharField(label=_("Device Name")) + + def __init__(self, *args, **kwargs): + super(AttachForm, self).__init__(*args, **kwargs) + + # Hide the device field if the hypervisor doesn't support it. + hypervisor_features = getattr(settings, + "OPENSTACK_HYPERVISOR_FEATURES", {}) + can_set_mount_point = hypervisor_features.get("can_set_mount_point", + True) + if not can_set_mount_point: + self.fields['device'].widget = forms.widgets.HiddenInput() + self.fields['device'].required = False + + # populate volume_id + volume = kwargs.get('initial', {}).get("volume", None) + if volume: + volume_id = volume.id + else: + volume_id = None + self.fields['volume_id'] = forms.CharField(widget=forms.HiddenInput(), + initial=volume_id) + + # Populate instance choices + instance_list = kwargs.get('initial', {}).get('instances', []) + instances = [] + for instance in instance_list: + if instance.status in tables.ACTIVE_STATES and \ + not any(instance.id == att["server_id"] + for att in volume.attachments): + instances.append((instance.id, '%s (%s)' % (instance.name, + instance.id))) + if instances: + instances.insert(0, ("", _("Select an instance"))) + else: + instances = (("", _("No instances available")),) + self.fields['instance'].choices = instances + + def handle(self, request, data): + instance_choices = dict(self.fields['instance'].choices) + instance_name = instance_choices.get(data['instance'], + _("Unknown instance (None)")) + # The name of the instance in the choices list has the ID appended to + # it, so let's slice that off... + instance_name = instance_name.rsplit(" (")[0] + try: + attach = api.nova.instance_volume_attach(request, + data['volume_id'], + data['instance'], + data.get('device', '')) + volume = cinder.volume_get(request, data['volume_id']) + if not volume.display_name: + volume_name = volume.id + else: + volume_name = volume.display_name + message = _('Attaching volume %(vol)s to instance ' + '%(inst)s on %(dev)s.') % {"vol": volume_name, + "inst": instance_name, + "dev": attach.device} + messages.info(request, message) + return True + except Exception: + redirect = reverse("horizon:project:volumes:index") + exceptions.handle(request, + _('Unable to attach volume.'), + redirect=redirect) diff --git a/cgcs_dashboard/dashboards/admin/server_groups/panel.py b/starlingx_dashboard/dashboards/admin/server_groups/panel.py similarity index 70% rename from cgcs_dashboard/dashboards/admin/server_groups/panel.py rename to starlingx_dashboard/dashboards/admin/server_groups/panel.py index 43230d9e..66f4d15a 100755 --- a/cgcs_dashboard/dashboards/admin/server_groups/panel.py +++ b/starlingx_dashboard/dashboards/admin/server_groups/panel.py @@ -1,35 +1,40 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2012 Nebula, 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. -# -# Copyright (c) 2013-2017 Wind River Systems, Inc. -# -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# - - -from django.utils.translation import ugettext_lazy as _ - -import horizon - - -class ServerGroups(horizon.Panel): - name = _("Server Groups") - slug = 'server_groups' - # Server groups are wrs-specific - permissions = ('openstack.services.compute',) - policy_rules = (("compute", "context_is_admin"),) +# Copyright 2012 Nebula, 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. +# +# Copyright (c) 2013-2017 Wind River Systems, Inc. +# + +from django.utils.translation import ugettext_lazy as _ + +import horizon + + +class ServerGroups(horizon.Panel): + name = _("Server Groups") + slug = 'server_groups' + # Server groups are wrs-specific + permissions = ('openstack.services.compute',) + policy_rules = (("compute", "context_is_admin"),) + + def allowed(self, context): + if context['request'].user.services_region == 'SystemController': + return False + else: + return super(ServerGroups, self).allowed(context) + + def nav(self, context): + if context['request'].user.services_region == 'SystemController': + return False + else: + return True diff --git a/cgcs_dashboard/dashboards/admin/server_groups/tables.py b/starlingx_dashboard/dashboards/admin/server_groups/tables.py similarity index 92% rename from cgcs_dashboard/dashboards/admin/server_groups/tables.py rename to starlingx_dashboard/dashboards/admin/server_groups/tables.py index 04efdd41..e8205987 100755 --- a/cgcs_dashboard/dashboards/admin/server_groups/tables.py +++ b/starlingx_dashboard/dashboards/admin/server_groups/tables.py @@ -1,320 +1,305 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2014 Wind River, Inc. -# Copyright 2012 Nebula, 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. -# -# Copyright (c) 2013-2017 Wind River Systems, Inc. -# -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# - - -from django.core.urlresolvers import NoReverseMatch -from django.core.urlresolvers import reverse -from django.utils import html -from django.utils import safestring -from django.utils.translation import string_concat -from django.utils.translation import ugettext_lazy as _ # noqa -from django.utils.translation import ungettext_lazy - -from horizon import exceptions -from horizon import tables - -from openstack_dashboard import api -from openstack_dashboard.api import nova -from openstack_dashboard.dashboards.project.volumes.tables \ - import get_attachment_name -from openstack_dashboard.usage import quotas - - -DELETABLE_STATES = ("available", "error") - - -class DeleteServerGroup(tables.DeleteAction): - data_type_singular = _("Server Group") - data_type_plural = _("Server Groups") - action_past = _("Scheduled deletion of") - - @staticmethod - def action_present(count): - return ungettext_lazy( - u"Server Group", - u"Server Groups", - count - ) - - @staticmethod - def action_past(count): - return ungettext_lazy( - u"Deleted Image", - u"Deleted Images", - count - ) - - def delete(self, request, obj_id): - obj = self.table.get_object_by_id(obj_id) - name = self.table.get_object_display(obj) - - try: - nova.server_group_delete(request, obj_id) - except Exception: - msg = _('Unable to delete group "%s" because it is not empty. ' - 'Either delete the member instances' - ' or remove them from the group.') - exceptions.check_message(["group", "not", "empty."], msg % name) - raise - - # maybe do a precheck to see if the group is empty first? - def allowed(self, request, server_group=None): - return True - - -class CreateServerGroup(tables.LinkAction): - name = "create" - verbose_name = _("Create Server Group") - url = "horizon:admin:server_groups:create" - classes = ("ajax-modal", "btn-create") - icon = "plus" - - def allowed(self, request, volume=None): - usages = quotas.tenant_quota_usages(request) - if usages['server_groups']['available'] <= 0: - if "disabled" not in self.classes: - self.classes = [c for c in self.classes] + ['disabled'] - self.verbose_name = string_concat(self.verbose_name, ' ', - _("(Quota exceeded)")) - else: - self.verbose_name = _("Create Server Group") - classes = [c for c in self.classes if c != "disabled"] - self.classes = classes - return True - - -class EditAttachments(tables.LinkAction): - name = "attachments" - verbose_name = _("Edit Attachments") - url = "horizon:admin:server_groups:attach" - classes = ("ajax-modal", "btn-edit") - - def allowed(self, request, server_group=None): - return True # volume.status in ("available", "in-use") - - -class CreateSnapshot(tables.LinkAction): - name = "snapshots" - verbose_name = _("Create Snapshot") - url = "horizon:admin:server_groups:create_snapshot" - classes = ("ajax-modal", "btn-camera") - - def allowed(self, request, server_group=None): - return True # server_group.status == "available" - - -class UpdateRow(tables.Row): - ajax = True - - def get_data(self, request, server_group_id): - server_group = nova.server_group_get(request, server_group_id) - if not server_group.name: - server_group.name = server_group_id - - return server_group - - -def get_policies(server_group): - policies = ', '.join(server_group.policies) - return policies - - -def get_metadata(server_group): - metadata_items = ['{}:{}'.format(x, y) for x, y in - server_group.metadata.items()] - metadata = ', '.join(metadata_items) - return metadata - - -def get_member_name(request, server_id): - try: - server = api.nova.server_get(request, server_id) - name = server.name - except Exception: - name = None - exceptions.handle(request, _("Unable to retrieve " - "member information.")) - # try and get a URL - try: - url = reverse("horizon:admin:instances:detail", args=(server_id,)) - instance = '%s' % (url, html.escape(name)) - except NoReverseMatch: - instance = name - return instance - - -class ProjectNameColumn(tables.Column): - """Customized column class - - Customized column class that does complex processing on the - server group. - """ - - def get_raw_data(self, server_group): - request = self.table.request - project_id = getattr(server_group, 'project_id', None) - try: - tenant = api.keystone.tenant_get(request, - project_id, - admin=True) - - project_name = getattr(tenant, "name", None) - except Exception: - project_name = "(not found)" - - return project_name - - -class MemberColumn(tables.Column): - """Customized column class - - Customized column class that does complex processing on the instances - in a server group. This was substantially copied - from the volume equivalent. - """ - - def get_raw_data(self, server_group): - request = self.table.request - link = _('%(name)s (%(id)s)') - members = [] - for member in server_group.members: - member_id = member - name = get_member_name(request, member) - vals = {"name": name, "id": member_id} - members.append(link % vals) - return safestring.mark_safe(", ".join(members)) - - -def get_server_group_type(server_group): - return server_group.volume_type if server_group.volume_type != "None" \ - else None - - -class ServerGroupsFilterAction(tables.FilterAction): - def filter(self, table, server_groups, filter_string): - """Naive case-insensitive search.""" - q = filter_string.lower() - return [group for group in server_groups - if q in group.display_name.lower()] - - -class ServerGroupsTable(tables.DataTable): - projectname = ProjectNameColumn("project_name", - verbose_name=_("Project")) - name = tables.Column("name", - verbose_name=_("Group Name"), - link="horizon:admin:server_groups:detail") - policies = tables.Column(get_policies, - verbose_name=_("Policies")) - members = MemberColumn("members", - verbose_name=_("Members")) - metadata = tables.Column(get_metadata, - verbose_name=_("Metadata")) - - class Meta(object): - name = "server_groups" - verbose_name = _("Server Groups") - row_class = UpdateRow - table_actions = ( - CreateServerGroup, DeleteServerGroup, ServerGroupsFilterAction) - row_actions = (DeleteServerGroup,) - - def get_object_display(self, obj): - return obj.name - - -class DetachServerGroup(tables.BatchAction): - name = "detach" - action_present = _("Detach") - action_past = _("Detaching") # This action is asynchronous. - data_type_singular = _("Server Group") - data_type_plural = _("Server Groups") - action_type = 'danger' - - @staticmethod - def action_present(count): - return ungettext_lazy( - u"Server Group", - u"Server Groups", - count - ) - - @staticmethod - def action_past(count): - return ungettext_lazy( - u"Deleted Group", - u"Deleted Groups", - count - ) - - def action(self, request, obj_id): - attachment = self.table.get_object_by_id(obj_id) - api.nova.instance_server_group_detach(request, - attachment.get('server_id', - None), - obj_id) - - def get_success_url(self, request): - return reverse('horizon:admin:server_groups:index') - - -class AttachedInstanceColumn(tables.Column): - """Customized column class - - Customized column class that does complex processing on the attachments - for a server group. - """ - - def get_raw_data(self, attachment): - request = self.table.request - return safestring.mark_safe(get_attachment_name(request, attachment, - True)) - - -class AttachmentsTable(tables.DataTable): - instance = AttachedInstanceColumn(get_member_name, - verbose_name=_("Instance")) - device = tables.Column("device", - verbose_name=_("Device")) - - def get_object_id(self, obj): - return obj['id'] - - def get_object_display(self, attachment): - instance_name = get_attachment_name(self.request, attachment, True) - vals = {"dev": attachment['device'], - "instance_name": html.strip_tags(instance_name)} - return _("%(dev)s on instance %(instance_name)s") % vals - - def get_object_by_id(self, obj_id): - for obj in self.data: - if self.get_object_id(obj) == obj_id: - return obj - raise ValueError('No match found for the id "%s".' % obj_id) - - class Meta(object): - name = "attachments" - verbose_name = _("Attachments") - table_actions = (DetachServerGroup,) - row_actions = (DetachServerGroup,) +# Copyright 2014 Wind River, Inc. +# Copyright 2012 Nebula, 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. +# +# Copyright (c) 2013-2017 Wind River Systems, Inc. +# + +from django.core.urlresolvers import NoReverseMatch +from django.core.urlresolvers import reverse +from django.utils import html +from django.utils import safestring +from django.utils.translation import string_concat +from django.utils.translation import ugettext_lazy as _ # noqa +from django.utils.translation import ungettext_lazy + +from horizon import exceptions +from horizon import tables + +from openstack_dashboard import api +from openstack_dashboard.api import nova +from openstack_dashboard.dashboards.project.volumes.tables \ + import get_attachment_name +from openstack_dashboard.usage import quotas + + +DELETABLE_STATES = ("available", "error") + + +class DeleteServerGroup(tables.DeleteAction): + @staticmethod + def action_present(count): + return ungettext_lazy( + u"Delete Server Group", + u"Delete Server Groups", + count + ) + + @staticmethod + def action_past(count): + return ungettext_lazy( + u"Deleted Server Group", + u"Deleted Server Groups", + count + ) + + def delete(self, request, obj_id): + obj = self.table.get_object_by_id(obj_id) + name = self.table.get_object_display(obj) + + try: + nova.server_group_delete(request, obj_id) + except Exception: + msg = _('Unable to delete group "%s" because it is not empty. ' + 'Either delete the member instances' + ' or remove them from the group.') + exceptions.check_message(["group", "not", "empty."], msg % name) + raise + + # maybe do a precheck to see if the group is empty first? + def allowed(self, request, server_group=None): + return True + + +class CreateServerGroup(tables.LinkAction): + name = "create" + verbose_name = _("Create Server Group") + url = "horizon:admin:server_groups:create" + classes = ("ajax-modal", "btn-create") + icon = "plus" + + def allowed(self, request, volume=None): + usages = quotas.tenant_quota_usages(request) + if usages['server_groups']['available'] <= 0: + if "disabled" not in self.classes: + self.classes = [c for c in self.classes] + ['disabled'] + self.verbose_name = string_concat(self.verbose_name, ' ', + _("(Quota exceeded)")) + else: + self.verbose_name = _("Create Server Group") + classes = [c for c in self.classes if c != "disabled"] + self.classes = classes + return True + + +class EditAttachments(tables.LinkAction): + name = "attachments" + verbose_name = _("Edit Attachments") + url = "horizon:admin:server_groups:attach" + classes = ("ajax-modal", "btn-edit") + + def allowed(self, request, server_group=None): + return True # volume.status in ("available", "in-use") + + +class CreateSnapshot(tables.LinkAction): + name = "snapshots" + verbose_name = _("Create Snapshot") + url = "horizon:admin:server_groups:create_snapshot" + classes = ("ajax-modal", "btn-camera") + + def allowed(self, request, server_group=None): + return True # server_group.status == "available" + + +class UpdateRow(tables.Row): + ajax = True + + def get_data(self, request, server_group_id): + server_group = nova.server_group_get(request, server_group_id) + if not server_group.name: + server_group.name = server_group_id + + return server_group + + +def get_policies(server_group): + policies = ', '.join(server_group.policies) + return policies + + +def get_metadata(server_group): + metadata_items = ['{}:{}'.format(x, y) for x, y in + server_group.metadata.items()] + metadata = ', '.join(metadata_items) + return metadata + + +def get_member_name(request, server_id): + try: + server = api.nova.server_get(request, server_id) + name = server.name + except Exception: + name = None + exceptions.handle(request, _("Unable to retrieve " + "member information.")) + # try and get a URL + try: + url = reverse("horizon:admin:instances:detail", args=(server_id,)) + instance = '%s' % (url, html.escape(name)) + except NoReverseMatch: + instance = name + return instance + + +class ProjectNameColumn(tables.Column): + """Customized column class + + Customized column class that does complex processing on the + server group. + """ + + def get_raw_data(self, server_group): + request = self.table.request + project_id = getattr(server_group, 'project_id', None) + try: + tenant = api.keystone.tenant_get(request, + project_id, + admin=True) + + project_name = getattr(tenant, "name", None) + except Exception: + project_name = "(not found)" + + return project_name + + +class MemberColumn(tables.Column): + """Customized column class + + Customized column class that does complex processing on the instances + in a server group. This was substantially copied + from the volume equivalent. + """ + + def get_raw_data(self, server_group): + request = self.table.request + link = _('%(name)s (%(id)s)') + members = [] + for member in server_group.members: + member_id = member + name = get_member_name(request, member) + vals = {"name": name, "id": member_id} + members.append(link % vals) + return safestring.mark_safe(", ".join(members)) + + +def get_server_group_type(server_group): + return server_group.volume_type if server_group.volume_type != "None" \ + else None + + +class ServerGroupsFilterAction(tables.FilterAction): + def filter(self, table, server_groups, filter_string): + """Naive case-insensitive search.""" + q = filter_string.lower() + return [group for group in server_groups + if q in group.display_name.lower()] + + +class ServerGroupsTable(tables.DataTable): + projectname = ProjectNameColumn("project_name", + verbose_name=_("Project")) + name = tables.Column("name", + verbose_name=_("Group Name"), + link="horizon:admin:server_groups:detail") + policies = tables.Column(get_policies, + verbose_name=_("Policies")) + members = MemberColumn("members", + verbose_name=_("Members")) + metadata = tables.Column(get_metadata, + verbose_name=_("Metadata")) + + class Meta(object): + name = "server_groups" + verbose_name = _("Server Groups") + row_class = UpdateRow + table_actions = ( + CreateServerGroup, DeleteServerGroup, ServerGroupsFilterAction) + row_actions = (DeleteServerGroup,) + + def get_object_display(self, obj): + return obj.name + + +class DetachServerGroup(tables.BatchAction): + name = "detach" + action_type = 'danger' + + @staticmethod + def action_present(count): + return ungettext_lazy( + u"Detach Server Group", + u"Detached Server Groups", + count + ) + + @staticmethod + def action_past(count): + return ungettext_lazy( + u"Detaching Server Group", + u"Detaching Server Groups", + count + ) + + def action(self, request, obj_id): + attachment = self.table.get_object_by_id(obj_id) + api.nova.instance_server_group_detach(request, + attachment.get('server_id', + None), + obj_id) + + def get_success_url(self, request): + return reverse('horizon:admin:server_groups:index') + + +class AttachedInstanceColumn(tables.Column): + """Customized column class + + Customized column class that does complex processing on the attachments + for a server group. + """ + + def get_raw_data(self, attachment): + request = self.table.request + return safestring.mark_safe(get_attachment_name(request, attachment, + True)) + + +class AttachmentsTable(tables.DataTable): + instance = AttachedInstanceColumn(get_member_name, + verbose_name=_("Instance")) + device = tables.Column("device", + verbose_name=_("Device")) + + def get_object_id(self, obj): + return obj['id'] + + def get_object_display(self, attachment): + instance_name = get_attachment_name(self.request, attachment, True) + vals = {"dev": attachment['device'], + "instance_name": html.strip_tags(instance_name)} + return _("%(dev)s on instance %(instance_name)s") % vals + + def get_object_by_id(self, obj_id): + for obj in self.data: + if self.get_object_id(obj) == obj_id: + return obj + raise ValueError('No match found for the id "%s".' % obj_id) + + class Meta(object): + name = "attachments" + verbose_name = _("Attachments") + table_actions = (DetachServerGroup,) + row_actions = (DetachServerGroup,) diff --git a/cgcs_dashboard/dashboards/admin/server_groups/tabs.py b/starlingx_dashboard/dashboards/admin/server_groups/tabs.py similarity index 89% rename from cgcs_dashboard/dashboards/admin/server_groups/tabs.py rename to starlingx_dashboard/dashboards/admin/server_groups/tabs.py index 0c51bf64..6d2bf6ae 100755 --- a/cgcs_dashboard/dashboards/admin/server_groups/tabs.py +++ b/starlingx_dashboard/dashboards/admin/server_groups/tabs.py @@ -1,58 +1,51 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2012 Nebula, 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. -# -# Copyright (c) 2013-2017 Wind River Systems, Inc. -# -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# - - -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ # noqa - -from horizon import exceptions -from horizon import tabs - -from openstack_dashboard.api import nova - - -class OverviewTab(tabs.Tab): - name = _("Overview") - slug = "overview" - template_name = ("admin/server_groups/" - "_detail_overview.html") - - def get_context_data(self, request): - server_group_id = self.tab_group.kwargs['server_group_id'] - try: - server_group = nova.server_group_get(request, server_group_id) - server_group.members_display = [] - for member in server_group.members: - server_group.members_display.append( - dict(id=member, instance=nova.server_get(request, member))) - except Exception: - redirect = reverse('horizon:admin:server_groups:index') - exceptions.handle(self.request, - _('Unable to retrieve server group details.'), - redirect=redirect) - return {'server_group': server_group} - - -class ServerGroupDetailTabs(tabs.TabGroup): - slug = "server_group_details" - tabs = (OverviewTab,) +# Copyright 2012 Nebula, 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. +# +# Copyright (c) 2013-2017 Wind River Systems, Inc. +# + +from django.core.urlresolvers import reverse +from django.utils.translation import ugettext_lazy as _ # noqa + +from horizon import exceptions +from horizon import tabs + +from openstack_dashboard.api import nova + + +class OverviewTab(tabs.Tab): + name = _("Overview") + slug = "overview" + template_name = ("admin/server_groups/" + "_detail_overview.html") + + def get_context_data(self, request): + server_group_id = self.tab_group.kwargs['server_group_id'] + try: + server_group = nova.server_group_get(request, server_group_id) + server_group.members_display = [] + for member in server_group.members: + server_group.members_display.append( + dict(id=member, instance=nova.server_get(request, member))) + except Exception: + redirect = reverse('horizon:admin:server_groups:index') + exceptions.handle(self.request, + _('Unable to retrieve server group details.'), + redirect=redirect) + return {'server_group': server_group} + + +class ServerGroupDetailTabs(tabs.TabGroup): + slug = "server_group_details" + tabs = (OverviewTab,) diff --git a/cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/_attach.html b/starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/_attach.html similarity index 97% rename from cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/_attach.html rename to starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/_attach.html index 462f0ee8..2d04307a 100755 --- a/cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/_attach.html +++ b/starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/_attach.html @@ -1,26 +1,26 @@ -{% extends "horizon/common/_modal_form.html" %} -{% load i18n %} -{% load url from future %} - -{% block form_id %}attach_volume_form{% endblock %} -{% block form_action %}{% url 'horizon:project:volumes:attach' volume.id %}{% endblock %} -{% block form_class %}{{ block.super }} horizontal {% if show_attach %}split_half{% else %} no_split{% endif %}{% endblock %} - -{% block modal_id %}attach_volume_modal{% endblock %} -{% block modal-header %}{% trans "Manage Volume Attachments" %}{% endblock %} - -{% block modal-body %} - {% if show_attach %} -

{% trans "Attach To Instance" %}

-
- {% include "horizon/common/_form_fields.html" %} -
- {% endif %} -{% endblock %} - -{% block modal-footer %} - {% trans "Cancel" %} - {% if show_attach %} - - {% endif %} -{% endblock %} +{% extends "horizon/common/_modal_form.html" %} +{% load i18n %} +{% load url from future %} + +{% block form_id %}attach_volume_form{% endblock %} +{% block form_action %}{% url 'horizon:project:volumes:attach' volume.id %}{% endblock %} +{% block form_class %}{{ block.super }} horizontal {% if show_attach %}split_half{% else %} no_split{% endif %}{% endblock %} + +{% block modal_id %}attach_volume_modal{% endblock %} +{% block modal-header %}{% trans "Manage Volume Attachments" %}{% endblock %} + +{% block modal-body %} + {% if show_attach %} +

{% trans "Attach To Instance" %}

+
+ {% include "horizon/common/_form_fields.html" %} +
+ {% endif %} +{% endblock %} + +{% block modal-footer %} + {% trans "Cancel" %} + {% if show_attach %} + + {% endif %} +{% endblock %} diff --git a/cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/_create.html b/starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/_create.html similarity index 97% rename from cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/_create.html rename to starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/_create.html index 068b8315..4eb86779 100755 --- a/cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/_create.html +++ b/starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/_create.html @@ -1,27 +1,27 @@ -{% extends "horizon/common/_modal_form.html" %} -{% load i18n %} -{% load url from future %} - -{% block form_id %}{% endblock %} -{% block form_action %}{% url 'horizon:admin:server_groups:create' %}?{{ request.GET.urlencode }}{% endblock %} - -{% block modal_id %}create_server_group_modal{% endblock %} -{% block modal-header %}{% trans "Create Server Group" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
- -
-

{% trans "Description" %}:

-

{% trans "From here you can create a new server group" %}

-
-{% endblock %} - -{% block modal-footer %} - {% trans "Cancel" %} - -{% endblock %} +{% extends "horizon/common/_modal_form.html" %} +{% load i18n %} +{% load url from future %} + +{% block form_id %}{% endblock %} +{% block form_action %}{% url 'horizon:admin:server_groups:create' %}?{{ request.GET.urlencode }}{% endblock %} + +{% block modal_id %}create_server_group_modal{% endblock %} +{% block modal-header %}{% trans "Create Server Group" %}{% endblock %} + +{% block modal-body %} +
+
+ {% include "horizon/common/_form_fields.html" %} +
+
+ +
+

{% trans "Description" %}:

+

{% trans "From here you can create a new server group" %}

+
+{% endblock %} + +{% block modal-footer %} + {% trans "Cancel" %} + +{% endblock %} diff --git a/cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/_detail_overview.html b/starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/_detail_overview.html similarity index 96% rename from cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/_detail_overview.html rename to starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/_detail_overview.html index 7b42dcee..79a9bd43 100755 --- a/cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/_detail_overview.html +++ b/starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/_detail_overview.html @@ -1,53 +1,53 @@ -{% load i18n sizeformat parse_date %} -{% load url from future %} - -

{% trans "Server Group Overview" %}: {{server_group.name }}

- -
-

{% trans "Info" %}

-
-
-
{% trans "Name" %}
-
{{ server_group.name }}
-
{% trans "ID" %}
-
{{ server_group.id }}
-
{% trans "Status" %}
-
{{ server_group.status|capfirst }}
-
-
- -
-

{% trans "Members" %}

-
-
- {% for member in server_group.members_display %} -
- {% url 'horizon:admin:instances:detail' member.id as instance_url%} - {{ member.instance.name }} ({{ member.id }}) -
- {% empty %} -
{% trans "No members" %}
- {% endfor %} -
-
- -
-

{% trans "Policies" %}

-
-
- {% for policy in server_group.policies %} -
{{ policy }}
- {% endfor %} -
-
- -
-

{% trans "Metadata" %}

-
-
- {% for key, value in server_group.metadata.items %} -
{{ key }}
-
{{ value }}
- {% endfor %} -
-
+{% load i18n sizeformat parse_date %} +{% load url from future %} + +

{% trans "Server Group Overview" %}: {{server_group.name }}

+ +
+

{% trans "Info" %}

+
+
+
{% trans "Name" %}
+
{{ server_group.name }}
+
{% trans "ID" %}
+
{{ server_group.id }}
+
{% trans "Status" %}
+
{{ server_group.status|capfirst }}
+
+
+ +
+

{% trans "Members" %}

+
+
+ {% for member in server_group.members_display %} +
+ {% url 'horizon:admin:instances:detail' member.id as instance_url%} + {{ member.instance.name }} ({{ member.id }}) +
+ {% empty %} +
{% trans "No members" %}
+ {% endfor %} +
+
+ +
+

{% trans "Policies" %}

+
+
+ {% for policy in server_group.policies %} +
{{ policy }}
+ {% endfor %} +
+
+ +
+

{% trans "Metadata" %}

+
+
+ {% for key, value in server_group.metadata.items %} +
{{ key }}
+
{{ value }}
+ {% endfor %} +
+
diff --git a/cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/attach.html b/starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/attach.html similarity index 96% rename from cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/attach.html rename to starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/attach.html index 4b4dad86..697273f4 100755 --- a/cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/attach.html +++ b/starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/attach.html @@ -1,11 +1,11 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Manage Volume Attachments" %}{% endblock %} - -{% block page_header %} - {% include "horizon/common/_page_header.html" with title=_("Manage Volume Attachments") %} -{% endblock page_header %} - -{% block main %} - {% include 'project/volumes/_attach.html' %} -{% endblock %} +{% extends 'base.html' %} +{% load i18n %} +{% block title %}{% trans "Manage Volume Attachments" %}{% endblock %} + +{% block page_header %} + {% include "horizon/common/_page_header.html" with title=_("Manage Volume Attachments") %} +{% endblock page_header %} + +{% block main %} + {% include 'project/volumes/_attach.html' %} +{% endblock %} diff --git a/cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/create.html b/starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/create.html similarity index 96% rename from cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/create.html rename to starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/create.html index 39b7d120..dc814115 100755 --- a/cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/create.html +++ b/starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/create.html @@ -1,11 +1,11 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Create Server Group" %}{% endblock %} - -{% block page_header %} - {% include "horizon/common/_page_header.html" with title=_("Create a Server Group") %} -{% endblock page_header %} - -{% block main %} - {% include 'project/server_groups/_create.html' %} -{% endblock %} +{% extends 'base.html' %} +{% load i18n %} +{% block title %}{% trans "Create Server Group" %}{% endblock %} + +{% block page_header %} + {% include "horizon/common/_page_header.html" with title=_("Create a Server Group") %} +{% endblock page_header %} + +{% block main %} + {% include 'project/server_groups/_create.html' %} +{% endblock %} diff --git a/cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/detail.html b/starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/detail.html similarity index 95% rename from cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/detail.html rename to starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/detail.html index 3ce02ba3..dcd744f6 100755 --- a/cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/detail.html +++ b/starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/detail.html @@ -1,11 +1,11 @@ -{% extends 'base.html' %} -{% load i18n breadcrumb_nav %} -{% block title %}{% trans "Server Group Details" %}{% endblock %} - -{% block main %} -
-
- {{ tab_group.render }} -
-
-{% endblock %} +{% extends 'base.html' %} +{% load i18n breadcrumb_nav %} +{% block title %}{% trans "Server Group Details" %}{% endblock %} + +{% block main %} +
+
+ {{ tab_group.render }} +
+
+{% endblock %} diff --git a/cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/index.html b/starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/index.html similarity index 96% rename from cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/index.html rename to starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/index.html index 44a03e4c..98978ef2 100755 --- a/cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/index.html +++ b/starlingx_dashboard/dashboards/admin/server_groups/templates/server_groups/index.html @@ -1,11 +1,11 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Server Groups" %}{% endblock %} - -{% block page_header %} - {% include "horizon/common/_page_header.html" with title=_("Server Groups") %} -{% endblock page_header %} - -{% block main %} - {{ table.render }} -{% endblock %} +{% extends 'base.html' %} +{% load i18n %} +{% block title %}{% trans "Server Groups" %}{% endblock %} + +{% block page_header %} + {% include "horizon/common/_page_header.html" with title=_("Server Groups") %} +{% endblock page_header %} + +{% block main %} + {{ table.render }} +{% endblock %} diff --git a/cgcs_dashboard/dashboards/admin/server_groups/urls.py b/starlingx_dashboard/dashboards/admin/server_groups/urls.py similarity index 83% rename from cgcs_dashboard/dashboards/admin/server_groups/urls.py rename to starlingx_dashboard/dashboards/admin/server_groups/urls.py index 5df47c0a..90d2c780 100755 --- a/cgcs_dashboard/dashboards/admin/server_groups/urls.py +++ b/starlingx_dashboard/dashboards/admin/server_groups/urls.py @@ -1,39 +1,32 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2012 Nebula, 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. -# -# Copyright (c) 2013-2017 Wind River Systems, Inc. -# -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# - - -from django.conf.urls import url - -from openstack_dashboard.dashboards.admin.server_groups import views - - -urlpatterns = [ - url(r'^$', views.IndexView.as_view(), name='index'), - url(r'^create/$', views.CreateView.as_view(), name='create'), - url(r'^(?P[^/]+)/attach/$', - views.EditAttachmentsView.as_view(), - name='attach'), - url(r'^(?P[^/]+)/$', - views.DetailView.as_view(), - name='detail') -] +# Copyright 2012 Nebula, 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. +# +# Copyright (c) 2013-2017 Wind River Systems, Inc. +# + +from django.conf.urls import url + +from openstack_dashboard.dashboards.admin.server_groups import views + + +urlpatterns = [ + url(r'^$', views.IndexView.as_view(), name='index'), + url(r'^create/$', views.CreateView.as_view(), name='create'), + url(r'^(?P[^/]+)/attach/$', + views.EditAttachmentsView.as_view(), + name='attach'), + url(r'^(?P[^/]+)/$', + views.DetailView.as_view(), + name='detail') +] diff --git a/cgcs_dashboard/dashboards/admin/server_groups/views.py b/starlingx_dashboard/dashboards/admin/server_groups/views.py similarity index 95% rename from cgcs_dashboard/dashboards/admin/server_groups/views.py rename to starlingx_dashboard/dashboards/admin/server_groups/views.py index e68dcc58..c8850aa9 100755 --- a/cgcs_dashboard/dashboards/admin/server_groups/views.py +++ b/starlingx_dashboard/dashboards/admin/server_groups/views.py @@ -1,154 +1,147 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2012 Nebula, 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. -# -# Copyright (c) 2013-2017 Wind River Systems, Inc. -# -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# - - -""" -Views for managing server groups. -""" - -from django.core.urlresolvers import reverse_lazy # noqa -from django.utils.translation import ugettext_lazy as _ # noqa - -from horizon import exceptions -from horizon import forms -from horizon import tables -from horizon import tabs - -from openstack_dashboard import api -from openstack_dashboard.usage import quotas - -from openstack_dashboard.dashboards.admin.server_groups \ - import forms as admin_forms - -from openstack_dashboard.dashboards.admin.server_groups \ - import tables as admin_tables -from openstack_dashboard.dashboards.admin.server_groups \ - import tabs as admin_tabs - - -# server groups don't currently support pagination -class IndexView(tables.DataTableView): - table_class = admin_tables.ServerGroupsTable - template_name = 'admin/server_groups/index.html' - page_title = _("Server Groups") - - def get_data(self): - try: - server_groups = api.nova.server_group_list( - self.request) - except Exception: - server_groups = [] - exceptions.handle(self.request, - _('Unable to retrieve server groups.')) - return server_groups - - -class DetailView(tabs.TabView): - tab_group_class = admin_tabs.ServerGroupDetailTabs - template_name = 'admin/server_groups/detail.html' - page_title = 'Server Group Details' - - -class CreateView(forms.ModalFormView): - form_class = admin_forms.CreateForm - template_name = 'admin/server_groups/create.html' - success_url = reverse_lazy("horizon:admin:server_groups:index") - - def get_context_data(self, **kwargs): - context = super(CreateView, self).get_context_data(**kwargs) - try: - context['usages'] = quotas.tenant_limit_usages(self.request) - except Exception: - exceptions.handle(self.request) - return context - - -class EditAttachmentsView(tables.DataTableView, forms.ModalFormView): - table_class = admin_tables.AttachmentsTable - form_class = admin_forms.AttachForm - template_name = 'admin/server_groups/attach.html' - success_url = reverse_lazy("horizon:admin:server_groups:index") - - def get_object(self): - if not hasattr(self, "_object"): - volume_id = self.kwargs['volume_id'] - try: - self._object = api.cinder.volume_get(self.request, volume_id) - except Exception: - self._object = None - exceptions.handle(self.request, - _('Unable to retrieve volume information.')) - return self._object - - def get_data(self): - try: - volumes = self.get_object() - attachments = [att for att in volumes.attachments if att] - except Exception: - attachments = [] - exceptions.handle(self.request, - _('Unable to retrieve volume information.')) - return attachments - - def get_initial(self): - try: - instances, has_more = api.nova.server_list(self.request) - except Exception: - instances = [] - exceptions.handle(self.request, - _("Unable to retrieve attachment information.")) - return {'volume': self.get_object(), - 'instances': instances} - - def get_form(self): - if not hasattr(self, "_form"): - form_class = self.get_form_class() - self._form = super(EditAttachmentsView, self).get_form(form_class) - return self._form - - def get_context_data(self, **kwargs): - context = super(EditAttachmentsView, self).get_context_data(**kwargs) - context['form'] = self.get_form() - volume = self.get_object() - if volume and volume.status == 'available': - context['show_attach'] = True - else: - context['show_attach'] = False - context['volume'] = volume - if self.request.is_ajax(): - context['hide'] = True - return context - - def get(self, request, *args, **kwargs): - # Table action handling - handled = self.construct_tables() - if handled: - return handled - return self.render_to_response(self.get_context_data(**kwargs)) - - def post(self, request, *args, **kwargs): - form = self.get_form() - if form.is_valid(): - return self.form_valid(form) - else: - return self.get(request, *args, **kwargs) +# Copyright 2012 Nebula, 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. +# +# Copyright (c) 2013-2017 Wind River Systems, Inc. +# + +""" +Views for managing server groups. +""" + +from django.core.urlresolvers import reverse_lazy # noqa +from django.utils.translation import ugettext_lazy as _ # noqa + +from horizon import exceptions +from horizon import forms +from horizon import tables +from horizon import tabs + +from openstack_dashboard import api +from openstack_dashboard.usage import quotas + +from openstack_dashboard.dashboards.admin.server_groups \ + import forms as admin_forms + +from openstack_dashboard.dashboards.admin.server_groups \ + import tables as admin_tables +from openstack_dashboard.dashboards.admin.server_groups \ + import tabs as admin_tabs + + +# server groups don't currently support pagination +class IndexView(tables.DataTableView): + table_class = admin_tables.ServerGroupsTable + template_name = 'admin/server_groups/index.html' + page_title = _("Server Groups") + + def get_data(self): + try: + server_groups = api.nova.server_group_list( + self.request, all_projects=True) + except Exception: + server_groups = [] + exceptions.handle(self.request, + _('Unable to retrieve server groups.')) + return server_groups + + +class DetailView(tabs.TabView): + tab_group_class = admin_tabs.ServerGroupDetailTabs + template_name = 'admin/server_groups/detail.html' + page_title = 'Server Group Details' + + +class CreateView(forms.ModalFormView): + form_class = admin_forms.CreateForm + template_name = 'admin/server_groups/create.html' + success_url = reverse_lazy("horizon:admin:server_groups:index") + + def get_context_data(self, **kwargs): + context = super(CreateView, self).get_context_data(**kwargs) + try: + context['usages'] = quotas.tenant_limit_usages(self.request) + except Exception: + exceptions.handle(self.request) + return context + + +class EditAttachmentsView(tables.DataTableView, forms.ModalFormView): + table_class = admin_tables.AttachmentsTable + form_class = admin_forms.AttachForm + template_name = 'admin/server_groups/attach.html' + success_url = reverse_lazy("horizon:admin:server_groups:index") + + def get_object(self): + if not hasattr(self, "_object"): + volume_id = self.kwargs['volume_id'] + try: + self._object = api.cinder.volume_get(self.request, volume_id) + except Exception: + self._object = None + exceptions.handle(self.request, + _('Unable to retrieve volume information.')) + return self._object + + def get_data(self): + try: + volumes = self.get_object() + attachments = [att for att in volumes.attachments if att] + except Exception: + attachments = [] + exceptions.handle(self.request, + _('Unable to retrieve volume information.')) + return attachments + + def get_initial(self): + try: + instances, has_more = api.nova.server_list(self.request) + except Exception: + instances = [] + exceptions.handle(self.request, + _("Unable to retrieve attachment information.")) + return {'volume': self.get_object(), + 'instances': instances} + + def get_form(self): + if not hasattr(self, "_form"): + form_class = self.get_form_class() + self._form = super(EditAttachmentsView, self).get_form(form_class) + return self._form + + def get_context_data(self, **kwargs): + context = super(EditAttachmentsView, self).get_context_data(**kwargs) + context['form'] = self.get_form() + volume = self.get_object() + if volume and volume.status == 'available': + context['show_attach'] = True + else: + context['show_attach'] = False + context['volume'] = volume + if self.request.is_ajax(): + context['hide'] = True + return context + + def get(self, request, *args, **kwargs): + # Table action handling + handled = self.construct_tables() + if handled: + return handled + return self.render_to_response(self.get_context_data(**kwargs)) + + def post(self, request, *args, **kwargs): + form = self.get_form() + if form.is_valid(): + return self.form_valid(form) + else: + return self.get(request, *args, **kwargs) diff --git a/cgcs_dashboard/dashboards/admin/software_management/__init__.py b/starlingx_dashboard/dashboards/admin/software_management/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/software_management/__init__.py rename to starlingx_dashboard/dashboards/admin/software_management/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/software_management/forms.py b/starlingx_dashboard/dashboards/admin/software_management/forms.py similarity index 88% rename from cgcs_dashboard/dashboards/admin/software_management/forms.py rename to starlingx_dashboard/dashboards/admin/software_management/forms.py index 448a43c9..60a87dbf 100755 --- a/cgcs_dashboard/dashboards/admin/software_management/forms.py +++ b/starlingx_dashboard/dashboards/admin/software_management/forms.py @@ -1,9 +1,7 @@ # # Copyright (c) 2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # import logging @@ -14,7 +12,7 @@ from django.utils.translation import ugettext_lazy as _ from horizon import exceptions from horizon import forms from horizon import messages -from openstack_dashboard import api +from starlingx_dashboard import api as stx_api LOG = logging.getLogger(__name__) @@ -41,7 +39,7 @@ class UploadPatchForm(forms.SelfHandlingForm): for f in request.FILES.getlist('patch_files'): try: success_responses.append( - api.patch.upload_patch(request, f, f.name)) + stx_api.patch.upload_patch(request, f, f.name)) except Exception as ex: failure_responses.append(str(ex)) @@ -125,10 +123,10 @@ class CreatePatchStrategyForm(forms.SelfHandlingForm): label=_("Maximum Parallel Compute Hosts"), initial=2, min_value=2, - max_value=10, + max_value=100, required=True, error_messages={'invalid': _('Maximum Parallel Compute Hosts must be ' - 'between 2 and 10.')}, + 'between 2 and 100.')}, widget=forms.TextInput( attrs={ 'class': 'switched', @@ -151,16 +149,16 @@ class CreatePatchStrategyForm(forms.SelfHandlingForm): def __init__(self, request, *args, **kwargs): super(CreatePatchStrategyForm, self).__init__(request, *args, **kwargs) - cinder_backend = api.sysinv.get_cinder_backend(request) - if api.sysinv.CINDER_BACKEND_CEPH not in cinder_backend: + cinder_backend = stx_api.sysinv.get_cinder_backend(request) + if stx_api.sysinv.CINDER_BACKEND_CEPH not in cinder_backend: del self.fields['storage_apply_type'] - system_type = api.sysinv.get_system_type(request) - if system_type == api.sysinv.SYSTEM_TYPE_AIO: + system_type = stx_api.sysinv.get_system_type(request) + if system_type == stx_api.sysinv.SYSTEM_TYPE_AIO: del self.fields['controller_apply_type'] self.fields['compute_apply_type'].choices = self.AIO_APPLY_TYPES - if api.sysinv.is_system_mode_simplex(request): + if stx_api.sysinv.is_system_mode_simplex(request): self.fields['default_instance_action'].choices = \ self.SIMPLEX_INSTANCE_ACTIONS @@ -170,8 +168,8 @@ class CreatePatchStrategyForm(forms.SelfHandlingForm): def handle(self, request, data): try: - response = api.vim.create_strategy( - request, api.vim.STRATEGY_SW_PATCH, + response = stx_api.vim.create_strategy( + request, stx_api.vim.STRATEGY_SW_PATCH, data.get('controller_apply_type', 'ignore'), data.get('storage_apply_type', 'ignore'), 'ignore', data['compute_apply_type'], @@ -240,8 +238,8 @@ class CreateUpgradeStrategyForm(forms.SelfHandlingForm): def __init__(self, request, *args, **kwargs): super(CreateUpgradeStrategyForm, self).__init__(request, *args, **kwargs) - cinder_backend = api.sysinv.get_cinder_backend(request) - if api.sysinv.CINDER_BACKEND_CEPH not in cinder_backend: + cinder_backend = stx_api.sysinv.get_cinder_backend(request) + if stx_api.sysinv.CINDER_BACKEND_CEPH not in cinder_backend: del self.fields['storage_apply_type'] def clean(self): @@ -250,8 +248,8 @@ class CreateUpgradeStrategyForm(forms.SelfHandlingForm): def handle(self, request, data): try: - response = api.vim.create_strategy( - request, api.vim.STRATEGY_SW_UPGRADE, 'ignore', + response = stx_api.vim.create_strategy( + request, stx_api.vim.STRATEGY_SW_UPGRADE, 'ignore', data.get('storage_apply_type', 'ignore'), 'ignore', data['compute_apply_type'], data['max_parallel_compute_hosts'], diff --git a/cgcs_dashboard/dashboards/admin/software_management/panel.py b/starlingx_dashboard/dashboards/admin/software_management/panel.py similarity index 82% rename from cgcs_dashboard/dashboards/admin/software_management/panel.py rename to starlingx_dashboard/dashboards/admin/software_management/panel.py index 59db8258..e1c533e9 100755 --- a/cgcs_dashboard/dashboards/admin/software_management/panel.py +++ b/starlingx_dashboard/dashboards/admin/software_management/panel.py @@ -1,9 +1,7 @@ # # Copyright (c) 2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # from django.utils.translation import ugettext_lazy as _ diff --git a/cgcs_dashboard/dashboards/admin/software_management/tables.py b/starlingx_dashboard/dashboards/admin/software_management/tables.py similarity index 91% rename from cgcs_dashboard/dashboards/admin/software_management/tables.py rename to starlingx_dashboard/dashboards/admin/software_management/tables.py index e6577543..f374d4ec 100755 --- a/cgcs_dashboard/dashboards/admin/software_management/tables.py +++ b/starlingx_dashboard/dashboards/admin/software_management/tables.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # import datetime @@ -16,7 +14,7 @@ from django.utils.translation import ungettext_lazy from horizon import messages from horizon import tables -from openstack_dashboard import api +from starlingx_dashboard import api as stx_api LOG = logging.getLogger(__name__) @@ -56,7 +54,7 @@ class ApplyPatch(tables.BatchAction): def handle(self, table, request, obj_ids): try: - result = api.patch.patch_apply_req(request, obj_ids) + result = stx_api.patch.patch_apply_req(request, obj_ids) messages.success(request, result) except Exception as ex: messages.error(request, ex.message) @@ -96,7 +94,7 @@ class RemovePatch(tables.BatchAction): def handle(self, table, request, obj_ids): try: - result = api.patch.patch_remove_req(request, obj_ids) + result = stx_api.patch.patch_remove_req(request, obj_ids) messages.success(request, result) except Exception as ex: messages.error(request, ex.message) @@ -130,7 +128,7 @@ class DeletePatch(tables.BatchAction): def handle(self, table, request, obj_ids): try: - result = api.patch.patch_delete_req(request, obj_ids) + result = stx_api.patch.patch_delete_req(request, obj_ids) messages.success(request, result) except Exception as ex: messages.error(request, ex.message) @@ -140,7 +138,7 @@ class UpdatePatchRow(tables.Row): ajax = True def get_data(self, request, patch_id): - patch = api.patch.get_patch(request, patch_id) + patch = stx_api.patch.get_patch(request, patch_id) return patch @@ -205,14 +203,14 @@ class PatchesTable(tables.DataTable): # Patch Orchestration def get_cached_strategy(request, strategy_name, table): - if api.vim.STRATEGY_SW_PATCH == strategy_name: + if stx_api.vim.STRATEGY_SW_PATCH == strategy_name: if 'patchstrategy' not in table.kwargs: - table.kwargs['patchstrategy'] = api.vim.get_strategy( + table.kwargs['patchstrategy'] = stx_api.vim.get_strategy( request, strategy_name) return table.kwargs['patchstrategy'] - elif api.vim.STRATEGY_SW_UPGRADE == strategy_name: + elif stx_api.vim.STRATEGY_SW_UPGRADE == strategy_name: if 'upgradestrategy' not in table.kwargs: - table.kwargs['upgradestrategy'] = api.vim.get_strategy( + table.kwargs['upgradestrategy'] = stx_api.vim.get_strategy( request, strategy_name) return table.kwargs['upgradestrategy'] @@ -225,11 +223,11 @@ class CreateStrategy(tables.LinkAction): def allowed(self, request, datum): try: # Only a single strategy (patch or upgrade) can exist at a time. - strategy = get_cached_strategy(request, api.vim.STRATEGY_SW_PATCH, + strategy = get_cached_strategy(request, stx_api.vim.STRATEGY_SW_PATCH, self.table) if not strategy: strategy = get_cached_strategy(request, - api.vim.STRATEGY_SW_UPGRADE, + stx_api.vim.STRATEGY_SW_UPGRADE, self.table) classes = [c for c in self.classes if c != "disabled"] @@ -284,7 +282,7 @@ class DeleteStrategy(tables.Action): def single(self, table, request, obj_id): try: - result = api.vim.delete_strategy(request, self.strategy_name, + result = stx_api.vim.delete_strategy(request, self.strategy_name, self.force) if result: messages.success(request, "Strategy Deleted") @@ -297,12 +295,12 @@ class DeleteStrategy(tables.Action): class DeletePatchStrategy(DeleteStrategy): name = "delete_patch_strategy" - strategy_name = api.vim.STRATEGY_SW_PATCH + strategy_name = stx_api.vim.STRATEGY_SW_PATCH class DeleteUpgradeStrategy(DeleteStrategy): name = "delete_upgrade_strategy" - strategy_name = api.vim.STRATEGY_SW_UPGRADE + strategy_name = stx_api.vim.STRATEGY_SW_UPGRADE class ApplyStrategy(tables.Action): @@ -333,7 +331,7 @@ class ApplyStrategy(tables.Action): def single(self, table, request, obj_id): try: - result = api.vim.apply_strategy(request, self.strategy_name) + result = stx_api.vim.apply_strategy(request, self.strategy_name) if result: messages.success(request, "Strategy apply in progress") else: @@ -345,12 +343,12 @@ class ApplyStrategy(tables.Action): class ApplyPatchStrategy(ApplyStrategy): name = "apply_patch_strategy" - strategy_name = api.vim.STRATEGY_SW_PATCH + strategy_name = stx_api.vim.STRATEGY_SW_PATCH class ApplyUpgradeStrategy(ApplyStrategy): name = "apply_upgrade_strategy" - strategy_name = api.vim.STRATEGY_SW_UPGRADE + strategy_name = stx_api.vim.STRATEGY_SW_UPGRADE class AbortStrategy(tables.Action): @@ -382,7 +380,7 @@ class AbortStrategy(tables.Action): def single(self, table, request, obj_id): try: - result = api.vim.abort_strategy(request, self.strategy_name) + result = stx_api.vim.abort_strategy(request, self.strategy_name) if result: messages.success(request, "Strategy abort in progress") else: @@ -394,12 +392,12 @@ class AbortStrategy(tables.Action): class AbortPatchStrategy(AbortStrategy): name = "abort_patch_strategy" - strategy_name = api.vim.STRATEGY_SW_PATCH + strategy_name = stx_api.vim.STRATEGY_SW_PATCH class AbortUpgradeStrategy(AbortStrategy): name = "abort_upgrade_strategy" - strategy_name = api.vim.STRATEGY_SW_UPGRADE + strategy_name = stx_api.vim.STRATEGY_SW_UPGRADE class ApplyStage(tables.BatchAction): @@ -428,7 +426,7 @@ class ApplyStage(tables.BatchAction): or strategy.state in ['aborted', 'aborting']: return False # Loop through the stages and ensure this is the first in 'line' - stages = api.vim.get_stages(request, self.strategy_name) + stages = stx_api.vim.get_stages(request, self.strategy_name) for s in stages: if s.phase.phase_name == stage.phase.phase_name and \ s.stage_id == stage.stage_id and \ @@ -444,7 +442,7 @@ class ApplyStage(tables.BatchAction): for obj_id in obj_ids: try: stage_id = obj_id.split('-', 1)[1] - result = api.vim.apply_strategy(request, self.strategy_name, + result = stx_api.vim.apply_strategy(request, self.strategy_name, stage_id) if result is None: messages.error(request, "Strategy stage %s apply failed" % @@ -460,12 +458,12 @@ class ApplyStage(tables.BatchAction): class ApplyPatchStage(ApplyStage): name = "apply_patch_stage" - strategy_name = api.vim.STRATEGY_SW_PATCH + strategy_name = stx_api.vim.STRATEGY_SW_PATCH class ApplyUpgradeStage(ApplyStage): name = "apply_upgrade_stage" - strategy_name = api.vim.STRATEGY_SW_UPGRADE + strategy_name = stx_api.vim.STRATEGY_SW_UPGRADE class AbortStage(tables.BatchAction): @@ -505,7 +503,7 @@ class AbortStage(tables.BatchAction): for obj_id in obj_ids: try: stage_id = obj_id.split('-', 1)[1] - result = api.vim.abort_strategy(request, self.strategy_name, + result = stx_api.vim.abort_strategy(request, self.strategy_name, stage_id) if result is None: messages.error(request, @@ -521,12 +519,12 @@ class AbortStage(tables.BatchAction): class AbortPatchStage(AbortStage): name = "abort_patch_stage" - strategy_name = api.vim.STRATEGY_SW_PATCH + strategy_name = stx_api.vim.STRATEGY_SW_PATCH class AbortUpgradeStage(AbortStage): name = "abort_upgrade_stage" - strategy_name = api.vim.STRATEGY_SW_UPGRADE + strategy_name = stx_api.vim.STRATEGY_SW_UPGRADE def get_current_step_time(stage): @@ -600,16 +598,16 @@ class UpdateStageRow(tables.Row): def get_data(self, request, row_id): phase = row_id.split('-', 1)[0] stage_id = row_id.split('-', 1)[1] - stage = api.vim.get_stage(request, self.strategy_name, phase, stage_id) + stage = stx_api.vim.get_stage(request, self.strategy_name, phase, stage_id) return stage class UpdatePatchStageRow(UpdateStageRow): - strategy_name = api.vim.STRATEGY_SW_PATCH + strategy_name = stx_api.vim.STRATEGY_SW_PATCH class UpdateUpgradeStageRow(UpdateStageRow): - strategy_name = api.vim.STRATEGY_SW_UPGRADE + strategy_name = stx_api.vim.STRATEGY_SW_UPGRADE class StagesTable(tables.DataTable): @@ -690,7 +688,7 @@ class UpdateStepRow(tables.Row): phase_name = row_id.split('-', 2)[0] stage_id = row_id.split('-', 2)[1] step_id = row_id.split('-', 2)[2] - step = api.vim.get_step( + step = stx_api.vim.get_step( request, self.strategy_name, phase_name, stage_id, step_id) step.phase_name = phase_name step.stage_id = stage_id @@ -698,11 +696,11 @@ class UpdateStepRow(tables.Row): class UpdatePatchStepRow(UpdateStepRow): - strategy_name = api.vim.STRATEGY_SW_PATCH + strategy_name = stx_api.vim.STRATEGY_SW_PATCH class UpdateUpgradeStepRow(UpdateStepRow): - strategy_name = api.vim.STRATEGY_SW_UPGRADE + strategy_name = stx_api.vim.STRATEGY_SW_UPGRADE class StepsTable(tables.DataTable): diff --git a/cgcs_dashboard/dashboards/admin/software_management/tabs.py b/starlingx_dashboard/dashboards/admin/software_management/tabs.py similarity index 78% rename from cgcs_dashboard/dashboards/admin/software_management/tabs.py rename to starlingx_dashboard/dashboards/admin/software_management/tabs.py index 5fbb7b1e..770627ce 100755 --- a/cgcs_dashboard/dashboards/admin/software_management/tabs.py +++ b/starlingx_dashboard/dashboards/admin/software_management/tabs.py @@ -1,12 +1,9 @@ # # Copyright (c) 2013-2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # - import logging from cgtsclient.common import constants @@ -14,8 +11,8 @@ from django.utils.translation import ugettext_lazy as _ from horizon import exceptions from horizon import tabs -from openstack_dashboard import api -from openstack_dashboard.dashboards.admin.software_management import \ +from starlingx_dashboard import api as stx_api +from starlingx_dashboard.dashboards.admin.software_management import \ tables as toplevel_tables LOG = logging.getLogger(__name__) @@ -32,7 +29,7 @@ class PatchesTab(tabs.TableTab): phosts = [] try: - phosts = api.patch.get_hosts(request) + phosts = stx_api.patch.get_hosts(request) except Exception: exceptions.handle(request, _('Unable to retrieve host list.')) @@ -46,7 +43,7 @@ class PatchesTab(tabs.TableTab): request = self.request patches = [] try: - patches = api.patch.get_patches(request) + patches = stx_api.patch.get_patches(request) except Exception: exceptions.handle(self.request, _('Unable to retrieve patch list.')) @@ -65,7 +62,7 @@ class PatchOrchestrationTab(tabs.TableTab): strategy = None try: - strategy = api.vim.get_strategy(request, api.vim.STRATEGY_SW_PATCH) + strategy = stx_api.vim.get_strategy(request, stx_api.vim.STRATEGY_SW_PATCH) except Exception as ex: LOG.exception(ex) exceptions.handle(request, @@ -78,13 +75,18 @@ class PatchOrchestrationTab(tabs.TableTab): request = self.request stages = [] try: - stages = api.vim.get_stages(request, api.vim.STRATEGY_SW_PATCH) + stages = stx_api.vim.get_stages(request, stx_api.vim.STRATEGY_SW_PATCH) except Exception: exceptions.handle(self.request, _('Unable to retrieve stages list.')) return stages + def allowed(self, request): + if request.user.services_region == 'SystemController': + return False + return True + class UpgradeOrchestrationTab(tabs.TableTab): table_classes = (toplevel_tables.UpgradeStagesTable,) @@ -98,8 +100,8 @@ class UpgradeOrchestrationTab(tabs.TableTab): strategy = None try: - strategy = api.vim.get_strategy(request, - api.vim.STRATEGY_SW_UPGRADE) + strategy = stx_api.vim.get_strategy(request, + stx_api.vim.STRATEGY_SW_UPGRADE) except Exception as ex: LOG.exception(ex) exceptions.handle(request, @@ -112,7 +114,7 @@ class UpgradeOrchestrationTab(tabs.TableTab): request = self.request stages = [] try: - stages = api.vim.get_stages(request, api.vim.STRATEGY_SW_UPGRADE) + stages = stx_api.vim.get_stages(request, stx_api.vim.STRATEGY_SW_UPGRADE) except Exception: exceptions.handle(self.request, _('Unable to retrieve stages list.')) @@ -120,8 +122,10 @@ class UpgradeOrchestrationTab(tabs.TableTab): return stages def allowed(self, request): + if request.user.services_region == 'SystemController': + return False # Upgrade orchestration not available on CPE deployments - systems = api.sysinv.system_list(request) + systems = stx_api.sysinv.system_list(request) system_type = systems[0].to_dict().get('system_type') if system_type == constants.TS_AIO: return False diff --git a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_create_patch_strategy.html b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_create_patch_strategy.html similarity index 97% rename from cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_create_patch_strategy.html rename to starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_create_patch_strategy.html index c9ee298e..32b796e3 100755 --- a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_create_patch_strategy.html +++ b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_create_patch_strategy.html @@ -1,35 +1,35 @@ -{% extends "horizon/common/_modal_form.html" %} -{% load i18n %} - -{% block form_action %}{% url 'horizon:admin:software_management:createpatchstrategy' %}{% endblock %} - -{% block modal-header %}{% trans "Create Patch Strategy" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
-

{% trans "Description:" %}

-

- {% trans "Create a strategy to specify how the system should be patched." %} -

-

- {% trans "There are " %}{{ alarms }}{% trans " active alarms on the system, " %}{{ affecting }}{% trans " of which are management affecting." %} -
- {% if affecting > 0 %} - {% trans "These management affecting alarms must be addressed before orchestration will be successful" %} - {% else %} - {% trans "These alarms can be ignored by choosing relaxed alarm restrictions." %} - {% endif %} -

- -
-{% endblock %} - -{% block modal-footer %} - Cancel - -{% endblock %} +{% extends "horizon/common/_modal_form.html" %} +{% load i18n %} + +{% block form_action %}{% url 'horizon:admin:software_management:createpatchstrategy' %}{% endblock %} + +{% block modal-header %}{% trans "Create Patch Strategy" %}{% endblock %} + +{% block modal-body %} +
+
+ {% include "horizon/common/_form_fields.html" %} +
+
+
+

{% trans "Description:" %}

+

+ {% trans "Create a strategy to specify how the system should be patched." %} +

+

+ {% trans "There are " %}{{ alarms }}{% trans " active alarms on the system, " %}{{ affecting }}{% trans " of which are management affecting." %} +
+ {% if affecting > 0 %} + {% trans "These management affecting alarms must be addressed before orchestration will be successful" %} + {% else %} + {% trans "These alarms can be ignored by choosing relaxed alarm restrictions." %} + {% endif %} +

+ +
+{% endblock %} + +{% block modal-footer %} + Cancel + +{% endblock %} diff --git a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_create_upgrade_strategy.html b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_create_upgrade_strategy.html similarity index 97% rename from cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_create_upgrade_strategy.html rename to starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_create_upgrade_strategy.html index 90d6fa4e..681a031c 100755 --- a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_create_upgrade_strategy.html +++ b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_create_upgrade_strategy.html @@ -1,35 +1,35 @@ -{% extends "horizon/common/_modal_form.html" %} -{% load i18n %} - -{% block form_action %}{% url 'horizon:admin:software_management:createupgradestrategy' %}{% endblock %} - -{% block modal-header %}{% trans "Create Upgrade Strategy" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
-

{% trans "Description:" %}

-

- {% trans "Create a strategy to specify how the system should be upgraded." %} -

-

- {% trans "There are " %}{{ alarms }}{% trans " active alarms on the system, " %}{{ affecting }}{% trans " of which are management affecting." %} -
- {% if affecting > 0 %} - {% trans "These management affecting alarms must be addressed before orchestration will be successful" %} - {% else %} - {% trans "These alarms can be ignored by choosing relaxed alarm restrictions." %} - {% endif %} -

- -
-{% endblock %} - -{% block modal-footer %} - Cancel - -{% endblock %} +{% extends "horizon/common/_modal_form.html" %} +{% load i18n %} + +{% block form_action %}{% url 'horizon:admin:software_management:createupgradestrategy' %}{% endblock %} + +{% block modal-header %}{% trans "Create Upgrade Strategy" %}{% endblock %} + +{% block modal-body %} +
+
+ {% include "horizon/common/_form_fields.html" %} +
+
+
+

{% trans "Description:" %}

+

+ {% trans "Create a strategy to specify how the system should be upgraded." %} +

+

+ {% trans "There are " %}{{ alarms }}{% trans " active alarms on the system, " %}{{ affecting }}{% trans " of which are management affecting." %} +
+ {% if affecting > 0 %} + {% trans "These management affecting alarms must be addressed before orchestration will be successful" %} + {% else %} + {% trans "These alarms can be ignored by choosing relaxed alarm restrictions." %} + {% endif %} +

+ +
+{% endblock %} + +{% block modal-footer %} + Cancel + +{% endblock %} diff --git a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_detail_patches.html b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_detail_patches.html similarity index 96% rename from cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_detail_patches.html rename to starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_detail_patches.html index c3797ae7..c98b84fd 100755 --- a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_detail_patches.html +++ b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_detail_patches.html @@ -1,54 +1,54 @@ -{% extends 'base.html' %} -{% load i18n breadcrumb_nav %} -{% block title %}{% trans "Patch Details" %}{% endblock %} - -{% block main %} -

{{patch.patch_id }}

- -
-
-
-

{% trans "Info" %}

-
-
-
{% trans "Patch State" %}
-
{{ patch.patchstate }}
-
{% trans "Platform Release Version" %}
-
{{ patch.sw_version }}
-
{% trans "Reboot-Required" %}
-
{{ patch.reboot_required }}
-
{% trans "Patch Status Code" %}
-
{{ patch.status }}
- {% if patch.unremovable == "Y" %} -
{% trans "Unremovable" %}
-
{% trans "This patch cannot be removed" %}
- {% endif %} -
{% trans "Required Patches" %}
-
{{ patch.requires_display|linebreaks }}
-
-
-
{% trans "Summary" %}
-
{{ patch.summary|linebreaks }}
-
-
-
{% trans "Description" %}
-
{{ patch.description|linebreaks }}
-
-
-
{% trans "Warnings" %}
-
{{ patch.warnings|linebreaks }}
-
-
-
{% trans "Installation Instructions" %}
-
{{ patch.install_instructions|linebreaks }}
-
-
-
{% trans "Contents" %}
-
{{ patch.contents_display|linebreaks }}
-
-
-
-
-{% endblock %} - - +{% extends 'base.html' %} +{% load i18n breadcrumb_nav %} +{% block title %}{% trans "Patch Details" %}{% endblock %} + +{% block main %} +

{{patch.patch_id }}

+ +
+
+
+

{% trans "Info" %}

+
+
+
{% trans "Patch State" %}
+
{{ patch.patchstate }}
+
{% trans "Platform Release Version" %}
+
{{ patch.sw_version }}
+
{% trans "Reboot-Required" %}
+
{{ patch.reboot_required }}
+
{% trans "Patch Status Code" %}
+
{{ patch.status }}
+ {% if patch.unremovable == "Y" %} +
{% trans "Unremovable" %}
+
{% trans "This patch cannot be removed" %}
+ {% endif %} +
{% trans "Required Patches" %}
+
{{ patch.requires_display|linebreaks }}
+
+
+
{% trans "Summary" %}
+
{{ patch.summary|linebreaks }}
+
+
+
{% trans "Description" %}
+
{{ patch.description|linebreaks }}
+
+
+
{% trans "Warnings" %}
+
{{ patch.warnings|linebreaks }}
+
+
+
{% trans "Installation Instructions" %}
+
{{ patch.install_instructions|linebreaks }}
+
+
+
{% trans "Contents" %}
+
{{ patch.contents_display|linebreaks }}
+
+
+
+
+{% endblock %} + + diff --git a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_detail_stage.html b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_detail_stage.html similarity index 95% rename from cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_detail_stage.html rename to starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_detail_stage.html index 7ad5dac4..5e029301 100755 --- a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_detail_stage.html +++ b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_detail_stage.html @@ -1,57 +1,57 @@ -{% extends 'base.html' %} -{% load i18n breadcrumb_nav %} -{% block title %}{% trans "Stage Details" %}{% endblock %} - -{% block main %} -

Stage {{ stage.stage_id }} of {{ stage.phase.phase_name|title }} Phase

- -
-
-
-

{% trans "Info" %}

-
-
-
-
Stage ID
-
{{ stage.stage_id }}
-
Stage Name
-
{{ stage.stage_name }}
-
Total Steps
-
{{ stage.total_steps }}
-
Current Step
-
{{ stage.current_step }}
-
Timeout
-
{{ stage.timeout_display }}
-
Start Date/Time
-
{{ stage.start_date_time }}
-
End Date/Time
-
{{ stage.end_date_time }}
-
Status
- {% if stage.inprogress %} -
{% trans "In Progress" %}
- {% else %} -
{{ stage.result }}
- {% endif %} -
Reason
-
{{ stage.reason }}
-
-
- - {{ steps_table.render }} -
-
-
-{% endblock %} - -{% block js %} - {{ block.super }} - +{% extends 'base.html' %} +{% load i18n breadcrumb_nav %} +{% block title %}{% trans "Stage Details" %}{% endblock %} + +{% block main %} +

Stage {{ stage.stage_id }} of {{ stage.phase.phase_name|title }} Phase

+ +
+
+
+

{% trans "Info" %}

+
+
+
+
Stage ID
+
{{ stage.stage_id }}
+
Stage Name
+
{{ stage.stage_name }}
+
Total Steps
+
{{ stage.total_steps }}
+
Current Step
+
{{ stage.current_step }}
+
Timeout
+
{{ stage.timeout_display }}
+
Start Date/Time
+
{{ stage.start_date_time }}
+
End Date/Time
+
{{ stage.end_date_time }}
+
Status
+ {% if stage.inprogress %} +
{% trans "In Progress" %}
+ {% else %} +
{{ stage.result }}
+ {% endif %} +
Reason
+
{{ stage.reason }}
+
+
+ + {{ steps_table.render }} +
+
+
+{% endblock %} + +{% block js %} + {{ block.super }} + {% endblock %} \ No newline at end of file diff --git a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_patch_orchestration.html b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_patch_orchestration.html similarity index 97% rename from cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_patch_orchestration.html rename to starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_patch_orchestration.html index 036897a1..e6c43a10 100755 --- a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_patch_orchestration.html +++ b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_patch_orchestration.html @@ -1,43 +1,43 @@ -{% load i18n sizeformat %} - -{% block main %} - -
-

{% trans "Patch Strategy" %}

-
-
- - {% if strategy %} -
-
{% trans "Controller Apply Type" %}
-
{{ strategy.controller_apply_type }}
-
{% trans "Storage Apply Type" %}
-
{{ strategy.storage_apply_type }}
-
{% trans "Compute Apply Type" %}
-
{{ strategy.compute_apply_type }}
- {% if strategy.compute_apply_type == "parallel" %} -
{% trans "Maximum Parallel Compute Hosts" %}
-
{{ strategy.max_parallel_compute_hosts }}
- {% endif %} -
{% trans "Default Instance Action" %}
-
{{ strategy.default_instance_action }}
-
{% trans "Alarm Restrictions" %}
-
{{ strategy.alarm_restrictions }}
-
-
-
{% trans "Current Phase" %}
-
{{ strategy.current_phase }}
-
{% trans "Current Phase Completion" %}
-
{{ strategy.current_phase_completion_percentage }}%
-
{% trans "State" %}
-
{{ strategy.state }}
-
- {% else %} - {% trans "No Strategy has been created" %} - {% endif %} -
-
-
- {{ patchstages_table.render }} - -{% endblock %} +{% load i18n sizeformat %} + +{% block main %} + +
+

{% trans "Patch Strategy" %}

+
+
+ + {% if strategy %} +
+
{% trans "Controller Apply Type" %}
+
{{ strategy.controller_apply_type }}
+
{% trans "Storage Apply Type" %}
+
{{ strategy.storage_apply_type }}
+
{% trans "Compute Apply Type" %}
+
{{ strategy.compute_apply_type }}
+ {% if strategy.compute_apply_type == "parallel" %} +
{% trans "Maximum Parallel Compute Hosts" %}
+
{{ strategy.max_parallel_compute_hosts }}
+ {% endif %} +
{% trans "Default Instance Action" %}
+
{{ strategy.default_instance_action }}
+
{% trans "Alarm Restrictions" %}
+
{{ strategy.alarm_restrictions }}
+
+
+
{% trans "Current Phase" %}
+
{{ strategy.current_phase }}
+
{% trans "Current Phase Completion" %}
+
{{ strategy.current_phase_completion_percentage }}%
+
{% trans "State" %}
+
{{ strategy.state }}
+
+ {% else %} + {% trans "No Strategy has been created" %} + {% endif %} +
+
+
+ {{ patchstages_table.render }} + +{% endblock %} diff --git a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_patches.html b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_patches.html similarity index 96% rename from cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_patches.html rename to starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_patches.html index a76c23db..11fbb2bb 100755 --- a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_patches.html +++ b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_patches.html @@ -1,20 +1,20 @@ -{% load i18n sizeformat %} - -{% block main %} -
-
- - {% if patch_current %} - {% trans "System is Patch Current" %} - {% else %} - {% trans "System is Not Patch Current" %} - {% endif %} - -
- - {{ patches_table.render }} -
-{% endblock %} - - - +{% load i18n sizeformat %} + +{% block main %} +
+
+ + {% if patch_current %} + {% trans "System is Patch Current" %} + {% else %} + {% trans "System is Not Patch Current" %} + {% endif %} + +
+ + {{ patches_table.render }} +
+{% endblock %} + + + diff --git a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_upgrade_orchestration.html b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_upgrade_orchestration.html similarity index 97% rename from cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_upgrade_orchestration.html rename to starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_upgrade_orchestration.html index 8dc02343..60eaaf51 100755 --- a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_upgrade_orchestration.html +++ b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_upgrade_orchestration.html @@ -1,39 +1,39 @@ -{% load i18n sizeformat %} - -{% block main %} - -
-

{% trans "Upgrade Strategy" %}

-
-
- - {% if strategy %} -
-
{% trans "Storage Apply Type" %}
-
{{ strategy.storage_apply_type }}
-
{% trans "Compute Apply Type" %}
-
{{ strategy.compute_apply_type }}
- {% if strategy.compute_apply_type == "parallel" %} -
{% trans "Maximum Parallel Compute Hosts" %}
-
{{ strategy.max_parallel_compute_hosts }}
- {% endif %} -
{% trans "Alarm Restrictions" %}
-
{{ strategy.alarm_restrictions }}
-
-
-
{% trans "Current Phase" %}
-
{{ strategy.current_phase }}
-
{% trans "Current Phase Completion" %}
-
{{ strategy.current_phase_completion_percentage }}%
-
{% trans "State" %}
-
{{ strategy.state }}
-
- {% else %} - {% trans "No Strategy has been created" %} - {% endif %} -
-
-
- {{ upgradestages_table.render }} - -{% endblock %} +{% load i18n sizeformat %} + +{% block main %} + +
+

{% trans "Upgrade Strategy" %}

+
+
+ + {% if strategy %} +
+
{% trans "Storage Apply Type" %}
+
{{ strategy.storage_apply_type }}
+
{% trans "Compute Apply Type" %}
+
{{ strategy.compute_apply_type }}
+ {% if strategy.compute_apply_type == "parallel" %} +
{% trans "Maximum Parallel Compute Hosts" %}
+
{{ strategy.max_parallel_compute_hosts }}
+ {% endif %} +
{% trans "Alarm Restrictions" %}
+
{{ strategy.alarm_restrictions }}
+
+
+
{% trans "Current Phase" %}
+
{{ strategy.current_phase }}
+
{% trans "Current Phase Completion" %}
+
{{ strategy.current_phase_completion_percentage }}%
+
{% trans "State" %}
+
{{ strategy.state }}
+
+ {% else %} + {% trans "No Strategy has been created" %} + {% endif %} +
+
+
+ {{ upgradestages_table.render }} + +{% endblock %} diff --git a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_upload_patch.html b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_upload_patch.html similarity index 96% rename from cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_upload_patch.html rename to starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_upload_patch.html index c95491ee..601a7214 100755 --- a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/_upload_patch.html +++ b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/_upload_patch.html @@ -1,27 +1,27 @@ -{% extends "horizon/common/_modal_form.html" %} -{% load i18n %} - -{% block form_action %}{% url 'horizon:admin:software_management:patchupload' %}{% endblock %} -{% block form_attrs %}enctype="multipart/form-data"{% endblock %} - -{% block modal-header %}{% trans "Upload Patches" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
-

{% trans "Description:" %}

-

- {% trans "Specify one or more patch files to upload to the Patching Service." %} -

- -
-{% endblock %} - -{% block modal-footer %} - Cancel - -{% endblock %} +{% extends "horizon/common/_modal_form.html" %} +{% load i18n %} + +{% block form_action %}{% url 'horizon:admin:software_management:patchupload' %}{% endblock %} +{% block form_attrs %}enctype="multipart/form-data"{% endblock %} + +{% block modal-header %}{% trans "Upload Patches" %}{% endblock %} + +{% block modal-body %} +
+
+ {% include "horizon/common/_form_fields.html" %} +
+
+
+

{% trans "Description:" %}

+

+ {% trans "Specify one or more patch files to upload to the Patching Service." %} +

+ +
+{% endblock %} + +{% block modal-footer %} + Cancel + +{% endblock %} diff --git a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/create_patch_strategy.html b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/create_patch_strategy.html similarity index 97% rename from cgcs_dashboard/dashboards/admin/software_management/templates/software_management/create_patch_strategy.html rename to starlingx_dashboard/dashboards/admin/software_management/templates/software_management/create_patch_strategy.html index 819619c0..7c56a935 100755 --- a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/create_patch_strategy.html +++ b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/create_patch_strategy.html @@ -1,11 +1,11 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Create Patch Strategy" %}{% endblock %} - -{% block page_header %} - {% include "horizon/common/_page_header.html" with title=_("Create Patch Strategy") %} -{% endblock page_header %} - -{% block main %} - {% include 'project/software_management/_create_patch_strategy.html' %} -{% endblock %} +{% extends 'base.html' %} +{% load i18n %} +{% block title %}{% trans "Create Patch Strategy" %}{% endblock %} + +{% block page_header %} + {% include "horizon/common/_page_header.html" with title=_("Create Patch Strategy") %} +{% endblock page_header %} + +{% block main %} + {% include 'project/software_management/_create_patch_strategy.html' %} +{% endblock %} diff --git a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/create_upgrade_strategy.html b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/create_upgrade_strategy.html similarity index 97% rename from cgcs_dashboard/dashboards/admin/software_management/templates/software_management/create_upgrade_strategy.html rename to starlingx_dashboard/dashboards/admin/software_management/templates/software_management/create_upgrade_strategy.html index 166c3433..b6510e01 100755 --- a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/create_upgrade_strategy.html +++ b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/create_upgrade_strategy.html @@ -1,11 +1,11 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Create Upgrade Strategy" %}{% endblock %} - -{% block page_header %} - {% include "horizon/common/_page_header.html" with title=_("Create Upgrade Strategy") %} -{% endblock page_header %} - -{% block main %} - {% include 'project/software_management/_create_upgrade_strategy.html' %} -{% endblock %} +{% extends 'base.html' %} +{% load i18n %} +{% block title %}{% trans "Create Upgrade Strategy" %}{% endblock %} + +{% block page_header %} + {% include "horizon/common/_page_header.html" with title=_("Create Upgrade Strategy") %} +{% endblock page_header %} + +{% block main %} + {% include 'project/software_management/_create_upgrade_strategy.html' %} +{% endblock %} diff --git a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/index.html b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/index.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/software_management/templates/software_management/index.html rename to starlingx_dashboard/dashboards/admin/software_management/templates/software_management/index.html diff --git a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/upload_patch.html b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/upload_patch.html similarity index 96% rename from cgcs_dashboard/dashboards/admin/software_management/templates/software_management/upload_patch.html rename to starlingx_dashboard/dashboards/admin/software_management/templates/software_management/upload_patch.html index 95fd8ca5..fa132d65 100755 --- a/cgcs_dashboard/dashboards/admin/software_management/templates/software_management/upload_patch.html +++ b/starlingx_dashboard/dashboards/admin/software_management/templates/software_management/upload_patch.html @@ -1,11 +1,11 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Upload Patches" %}{% endblock %} - -{% block page_header %} - {% include "horizon/common/_page_header.html" with title=_("Upload Patches") %} -{% endblock page_header %} - -{% block main %} - {% include 'project/inventory/_upload_patch.html' %} -{% endblock %} +{% extends 'base.html' %} +{% load i18n %} +{% block title %}{% trans "Upload Patches" %}{% endblock %} + +{% block page_header %} + {% include "horizon/common/_page_header.html" with title=_("Upload Patches") %} +{% endblock page_header %} + +{% block main %} + {% include 'project/inventory/_upload_patch.html' %} +{% endblock %} diff --git a/cgcs_dashboard/dashboards/admin/software_management/urls.py b/starlingx_dashboard/dashboards/admin/software_management/urls.py similarity index 64% rename from cgcs_dashboard/dashboards/admin/software_management/urls.py rename to starlingx_dashboard/dashboards/admin/software_management/urls.py index 3b551758..4e64bc1a 100755 --- a/cgcs_dashboard/dashboards/admin/software_management/urls.py +++ b/starlingx_dashboard/dashboards/admin/software_management/urls.py @@ -1,26 +1,24 @@ # # Copyright (c) 2013-2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # from django.conf.urls import url -from openstack_dashboard.dashboards.admin.software_management.views import \ +from starlingx_dashboard.dashboards.admin.software_management.views import \ CreatePatchStrategyView -from openstack_dashboard.dashboards.admin.software_management.views import \ +from starlingx_dashboard.dashboards.admin.software_management.views import \ CreateUpgradeStrategyView -from openstack_dashboard.dashboards.admin.software_management.views import \ +from starlingx_dashboard.dashboards.admin.software_management.views import \ DetailPatchStageView -from openstack_dashboard.dashboards.admin.software_management.views import \ +from starlingx_dashboard.dashboards.admin.software_management.views import \ DetailPatchView -from openstack_dashboard.dashboards.admin.software_management.views import \ +from starlingx_dashboard.dashboards.admin.software_management.views import \ DetailUpgradeStageView -from openstack_dashboard.dashboards.admin.software_management.views import \ +from starlingx_dashboard.dashboards.admin.software_management.views import \ IndexView -from openstack_dashboard.dashboards.admin.software_management.views import \ +from starlingx_dashboard.dashboards.admin.software_management.views import \ UploadPatchView diff --git a/cgcs_dashboard/dashboards/admin/software_management/views.py b/starlingx_dashboard/dashboards/admin/software_management/views.py similarity index 85% rename from cgcs_dashboard/dashboards/admin/software_management/views.py rename to starlingx_dashboard/dashboards/admin/software_management/views.py index 1c3aed9d..a7d1bd97 100755 --- a/cgcs_dashboard/dashboards/admin/software_management/views.py +++ b/starlingx_dashboard/dashboards/admin/software_management/views.py @@ -1,9 +1,7 @@ # # Copyright (c) 2013-2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # import datetime @@ -18,16 +16,16 @@ from horizon import forms from horizon import tables from horizon import tabs from horizon import views -from openstack_dashboard import api -from openstack_dashboard.dashboards.admin.software_management.forms import \ +from starlingx_dashboard import api as stx_api +from starlingx_dashboard.dashboards.admin.software_management.forms import \ CreatePatchStrategyForm -from openstack_dashboard.dashboards.admin.software_management.forms import \ +from starlingx_dashboard.dashboards.admin.software_management.forms import \ CreateUpgradeStrategyForm -from openstack_dashboard.dashboards.admin.software_management.forms import \ +from starlingx_dashboard.dashboards.admin.software_management.forms import \ UploadPatchForm -from openstack_dashboard.dashboards.admin.software_management import \ +from starlingx_dashboard.dashboards.admin.software_management import \ tables as toplevel_tables -from openstack_dashboard.dashboards.admin.software_management.tabs \ +from starlingx_dashboard.dashboards.admin.software_management.tabs \ import SoftwareManagementTabs LOG = logging.getLogger(__name__) @@ -55,7 +53,7 @@ class DetailPatchView(views.HorizonTemplateView): if not hasattr(self, "_patch"): patch_id = self.kwargs['patch_id'] try: - patch = api.patch.get_patch(self.request, patch_id) + patch = stx_api.patch.get_patch(self.request, patch_id) patch.contents_display = "%s" % "\n".join( filter(None, patch.contents)) patch.requires_display = "%s" % "\n".join( @@ -87,7 +85,7 @@ class CreatePatchStrategyView(forms.ModalFormView): def get_context_data(self, **kwargs): context = super(CreatePatchStrategyView, self).get_context_data( **kwargs) - alarms = api.sysinv.alarm_list(self.request) + alarms = stx_api.sysinv.alarm_list(self.request) affecting = \ len([alarm for alarm in alarms if alarm.mgmt_affecting == 'True']) @@ -105,7 +103,7 @@ class CreateUpgradeStrategyView(forms.ModalFormView): def get_context_data(self, **kwargs): context = super(CreateUpgradeStrategyView, self).get_context_data( **kwargs) - alarms = api.sysinv.alarm_list(self.request) + alarms = stx_api.sysinv.alarm_list(self.request) affecting = \ len([alarm for alarm in alarms if alarm.mgmt_affecting == 'True']) @@ -128,7 +126,7 @@ class DetailStageView(tables.DataTableView): phase = self.kwargs['phase'] stage_id = self.kwargs['stage_id'] try: - stage = api.vim.get_stage(self.request, self.strategy_name, + stage = stx_api.vim.get_stage(self.request, self.strategy_name, phase, stage_id) stage.timeout_display = \ datetime.timedelta(seconds=stage.timeout) @@ -158,9 +156,9 @@ class DetailStageView(tables.DataTableView): class DetailPatchStageView(DetailStageView): table_class = toplevel_tables.PatchStepsTable - strategy_name = api.vim.STRATEGY_SW_PATCH + strategy_name = stx_api.vim.STRATEGY_SW_PATCH class DetailUpgradeStageView(DetailStageView): table_class = toplevel_tables.UpgradeStepsTable - strategy_name = api.vim.STRATEGY_SW_UPGRADE + strategy_name = stx_api.vim.STRATEGY_SW_UPGRADE diff --git a/cgcs_dashboard/dashboards/admin/storage_overview/__init__.py b/starlingx_dashboard/dashboards/admin/storage_overview/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/storage_overview/__init__.py rename to starlingx_dashboard/dashboards/admin/storage_overview/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/storage_overview/constants.py b/starlingx_dashboard/dashboards/admin/storage_overview/constants.py similarity index 62% rename from cgcs_dashboard/dashboards/admin/storage_overview/constants.py rename to starlingx_dashboard/dashboards/admin/storage_overview/constants.py index c7795979..f513b684 100644 --- a/cgcs_dashboard/dashboards/admin/storage_overview/constants.py +++ b/starlingx_dashboard/dashboards/admin/storage_overview/constants.py @@ -1,9 +1,7 @@ # # Copyright (c) 2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # PREFIX = 'admin/storage_overview/' diff --git a/cgcs_dashboard/dashboards/admin/storage_overview/panel.py b/starlingx_dashboard/dashboards/admin/storage_overview/panel.py similarity index 77% rename from cgcs_dashboard/dashboards/admin/storage_overview/panel.py rename to starlingx_dashboard/dashboards/admin/storage_overview/panel.py index f18512f8..d36ff0ff 100755 --- a/cgcs_dashboard/dashboards/admin/storage_overview/panel.py +++ b/starlingx_dashboard/dashboards/admin/storage_overview/panel.py @@ -1,9 +1,7 @@ # # Copyright (c) 2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # from django.utils.translation import ugettext_lazy as _ @@ -19,12 +17,16 @@ class StorageOverview(horizon.Panel): permissions = ('openstack.services.platform',) def allowed(self, context): + if context['request'].user.services_region == 'SystemController': + return False if not base.is_service_enabled(context['request'], 'platform'): return False else: return super(StorageOverview, self).allowed(context) def nav(self, context): + if context['request'].user.services_region == 'SystemController': + return False if not base.is_service_enabled(context['request'], 'platform'): return False else: diff --git a/cgcs_dashboard/dashboards/admin/storage_overview/tables.py b/starlingx_dashboard/dashboards/admin/storage_overview/tables.py similarity index 68% rename from cgcs_dashboard/dashboards/admin/storage_overview/tables.py rename to starlingx_dashboard/dashboards/admin/storage_overview/tables.py index 1555670e..d09919a9 100644 --- a/cgcs_dashboard/dashboards/admin/storage_overview/tables.py +++ b/starlingx_dashboard/dashboards/admin/storage_overview/tables.py @@ -1,20 +1,21 @@ -# Copyright (c) 2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# Copyright (c) 2016-2018 Wind River Systems, Inc. # +# SPDX-License-Identifier: Apache-2.0 +# + from django.utils.translation import ugettext_lazy as _ from horizon import tables class UsageTable(tables.DataTable): - service = tables.Column('service_name', verbose_name=_('Service name')) - backend = tables.Column('backend_name', verbose_name=_('Backend name')) - capacity = \ - tables.Column('total_capacity', verbose_name=_('Total Capacity (GiB)')) - free = \ - tables.Column('free_capacity', verbose_name=_('Free Capacity (GiB)')) + be_type = tables.Column('backend', verbose_name=_('Backend type')) + be_name = tables.Column('name', verbose_name=_('Backend name')) + be_service = tables.Column('service_name', verbose_name=_('Service name')) + capacity = tables.Column('total_capacity', + verbose_name=_('Total Capacity (GiB)')) + free = tables.Column('free_capacity', + verbose_name=_('Free Capacity (GiB)')) class Meta(object): name = "usage" diff --git a/cgcs_dashboard/dashboards/admin/storage_overview/tabs.py b/starlingx_dashboard/dashboards/admin/storage_overview/tabs.py similarity index 91% rename from cgcs_dashboard/dashboards/admin/storage_overview/tabs.py rename to starlingx_dashboard/dashboards/admin/storage_overview/tabs.py index 8707a22e..123e765e 100644 --- a/cgcs_dashboard/dashboards/admin/storage_overview/tabs.py +++ b/starlingx_dashboard/dashboards/admin/storage_overview/tabs.py @@ -1,11 +1,9 @@ +# # Copyright (c) 2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # - import logging from django.utils.translation import ugettext_lazy as _ @@ -82,8 +80,8 @@ class StorageUsageTab(tabs.TableTab): def get_usage_data(self): try: return sysinv.storage_usage_list(self.request) - except Exception as e: - LOG.error(e) + except Exception: + LOG.error("Exception requesting storage usage information") return [] diff --git a/cgcs_dashboard/dashboards/admin/storage_overview/templates/storage_overview/_detail_storageservices.html b/starlingx_dashboard/dashboards/admin/storage_overview/templates/storage_overview/_detail_storageservices.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/storage_overview/templates/storage_overview/_detail_storageservices.html rename to starlingx_dashboard/dashboards/admin/storage_overview/templates/storage_overview/_detail_storageservices.html diff --git a/cgcs_dashboard/dashboards/admin/storage_overview/templates/storage_overview/_usage.html b/starlingx_dashboard/dashboards/admin/storage_overview/templates/storage_overview/_usage.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/storage_overview/templates/storage_overview/_usage.html rename to starlingx_dashboard/dashboards/admin/storage_overview/templates/storage_overview/_usage.html diff --git a/cgcs_dashboard/dashboards/admin/storage_overview/templates/storage_overview/storage_overview.html b/starlingx_dashboard/dashboards/admin/storage_overview/templates/storage_overview/storage_overview.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/storage_overview/templates/storage_overview/storage_overview.html rename to starlingx_dashboard/dashboards/admin/storage_overview/templates/storage_overview/storage_overview.html diff --git a/cgcs_dashboard/dashboards/admin/storage_overview/urls.py b/starlingx_dashboard/dashboards/admin/storage_overview/urls.py similarity index 57% rename from cgcs_dashboard/dashboards/admin/storage_overview/urls.py rename to starlingx_dashboard/dashboards/admin/storage_overview/urls.py index 6fb7dacd..03404277 100644 --- a/cgcs_dashboard/dashboards/admin/storage_overview/urls.py +++ b/starlingx_dashboard/dashboards/admin/storage_overview/urls.py @@ -1,12 +1,9 @@ # # Copyright (c) 2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # - from django.conf.urls import url from openstack_dashboard.dashboards.admin.storage_overview import views diff --git a/cgcs_dashboard/dashboards/admin/storage_overview/views.py b/starlingx_dashboard/dashboards/admin/storage_overview/views.py similarity index 74% rename from cgcs_dashboard/dashboards/admin/storage_overview/views.py rename to starlingx_dashboard/dashboards/admin/storage_overview/views.py index b4d0953c..c2523012 100644 --- a/cgcs_dashboard/dashboards/admin/storage_overview/views.py +++ b/starlingx_dashboard/dashboards/admin/storage_overview/views.py @@ -1,12 +1,9 @@ # # Copyright (c) 2016 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # - from django.utils.translation import ugettext_lazy as _ from horizon import tabs diff --git a/cgcs_dashboard/dashboards/admin/system_config/__init__.py b/starlingx_dashboard/dashboards/admin/system_config/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/__init__.py rename to starlingx_dashboard/dashboards/admin/system_config/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/system_config/address_pools/__init__.py b/starlingx_dashboard/dashboards/admin/system_config/address_pools/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/address_pools/__init__.py rename to starlingx_dashboard/dashboards/admin/system_config/address_pools/__init__.py diff --git a/cgcs_dashboard/dashboards/admin/system_config/address_pools/forms.py b/starlingx_dashboard/dashboards/admin/system_config/address_pools/forms.py similarity index 96% rename from cgcs_dashboard/dashboards/admin/system_config/address_pools/forms.py rename to starlingx_dashboard/dashboards/admin/system_config/address_pools/forms.py index b3c3d1e7..837eaf78 100755 --- a/cgcs_dashboard/dashboards/admin/system_config/address_pools/forms.py +++ b/starlingx_dashboard/dashboards/admin/system_config/address_pools/forms.py @@ -14,10 +14,6 @@ # # Copyright (c) 2015 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# import logging diff --git a/cgcs_dashboard/dashboards/admin/system_config/address_pools/tables.py b/starlingx_dashboard/dashboards/admin/system_config/address_pools/tables.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/address_pools/tables.py rename to starlingx_dashboard/dashboards/admin/system_config/address_pools/tables.py diff --git a/cgcs_dashboard/dashboards/admin/system_config/address_pools/views.py b/starlingx_dashboard/dashboards/admin/system_config/address_pools/views.py similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/address_pools/views.py rename to starlingx_dashboard/dashboards/admin/system_config/address_pools/views.py diff --git a/cgcs_dashboard/dashboards/admin/system_config/forms.py b/starlingx_dashboard/dashboards/admin/system_config/forms.py similarity index 93% rename from cgcs_dashboard/dashboards/admin/system_config/forms.py rename to starlingx_dashboard/dashboards/admin/system_config/forms.py index a85fed1e..aafa5754 100755 --- a/cgcs_dashboard/dashboards/admin/system_config/forms.py +++ b/starlingx_dashboard/dashboards/admin/system_config/forms.py @@ -1,14 +1,9 @@ # -# Copyright (c) 2013-2017 Wind River Systems, Inc. +# Copyright (c) 2013-2018 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - - import logging from collections import OrderedDict @@ -568,6 +563,12 @@ class UpdateiStorage(forms.SelfHandlingForm): help_text=_("Disk space for image conversion in gibibytes."), min_value=0) + patch_vault = forms.IntegerField( + label=_("Patch-Vault Storage (GiB)"), + required=False, + help_text=_("Platform Patch-Vault storage space in gibibytes."), + min_value=0) + ceph_mon = forms.IntegerField( label=_("Ceph Mon Storage (GiB)"), required=False, @@ -581,6 +582,8 @@ class UpdateiStorage(forms.SelfHandlingForm): super(UpdateiStorage, self).__init__(request, *args, **kwargs) if not kwargs['initial'].get('ceph_mon'): del self.fields['ceph_mon'] + if not kwargs['initial'].get('patch_vault'): + del self.fields['patch_vault'] def clean(self): cleaned_data = super(UpdateiStorage, self).clean() @@ -633,43 +636,9 @@ class UpdateiStorage(forms.SelfHandlingForm): class UpdateiStoragePools(forms.SelfHandlingForm): + tier_name = forms.CharField(widget=forms.widgets.HiddenInput) uuid = forms.CharField(widget=forms.widgets.HiddenInput) - js_attrs = {'onchange': 'add_total_quota()', - 'onkeypress': 'this.onchange()', - 'onpaste': 'this.onchange()', - 'oninput': 'this.onchange()', - 'onload': 'this.onchange()'} - - cinder_pool_gib = forms.IntegerField( - label=_("Cinder Volumes Pool (GiB)"), - required=True, - help_text=_("Storage space allocated to cinder volumes in gibibytes."), - min_value=0, - widget=forms.NumberInput(attrs=js_attrs)) - - glance_pool_gib = forms.IntegerField( - label=_("Glance Image Pool (GiB)"), - required=True, - help_text=_("Storage space allocated to glance images in gibibytes."), - min_value=0, - widget=forms.NumberInput(attrs=js_attrs)) - - ephemeral_pool_gib = forms.IntegerField( - label=_("Ephemeral Storage Pool(Gib)"), - required=True, - help_text=_("Storage space allocated to nova ephemeral instance disks " - "in gibibytes."), - min_value=0, - widget=forms.NumberInput(attrs=js_attrs)) - - object_pool_gib = forms.IntegerField( - label=_("Object Storage Pool(Gib)"), - required=True, - help_text=_("Storage space allocated to objects in gibibytes."), - min_value=0, - widget=forms.NumberInput(attrs=js_attrs)) - failure_url = 'horizon:admin:system_config:index' failure_message = ('Failed to update size of ceph pools.' ' Ceph cluster may be down, check cluster status' @@ -677,6 +646,46 @@ class UpdateiStoragePools(forms.SelfHandlingForm): def __init__(self, request, *args, **kwargs): super(UpdateiStoragePools, self).__init__(request, *args, **kwargs) + self._tier_name = kwargs['initial']['tier_name'] + + js_attrs = {'onchange': 'add_total_quota()', + 'onkeypress': 'this.onchange()', + 'onpaste': 'this.onchange()', + 'oninput': 'this.onchange()', + 'onload': 'this.onchange()'} + + self.fields['cinder_pool_gib'] = forms.IntegerField( + label=_("Cinder Volumes Pool (GiB)"), + required=True, + help_text=_("Storage space allocated to cinder volumes in " + "gibibytes."), + min_value=0, + widget=forms.NumberInput(attrs=js_attrs)) + + if self._tier_name == 'storage': + self.fields['glance_pool_gib'] = forms.IntegerField( + label=_("Glance Image Pool (GiB)"), + required=True, + help_text=_("Storage space allocated to glance images in " + "gibibytes."), + min_value=0, + widget=forms.NumberInput(attrs=js_attrs)) + + self.fields['ephemeral_pool_gib'] = forms.IntegerField( + label=_("Ephemeral Storage Pool(GiB)"), + required=True, + help_text=_("Storage space allocated to nova ephemeral " + "instance disks in gibibytes."), + min_value=0, + widget=forms.NumberInput(attrs=js_attrs)) + + self.fields['object_pool_gib'] = forms.IntegerField( + label=_("Object Storage Pool(GiB)"), + required=True, + help_text=_("Storage space allocated to objects in " + "gibibytes."), + min_value=0, + widget=forms.NumberInput(attrs=js_attrs)) def clean(self): cleaned_data = super(UpdateiStoragePools, self).clean() @@ -685,15 +694,11 @@ class UpdateiStoragePools(forms.SelfHandlingForm): def handle(self, request, data): send_to_sysinv = False - try: - if data: - if 'uuid' in data.keys(): if not data['uuid']: data['uuid'] = ' ' - else: data['uuid'] = ' ' @@ -702,23 +707,18 @@ class UpdateiStoragePools(forms.SelfHandlingForm): data.pop('uuid') if hasattr(storage_config, 'uuid'): - storage_config_uuid = storage_config.uuid STORAGE_VALUES = {} - if hasattr(storage_config, 'cinder_pool_gib'): STORAGE_VALUES['cinder_pool_gib'] = \ unicode(storage_config._cinder_pool_gib) - if hasattr(storage_config, 'glance_pool_gib'): STORAGE_VALUES['glance_pool_gib'] = \ unicode(storage_config._glance_pool_gib) - if hasattr(storage_config, 'ephemeral_pool_gib'): STORAGE_VALUES['ephemeral_pool_gib'] = \ unicode(storage_config._ephemeral_pool_gib) - if hasattr(storage_config, 'object_pool_gib'): STORAGE_VALUES['object_pool_gib'] = \ unicode(storage_config._object_pool_gib) @@ -728,18 +728,14 @@ class UpdateiStoragePools(forms.SelfHandlingForm): LOG.info("initial send_to_sysinv=%s", send_to_sysinv) if len(STORAGE_VALUES) != len(data): - data['action'] = 'apply' send_to_sysinv = True - else: for key in STORAGE_VALUES.keys(): if STORAGE_VALUES[key] != data[key]: send_to_sysinv = True break - else: storage_config_uuid = ' ' - else: storage_config_uuid = ' ' data = {'cinder_pool_gib': '', diff --git a/cgcs_dashboard/dashboards/admin/system_config/panel.py b/starlingx_dashboard/dashboards/admin/system_config/panel.py similarity index 78% rename from cgcs_dashboard/dashboards/admin/system_config/panel.py rename to starlingx_dashboard/dashboards/admin/system_config/panel.py index 4b64d1af..5aaef428 100755 --- a/cgcs_dashboard/dashboards/admin/system_config/panel.py +++ b/starlingx_dashboard/dashboards/admin/system_config/panel.py @@ -1,13 +1,9 @@ # # Copyright (c) 2013-2014 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - from django.utils.translation import ugettext_lazy as _ import horizon diff --git a/cgcs_dashboard/dashboards/admin/system_config/tables.py b/starlingx_dashboard/dashboards/admin/system_config/tables.py similarity index 96% rename from cgcs_dashboard/dashboards/admin/system_config/tables.py rename to starlingx_dashboard/dashboards/admin/system_config/tables.py index 828d6111..451ace6c 100644 --- a/cgcs_dashboard/dashboards/admin/system_config/tables.py +++ b/starlingx_dashboard/dashboards/admin/system_config/tables.py @@ -1,15 +1,13 @@ # -# Copyright (c) 2013-2017 Wind River Systems, Inc. +# Copyright (c) 2013-2018 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # - import logging from cgtsclient import exc +from django.core.urlresolvers import reverse # noqa from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ungettext_lazy @@ -106,10 +104,13 @@ class EditiStorage(tables.LinkAction): class EditiStoragePools(tables.LinkAction): name = "update_storage_pools" - verbose_name = _("Edit size of Ceph storage pools") + verbose_name = _("Edit pool quotas") url = "horizon:admin:system_config:update_storage_pools_table" classes = ("ajax-modal", "btn-edit") + def get_link_url(self, storage_ceph): + return reverse(self.url, args=(storage_ceph.tier_name,)) + class UpdateDNSRow(tables.Row): ajax = True @@ -289,6 +290,10 @@ class iStorageTable(tables.DataTable): class iStoragePoolsTable(tables.DataTable): + tier_name = tables.Column( + 'tier_name', + verbose_name=_('Ceph Storage Tier')) + cinder_pool_gib = tables.Column( 'cinder_pool_gib', verbose_name=_('Cinder Volume Storage (GiB)')) @@ -313,14 +318,14 @@ class iStoragePoolsTable(tables.DataTable): return unicode(datum.uuid) def get_object_display(self, datum): - return datum.uuid + return ("%s" % datum.tier_name) class Meta(object): name = "storage_pools_table" verbose_name = _("Ceph Storage Pools") row_class = UpdateStorageRow multi_select = False - table_actions = (EditiStoragePools,) + row_actions = (EditiStoragePools,) ########################################################### diff --git a/cgcs_dashboard/dashboards/admin/system_config/tabs.py b/starlingx_dashboard/dashboards/admin/system_config/tabs.py similarity index 97% rename from cgcs_dashboard/dashboards/admin/system_config/tabs.py rename to starlingx_dashboard/dashboards/admin/system_config/tabs.py index 23fe3349..5f8eefd9 100755 --- a/cgcs_dashboard/dashboards/admin/system_config/tabs.py +++ b/starlingx_dashboard/dashboards/admin/system_config/tabs.py @@ -1,14 +1,9 @@ # # Copyright (c) 2013-2017 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - - import logging from django.utils.translation import ugettext_lazy as _ diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_cdns_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_cdns_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_cdns_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_cdns_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_cntp_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_cntp_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_cntp_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_cntp_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_coam_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_coam_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_coam_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_coam_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_create_sdn_controller_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_create_sdn_controller_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_create_sdn_controller_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_create_sdn_controller_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_detail_sdn_controller_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_detail_sdn_controller_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_detail_sdn_controller_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_detail_sdn_controller_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_edit.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_edit.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_edit.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_edit.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_sdn_controller_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_sdn_controller_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_sdn_controller_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_sdn_controller_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_storage_pools_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_storage_pools_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_storage_pools_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_storage_pools_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_storage_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_storage_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_storage_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_storage_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_systems.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_systems.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_systems.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_systems.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_update_cdns_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_update_cdns_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_update_cdns_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_update_cdns_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_update_cntp_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_update_cntp_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_update_cntp_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_update_cntp_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_update_coam_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_update_coam_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_update_coam_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_update_coam_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_update_istorage_pools_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_update_istorage_pools_table.html similarity index 71% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_update_istorage_pools_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_update_istorage_pools_table.html index 9fd6bc5c..ae7a3a2f 100755 --- a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_update_istorage_pools_table.html +++ b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_update_istorage_pools_table.html @@ -2,7 +2,7 @@ {% load i18n %} {% block form_id %}edit_iconfig_form{% endblock %} -{% block form_action %}{% url 'horizon:admin:system_config:update_storage_pools_table' %}{% endblock %} +{% block form_action %}{% url 'horizon:admin:system_config:update_storage_pools_table' tier_name %}{% endblock %} {% block modal_id %}edit_iconfig_modal{% endblock %} {% block modal-header %}{% trans "Edit size of Ceph Storage Pools" %}{% endblock %} @@ -23,10 +23,10 @@ + (parseInt(ephemeral.value) || 0) + (parseInt(obj.value) || 0); - total_cluster_size = parseInt(document.getElementById('total_cluster_size').innerHTML) || 0; + total_tier_size = parseInt(document.getElementById('total_tier_size').innerHTML) || 0; dynamic_quota.innerHTML = current_quota_total; - if (current_quota_total == total_cluster_size) { + if (current_quota_total == total_tier_size) { document.getElementById('quota_text').style.color='green'; } else { @@ -42,10 +42,16 @@

{% trans "Description" %}:

-

{% trans "From here you can update the quota allocated to the pools of the Ceph storage cluster." %}

-

{% trans "A quota value of 0 will allow the storage associated with that pool to consume all available space in the Ceph cluster." %}

-

{% trans "The sum of the desired quotas must equal 100% of the cluster size." %}

-

{{ configured_quota }} GiB out of {{ cluster_total }} GiB configured

+

{% trans "From here you can update the quota allocated to the pools associated with this Ceph storage tier." %}

+

{% trans "A quota value of 0 will allow the storage associated with that pool to consume all available space in the tier." %}

+ {% if tier_name == 'storage' %} +

{% trans "A quota value of 0 is not allowed for the cinder pool or glance pool." %}

+

{% trans "The sum of the desired quotas must equal 100% of the cluster size." %}

+ {% else %} +

{% trans "A quota value of 0 is allowed for the cinder pool." %}

+ {% endif %} + +

{{ configured_quota }} GiB out of {{ tier_total }} GiB configured

{% endblock %} diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_update_istorage_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_update_istorage_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_update_istorage_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_update_istorage_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_update_sdn_controller_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_update_sdn_controller_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_update_sdn_controller_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_update_sdn_controller_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_update_system.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_update_system.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/_update_system.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/_update_system.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/address_pools/_create.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/address_pools/_create.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/address_pools/_create.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/address_pools/_create.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/address_pools/_update.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/address_pools/_update.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/address_pools/_update.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/address_pools/_update.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/address_pools/create.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/address_pools/create.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/address_pools/create.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/address_pools/create.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/address_pools/update.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/address_pools/update.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/address_pools/update.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/address_pools/update.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/create_sdn_controller_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/create_sdn_controller_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/create_sdn_controller_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/create_sdn_controller_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/detail_sdn_controller_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/detail_sdn_controller_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/detail_sdn_controller_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/detail_sdn_controller_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/edit.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/edit.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/edit.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/edit.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/index.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/index.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/index.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/index.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/update_cdns_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/update_cdns_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/update_cdns_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/update_cdns_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/update_cntp_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/update_cntp_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/update_cntp_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/update_cntp_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/update_coam_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/update_coam_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/update_coam_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/update_coam_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/update_istorage_pools_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/update_istorage_pools_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/update_istorage_pools_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/update_istorage_pools_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/update_istorage_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/update_istorage_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/update_istorage_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/update_istorage_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/update_sdn_controller_table.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/update_sdn_controller_table.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/update_sdn_controller_table.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/update_sdn_controller_table.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/templates/system_config/update_system.html b/starlingx_dashboard/dashboards/admin/system_config/templates/system_config/update_system.html similarity index 100% rename from cgcs_dashboard/dashboards/admin/system_config/templates/system_config/update_system.html rename to starlingx_dashboard/dashboards/admin/system_config/templates/system_config/update_system.html diff --git a/cgcs_dashboard/dashboards/admin/system_config/urls.py b/starlingx_dashboard/dashboards/admin/system_config/urls.py similarity index 89% rename from cgcs_dashboard/dashboards/admin/system_config/urls.py rename to starlingx_dashboard/dashboards/admin/system_config/urls.py index 3a9a041a..53c2f5c0 100755 --- a/cgcs_dashboard/dashboards/admin/system_config/urls.py +++ b/starlingx_dashboard/dashboards/admin/system_config/urls.py @@ -1,9 +1,7 @@ # -# Copyright (c) 2013-2017 Wind River Systems, Inc. +# Copyright (c) 2013-2018 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # from django.conf.urls import url @@ -35,6 +33,7 @@ from openstack_dashboard.dashboards.admin.system_config.views import \ UUID = r'^(?P[^/]+)/%s$' PIPELINE = r'^(?P[^/]+)/%s$' +TIER = r'^(?P[^/]+)/%s$' urlpatterns = [ url(r'^$', IndexView.as_view(), name='index'), @@ -58,7 +57,8 @@ urlpatterns = [ url(r'^update_istorage_table/$', UpdateiStorageView.as_view(), name='update_storage_table'), - url(r'^update_istorage_pools_table/$', UpdateiStoragePoolsView.as_view(), + url(TIER % 'update_istorage_pools_table', + UpdateiStoragePoolsView.as_view(), name='update_storage_pools_table'), url(UUID % 'update_sdn_controller_table', UpdateSDNControllerView.as_view(), diff --git a/cgcs_dashboard/dashboards/admin/system_config/views.py b/starlingx_dashboard/dashboards/admin/system_config/views.py similarity index 86% rename from cgcs_dashboard/dashboards/admin/system_config/views.py rename to starlingx_dashboard/dashboards/admin/system_config/views.py index a38f5754..46ebe51b 100755 --- a/cgcs_dashboard/dashboards/admin/system_config/views.py +++ b/starlingx_dashboard/dashboards/admin/system_config/views.py @@ -1,15 +1,12 @@ # -# Copyright (c) 2013-2017 Wind River Systems, Inc. +# Copyright (c) 2013-2018 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - import logging +from django.core.urlresolvers import reverse # noqa from django.core.urlresolvers import reverse_lazy from django.utils.translation import ugettext_lazy as _ @@ -264,75 +261,70 @@ class UpdateiStoragePoolsView(forms.ModalFormView): def get_context_data(self, **kwargs): ctxt = super(UpdateiStoragePoolsView, self).get_context_data(**kwargs) + ctxt['tier_name'] = self.kwargs['tier_name'] + storage_list = api.sysinv.storagepool_list(self.request) - if storage_list: - if hasattr(storage_list[0], 'uuid'): - uuid = storage_list[0].uuid + ctxt['uuid'] = " " + for s in storage_list: + if s.tier_name == ctxt['tier_name']: + ctxt['uuid'] = s.uuid + ctxt['tier_name'] = s.tier_name + ctxt['tier_total'] = s.ceph_total_space_gib - else: - uuid = " " - - else: - uuid = " " - - ctxt['uuid'] = uuid - ctxt['cluster_total'] = storage_list[0].ceph_total_space_gib - - ctxt['configured_quota'] = 0 - # check before adding each value in case it is None - if storage_list[0].cinder_pool_gib: - ctxt['configured_quota'] += storage_list[0].cinder_pool_gib - if storage_list[0].glance_pool_gib: - ctxt['configured_quota'] += storage_list[0].glance_pool_gib - if storage_list[0].ephemeral_pool_gib: - ctxt['configured_quota'] += storage_list[0].ephemeral_pool_gib - if storage_list[0].object_pool_gib: - ctxt['configured_quota'] += storage_list[0].object_pool_gib + ctxt['configured_quota'] = 0 + # check before adding each value in case it is None + if s.cinder_pool_gib: + ctxt['configured_quota'] += s.cinder_pool_gib + if s.glance_pool_gib: + ctxt['configured_quota'] += s.glance_pool_gib + if s.ephemeral_pool_gib: + ctxt['configured_quota'] += s.ephemeral_pool_gib + if s.object_pool_gib: + ctxt['configured_quota'] += s.object_pool_gib + break return ctxt def get_initial(self): - - storage_form_data = {'uuid': ' ', - 'cinder_pool_gib': None, - 'glance_pool_gib': None, - 'ephemeral_pool_gib': None, - 'object_pool_gib': None} + form_data = {'uuid': ' ', + 'tier_name': None, + 'cinder_pool_gib': None, + 'glance_pool_gib': None, + 'ephemeral_pool_gib': None, + 'object_pool_gib': None} try: - + target_tier = self.kwargs['tier_name'] storage_list = api.sysinv.storagepool_list(self.request) + for s in storage_list: + if s.tier_name == target_tier: - if storage_list: - if storage_list[0]: - - storage_attrs = storage_list[0]._attrs + storage_attrs = s._attrs if 'uuid' in storage_attrs: - storage_form_data['uuid'] = storage_list[0].uuid + form_data['uuid'] = s.uuid + + if 'tier_name' in storage_attrs: + form_data['tier_name'] = s.tier_name if 'cinder_pool_gib' in storage_attrs: - storage_form_data['cinder_pool_gib'] = storage_list[ - 0].cinder_pool_gib + form_data['cinder_pool_gib'] = s.cinder_pool_gib if 'glance_pool_gib' in storage_attrs: - storage_form_data['glance_pool_gib'] = storage_list[ - 0].glance_pool_gib + form_data['glance_pool_gib'] = s.glance_pool_gib if 'ephemeral_pool_gib' in storage_attrs: - storage_form_data['ephemeral_pool_gib'] = storage_list[ - 0].ephemeral_pool_gib + form_data['ephemeral_pool_gib'] = s.ephemeral_pool_gib if 'object_pool_gib' in storage_attrs: - storage_form_data['object_pool_gib'] = storage_list[ - 0].object_pool_gib + form_data['object_pool_gib'] = s.object_pool_gib except Exception: exceptions.handle(self.request, _("Unable to retrieve size of Ceph pools.")) - return storage_form_data + return form_data ###################################################### diff --git a/cgcs_dashboard/dashboards/dc_admin/__init__.py b/starlingx_dashboard/dashboards/dc_admin/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/dc_admin/__init__.py rename to starlingx_dashboard/dashboards/dc_admin/__init__.py diff --git a/cgcs_dashboard/dashboards/dc_admin/cloud_overview/__init__.py b/starlingx_dashboard/dashboards/dc_admin/cloud_overview/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/dc_admin/cloud_overview/__init__.py rename to starlingx_dashboard/dashboards/dc_admin/cloud_overview/__init__.py diff --git a/cgcs_dashboard/dashboards/dc_admin/cloud_overview/panel.py b/starlingx_dashboard/dashboards/dc_admin/cloud_overview/panel.py similarity index 56% rename from cgcs_dashboard/dashboards/dc_admin/cloud_overview/panel.py rename to starlingx_dashboard/dashboards/dc_admin/cloud_overview/panel.py index c4f9e412..ab362ede 100755 --- a/cgcs_dashboard/dashboards/dc_admin/cloud_overview/panel.py +++ b/starlingx_dashboard/dashboards/dc_admin/cloud_overview/panel.py @@ -1,9 +1,7 @@ # # Copyright (c) 2017 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # diff --git a/cgcs_dashboard/dashboards/dc_admin/cloud_overview/templates/cloud_overview/index.html b/starlingx_dashboard/dashboards/dc_admin/cloud_overview/templates/cloud_overview/index.html similarity index 100% rename from cgcs_dashboard/dashboards/dc_admin/cloud_overview/templates/cloud_overview/index.html rename to starlingx_dashboard/dashboards/dc_admin/cloud_overview/templates/cloud_overview/index.html diff --git a/cgcs_dashboard/dashboards/dc_admin/cloud_overview/urls.py b/starlingx_dashboard/dashboards/dc_admin/cloud_overview/urls.py similarity index 57% rename from cgcs_dashboard/dashboards/dc_admin/cloud_overview/urls.py rename to starlingx_dashboard/dashboards/dc_admin/cloud_overview/urls.py index 352d0728..943127c6 100755 --- a/cgcs_dashboard/dashboards/dc_admin/cloud_overview/urls.py +++ b/starlingx_dashboard/dashboards/dc_admin/cloud_overview/urls.py @@ -1,9 +1,7 @@ # # Copyright (c) 2017 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # diff --git a/cgcs_dashboard/dashboards/dc_admin/cloud_overview/views.py b/starlingx_dashboard/dashboards/dc_admin/cloud_overview/views.py similarity index 51% rename from cgcs_dashboard/dashboards/dc_admin/cloud_overview/views.py rename to starlingx_dashboard/dashboards/dc_admin/cloud_overview/views.py index 1b64f35b..b89f3107 100755 --- a/cgcs_dashboard/dashboards/dc_admin/cloud_overview/views.py +++ b/starlingx_dashboard/dashboards/dc_admin/cloud_overview/views.py @@ -1,9 +1,7 @@ # # Copyright (c) 2017 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # diff --git a/cgcs_dashboard/dashboards/dc_admin/dashboard.py b/starlingx_dashboard/dashboards/dc_admin/dashboard.py similarity index 69% rename from cgcs_dashboard/dashboards/dc_admin/dashboard.py rename to starlingx_dashboard/dashboards/dc_admin/dashboard.py index 2582487a..331b58c6 100755 --- a/cgcs_dashboard/dashboards/dc_admin/dashboard.py +++ b/starlingx_dashboard/dashboards/dc_admin/dashboard.py @@ -1,9 +1,7 @@ # # Copyright (c) 2017 Wind River Systems, Inc. # -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. +# SPDX-License-Identifier: Apache-2.0 # @@ -23,9 +21,8 @@ class DCAdmin(horizon.Dashboard): 'openstack.services.dcmanager',) def allowed(self, context): - # Must be in SystemController region or in RegionOne (and in DC mode) + # Must be in SystemController region if context['request'].user.services_region != 'SystemController': - # TODO(tsmith) enhance criteria? return False return super(DCAdmin, self).allowed(context) diff --git a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/cloud_overview.module.js b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/cloud_overview.module.js similarity index 78% rename from cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/cloud_overview.module.js rename to starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/cloud_overview.module.js index c1450d5b..5bc599fb 100755 --- a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/cloud_overview.module.js +++ b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/cloud_overview.module.js @@ -1,9 +1,8 @@ /** * Copyright (c) 2017 Wind River Systems, Inc. - * - * The right to copy, distribute, modify, or otherwise make use - * of this software may be licensed only pursuant to the terms - * of an applicable Wind River license agreement. +* +* SPDX-License-Identifier: Apache-2.0 +* */ (function() { diff --git a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/cloud_overview.module.spec.js b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/cloud_overview.module.spec.js similarity index 62% rename from cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/cloud_overview.module.spec.js rename to starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/cloud_overview.module.spec.js index a6addd34..2d4fa14a 100755 --- a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/cloud_overview.module.spec.js +++ b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/cloud_overview.module.spec.js @@ -1,9 +1,8 @@ /** * Copyright (c) 2017 Wind River Systems, Inc. - * - * The right to copy, distribute, modify, or otherwise make use - * of this software may be licensed only pursuant to the terms - * of an applicable Wind River license agreement. +* +* SPDX-License-Identifier: Apache-2.0 +* */ (function() { diff --git a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/add_subcloud.service.js b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/add_subcloud.service.js similarity index 92% rename from cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/add_subcloud.service.js rename to starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/add_subcloud.service.js index 2725315a..238616ed 100755 --- a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/add_subcloud.service.js +++ b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/add_subcloud.service.js @@ -1,90 +1,89 @@ -/** - * Copyright (c) 2017 Wind River Systems, Inc. - * - * The right to copy, distribute, modify, or otherwise make use - * of this software may be licensed only pursuant to the terms - * of an applicable Wind River license agreement. - */ - -(function() { - 'use strict'; - - /** - * @ngdoc overview - * @name horizon.dashboard.container-infra.clusters.create.service - * @description Service for the container-infra cluster create modal - */ - angular - .module('horizon.dashboard.dc_admin.cloud_overview') - .factory('horizon.dashboard.dc_admin.cloud_overview.add_subcloud.service', createService); - - createService.$inject = [ - '$location', - 'horizon.app.core.openstack-service-api.dc_manager', - 'horizon.framework.util.actions.action-result.service', - 'horizon.framework.util.i18n.gettext', - 'horizon.framework.util.q.extensions', - 'horizon.framework.widgets.form.ModalFormService', - 'horizon.framework.widgets.toast.service', - ]; - - function createService( - $location, dc_manager, actionResult, gettext, $qExtensions, modal, toast - ) { - - var config; - var message = { - success: gettext('Subcloud %s was successfully created.') - }; - - var service = { - perform: perform, - allowed: allowed - }; - - return service; - - ////////////// - - function perform(selected, $scope) { - config = workflow.init('create', gettext('Create'), $scope); - if (typeof selected !== 'undefined') { - config.model.cluster_template_id = selected.id; - } - return modal.open(config).then(submit); - } - - function allowed() { - return $qExtensions.booleanAsPromise(true); - } - - function submit(context) { - context.model = cleanNullProperties(context.model); - return magnum.createCluster(context.model, false).then(success, true); - } - - function cleanNullProperties(model) { - // Initially clean fields that don't have any value. - // Not only "null", blank too. - for (var key in model) { - if (model.hasOwnProperty(key) && model[key] === null || model[key] === "" || - key === "tabs") { - delete model[key]; - } - } - return model; - } - - function success(response) { - response.data.id = response.data.uuid; - toast.add('success', interpolate(message.success, [response.data.id])); - var result = actionResult.getActionResult() - .created(resourceType, response.data.id); - if (result.result.failed.length === 0 && result.result.created.length > 0) { - $location.path("/project/clusters"); - } else { - return result.result; - } - } - } +/** + * Copyright (c) 2017 Wind River Systems, Inc. +* +* SPDX-License-Identifier: Apache-2.0 +* + */ + +(function() { + 'use strict'; + + /** + * @ngdoc overview + * @name horizon.dashboard.container-infra.clusters.create.service + * @description Service for the container-infra cluster create modal + */ + angular + .module('horizon.dashboard.dc_admin.cloud_overview') + .factory('horizon.dashboard.dc_admin.cloud_overview.add_subcloud.service', createService); + + createService.$inject = [ + '$location', + 'horizon.app.core.openstack-service-api.dc_manager', + 'horizon.framework.util.actions.action-result.service', + 'horizon.framework.util.i18n.gettext', + 'horizon.framework.util.q.extensions', + 'horizon.framework.widgets.form.ModalFormService', + 'horizon.framework.widgets.toast.service', + ]; + + function createService( + $location, dc_manager, actionResult, gettext, $qExtensions, modal, toast + ) { + + var config; + var message = { + success: gettext('Subcloud %s was successfully created.') + }; + + var service = { + perform: perform, + allowed: allowed + }; + + return service; + + ////////////// + + function perform(selected, $scope) { + config = workflow.init('create', gettext('Create'), $scope); + if (typeof selected !== 'undefined') { + config.model.cluster_template_id = selected.id; + } + return modal.open(config).then(submit); + } + + function allowed() { + return $qExtensions.booleanAsPromise(true); + } + + function submit(context) { + context.model = cleanNullProperties(context.model); + return magnum.createCluster(context.model, false).then(success, true); + } + + function cleanNullProperties(model) { + // Initially clean fields that don't have any value. + // Not only "null", blank too. + for (var key in model) { + if (model.hasOwnProperty(key) && model[key] === null || model[key] === "" || + key === "tabs") { + delete model[key]; + } + } + return model; + } + + function success(response) { + response.data.id = response.data.uuid; + toast.add('success', interpolate(message.success, [response.data.id])); + var result = actionResult.getActionResult() + .created(resourceType, response.data.id); + if (result.result.failed.length === 0 && result.result.created.length > 0) { + $location.path("/project/clusters"); + } else { + return result.result; + } + } + } })(); \ No newline at end of file diff --git a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/central_table.controller.js b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/central_table.controller.js similarity index 89% rename from cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/central_table.controller.js rename to starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/central_table.controller.js index a1a8d94d..20f29aa1 100755 --- a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/central_table.controller.js +++ b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/central_table.controller.js @@ -1,9 +1,8 @@ /** * Copyright (c) 2017 Wind River Systems, Inc. - * - * The right to copy, distribute, modify, or otherwise make use - * of this software may be licensed only pursuant to the terms - * of an applicable Wind River license agreement. +* +* SPDX-License-Identifier: Apache-2.0 +* */ @@ -104,11 +103,11 @@ ///////////// function goToCentralAlarmDetails(cloud) { - $window.location.href = "/admin/fault_management/"; + $window.location.href = "/auth/switch_services_region/RegionOne/?next=/admin/fault_management/"; } function goToCentralHostDetails(cloud) { - $window.location.href = "/admin/inventory/"; + $window.location.href = "/auth/switch_services_region/RegionOne/?next=/admin/inventory/"; } } diff --git a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/central_table.html b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/central_table.html similarity index 100% rename from cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/central_table.html rename to starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/central_table.html diff --git a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/subcloud_table.controller.js b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/subcloud_table.controller.js similarity index 96% rename from cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/subcloud_table.controller.js rename to starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/subcloud_table.controller.js index 4ed99d11..ee0698dd 100755 --- a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/subcloud_table.controller.js +++ b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/subcloud_table.controller.js @@ -1,9 +1,8 @@ /** * Copyright (c) 2017 Wind River Systems, Inc. - * - * The right to copy, distribute, modify, or otherwise make use - * of this software may be licensed only pursuant to the terms - * of an applicable Wind River license agreement. +* +* SPDX-License-Identifier: Apache-2.0 +* */ @@ -214,11 +213,11 @@ "management-gateway-ip": { type: "string", title: "Management Gateway IP"}, - "central-gateway-ip": { + "systemcontroller-gateway-ip": { type: "string", - title: "Central Ggateway IP"}, + title: "System Controller Gateway IP"}, }, - required: ["name", "management-subnet", "management-start-ip", "management-end-ip", "management-gateway-ip", "central-gateway-ip"], + required: ["name", "management-subnet", "management-start-ip", "management-end-ip", "management-gateway-ip", "systemcontroller-gateway-ip"], }; function addSubcloud() { @@ -315,6 +314,11 @@ "oam-interface-mtu": { type: "number", title: "OAM Interface MTU"}, + "system-mode": { + type: "string", + title: "System Mode", + enum: ["duplex", "duplex-direct", "simplex"], + default: "duplex"}, }, }; diff --git a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/subcloud_table.html b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/subcloud_table.html similarity index 99% rename from cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/subcloud_table.html rename to starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/subcloud_table.html index 1870c634..e10e128d 100755 --- a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/subcloud_table.html +++ b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/subcloud_table.html @@ -170,7 +170,7 @@

Sync Status

-
{$ status.endpoint_type $}
+
{$ status.endpoint_type $}
diff --git a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/dc_admin.module.js b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/dc_admin.module.js similarity index 67% rename from cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/dc_admin.module.js rename to starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/dc_admin.module.js index 4c080c83..c947a136 100755 --- a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/dc_admin.module.js +++ b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/dc_admin.module.js @@ -1,9 +1,8 @@ /** * Copyright (c) 2017 Wind River Systems, Inc. - * - * The right to copy, distribute, modify, or otherwise make use - * of this software may be licensed only pursuant to the terms - * of an applicable Wind River license agreement. +* +* SPDX-License-Identifier: Apache-2.0 +* */ (function() { diff --git a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/dc_admin.module.spec.js b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/dc_admin.module.spec.js similarity index 81% rename from cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/dc_admin.module.spec.js rename to starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/dc_admin.module.spec.js index 8c3d784a..92f4dafb 100755 --- a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/dc_admin.module.spec.js +++ b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/dc_admin.module.spec.js @@ -1,9 +1,8 @@ /** * Copyright (c) 2017 Wind River Systems, Inc. - * - * The right to copy, distribute, modify, or otherwise make use - * of this software may be licensed only pursuant to the terms - * of an applicable Wind River license agreement. +* +* SPDX-License-Identifier: Apache-2.0 +* */ (function() { diff --git a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/dc_manager.service.js b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/dc_manager.service.js similarity index 96% rename from cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/dc_manager.service.js rename to starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/dc_manager.service.js index d6b08347..8e2294d8 100755 --- a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/dc_manager.service.js +++ b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/dc_manager.service.js @@ -1,9 +1,8 @@ /** * Copyright (c) 2017 Wind River Systems, Inc. - * - * The right to copy, distribute, modify, or otherwise make use - * of this software may be licensed only pursuant to the terms - * of an applicable Wind River license agreement. +* +* SPDX-License-Identifier: Apache-2.0 +* */ (function () { diff --git a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/sysinv.service.js b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/sysinv.service.js similarity index 89% rename from cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/sysinv.service.js rename to starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/sysinv.service.js index 5347b2b0..17958e86 100755 --- a/cgcs_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/sysinv.service.js +++ b/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/sysinv.service.js @@ -1,9 +1,8 @@ /** * Copyright (c) 2017 Wind River Systems, Inc. - * - * The right to copy, distribute, modify, or otherwise make use - * of this software may be licensed only pursuant to the terms - * of an applicable Wind River license agreement. +* +* SPDX-License-Identifier: Apache-2.0 +* */ (function () { diff --git a/cgcs_dashboard/dashboards/project/__init__.py b/starlingx_dashboard/dashboards/project/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/project/__init__.py rename to starlingx_dashboard/dashboards/project/__init__.py diff --git a/cgcs_dashboard/dashboards/project/server_groups/__init__.py b/starlingx_dashboard/dashboards/project/server_groups/__init__.py similarity index 100% rename from cgcs_dashboard/dashboards/project/server_groups/__init__.py rename to starlingx_dashboard/dashboards/project/server_groups/__init__.py diff --git a/cgcs_dashboard/dashboards/project/server_groups/forms.py b/starlingx_dashboard/dashboards/project/server_groups/forms.py similarity index 89% rename from cgcs_dashboard/dashboards/project/server_groups/forms.py rename to starlingx_dashboard/dashboards/project/server_groups/forms.py index c756eb7c..d8e1413c 100755 --- a/cgcs_dashboard/dashboards/project/server_groups/forms.py +++ b/starlingx_dashboard/dashboards/project/server_groups/forms.py @@ -1,172 +1,176 @@ -# -# Copyright (c) 2013-2017 Wind River Systems, Inc. -# -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# - -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2012 Nebula, Inc. -# All rights reserved. - -""" -Views for managing volumes. -""" - -from django.conf import settings -from django.core.urlresolvers import reverse -from django.forms import ValidationError -from django.utils.translation import ugettext_lazy as _ # noqa - -from horizon import exceptions -from horizon import forms -from horizon import messages - -from openstack_dashboard import api -from openstack_dashboard.api import cinder -from openstack_dashboard.api import nova -from openstack_dashboard.dashboards.project.instances import tables - - -class CreateForm(forms.SelfHandlingForm): - name = forms.CharField(max_length="255", label=_("Server Group Name")) - policy = forms.ChoiceField(label=_("Policy"), - required=False, - widget=forms.Select( - attrs={ - 'class': 'switchable', - 'data-slug': 'policy_ht'})) - - is_best_effort = forms.BooleanField(label=_("Best Effort"), required=False) - - group_size = forms.IntegerField( - min_value=1, - label=_("Max Group Size (Instances)"), - required=False, - widget=forms.TextInput( - attrs={ - 'class': 'switchable switched', - 'data-switch-on': 'policy_ht', - 'data-policy_ht-anti-affinity': 'Max Group Size (Instances)', - 'data-policy_ht-affinity': 'Max Group Size (Instances)'})) - - group_size_ht = forms.IntegerField( - label=_("Max Group Size (Instances)"), - required=False, - widget=forms.TextInput( - attrs={ - 'readonly': 'readonly', - 'class': 'switchable switched', - 'data-switch-on': 'policy_ht', - 'data-policy_ht-affinity-hyperthread': - 'Max Group Size (Instances)'})) - - def __init__(self, request, *args, **kwargs): - super(CreateForm, self).__init__(request, *args, **kwargs) - self.fields['policy'].choices = [("anti-affinity", "anti-affinity"), - ("affinity", "affinity")] - - def handle(self, request, data): - try: - policy = data['policy'] - policies = [] - if policy: - policies.append(policy) - metadata = {} - if data['is_best_effort']: - metadata['wrs-sg:best_effort'] = "true" - group_size = data['group_size'] - group_size_ht = data['group_size_ht'] - if group_size: - metadata['wrs-sg:group_size'] = str(group_size) - elif group_size_ht: - metadata['wrs-sg:group_size'] = str(group_size_ht) - - kwargs = {'name': data['name'], - 'policies': policies, - 'metadata': metadata} - server_group = nova.server_group_create(request, **kwargs) - return server_group - - except ValidationError as e: - self.api_error(e.messages[0]) - return False - except Exception: - exceptions.handle(request, ignore=True) - self.api_error(_("Unable to create server group.")) - return False - - -class AttachForm(forms.SelfHandlingForm): - instance = forms.ChoiceField(label=_("Attach to Server Group"), - help_text=_("Select an server group to " - "attach to.")) - device = forms.CharField(label=_("Device Name")) - - def __init__(self, *args, **kwargs): - super(AttachForm, self).__init__(*args, **kwargs) - - # Hide the device field if the hypervisor doesn't support it. - hypervisor_features = getattr(settings, - "OPENSTACK_HYPERVISOR_FEATURES", - {}) - can_set_mount_point = hypervisor_features.get("can_set_mount_point", - True) - if not can_set_mount_point: - self.fields['device'].widget = forms.widgets.HiddenInput() - self.fields['device'].required = False - - # populate volume_id - volume = kwargs.get('initial', {}).get("volume", None) - if volume: - volume_id = volume.id - else: - volume_id = None - self.fields['volume_id'] = forms.CharField(widget=forms.HiddenInput(), - initial=volume_id) - - # Populate instance choices - instance_list = kwargs.get('initial', {}).get('instances', []) - instances = [] - for instance in instance_list: - if instance.status in tables.ACTIVE_STATES and \ - not any(instance.id == att["server_id"] - for att in volume.attachments): - instances.append((instance.id, '%s (%s)' % (instance.name, - instance.id))) - if instances: - instances.insert(0, ("", _("Select an instance"))) - else: - instances = (("", _("No instances available")),) - self.fields['instance'].choices = instances - - def handle(self, request, data): - instance_choices = dict(self.fields['instance'].choices) - instance_name = instance_choices.get(data['instance'], - _("Unknown instance (None)")) - # The name of the instance in the choices list has the ID appended to - # it, so let's slice that off... - instance_name = instance_name.rsplit(" (")[0] - try: - attach = api.nova.instance_volume_attach(request, - data['volume_id'], - data['instance'], - data.get('device', '')) - volume = cinder.volume_get(request, data['volume_id']) - if not volume.display_name: - volume_name = volume.id - else: - volume_name = volume.display_name - message = _('Attaching volume %(vol)s to instance ' - '%(inst)s on %(dev)s.') % {"vol": volume_name, - "inst": instance_name, - "dev": attach.device} - messages.info(request, message) - return True - except Exception: - redirect = reverse("horizon:project:volumes:index") - exceptions.handle(request, - _('Unable to attach volume.'), - redirect=redirect) +# 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. +# +# Copyright (c) 2013-2017 Wind River Systems, Inc. +# +# Copyright 2012 Nebula, Inc. +# All rights reserved. + +""" +Views for managing volumes. +""" + +from django.conf import settings +from django.core.urlresolvers import reverse +from django.forms import ValidationError +from django.utils.translation import ugettext_lazy as _ # noqa + +from horizon import exceptions +from horizon import forms +from horizon import messages + +from openstack_dashboard import api +from openstack_dashboard.api import cinder +from starlingx_dashboard.api import nova +from openstack_dashboard.dashboards.project.instances import tables + + +class CreateForm(forms.SelfHandlingForm): + name = forms.CharField(max_length="255", label=_("Server Group Name")) + policy = forms.ChoiceField(label=_("Policy"), + required=False, + widget=forms.Select( + attrs={ + 'class': 'switchable', + 'data-slug': 'policy_ht'})) + + is_best_effort = forms.BooleanField(label=_("Best Effort"), required=False) + + group_size = forms.IntegerField( + min_value=1, + label=_("Max Group Size (Instances)"), + required=False, + widget=forms.TextInput( + attrs={ + 'class': 'switchable switched', + 'data-switch-on': 'policy_ht', + 'data-policy_ht-anti-affinity': 'Max Group Size (Instances)', + 'data-policy_ht-affinity': 'Max Group Size (Instances)'})) + + group_size_ht = forms.IntegerField( + label=_("Max Group Size (Instances)"), + required=False, + widget=forms.TextInput( + attrs={ + 'readonly': 'readonly', + 'class': 'switchable switched', + 'data-switch-on': 'policy_ht', + 'data-policy_ht-affinity-hyperthread': + 'Max Group Size (Instances)'})) + + def __init__(self, request, *args, **kwargs): + super(CreateForm, self).__init__(request, *args, **kwargs) + self.fields['policy'].choices = [("anti-affinity", "anti-affinity"), + ("affinity", "affinity")] + + def handle(self, request, data): + try: + policy = data['policy'] + policies = [] + if policy: + policies.append(policy) + metadata = {} + if data['is_best_effort']: + metadata['wrs-sg:best_effort'] = "true" + group_size = data['group_size'] + group_size_ht = data['group_size_ht'] + if group_size: + metadata['wrs-sg:group_size'] = str(group_size) + elif group_size_ht: + metadata['wrs-sg:group_size'] = str(group_size_ht) + + kwargs = {'name': data['name'], + 'policies': policies, + 'metadata': metadata} + server_group = nova.server_group_create(request, **kwargs) + return server_group + + except ValidationError as e: + self.api_error(e.messages[0]) + return False + except Exception: + exceptions.handle(request, ignore=True) + self.api_error(_("Unable to create server group.")) + return False + + +class AttachForm(forms.SelfHandlingForm): + instance = forms.ChoiceField(label=_("Attach to Server Group"), + help_text=_("Select an server group to " + "attach to.")) + device = forms.CharField(label=_("Device Name")) + + def __init__(self, *args, **kwargs): + super(AttachForm, self).__init__(*args, **kwargs) + + # Hide the device field if the hypervisor doesn't support it. + hypervisor_features = getattr(settings, + "OPENSTACK_HYPERVISOR_FEATURES", + {}) + can_set_mount_point = hypervisor_features.get("can_set_mount_point", + True) + if not can_set_mount_point: + self.fields['device'].widget = forms.widgets.HiddenInput() + self.fields['device'].required = False + + # populate volume_id + volume = kwargs.get('initial', {}).get("volume", None) + if volume: + volume_id = volume.id + else: + volume_id = None + self.fields['volume_id'] = forms.CharField(widget=forms.HiddenInput(), + initial=volume_id) + + # Populate instance choices + instance_list = kwargs.get('initial', {}).get('instances', []) + instances = [] + for instance in instance_list: + if instance.status in tables.ACTIVE_STATES and \ + not any(instance.id == att["server_id"] + for att in volume.attachments): + instances.append((instance.id, '%s (%s)' % (instance.name, + instance.id))) + if instances: + instances.insert(0, ("", _("Select an instance"))) + else: + instances = (("", _("No instances available")),) + self.fields['instance'].choices = instances + + def handle(self, request, data): + instance_choices = dict(self.fields['instance'].choices) + instance_name = instance_choices.get(data['instance'], + _("Unknown instance (None)")) + # The name of the instance in the choices list has the ID appended to + # it, so let's slice that off... + instance_name = instance_name.rsplit(" (")[0] + try: + attach = api.nova.instance_volume_attach(request, + data['volume_id'], + data['instance'], + data.get('device', '')) + volume = cinder.volume_get(request, data['volume_id']) + if not volume.display_name: + volume_name = volume.id + else: + volume_name = volume.display_name + message = _('Attaching volume %(vol)s to instance ' + '%(inst)s on %(dev)s.') % {"vol": volume_name, + "inst": instance_name, + "dev": attach.device} + messages.info(request, message) + return True + except Exception: + redirect = reverse("horizon:project:volumes:index") + exceptions.handle(request, + _('Unable to attach volume.'), + redirect=redirect) diff --git a/cgcs_dashboard/dashboards/project/server_groups/panel.py b/starlingx_dashboard/dashboards/project/server_groups/panel.py similarity index 86% rename from cgcs_dashboard/dashboards/project/server_groups/panel.py rename to starlingx_dashboard/dashboards/project/server_groups/panel.py index b3381a68..9d336c37 100755 --- a/cgcs_dashboard/dashboards/project/server_groups/panel.py +++ b/starlingx_dashboard/dashboards/project/server_groups/panel.py @@ -1,52 +1,45 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2012 Nebula, 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. -# -# Copyright (c) 2013-2017 Wind River Systems, Inc. -# -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# - - -from django.utils.translation import ugettext_lazy as _ # noqa - -import horizon - -from openstack_dashboard.api import base -from openstack_dashboard.dashboards.project import dashboard - - -class ServerGroups(horizon.Panel): - name = _("Server Groups") - slug = 'server_groups' - # Server groups are wrs-specific - permissions = ('openstack.services.platform',) - - def allowed(self, context): - if not base.is_service_enabled(context['request'], 'platform'): - return False - else: - return super(ServerGroups, self).allowed(context) - - def nav(self, context): - if not base.is_service_enabled(context['request'], 'platform'): - return False - else: - return True - - -dashboard.Project.register(ServerGroups) +# Copyright 2012 Nebula, 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. +# +# Copyright (c) 2013-2017 Wind River Systems, Inc. +# + +from django.utils.translation import ugettext_lazy as _ # noqa + +import horizon + +from openstack_dashboard.api import base +from openstack_dashboard.dashboards.project import dashboard + + +class ServerGroups(horizon.Panel): + name = _("Server Groups") + slug = 'server_groups' + # Server groups are wrs-specific + permissions = ('openstack.services.platform',) + + def allowed(self, context): + if not base.is_service_enabled(context['request'], 'platform'): + return False + else: + return super(ServerGroups, self).allowed(context) + + def nav(self, context): + if not base.is_service_enabled(context['request'], 'platform'): + return False + else: + return True + + +dashboard.Project.register(ServerGroups) diff --git a/cgcs_dashboard/dashboards/project/server_groups/tables.py b/starlingx_dashboard/dashboards/project/server_groups/tables.py similarity index 97% rename from cgcs_dashboard/dashboards/project/server_groups/tables.py rename to starlingx_dashboard/dashboards/project/server_groups/tables.py index e04efcbf..987a8e9e 100755 --- a/cgcs_dashboard/dashboards/project/server_groups/tables.py +++ b/starlingx_dashboard/dashboards/project/server_groups/tables.py @@ -1,293 +1,286 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2012 Nebula, 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. -# -# Copyright (c) 2013-2017 Wind River Systems, Inc. -# -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# - - -from django.core.urlresolvers import NoReverseMatch -from django.core.urlresolvers import reverse -from django.utils import html -from django.utils import safestring -from django.utils.translation import string_concat # noqa -from django.utils.translation import ugettext_lazy as _ # noqa -from django.utils.translation import ungettext_lazy - -from horizon import exceptions -from horizon import tables - -from openstack_dashboard import api -from openstack_dashboard.api import nova -from openstack_dashboard.dashboards.project.volumes.tables \ - import get_attachment_name -from openstack_dashboard.usage import quotas - - -DELETABLE_STATES = ("available", "error") - - -class DeleteServerGroup(tables.DeleteAction): - data_type_singular = _("Server Group") - data_type_plural = _("Server Groups") - action_past = _("Scheduled deletion of") - - @staticmethod - def action_present(count): - return ungettext_lazy( - u"Delete Server Group", - u"Delete Server Groups", - count - ) - - @staticmethod - def action_past(count): - return ungettext_lazy( - u"Deleted Server Group", - u"Deleted Server Groups", - count - ) - - def delete(self, request, obj_id): - obj = self.table.get_object_by_id(obj_id) - name = self.table.get_object_display(obj) - - try: - nova.server_group_delete(request, obj_id) - except Exception: - msg = _('Unable to delete group "%s" because it is not empty. ' - 'Either delete the member ' - 'instances or remove them from the group.') - exceptions.check_message(["group", "not", "empty."], msg % name) - raise - - # maybe do a precheck to see if the group is empty first? - def allowed(self, request, server_group=None): - return True - - -class CreateServerGroup(tables.LinkAction): - name = "create" - verbose_name = _("Create Server Group") - url = "horizon:project:server_groups:create" - classes = ("ajax-modal", "btn-create") - icon = "plus" - - def allowed(self, request, volume=None): - usages = quotas.tenant_quota_usages(request) - if usages['server_groups']['available'] <= 0: - if "disabled" not in self.classes: - self.classes = [c for c in self.classes] + ['disabled'] - self.verbose_name = string_concat(self.verbose_name, ' ', - _("(Quota exceeded)")) - else: - self.verbose_name = _("Create Server Group") - classes = [c for c in self.classes if c != "disabled"] - self.classes = classes - return True - - -class EditAttachments(tables.LinkAction): - name = "attachments" - verbose_name = _("Edit Attachments") - url = "horizon:project:server_groups:attach" - classes = ("ajax-modal", "btn-edit") - - def allowed(self, request, server_group=None): - return True # volume.status in ("available", "in-use") - - -class CreateSnapshot(tables.LinkAction): - name = "snapshots" - verbose_name = _("Create Snapshot") - url = "horizon:project:server_groups:create_snapshot" - classes = ("ajax-modal", "btn-camera") - - def allowed(self, request, server_group=None): - return True # server_group.status == "available" - - -class UpdateRow(tables.Row): - ajax = True - - def get_data(self, request, server_group_id): - server_group = nova.server_group_get(request, server_group_id) - if not server_group.name: - server_group.name = server_group_id - return server_group - - -def get_policies(server_group): - policies = ', '.join(server_group.policies) - return policies - - -def get_metadata(server_group): - metadata_items = ['{}:{}'.format(x, y) for x, y in - server_group.metadata.items()] - metadata = ', '.join(metadata_items) - return metadata - - -def get_member_name(request, server_id): - try: - server = api.nova.server_get(request, server_id) - name = server.name - except Exception: - name = None - exceptions.handle(request, _("Unable to retrieve " - "member information.")) - # try and get a URL - try: - url = reverse("horizon:project:instances:detail", args=(server_id,)) - instance = '%s' % (url, html.escape(name)) - except NoReverseMatch: - instance = name - return instance - - -class MemberColumn(tables.Column): - """Customized column class - - Customized column class that does complex processing on the instances - in a server group. This was substantially copied - from the volume equivalent. - """ - - def get_raw_data(self, server_group): - request = self.table.request - link = _('%(name)s (%(id)s)') - members = [] - for member in server_group.members: - member_id = member - name = get_member_name(request, member) - vals = {"name": name, "id": member_id} - members.append(link % vals) - return safestring.mark_safe(", ".join(members)) - - -def get_server_group_type(server_group): - return server_group.volume_type if server_group.volume_type != "None" \ - else None - - -class ServerGroupsFilterAction(tables.FilterAction): - def filter(self, table, server_groups, filter_string): - """Naive case-insensitive search.""" - q = filter_string.lower() - return [group for group in server_groups - if q in group.display_name.lower()] - - -class ServerGroupsTable(tables.DataTable): - name = tables.Column("name", - verbose_name=_("Group Name"), - link="horizon:project:server_groups:detail") - policies = tables.Column(get_policies, - verbose_name=_("Policies")) - members = MemberColumn("members", - verbose_name=_("Members")) - metadata = tables.Column(get_metadata, - verbose_name=_("Metadata")) - - class Meta(object): - name = "server_groups" - verbose_name = _("Server Groups") - row_class = UpdateRow - table_actions = ( - CreateServerGroup, DeleteServerGroup, ServerGroupsFilterAction) - row_actions = (DeleteServerGroup,) - - def get_object_display(self, obj): - return obj.name - - -class DetachServerGroup(tables.BatchAction): - name = "detach" - action_present = _("Detach") - action_past = _("Detaching") # This action is asynchronous. - data_type_singular = _("Server Group") - data_type_plural = _("Server Groups") - classes = ('btn-danger', 'btn-detach') - - @staticmethod - def action_present(count): - return ungettext_lazy( - u"Server Group", - u"Server Groups", - count - ) - - @staticmethod - def action_past(count): - return ungettext_lazy( - u"Deleted Group", - u"Deleted Groups", - count - ) - - def action(self, request, obj_id): - attachment = self.table.get_object_by_id(obj_id) - api.nova.instance_server_group_detach( - request, - attachment.get('server_id', None), - obj_id) - - def get_success_url(self, request): - return reverse('horizon:project:server_groups:index') - - -class AttachedInstanceColumn(tables.Column): - """Customized column class - - Customized column class that does complex processing on the attachments - for a server group. - """ - - def get_raw_data(self, attachment): - request = self.table.request - return safestring.mark_safe(get_attachment_name(request, attachment)) - - -class AttachmentsTable(tables.DataTable): - instance = AttachedInstanceColumn(get_member_name, - verbose_name=_("Instance")) - device = tables.Column("device", - verbose_name=_("Device")) - - def get_object_id(self, obj): - return obj['id'] - - def get_object_display(self, attachment): - instance_name = get_attachment_name(self.request, attachment) - vals = {"dev": attachment['device'], - "instance_name": html.strip_tags(instance_name)} - return _("%(dev)s on instance %(instance_name)s") % vals - - def get_object_by_id(self, obj_id): - for obj in self.data: - if self.get_object_id(obj) == obj_id: - return obj - raise ValueError('No match found for the id "%s".' % obj_id) - - class Meta(object): - name = "attachments" - verbose_name = _("Attachments") - table_actions = (DetachServerGroup,) - row_actions = (DetachServerGroup,) +# Copyright 2012 Nebula, 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. +# +# Copyright (c) 2013-2017 Wind River Systems, Inc. +# + +from django.core.urlresolvers import NoReverseMatch +from django.core.urlresolvers import reverse +from django.utils import html +from django.utils import safestring +from django.utils.translation import string_concat # noqa +from django.utils.translation import ugettext_lazy as _ # noqa +from django.utils.translation import ungettext_lazy + +from horizon import exceptions +from horizon import tables + +from openstack_dashboard import api +from openstack_dashboard.api import nova +from openstack_dashboard.dashboards.project.volumes.tables \ + import get_attachment_name +from openstack_dashboard.usage import quotas + + +DELETABLE_STATES = ("available", "error") + + +class DeleteServerGroup(tables.DeleteAction): + data_type_singular = _("Server Group") + data_type_plural = _("Server Groups") + action_past = _("Scheduled deletion of") + + @staticmethod + def action_present(count): + return ungettext_lazy( + u"Delete Server Group", + u"Delete Server Groups", + count + ) + + @staticmethod + def action_past(count): + return ungettext_lazy( + u"Deleted Server Group", + u"Deleted Server Groups", + count + ) + + def delete(self, request, obj_id): + obj = self.table.get_object_by_id(obj_id) + name = self.table.get_object_display(obj) + + try: + nova.server_group_delete(request, obj_id) + except Exception: + msg = _('Unable to delete group "%s" because it is not empty. ' + 'Either delete the member ' + 'instances or remove them from the group.') + exceptions.check_message(["group", "not", "empty."], msg % name) + raise + + # maybe do a precheck to see if the group is empty first? + def allowed(self, request, server_group=None): + return True + + +class CreateServerGroup(tables.LinkAction): + name = "create" + verbose_name = _("Create Server Group") + url = "horizon:project:server_groups:create" + classes = ("ajax-modal", "btn-create") + icon = "plus" + + def allowed(self, request, volume=None): + usages = quotas.tenant_quota_usages(request) + if usages['server_groups']['available'] <= 0: + if "disabled" not in self.classes: + self.classes = [c for c in self.classes] + ['disabled'] + self.verbose_name = string_concat(self.verbose_name, ' ', + _("(Quota exceeded)")) + else: + self.verbose_name = _("Create Server Group") + classes = [c for c in self.classes if c != "disabled"] + self.classes = classes + return True + + +class EditAttachments(tables.LinkAction): + name = "attachments" + verbose_name = _("Edit Attachments") + url = "horizon:project:server_groups:attach" + classes = ("ajax-modal", "btn-edit") + + def allowed(self, request, server_group=None): + return True # volume.status in ("available", "in-use") + + +class CreateSnapshot(tables.LinkAction): + name = "snapshots" + verbose_name = _("Create Snapshot") + url = "horizon:project:server_groups:create_snapshot" + classes = ("ajax-modal", "btn-camera") + + def allowed(self, request, server_group=None): + return True # server_group.status == "available" + + +class UpdateRow(tables.Row): + ajax = True + + def get_data(self, request, server_group_id): + server_group = nova.server_group_get(request, server_group_id) + if not server_group.name: + server_group.name = server_group_id + return server_group + + +def get_policies(server_group): + policies = ', '.join(server_group.policies) + return policies + + +def get_metadata(server_group): + metadata_items = ['{}:{}'.format(x, y) for x, y in + server_group.metadata.items()] + metadata = ', '.join(metadata_items) + return metadata + + +def get_member_name(request, server_id): + try: + server = api.nova.server_get(request, server_id) + name = server.name + except Exception: + name = None + exceptions.handle(request, _("Unable to retrieve " + "member information.")) + # try and get a URL + try: + url = reverse("horizon:project:instances:detail", args=(server_id,)) + instance = '%s' % (url, html.escape(name)) + except NoReverseMatch: + instance = name + return instance + + +class MemberColumn(tables.Column): + """Customized column class + + Customized column class that does complex processing on the instances + in a server group. This was substantially copied + from the volume equivalent. + """ + + def get_raw_data(self, server_group): + request = self.table.request + link = _('%(name)s (%(id)s)') + members = [] + for member in server_group.members: + member_id = member + name = get_member_name(request, member) + vals = {"name": name, "id": member_id} + members.append(link % vals) + return safestring.mark_safe(", ".join(members)) + + +def get_server_group_type(server_group): + return server_group.volume_type if server_group.volume_type != "None" \ + else None + + +class ServerGroupsFilterAction(tables.FilterAction): + def filter(self, table, server_groups, filter_string): + """Naive case-insensitive search.""" + q = filter_string.lower() + return [group for group in server_groups + if q in group.display_name.lower()] + + +class ServerGroupsTable(tables.DataTable): + name = tables.Column("name", + verbose_name=_("Group Name"), + link="horizon:project:server_groups:detail") + policies = tables.Column(get_policies, + verbose_name=_("Policies")) + members = MemberColumn("members", + verbose_name=_("Members")) + metadata = tables.Column(get_metadata, + verbose_name=_("Metadata")) + + class Meta(object): + name = "server_groups" + verbose_name = _("Server Groups") + row_class = UpdateRow + table_actions = ( + CreateServerGroup, DeleteServerGroup, ServerGroupsFilterAction) + row_actions = (DeleteServerGroup,) + + def get_object_display(self, obj): + return obj.name + + +class DetachServerGroup(tables.BatchAction): + name = "detach" + action_present = _("Detach") + action_past = _("Detaching") # This action is asynchronous. + data_type_singular = _("Server Group") + data_type_plural = _("Server Groups") + classes = ('btn-danger', 'btn-detach') + + @staticmethod + def action_present(count): + return ungettext_lazy( + u"Server Group", + u"Server Groups", + count + ) + + @staticmethod + def action_past(count): + return ungettext_lazy( + u"Deleted Group", + u"Deleted Groups", + count + ) + + def action(self, request, obj_id): + attachment = self.table.get_object_by_id(obj_id) + api.nova.instance_server_group_detach( + request, + attachment.get('server_id', None), + obj_id) + + def get_success_url(self, request): + return reverse('horizon:project:server_groups:index') + + +class AttachedInstanceColumn(tables.Column): + """Customized column class + + Customized column class that does complex processing on the attachments + for a server group. + """ + + def get_raw_data(self, attachment): + request = self.table.request + return safestring.mark_safe(get_attachment_name(request, attachment)) + + +class AttachmentsTable(tables.DataTable): + instance = AttachedInstanceColumn(get_member_name, + verbose_name=_("Instance")) + device = tables.Column("device", + verbose_name=_("Device")) + + def get_object_id(self, obj): + return obj['id'] + + def get_object_display(self, attachment): + instance_name = get_attachment_name(self.request, attachment) + vals = {"dev": attachment['device'], + "instance_name": html.strip_tags(instance_name)} + return _("%(dev)s on instance %(instance_name)s") % vals + + def get_object_by_id(self, obj_id): + for obj in self.data: + if self.get_object_id(obj) == obj_id: + return obj + raise ValueError('No match found for the id "%s".' % obj_id) + + class Meta(object): + name = "attachments" + verbose_name = _("Attachments") + table_actions = (DetachServerGroup,) + row_actions = (DetachServerGroup,) diff --git a/cgcs_dashboard/dashboards/project/server_groups/tabs.py b/starlingx_dashboard/dashboards/project/server_groups/tabs.py similarity index 89% rename from cgcs_dashboard/dashboards/project/server_groups/tabs.py rename to starlingx_dashboard/dashboards/project/server_groups/tabs.py index 02a6eb4c..527c174d 100755 --- a/cgcs_dashboard/dashboards/project/server_groups/tabs.py +++ b/starlingx_dashboard/dashboards/project/server_groups/tabs.py @@ -1,58 +1,51 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2012 Nebula, 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. -# -# Copyright (c) 2013-2017 Wind River Systems, Inc. -# -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# - - -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ # noqa - -from horizon import exceptions -from horizon import tabs - -from openstack_dashboard.api import nova - - -class OverviewTab(tabs.Tab): - name = _("Overview") - slug = "overview" - template_name = ("project/server_groups/" - "_detail_overview.html") - - def get_context_data(self, request): - server_group_id = self.tab_group.kwargs['server_group_id'] - try: - server_group = nova.server_group_get(request, server_group_id) - server_group.members_display = [] - for member in server_group.members: - server_group.members_display.append( - dict(id=member, instance=nova.server_get(request, member))) - except Exception: - redirect = reverse('horizon:project:server_groups:index') - exceptions.handle(self.request, - _('Unable to retrieve server group details.'), - redirect=redirect) - return {'server_group': server_group} - - -class ServerGroupDetailTabs(tabs.TabGroup): - slug = "server_group_details" - tabs = (OverviewTab,) +# Copyright 2012 Nebula, 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. +# +# Copyright (c) 2013-2017 Wind River Systems, Inc. +# + +from django.core.urlresolvers import reverse +from django.utils.translation import ugettext_lazy as _ # noqa + +from horizon import exceptions +from horizon import tabs + +from openstack_dashboard.api import nova + + +class OverviewTab(tabs.Tab): + name = _("Overview") + slug = "overview" + template_name = ("project/server_groups/" + "_detail_overview.html") + + def get_context_data(self, request): + server_group_id = self.tab_group.kwargs['server_group_id'] + try: + server_group = nova.server_group_get(request, server_group_id) + server_group.members_display = [] + for member in server_group.members: + server_group.members_display.append( + dict(id=member, instance=nova.server_get(request, member))) + except Exception: + redirect = reverse('horizon:project:server_groups:index') + exceptions.handle(self.request, + _('Unable to retrieve server group details.'), + redirect=redirect) + return {'server_group': server_group} + + +class ServerGroupDetailTabs(tabs.TabGroup): + slug = "server_group_details" + tabs = (OverviewTab,) diff --git a/cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/_attach.html b/starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/_attach.html similarity index 97% rename from cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/_attach.html rename to starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/_attach.html index 0784b682..934f95ef 100755 --- a/cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/_attach.html +++ b/starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/_attach.html @@ -1,26 +1,26 @@ -{% extends "horizon/common/_modal_form.html" %} -{% load i18n %} -{% load url from future %} - -{% block form_id %}attach_volume_form{% endblock %} -{% block form_action %}{% url 'horizon:project:volumes:attach' volume.id %}{% endblock %} -{% block form_class %}{{ block.super }} horizontal {% if show_attach %}split_half{% else %} no_split{% endif %}{% endblock %} - -{% block modal_id %}attach_volume_modal{% endblock %} -{% block modal-header %}{% trans "Manage Volume Attachments" %}{% endblock %} - -{% block modal-body %} - {% if show_attach %} -

{% trans "Attach To Instance" %}

-
- {% include "horizon/common/_form_fields.html" %} -
- {% endif %} -{% endblock %} - -{% block modal-footer %} - Cancel - {% if show_attach %} - - {% endif %} -{% endblock %} +{% extends "horizon/common/_modal_form.html" %} +{% load i18n %} +{% load url from future %} + +{% block form_id %}attach_volume_form{% endblock %} +{% block form_action %}{% url 'horizon:project:volumes:attach' volume.id %}{% endblock %} +{% block form_class %}{{ block.super }} horizontal {% if show_attach %}split_half{% else %} no_split{% endif %}{% endblock %} + +{% block modal_id %}attach_volume_modal{% endblock %} +{% block modal-header %}{% trans "Manage Volume Attachments" %}{% endblock %} + +{% block modal-body %} + {% if show_attach %} +

{% trans "Attach To Instance" %}

+
+ {% include "horizon/common/_form_fields.html" %} +
+ {% endif %} +{% endblock %} + +{% block modal-footer %} + Cancel + {% if show_attach %} + + {% endif %} +{% endblock %} diff --git a/cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/_create.html b/starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/_create.html similarity index 96% rename from cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/_create.html rename to starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/_create.html index 8d0f1bbd..742d43c6 100755 --- a/cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/_create.html +++ b/starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/_create.html @@ -1,27 +1,26 @@ -{% extends "horizon/common/_modal_form.html" %} -{% load i18n %} -{% load url from future %} - -{% block form_id %}{% endblock %} -{% block form_action %}{% url 'horizon:project:server_groups:create' %}?{{ request.GET.urlencode }}{% endblock %} - -{% block modal_id %}create_server_group_modal{% endblock %} -{% block modal-header %}{% trans "Create Server Group" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
- -
-

{% trans "Description" %}:

-

{% trans "From here you can create a new server group" %}

-
-{% endblock %} - -{% block modal-footer %} - {% trans "Cancel" %} - -{% endblock %} +{% extends "horizon/common/_modal_form.html" %} +{% load i18n %} + +{% block form_id %}{% endblock %} +{% block form_action %}{% url 'horizon:project:server_groups:create' %}?{{ request.GET.urlencode }}{% endblock %} + +{% block modal_id %}create_server_group_modal{% endblock %} +{% block modal-header %}{% trans "Create Server Group" %}{% endblock %} + +{% block modal-body %} +
+
+ {% include "horizon/common/_form_fields.html" %} +
+
+ +
+

{% trans "Description" %}:

+

{% trans "From here you can create a new server group" %}

+
+{% endblock %} + +{% block modal-footer %} + {% trans "Cancel" %} + +{% endblock %} diff --git a/cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/_detail_overview.html b/starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/_detail_overview.html similarity index 96% rename from cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/_detail_overview.html rename to starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/_detail_overview.html index e366852a..bf1df26c 100755 --- a/cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/_detail_overview.html +++ b/starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/_detail_overview.html @@ -1,53 +1,53 @@ -{% load i18n sizeformat parse_date %} -{% load url from future %} - -

{% trans "Server Group Overview" %}: {{server_group.name }}

- -
-

{% trans "Info" %}

-
-
-
{% trans "Name" %}
-
{{ server_group.name }}
-
{% trans "ID" %}
-
{{ server_group.id }}
-
{% trans "Status" %}
-
{{ server_group.status|capfirst }}
-
-
- -
-

{% trans "Members" %}

-
-
- {% for member in server_group.members_display %} -
- {% url 'horizon:project:instances:detail' member.id as instance_url%} - {{ member.instance.name }} ({{ member.id }}) -
- {% empty %} -
{% trans "No members" %}
- {% endfor %} -
-
- -
-

{% trans "Policies" %}

-
-
- {% for policy in server_group.policies %} -
{{ policy }}
- {% endfor %} -
-
- -
-

{% trans "Metadata" %}

-
-
- {% for key, value in server_group.metadata.items %} -
{{ key }}
-
{{ value }}
- {% endfor %} -
-
+{% load i18n sizeformat parse_date %} +{% load url from future %} + +

{% trans "Server Group Overview" %}: {{server_group.name }}

+ +
+

{% trans "Info" %}

+
+
+
{% trans "Name" %}
+
{{ server_group.name }}
+
{% trans "ID" %}
+
{{ server_group.id }}
+
{% trans "Status" %}
+
{{ server_group.status|capfirst }}
+
+
+ +
+

{% trans "Members" %}

+
+
+ {% for member in server_group.members_display %} +
+ {% url 'horizon:project:instances:detail' member.id as instance_url%} + {{ member.instance.name }} ({{ member.id }}) +
+ {% empty %} +
{% trans "No members" %}
+ {% endfor %} +
+
+ +
+

{% trans "Policies" %}

+
+
+ {% for policy in server_group.policies %} +
{{ policy }}
+ {% endfor %} +
+
+ +
+

{% trans "Metadata" %}

+
+
+ {% for key, value in server_group.metadata.items %} +
{{ key }}
+
{{ value }}
+ {% endfor %} +
+
diff --git a/cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/attach.html b/starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/attach.html similarity index 96% rename from cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/attach.html rename to starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/attach.html index 4b4dad86..697273f4 100755 --- a/cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/attach.html +++ b/starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/attach.html @@ -1,11 +1,11 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Manage Volume Attachments" %}{% endblock %} - -{% block page_header %} - {% include "horizon/common/_page_header.html" with title=_("Manage Volume Attachments") %} -{% endblock page_header %} - -{% block main %} - {% include 'project/volumes/_attach.html' %} -{% endblock %} +{% extends 'base.html' %} +{% load i18n %} +{% block title %}{% trans "Manage Volume Attachments" %}{% endblock %} + +{% block page_header %} + {% include "horizon/common/_page_header.html" with title=_("Manage Volume Attachments") %} +{% endblock page_header %} + +{% block main %} + {% include 'project/volumes/_attach.html' %} +{% endblock %} diff --git a/cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/create.html b/starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/create.html similarity index 96% rename from cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/create.html rename to starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/create.html index 10bbff14..5b1a14fd 100755 --- a/cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/create.html +++ b/starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/create.html @@ -1,11 +1,11 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Create Server Group" %}{% endblock %} - -{% block page_header %} - {% include "horizon/common/_page_header.html" with title=_("Create an Server Group") %} -{% endblock page_header %} - -{% block main %} - {% include 'project/server_groups/_create.html' %} -{% endblock %} +{% extends 'base.html' %} +{% load i18n %} +{% block title %}{% trans "Create Server Group" %}{% endblock %} + +{% block page_header %} + {% include "horizon/common/_page_header.html" with title=_("Create an Server Group") %} +{% endblock page_header %} + +{% block main %} + {% include 'project/server_groups/_create.html' %} +{% endblock %} diff --git a/cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/detail.html b/starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/detail.html similarity index 95% rename from cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/detail.html rename to starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/detail.html index 3ce02ba3..dcd744f6 100755 --- a/cgcs_dashboard/dashboards/admin/server_groups/templates/server_groups/detail.html +++ b/starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/detail.html @@ -1,11 +1,11 @@ -{% extends 'base.html' %} -{% load i18n breadcrumb_nav %} -{% block title %}{% trans "Server Group Details" %}{% endblock %} - -{% block main %} -
-
- {{ tab_group.render }} -
-
-{% endblock %} +{% extends 'base.html' %} +{% load i18n breadcrumb_nav %} +{% block title %}{% trans "Server Group Details" %}{% endblock %} + +{% block main %} +
+
+ {{ tab_group.render }} +
+
+{% endblock %} diff --git a/cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/index.html b/starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/index.html similarity index 96% rename from cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/index.html rename to starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/index.html index 44a03e4c..98978ef2 100755 --- a/cgcs_dashboard/dashboards/project/server_groups/templates/server_groups/index.html +++ b/starlingx_dashboard/dashboards/project/server_groups/templates/server_groups/index.html @@ -1,11 +1,11 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Server Groups" %}{% endblock %} - -{% block page_header %} - {% include "horizon/common/_page_header.html" with title=_("Server Groups") %} -{% endblock page_header %} - -{% block main %} - {{ table.render }} -{% endblock %} +{% extends 'base.html' %} +{% load i18n %} +{% block title %}{% trans "Server Groups" %}{% endblock %} + +{% block page_header %} + {% include "horizon/common/_page_header.html" with title=_("Server Groups") %} +{% endblock page_header %} + +{% block main %} + {{ table.render }} +{% endblock %} diff --git a/cgcs_dashboard/dashboards/project/server_groups/urls.py b/starlingx_dashboard/dashboards/project/server_groups/urls.py similarity index 78% rename from cgcs_dashboard/dashboards/project/server_groups/urls.py rename to starlingx_dashboard/dashboards/project/server_groups/urls.py index 04a8a769..737dadf5 100755 --- a/cgcs_dashboard/dashboards/project/server_groups/urls.py +++ b/starlingx_dashboard/dashboards/project/server_groups/urls.py @@ -1,39 +1,32 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2012 Nebula, 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. -# -# Copyright (c) 2013-2017 Wind River Systems, Inc. -# -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# - - -from django.conf.urls import url - -from openstack_dashboard.dashboards.project.server_groups import views - - -urlpatterns = [ - url(r'^$', views.IndexView.as_view(), name='index'), - url(r'^create/$', views.CreateView.as_view(), name='create'), - url(r'^(?P[^/]+)/attach/$', - views.EditAttachmentsView.as_view(), - name='attach'), - url(r'^(?P[^/]+)/$', - views.DetailView.as_view(), - name='detail'), -] +# Copyright 2012 Nebula, 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. +# +# Copyright (c) 2013-2017 Wind River Systems, Inc. +# + +from django.conf.urls import url + +from starlingx_dashboard.dashboards.project.server_groups import views + + +urlpatterns = [ + url(r'^$', views.IndexView.as_view(), name='index'), + url(r'^create/$', views.CreateView.as_view(), name='create'), + url(r'^(?P[^/]+)/attach/$', + views.EditAttachmentsView.as_view(), + name='attach'), + url(r'^(?P[^/]+)/$', + views.DetailView.as_view(), + name='detail'), +] diff --git a/cgcs_dashboard/dashboards/project/server_groups/views.py b/starlingx_dashboard/dashboards/project/server_groups/views.py similarity index 92% rename from cgcs_dashboard/dashboards/project/server_groups/views.py rename to starlingx_dashboard/dashboards/project/server_groups/views.py index 63397b92..ab1fd858 100755 --- a/cgcs_dashboard/dashboards/project/server_groups/views.py +++ b/starlingx_dashboard/dashboards/project/server_groups/views.py @@ -1,154 +1,148 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2012 Nebula, 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. -# -# Copyright (c) 2013-2017 Wind River Systems, Inc. -# -# The right to copy, distribute, modify, or otherwise make use -# of this software may be licensed only pursuant to the terms -# of an applicable Wind River license agreement. -# - - -""" -Views for managing server groups. -""" - -from django.core.urlresolvers import reverse_lazy # noqa -from django.utils.translation import ugettext_lazy as _ # noqa - -from horizon import exceptions -from horizon import forms -from horizon import tables -from horizon import tabs - -from openstack_dashboard import api -from openstack_dashboard.usage import quotas - -from openstack_dashboard.dashboards.project.server_groups \ - import forms as project_forms - -from openstack_dashboard.dashboards.project.server_groups \ - import tables as project_tables -from openstack_dashboard.dashboards.project.server_groups \ - import tabs as project_tabs - - -# server groups don't currently support pagination -class IndexView(tables.DataTableView): - table_class = project_tables.ServerGroupsTable - template_name = 'project/server_groups/index.html' - page_title = _("Server Groups") - - def get_data(self): - try: - server_groups = api.nova.server_group_list( - self.request) - except Exception: - server_groups = [] - exceptions.handle(self.request, - _('Unable to retrieve server groups.')) - return server_groups - - -class DetailView(tabs.TabView): - tab_group_class = project_tabs.ServerGroupDetailTabs - template_name = 'project/server_groups/detail.html' - page_title = 'Server Group Details' - - -class CreateView(forms.ModalFormView): - form_class = project_forms.CreateForm - template_name = 'project/server_groups/create.html' - success_url = reverse_lazy("horizon:project:server_groups:index") - - def get_context_data(self, **kwargs): - context = super(CreateView, self).get_context_data(**kwargs) - try: - context['usages'] = quotas.tenant_limit_usages(self.request) - except Exception: - exceptions.handle(self.request) - return context - - -class EditAttachmentsView(tables.DataTableView, forms.ModalFormView): - table_class = project_tables.AttachmentsTable - form_class = project_forms.AttachForm - template_name = 'project/server_groups/attach.html' - success_url = reverse_lazy("horizon:project:server_groups:index") - - def get_object(self): - if not hasattr(self, "_object"): - volume_id = self.kwargs['volume_id'] - try: - self._object = api.cinder.volume_get(self.request, volume_id) - except Exception: - self._object = None - exceptions.handle(self.request, - _('Unable to retrieve volume information.')) - return self._object - - def get_data(self): - try: - volumes = self.get_object() - attachments = [att for att in volumes.attachments if att] - except Exception: - attachments = [] - exceptions.handle(self.request, - _('Unable to retrieve volume information.')) - return attachments - - def get_initial(self): - try: - instances, has_more = api.nova.server_list(self.request) - except Exception: - instances = [] - exceptions.handle(self.request, - _("Unable to retrieve attachment information.")) - return {'volume': self.get_object(), - 'instances': instances} - - def get_form(self): - if not hasattr(self, "_form"): - form_class = self.get_form_class() - self._form = super(EditAttachmentsView, self).get_form(form_class) - return self._form - - def get_context_data(self, **kwargs): - context = super(EditAttachmentsView, self).get_context_data(**kwargs) - context['form'] = self.get_form() - volume = self.get_object() - if volume and volume.status == 'available': - context['show_attach'] = True - else: - context['show_attach'] = False - context['volume'] = volume - if self.request.is_ajax(): - context['hide'] = True - return context - - def get(self, request, *args, **kwargs): - # Table action handling - handled = self.construct_tables() - if handled: - return handled - return self.render_to_response(self.get_context_data(**kwargs)) - - def post(self, request, *args, **kwargs): - form = self.get_form() - if form.is_valid(): - return self.form_valid(form) - else: - return self.get(request, *args, **kwargs) +# Copyright 2012 Nebula, 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. +# +# Copyright (c) 2013-2017 Wind River Systems, Inc. +# + +""" +Views for managing server groups. +""" + + +from django.core.urlresolvers import reverse_lazy # noqa +from django.utils.translation import ugettext_lazy as _ # noqa + +from horizon import exceptions +from horizon import forms +from horizon import tables +from horizon import tabs + +from openstack_dashboard import api +from openstack_dashboard.usage import quotas + +from starlingx_dashboard.dashboards.project.server_groups \ + import forms as project_forms + +from starlingx_dashboard.dashboards.project.server_groups \ + import tables as project_tables +from starlingx_dashboard.dashboards.project.server_groups \ + import tabs as project_tabs + + +# server groups don't currently support pagination +class IndexView(tables.DataTableView): + table_class = project_tables.ServerGroupsTable + template_name = 'project/server_groups/index.html' + page_title = _("Server Groups") + + def get_data(self): + try: + server_groups = api.nova.server_group_list( + self.request) + except Exception: + server_groups = [] + exceptions.handle(self.request, + _('Unable to retrieve server groups.')) + return server_groups + + +class DetailView(tabs.TabView): + tab_group_class = project_tabs.ServerGroupDetailTabs + template_name = 'project/server_groups/detail.html' + page_title = 'Server Group Details' + + +class CreateView(forms.ModalFormView): + form_class = project_forms.CreateForm + template_name = 'project/server_groups/create.html' + success_url = reverse_lazy("horizon:project:server_groups:index") + + def get_context_data(self, **kwargs): + context = super(CreateView, self).get_context_data(**kwargs) + try: + context['usages'] = quotas.tenant_limit_usages(self.request) + except Exception: + exceptions.handle(self.request) + return context + + +class EditAttachmentsView(tables.DataTableView, forms.ModalFormView): + table_class = project_tables.AttachmentsTable + form_class = project_forms.AttachForm + template_name = 'project/server_groups/attach.html' + success_url = reverse_lazy("horizon:project:server_groups:index") + + def get_object(self): + if not hasattr(self, "_object"): + volume_id = self.kwargs['volume_id'] + try: + self._object = api.cinder.volume_get(self.request, volume_id) + except Exception: + self._object = None + exceptions.handle(self.request, + _('Unable to retrieve volume information.')) + return self._object + + def get_data(self): + try: + volumes = self.get_object() + attachments = [att for att in volumes.attachments if att] + except Exception: + attachments = [] + exceptions.handle(self.request, + _('Unable to retrieve volume information.')) + return attachments + + def get_initial(self): + try: + instances, has_more = api.nova.server_list(self.request) + except Exception: + instances = [] + exceptions.handle(self.request, + _("Unable to retrieve attachment information.")) + return {'volume': self.get_object(), + 'instances': instances} + + def get_form(self): + if not hasattr(self, "_form"): + form_class = self.get_form_class() + self._form = super(EditAttachmentsView, self).get_form(form_class) + return self._form + + def get_context_data(self, **kwargs): + context = super(EditAttachmentsView, self).get_context_data(**kwargs) + context['form'] = self.get_form() + volume = self.get_object() + if volume and volume.status == 'available': + context['show_attach'] = True + else: + context['show_attach'] = False + context['volume'] = volume + if self.request.is_ajax(): + context['hide'] = True + return context + + def get(self, request, *args, **kwargs): + # Table action handling + handled = self.construct_tables() + if handled: + return handled + return self.render_to_response(self.get_context_data(**kwargs)) + + def post(self, request, *args, **kwargs): + form = self.get_form() + if form.is_valid(): + return self.form_valid(form) + else: + return self.get(request, *args, **kwargs) diff --git a/cgcs_dashboard/enabled/_1031_WRS_project_server_groups_panel.py b/starlingx_dashboard/enabled/_1031_starlingx_project_server_groups_panel.py similarity index 69% rename from cgcs_dashboard/enabled/_1031_WRS_project_server_groups_panel.py rename to starlingx_dashboard/enabled/_1031_starlingx_project_server_groups_panel.py index 44de6166..1b47443f 100755 --- a/cgcs_dashboard/enabled/_1031_WRS_project_server_groups_panel.py +++ b/starlingx_dashboard/enabled/_1031_starlingx_project_server_groups_panel.py @@ -1,10 +1,11 @@ -# The slug of the panel to be added to HORIZON_CONFIG. Required. -PANEL = 'server_groups' -# The slug of the dashboard the PANEL associated with. Required. -PANEL_DASHBOARD = 'project' -# The slug of the panel group the PANEL is associated with. -PANEL_GROUP = 'compute' - -# Python panel class of the PANEL to be added. -ADD_PANEL = \ - 'cgcs_dashboard.dashboards.project.server_groups.panel.ServerGroups' +# The slug of the panel to be added to HORIZON_CONFIG. Required. +PANEL = 'server_groups' +# The slug of the dashboard the PANEL associated with. Required. +PANEL_DASHBOARD = 'project' +# The slug of the panel group the PANEL is associated with. +PANEL_GROUP = 'compute' +# A list of applications to be added to INSTALLED_APPS. + +# Python panel class of the PANEL to be added. +ADD_PANEL = \ + 'starlingx_dashboard.dashboards.project.server_groups.panel.ServerGroups' diff --git a/cgcs_dashboard/enabled/_2005_admin_platform_panel_group.py b/starlingx_dashboard/enabled/_2005_starlingx_admin_platform_panel_group.py similarity index 85% rename from cgcs_dashboard/enabled/_2005_admin_platform_panel_group.py rename to starlingx_dashboard/enabled/_2005_starlingx_admin_platform_panel_group.py index 4ff9a7d0..5b986dcb 100755 --- a/cgcs_dashboard/enabled/_2005_admin_platform_panel_group.py +++ b/starlingx_dashboard/enabled/_2005_starlingx_admin_platform_panel_group.py @@ -6,3 +6,4 @@ PANEL_GROUP = 'platform' PANEL_GROUP_NAME = _('Platform') # The slug of the dashboard the PANEL_GROUP associated with. Required. PANEL_GROUP_DASHBOARD = 'admin' +# A list of applications to be added to INSTALLED_APPS. diff --git a/cgcs_dashboard/enabled/_2032_WRS_admin_fault_management_panel.py b/starlingx_dashboard/enabled/_2032_starlingx_admin_fault_management_panel.py similarity index 87% rename from cgcs_dashboard/enabled/_2032_WRS_admin_fault_management_panel.py rename to starlingx_dashboard/enabled/_2032_starlingx_admin_fault_management_panel.py index 1fa3b726..a0e0dbb7 100755 --- a/cgcs_dashboard/enabled/_2032_WRS_admin_fault_management_panel.py +++ b/starlingx_dashboard/enabled/_2032_starlingx_admin_fault_management_panel.py @@ -6,5 +6,6 @@ PANEL_DASHBOARD = 'admin' PANEL_GROUP = 'platform' # Python panel class of the PANEL to be added. -ADD_PANEL = 'cgcs_dashboard.dashboards.admin.' \ +ADD_PANEL = 'starlingx_dashboard.dashboards.admin.' \ 'fault_management.panel.FaultManagement' + diff --git a/cgcs_dashboard/enabled/_2034_WRS_platform_software_management_panel.py b/starlingx_dashboard/enabled/_2034_starlingx_platform_software_management_panel.py similarity index 82% rename from cgcs_dashboard/enabled/_2034_WRS_platform_software_management_panel.py rename to starlingx_dashboard/enabled/_2034_starlingx_platform_software_management_panel.py index 25f1edae..58fda97f 100755 --- a/cgcs_dashboard/enabled/_2034_WRS_platform_software_management_panel.py +++ b/starlingx_dashboard/enabled/_2034_starlingx_platform_software_management_panel.py @@ -6,5 +6,6 @@ PANEL_DASHBOARD = 'admin' PANEL_GROUP = 'platform' # Python panel class of the PANEL to be added. -ADD_PANEL = 'cgcs_dashboard.dashboards.admin.software_management.' \ +ADD_PANEL = 'starlingx_dashboard.dashboards.admin.software_management.' \ 'panel.SoftwareManagement' + diff --git a/cgcs_dashboard/enabled/_2035_WRS_admin_inventory_panel.py b/starlingx_dashboard/enabled/_2035_starlingx_admin_inventory_panel.py similarity index 79% rename from cgcs_dashboard/enabled/_2035_WRS_admin_inventory_panel.py rename to starlingx_dashboard/enabled/_2035_starlingx_admin_inventory_panel.py index 603ef162..e054d666 100755 --- a/cgcs_dashboard/enabled/_2035_WRS_admin_inventory_panel.py +++ b/starlingx_dashboard/enabled/_2035_starlingx_admin_inventory_panel.py @@ -6,4 +6,5 @@ PANEL_DASHBOARD = 'admin' PANEL_GROUP = 'platform' # Python panel class of the PANEL to be added. -ADD_PANEL = 'cgcs.dashboards.admin.inventory.panel.Inventory' +ADD_PANEL = 'starlingx_dashboard.dashboards.admin.inventory.panel.Inventory' + diff --git a/cgcs_dashboard/enabled/_2036_WRS_admin_providernets.py b/starlingx_dashboard/enabled/_2036_starlingx_admin_providernets.py similarity index 87% rename from cgcs_dashboard/enabled/_2036_WRS_admin_providernets.py rename to starlingx_dashboard/enabled/_2036_starlingx_admin_providernets.py index ef857269..1d85e89e 100755 --- a/cgcs_dashboard/enabled/_2036_WRS_admin_providernets.py +++ b/starlingx_dashboard/enabled/_2036_starlingx_admin_providernets.py @@ -6,5 +6,5 @@ PANEL_DASHBOARD = 'admin' PANEL_GROUP = 'platform' # Python panel class of the PANEL to be added. -ADD_PANEL = ('cgcs_dashboard.dashboards.admin.' +ADD_PANEL = ('starlingx_dashboard.dashboards.admin.' 'providernets.panel.Providernets') diff --git a/cgcs_dashboard/enabled/_2037_WRS_admin_host_topology_panel.py b/starlingx_dashboard/enabled/_2037_starlingx_admin_host_topology_panel.py similarity index 82% rename from cgcs_dashboard/enabled/_2037_WRS_admin_host_topology_panel.py rename to starlingx_dashboard/enabled/_2037_starlingx_admin_host_topology_panel.py index c255401a..b775b741 100755 --- a/cgcs_dashboard/enabled/_2037_WRS_admin_host_topology_panel.py +++ b/starlingx_dashboard/enabled/_2037_starlingx_admin_host_topology_panel.py @@ -6,5 +6,5 @@ PANEL_DASHBOARD = 'admin' PANEL_GROUP = 'platform' # Python panel class of the PANEL to be added. -ADD_PANEL = 'cgcs_dashboard.dashboards.admin.host_topology.panel.' \ +ADD_PANEL = 'starlingx_dashboard.dashboards.admin.host_topology.panel.' \ 'HostTopology' diff --git a/cgcs_dashboard/enabled/_2038_WRS_platform_storage_overview_panel.py b/starlingx_dashboard/enabled/_2038_starlingx_platform_storage_overview_panel.py similarity index 67% rename from cgcs_dashboard/enabled/_2038_WRS_platform_storage_overview_panel.py rename to starlingx_dashboard/enabled/_2038_starlingx_platform_storage_overview_panel.py index 43137233..7f2123af 100755 --- a/cgcs_dashboard/enabled/_2038_WRS_platform_storage_overview_panel.py +++ b/starlingx_dashboard/enabled/_2038_starlingx_platform_storage_overview_panel.py @@ -6,5 +6,7 @@ PANEL_DASHBOARD = 'admin' PANEL_GROUP = 'platform' # Python panel class of the PANEL to be added. -ADD_PANEL = 'cgcs_dashboard.dashboards.admin.storage_overview.' \ +ADD_PANEL = 'starlingx_dashboard.dashboards.admin.storage_overview.' \ 'panel.StorageOverview' +# A list of applications to be added to INSTALLED_APPS. +ADD_INSTALLED_APPS = ['starlingx_dashboard', ] \ No newline at end of file diff --git a/cgcs_dashboard/enabled/_2039_WRS_admin_system_config.py b/starlingx_dashboard/enabled/_2039_starlingx_admin_system_config.py similarity index 70% rename from cgcs_dashboard/enabled/_2039_WRS_admin_system_config.py rename to starlingx_dashboard/enabled/_2039_starlingx_admin_system_config.py index 6b07ee62..09937c19 100755 --- a/cgcs_dashboard/enabled/_2039_WRS_admin_system_config.py +++ b/starlingx_dashboard/enabled/_2039_starlingx_admin_system_config.py @@ -6,5 +6,7 @@ PANEL_DASHBOARD = 'admin' PANEL_GROUP = 'platform' # Python panel class of the PANEL to be added. -ADD_PANEL = ('cgcs_dashboard.dashboards.admin.' +ADD_PANEL = ('starlingx_dashboard.dashboards.admin.' 'system_config.panel.SystemConfig') +# A list of applications to be added to INSTALLED_APPS. +ADD_INSTALLED_APPS = ['starlingx_dashboard', ] \ No newline at end of file diff --git a/cgcs_dashboard/enabled/_2061_WRS_admin_server_groups_panel.py b/starlingx_dashboard/enabled/_2061_starlingx_admin_server_groups_panel.py similarity index 63% rename from cgcs_dashboard/enabled/_2061_WRS_admin_server_groups_panel.py rename to starlingx_dashboard/enabled/_2061_starlingx_admin_server_groups_panel.py index 76d00bd7..edbea732 100755 --- a/cgcs_dashboard/enabled/_2061_WRS_admin_server_groups_panel.py +++ b/starlingx_dashboard/enabled/_2061_starlingx_admin_server_groups_panel.py @@ -1,10 +1,12 @@ -# The slug of the panel to be added to HORIZON_CONFIG. Required. -PANEL = 'server_groups' -# The slug of the dashboard the PANEL associated with. Required. -PANEL_DASHBOARD = 'admin' -# The slug of the panel group the PANEL is associated with. -PANEL_GROUP = 'compute' - -# Python panel class of the PANEL to be added. -ADD_PANEL = \ - 'cgcs_dashboard.dashboards.admin.server_groups.panel.ServerGroups' +# The slug of the panel to be added to HORIZON_CONFIG. Required. +PANEL = 'server_groups' +# The slug of the dashboard the PANEL associated with. Required. +PANEL_DASHBOARD = 'admin' +# The slug of the panel group the PANEL is associated with. +PANEL_GROUP = 'compute' + +# Python panel class of the PANEL to be added. +ADD_PANEL = \ + 'starlingx_dashboard.dashboards.admin.server_groups.panel.ServerGroups' +# A list of applications to be added to INSTALLED_APPS. +ADD_INSTALLED_APPS = ['starlingx_dashboard', ] \ No newline at end of file diff --git a/cgcs_dashboard/enabled/_2200_WRS_dc_admin.py b/starlingx_dashboard/enabled/_2200_starlingx_dc_admin.py similarity index 90% rename from cgcs_dashboard/enabled/_2200_WRS_dc_admin.py rename to starlingx_dashboard/enabled/_2200_starlingx_dc_admin.py index d237c160..e41ec84c 100755 --- a/cgcs_dashboard/enabled/_2200_WRS_dc_admin.py +++ b/starlingx_dashboard/enabled/_2200_starlingx_dc_admin.py @@ -5,8 +5,7 @@ DEFAULT = False # A dictionary of exception classes to be added to HORIZON['exceptions']. ADD_EXCEPTIONS = {} # A list of applications to be added to INSTALLED_APPS. -ADD_INSTALLED_APPS = ['cgcs_dashboard', ] - +ADD_INSTALLED_APPS = ['starlingx_dashboard', ] ADD_ANGULAR_MODULES = [ 'horizon.dashboard.dc_admin', ] diff --git a/cgcs_dashboard/enabled/_2210_WRS_dc_admin_cloud_overview_panel.py b/starlingx_dashboard/enabled/_2210_starlingx_dc_admin_cloud_overview_panel.py similarity index 78% rename from cgcs_dashboard/enabled/_2210_WRS_dc_admin_cloud_overview_panel.py rename to starlingx_dashboard/enabled/_2210_starlingx_dc_admin_cloud_overview_panel.py index 44e40ab5..52edbc51 100755 --- a/cgcs_dashboard/enabled/_2210_WRS_dc_admin_cloud_overview_panel.py +++ b/starlingx_dashboard/enabled/_2210_starlingx_dc_admin_cloud_overview_panel.py @@ -13,5 +13,7 @@ PANEL = 'cloud_overview' DISABLED = False # Python panel class of the PANEL to be added. -ADD_PANEL = 'cgcs_dashboard.dashboards.' \ +ADD_PANEL = 'starlingx_dashboard.dashboards.' \ 'dc_admin.cloud_overview.panel.CloudOverview' +# A list of applications to be added to INSTALLED_APPS. +ADD_INSTALLED_APPS = ['starlingx_dashboard', ] \ No newline at end of file diff --git a/cgcs_dashboard/enabled/__init__.py b/starlingx_dashboard/enabled/__init__.py similarity index 100% rename from cgcs_dashboard/enabled/__init__.py rename to starlingx_dashboard/enabled/__init__.py diff --git a/cgcs_dashboard/exceptions.py b/starlingx_dashboard/exceptions.py similarity index 100% rename from cgcs_dashboard/exceptions.py rename to starlingx_dashboard/exceptions.py diff --git a/starlingx_dashboard/horizon/__init__.py b/starlingx_dashboard/horizon/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/starlingx_dashboard/horizon/tables/__init__.py b/starlingx_dashboard/horizon/tables/__init__.py new file mode 100644 index 00000000..92dfa01c --- /dev/null +++ b/starlingx_dashboard/horizon/tables/__init__.py @@ -0,0 +1,2 @@ +from starlingx_dashboard.stx_horizon.tables.actions import FixedWithQueryFilter +from starlingx_dashboard.stx_horizon.tables.actions import LimitAction \ No newline at end of file diff --git a/starlingx_dashboard/horizon/tables/actions.py b/starlingx_dashboard/horizon/tables/actions.py new file mode 100644 index 00000000..85edf45c --- /dev/null +++ b/starlingx_dashboard/horizon/tables/actions.py @@ -0,0 +1,196 @@ +# +# Copyright (c) 2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 +# + +from collections import OrderedDict + +from django.conf import settings +from django.utils.translation import ugettext_lazy as _ # noqa + +from horizon.tables.actions import BaseAction +from horizon.tables import FilterAction + +DEFAULT_TABLE_LIMITS = [10, 20, 50, 100, 500, 1000] + +class FixedWithQueryFilter(FilterAction): + """A FilterAction that visually renders like a combination + FixedFilterAction and a FilterAction of type "query. + + Before extracting data from the filter, always ensure to first call + the method updateFromRequestDataToSession(..) which will copy current + request data to the session + + Use get_filter_string(self, request) method to extract the current + filter string + + Use get_filter_field(self,request) method to extract the current + "choice" value + """ + def __init__(self, **kwargs): + super(FixedWithQueryFilter, self).__init__(**kwargs) + self.filter_type = "fixedwithquery" + self.filter_choices = [] + self.default_value = '' + self.grouped_choices = [] + self.disabled_choices = [] + + def _get_fieldFromGETorPOSTorSESSION(self, request, param_name): + """Utility method for getting 'named" data (param_name) from either + GET/POST or Session . + IMPORTANT NOTE: Has the side-effect of storing the data into + the session + TODO: In the future, this method should really live in some + utility module. + + :param request: + :param param_name: + :return: value of data referenced by param_name + """ + the_field = None + + if param_name in request.GET: + the_field = request.GET.get(param_name, '') + + if the_field is None and param_name in request.POST: + the_field = request.POST.get(param_name, '') + + if the_field is None and param_name in request.session: + the_field = request.session.get(param_name, '') + + if the_field is not None: + request.session[param_name] = the_field + + return the_field + + def get_filter_field(self, request): + param_name = '%s_field' % self.get_param_name() + filter_field = self._get_fieldFromGETorPOSTorSESSION(request, + param_name) + self.filter_field = filter_field \ + if filter_field \ + else self.default_value + return filter_field + + def get_filter_string(self, request): + param_name = self.get_param_name() + filter_string = self._get_fieldFromGETorPOSTorSESSION(request, + param_name) + self.filter_string = filter_string if filter_string else '' + self.build_grouped_choices() + + return filter_string + + def updateFromRequestDataToSession(self, request): + # The desired side-effect of calling the following 2 functions + # will update the filter field and filter string into + # the session so that they are 'remembered' across requests + self.get_filter_field(request) + self.get_filter_string(request) + + def set_disabled_filter_field_for_group(self, grpNo, disabled_status): + self.disabled_choices[grpNo] = disabled_status + + def get_filter_field_for_group(self, grpNo): + splitted = self.filter_field.split("|") + if len(splitted) <= grpNo: + raise Exception("get_filter_field_for_group: grpNo out of \ + range! grpNo={}".format(grpNo)) + value = splitted[grpNo] + if not value: + value = self.default_value.split("|")[grpNo] + return value + + def build_grouped_choices(self): + grps = [] + grpNo = 0 + + for choices_in_group in self.filter_choices: + currentGrpValue = self.get_filter_field_for_group(grpNo) + disable_status = self.disabled_choices[grpNo] + + grps.append( + { + "grpNo": grpNo, + "filter_choices": choices_in_group, + "value": currentGrpValue, + "disabled": disable_status + } + ) + grpNo = grpNo + 1 + + self.grouped_choices = grps + + return grps + + +class LimitAction(BaseAction): + """A base class representing a count limit action for a table. + + .. attribute:: name + + The short name or "slug" representing this action. Defaults to + ``"limit"``. + + .. attribute:: limits + + A set of table entry limits. Default: ``"settings.TABLE_LIMITS"``. + + .. attribute:: limit_format + + A default format sting used do format the verbose + name of each limit count. + Default: ``"%(count)s %(name)s"``. + + .. attribute:: verbose_name + + A descriptive entity name to be used . Default: ``"Entries"``. + """ + + # class attribute name is used for ordering of Actions in table + name = "limit" + verbose_name = _("Entries") + limit_format = _("%(count)s %(name)s") + limits = set(getattr(settings, 'TABLE_LIMITS', DEFAULT_TABLE_LIMITS)) + + def __init__(self, **kwargs): + super(LimitAction, self).__init__(**kwargs) + self.name = kwargs.get('name', self.name) + self.limits = kwargs.get('limits', self.limits) + self.limit_format = kwargs.get('limit_format', self.limit_format) + self.verbose_name = kwargs.get('verbose_name', self.verbose_name) + + def get_param_name(self): + """Returns the limit parameter name for this table action.""" + return self.table._meta.limit_param + + def get_default_classes(self): + classes = super(LimitAction, self).get_default_classes() + classes += ("btn", "btn-default", "btn-sm", + "btn-limit", "dropdown-toggle") + return classes + + def get_limit_display(self): + """Default formatter for each limit entry.""" + count = self.table.get_limit_count() + return self.get_limit_name(count) + + def get_limit_name(self, count): + """Default formatter for each limit entry.""" + if count is None: + return "Default Limit" + return str(self.limit_format % {'count': count, + 'name': self.verbose_name}) + + def get_limit_count(self): + """Return the current table limit for tables that support paging.""" + count = self.table.get_limit_count() + return count + + def get_limits(self): + """"Return the set of limits supported by the action.""" + limits = {} + for count in self.limits: + limits[count] = self.get_limit_name(count) + return OrderedDict(sorted(limits.items(), key=lambda limit: limit[0])) \ No newline at end of file diff --git a/starlingx_dashboard/local/local_settings.py.example b/starlingx_dashboard/local/local_settings.py.example new file mode 100644 index 00000000..0b338b4c --- /dev/null +++ b/starlingx_dashboard/local/local_settings.py.example @@ -0,0 +1 @@ +TABLE_LIMITS = 100 \ No newline at end of file diff --git a/starlingx_dashboard/locale/.keep b/starlingx_dashboard/locale/.keep new file mode 100644 index 00000000..e69de29b diff --git a/starlingx_dashboard/static/js/horizon.alarmbanner.js b/starlingx_dashboard/static/js/horizon.alarmbanner.js new file mode 100755 index 00000000..3e00ff4a --- /dev/null +++ b/starlingx_dashboard/static/js/horizon.alarmbanner.js @@ -0,0 +1,67 @@ +/* Core functionality related to alam-banner. */ +horizon.alarmbanner = { + + enabled: false, + refresh: function(data) { + + var $old = $(location).attr('pathname'); + var $url = $(location).attr('href'); + $url = $url.replace($old, "/admin/fault_management/banner"); + + horizon.ajax.queue({ + url: $url, + success: function(data, textStatus, jqXHR) { + var $new = $(data); + var $old = $('.alarmbanner'); + if ($new.html() !== $old.html()) { + $old.html($new.html()); + } + + // start periodic refresh + if (horizon.alarmbanner.enabled === false) { + horizon.refresh.addRefreshFunction( + horizon.alarmbanner.refresh); + horizon.alarmbanner.enabled = true; + } + }, + error: function(jqXHR, textStatus, error) { + if (jqXHR.status !== 401 && jqXHR.status !== 403) { + // error is raised with status of 0 when ajax query is cancelled + // due to new page request + if (jqXHR.status !== 0) { + horizon.clearInfoMessages(); + horizon.clearErrorMessages(); + horizon.alert("info", gettext("Failed to refresh alarm banner, retrying on next interval.")); + } + + // start periodic refresh + if (horizon.alarmbanner.enabled === false) { + horizon.refresh.addRefreshFunction( + horizon.alarmbanner.refresh); + horizon.alarmbanner.enabled = true; + } + } + }, + complete: function(jqXHR, textStatus) { + } + }); + return true; + }, + + onclick: function() { + var $fm = "/admin/fault_management"; + var $dc = "/dc_admin/"; + var $cur = document.location.href; + var $path = document.location.pathname; + if ($path.match($fm) === null && $path.match($dc) === null) { + document.location.href = $cur.replace($path, $fm); + } + }, +}; + + +horizon.addInitFunction(function() { + // trigger alarm banner refresh on page load and enable + // periodic refresh after the first one + horizon.alarmbanner.refresh(null); +}); diff --git a/starlingx_dashboard/static/js/horizon.details.js b/starlingx_dashboard/static/js/horizon.details.js new file mode 100755 index 00000000..53adf53c --- /dev/null +++ b/starlingx_dashboard/static/js/horizon.details.js @@ -0,0 +1,30 @@ +/* Functionality related to detail panes */ +horizon.details = { +}; + +horizon.details.refresh = function(html) { + var $new_details = $(html).find('.detail > dl').parent(); + var $old_details = $('.detail > dl').parent(); + + if ($new_details.length != $old_details.length) { + // Page structure has changed, abort refresh + return false; + } + + $new_details.each(function(index, elm) { + var $new_detail = $(this); + var $old_detail = $($old_details.get(index)); + if ($new_detail.html() != $old_detail.html()) { + $old_detail.replaceWith($new_detail); + } + }); + + return true; +}; + +horizon.addInitFunction(function() { + if ($('.detail > dl').length > 0) { + // Register callback handler to update the detail panels on page refresh + horizon.refresh.addRefreshFunction(horizon.details.refresh); + } +}); diff --git a/cgcs_dashboard/static/js/horizon.hosttopology.js b/starlingx_dashboard/static/js/horizon.hosttopology.js similarity index 100% rename from cgcs_dashboard/static/js/horizon.hosttopology.js rename to starlingx_dashboard/static/js/horizon.hosttopology.js diff --git a/starlingx_dashboard/static/js/horizon.refresh.js b/starlingx_dashboard/static/js/horizon.refresh.js new file mode 100755 index 00000000..918fd140 --- /dev/null +++ b/starlingx_dashboard/static/js/horizon.refresh.js @@ -0,0 +1,135 @@ +/* Core functionality related to page auto refresh. */ +horizon.refresh = { + refresh_interval: 5000, + _refresh_functions: [], + timeout: null, + + init: function() { + // Add page refresh time to page header + horizon.refresh.datetime(); + + $('#navbar-collapse > div.context_selection > ul > li > ul li a ').click(function (){ + clearTimeout(horizon.refresh.timeout); + clearTimeout(horizon.datatables.timeout); + }); + + // Setup next refresh interval + horizon.refresh.timeout = setTimeout(horizon.refresh.update, horizon.refresh.refresh_interval); + }, + + update: function() { + if (!horizon.refresh._refresh_functions.length) { + // No refresh handlers registered + return; + } + + // Ignore any tabs which react badly to auto-refresh + var ignore = ["instance_details__console"]; + + // Figure out which tabs have been loaded + loaded = ""; + $(".nav-tabs a[data-target]").each(function(index){ + var slug = $(this).attr('data-target').replace('#',''); + if ($(this).attr('data-loaded') == 'true' && ignore.indexOf(slug) == -1){ + if (loaded){loaded+=','} + loaded+=slug; + } + }); + + // Grab current href (for refresh) but remove the tab parameter ( if exists ) + var currentHREF = $(location).attr('href'); + var qryStrObj = jQuery.query.load( currentHREF ); + var oldQryStr = qryStrObj.toString(); + var newQryStr = qryStrObj.SET("tab", null).SET("loaded", loaded).COMPACT().toString(); + if (oldQryStr){ + var $href=currentHREF.replace(oldQryStr, newQryStr); + }else { + var $href=currentHREF += newQryStr; + } + + horizon.ajax.queue({ + url: $href, + success: function(data, textStatus, jqXHR) { + var refreshed = true; + if (jqXHR.responseText.length > 0) { + $(horizon.refresh._refresh_functions).each(function (index, f) { + refreshed = f(data); + return refreshed; + }); + if (refreshed) { + horizon.refresh.datetime(); + } + } else { + // assume that the entity has been deleted + location.href = $('#sidebar-accordion a.openstack-panel.active').attr('href'); + } + }, + error: function(jqXHR, textStatus, error) { + // Zero-status usually seen when user navigates away + if (jqXHR.status != 0) { + horizon.refresh.alert(); + } + }, + complete: function(jqXHR, textStatus) { + + // Check for redirect condition + var redirect = false + switch (jqXHR.status) { + case 401: + // Authorization error, likely redirect to login page + redirect = jqXHR.getResponseHeader("X-Horizon-Location"); + break; + case 404: + // The object seems to be gone, redirect back to main nav + redirect = $('#sidebar-accordion a.openstack-panel.active').attr('href'); + break; + case 302: + // Object is likely gone and are being redirect to index page + redirect = jqXHR.getResponseHeader("Location"); + break; + } + if (redirect) { + location.href = redirect; + } + + horizon.autoDismissAlerts(); + + // Check for error condition + var messages = $.parseJSON(horizon.ajax.get_messages(jqXHR)); + var errors = $(messages).filter(function (index, item) { + return item[0] == 'error'; + }); + if (errors.length > 0) { + horizon.refresh.alert(); + } + + // Reset for next refresh interval + horizon.refresh.timeout = setTimeout(horizon.refresh.update, horizon.refresh.refresh_interval); + } + }); + }, + + alert: function() { + horizon.clearInfoMessages(); + horizon.clearErrorMessages(); + horizon.clearWarningMessages(); + horizon.alert("info", gettext("Failed to auto refresh page, retrying on next interval.")); + }, + + datetime: function() { + // Update page refresh time + var location = $('.datetime'); + if (location !== null) { + var datetime = new Date(); + location.html(datetime.toLocaleString()); + } + }, + + addRefreshFunction: function(f) { + horizon.refresh._refresh_functions.push(f); + } +}; + +horizon.addInitFunction(function() { + horizon.refresh.init(); +}); diff --git a/starlingx_dashboard/static/js/windriver.rickshaw.js b/starlingx_dashboard/static/js/windriver.rickshaw.js new file mode 100755 index 00000000..280baae2 --- /dev/null +++ b/starlingx_dashboard/static/js/windriver.rickshaw.js @@ -0,0 +1,513 @@ +Rickshaw.namespace('Rickshaw.Series.FixedDuration.ExtendedData'); + +Rickshaw.Series.FixedDuration.ExtendedData = Rickshaw.Class.create(Rickshaw.Series.FixedDuration, { + + initialize: function ($super, data, palette, options) { + $super(data, palette, options); + + this.lastTimestamp = 0; + }, + + addData: function($super, data, x) { + + var index = this.getIndex(); + + Rickshaw.keys(data).forEach(function(name) { + if (!this.itemByName(name)) { + this.addItem({name: name}); + } + }, this); + + var count = 0; + this.forEach(function(item) { + count = 0; + var points = (Array.isArray(data[item.name])) ? data[item.name] : [data[item.name]]; + points.forEach(function(point) { + var datum = Object.create(point); + datum.x = x || this.getTimestamp(datum.x) || ((index * this.timeInterval || 1) + this.timeBase); + datum.y = (datum.y || 0); + item.data.push(datum); + count++; + if (datum.x > this.lastTimestamp) { + this.lastTimestamp = datum.x; + } + }, this); + }, this); + + this.currentSize += count; + this.currentIndex += count; + + if (this.maxDataPoints !== undefined) { + while (this.currentSize > this.maxDataPoints) { + this.dropData(); + } + } + }, + + zeroData: function() { + this.forEach(function(item) { + item.data.forEach(function(datum) { + datum.y = 0; + }); + }, this); + }, + + /* timestamp rounded down to the nearest interval time */ + getTimestamp: function(timestamp) { + return Math.floor(timestamp / this.timeInterval) * this.timeInterval; + }, + + getLastTimestamp: function() { + return this.lastTimestamp; + } +}); + +Rickshaw.namespace('Rickshaw.Fixtures.Number'); + +Rickshaw.Fixtures.Number.formatBinaryBytes = function(y) { + //CGCS addition + var abs_y = Math.abs(y); + if (abs_y >= 1125899906842624) { return (y / 1125899906842624).toFixed(0) + "P"; } + else if (abs_y >= 1099511627776){ return (y / 1099511627776).toFixed(0) + "T"; } + else if (abs_y >= 1073741824) { return (y / 1073741824).toFixed(0) + "G"; } + else if (abs_y >= 1048576) { return (y / 1048576).toFixed(0) + "M"; } + else if (abs_y >= 1024) { return (y / 1024).toFixed(0) + "K"; } + else if (abs_y < 1 && y > 0) { return y.toFixed(0); } + else if (abs_y === 0) { return '0'; } + else { return y.toFixed(0); } +}; + + +Rickshaw.namespace('Rickshaw.Graph.Behavior.Series.Toggle'); + +Rickshaw.Graph.Behavior.Series.Toggle = function(args) { + + this.graph = args.graph; + this.legend = args.legend; + + var self = this; + + this.addAnchor = function(line) { + + var anchor = document.createElement('a'); + anchor.innerHTML = '✔'; + anchor.classList.add('action'); + line.element.insertBefore(anchor, line.element.firstChild); + + anchor.onclick = function(e) { + if (line.series.disabled) { + line.series.enable(); + line.element.classList.remove('disabled'); + } else { + if (this.graph.series.filter(function(s) { return !s.disabled }).length <= 1) return; + line.series.disable(); + line.element.classList.add('disabled'); + } + + }.bind(this); + + var label = line.element.getElementsByTagName('span')[0]; + label.onclick = function(e){ + + var disableAllOtherLines = line.series.disabled; + if ( ! disableAllOtherLines ) { + for ( var i = 0; i < self.legend.lines.length; i++ ) { + var l = self.legend.lines[i]; + if ( line.series === l.series ) { + // noop + } else if ( l.series.disabled ) { + // noop + } else { + disableAllOtherLines = true; + break; + } + } + } + + // show all or none + if ( disableAllOtherLines ) { + + // these must happen first or else we try ( and probably fail ) to make a no line graph + line.series.enable(false); + line.element.classList.remove('disabled'); + + self.legend.lines.forEach(function(l){ + if ( line.series === l.series ) { + // noop + } else { + l.series.disable(false); + l.element.classList.add('disabled'); + } + }); + + } else { + + self.legend.lines.forEach(function(l){ + l.series.enable(false); + l.element.classList.remove('disabled'); + }); + + } + + self.graph.update(); + }; + + }; + + if (this.legend) { + + var $ = jQuery; + if (typeof $ != 'undefined' && $(this.legend.list).sortable) { + + $(this.legend.list).sortable( { + start: function(event, ui) { + ui.item.bind('no.onclick', + function(event) { + event.preventDefault(); + } + ); + }, + stop: function(event, ui) { + setTimeout(function(){ + ui.item.unbind('no.onclick'); + }, 250); + } + }); + } + + this.legend.lines.forEach( function(l) { + self.addAnchor(l); + } ); + } + + this._addBehavior = function() { + + this.graph.series.forEach( function(s) { + // Update parameter is CGCS addition + s.disable = function(update) { + + if (self.graph.series.length <= 1) { + throw('only one series left'); + } + + s.disabled = true; + if (update !== false) { + self.graph.update(); + } + }; + + s.enable = function(update) { + s.disabled = false; + if (update !== false) { + self.graph.update(); + } + }; + } ); + }; + this._addBehavior(); + + this.updateBehaviour = function () { this._addBehavior() }; + +}; + + +Rickshaw.namespace('Rickshaw.Graph.HoverDetail'); + +Rickshaw.Graph.HoverDetail = Rickshaw.Class.create({ + + initialize: function(args) { + + var graph = this.graph = args.graph; + + this.xFormatter = args.xFormatter || function(x) { + return new Date( x * 1000 ).toUTCString(); + }; + + this.yFormatter = args.yFormatter || function(y) { + return y === null ? y : y.toFixed(2); + }; + + var element = this.element = document.createElement('div'); + element.className = 'detail'; + + this.visible = true; + graph.element.appendChild(element); + + this.lastEvent = null; + this._addListeners(); + + this.onShow = args.onShow; + this.onHide = args.onHide; + this.onRender = args.onRender; + + this.formatter = args.formatter || this.formatter; + + }, + + formatter: function(series, x, y, formattedX, formattedY, d) { + return series.name + ': ' + formattedY; + }, + + update: function(e) { + + e = e || this.lastEvent; + if (!e) return; + this.lastEvent = e; + + if (!e.target.nodeName.match(/^(path|svg|rect|circle)$/)) return; + + var graph = this.graph; + + var eventX = e.offsetX || e.layerX; + var eventY = e.offsetY || e.layerY; + + var j = 0; + var points = []; + var nearestPoint; + + this.graph.series.active().forEach( function(series) { + + var data = this.graph.stackedData[j++]; + + if (!data.length) + return; + + var domainX = graph.x.invert(eventX); + + var domainIndexScale = d3.scale.linear() + .domain([data[0].x, data.slice(-1)[0].x]) + .range([0, data.length - 1]); + + var approximateIndex = Math.round(domainIndexScale(domainX)); + if (approximateIndex == data.length - 1) approximateIndex--; + + var dataIndex = Math.min(approximateIndex || 0, data.length - 1); + + for (var i = approximateIndex; i < data.length - 1;) { + + if (!data[i] || !data[i + 1]) break; + + if (data[i].x <= domainX && data[i + 1].x > domainX) { + dataIndex = Math.abs(domainX - data[i].x) < Math.abs(domainX - data[i + 1].x) ? i : i + 1; + break; + } + + if (data[i + 1].x <= domainX) { i++ } else { i-- } + } + + if (dataIndex < 0) dataIndex = 0; + var value = data[dataIndex]; + + var distance = Math.sqrt( + Math.pow(Math.abs(graph.x(value.x) - eventX), 2) + + Math.pow(Math.abs(graph.y(value.y + value.y0) - eventY), 2) + ); + + var xFormatter = series.xFormatter || this.xFormatter; + var yFormatter = series.yFormatter || this.yFormatter; + + var point = { + formattedXValue: xFormatter(value.x), + formattedYValue: yFormatter(series.scale ? series.scale.invert(value.y) : value.y), + series: series, + value: value, + distance: distance, + order: j, + name: series.name + }; + + if (!nearestPoint || distance < nearestPoint.distance) { + nearestPoint = point; + } + + points.push(point); + + }, this ); + + if (!nearestPoint) + return; + + nearestPoint.active = true; + + var domainX = nearestPoint.value.x; + var formattedXValue = nearestPoint.formattedXValue; + + this.element.innerHTML = ''; + this.element.style.left = graph.x(domainX) + 'px'; + + this.visible && this.render( { + points: points, + detail: points, // for backwards compatibility + mouseX: eventX, + mouseY: eventY, + formattedXValue: formattedXValue, + domainX: domainX + } ); + }, + + hide: function() { + this.visible = false; + this.element.classList.add('inactive'); + + if (typeof this.onHide == 'function') { + this.onHide(); + } + }, + + show: function() { + this.visible = true; + this.element.classList.remove('inactive'); + + if (typeof this.onShow == 'function') { + this.onShow(); + } + }, + + render: function(args) { + + var graph = this.graph; + var points = args.points; + var point = points.filter( function(p) { return p.active } ).shift(); + + if (point.value.y === null) return; + + var formattedXValue = point.formattedXValue; + var formattedYValue = point.formattedYValue; + + this.element.innerHTML = ''; + this.element.style.left = graph.x(point.value.x) + 'px'; + + var xLabel = document.createElement('div'); + + xLabel.className = 'x_label'; + xLabel.innerHTML = formattedXValue; + this.element.appendChild(xLabel); + + var item = document.createElement('div'); + + item.className = 'item'; + + // invert the scale if this series displays using a scale + var series = point.series; + var actualY = series.scale ? series.scale.invert(point.value.y) : point.value.y; + + item.innerHTML = this.formatter(series, point.value.x, actualY, formattedXValue, formattedYValue, point); + item.style.top = this.graph.y(point.value.y0 + point.value.y) + 'px'; + + this.element.appendChild(item); + + var dot = document.createElement('div'); + + dot.className = 'dot'; + dot.style.top = item.style.top; + dot.style.borderColor = series.color; + + this.element.appendChild(dot); + + if (point.active) { + item.classList.add('active'); + dot.classList.add('active'); + } + + // Assume left alignment until the element has been displayed and + // bounding box calculations are possible. + var alignables = [xLabel, item]; + alignables.forEach(function(el) { + el.classList.add('left'); + }); + + this.show(); + + // If left-alignment results in any error, try right-alignment. + var leftAlignError = this._calcLayoutError(alignables); + if (leftAlignError > 0) { + alignables.forEach(function(el) { + el.classList.remove('left'); + el.classList.add('right'); + }); + + // If right-alignment is worse than left alignment, switch back. + var rightAlignError = this._calcLayoutError(alignables); + if (rightAlignError > leftAlignError) { + alignables.forEach(function(el) { + el.classList.remove('right'); + el.classList.add('left'); + }); + } + } + + if (typeof this.onRender == 'function') { + this.onRender(args); + } + }, + + _calcLayoutError: function(alignables) { + // Layout error is calculated as the number of linear pixels by which + // an alignable extends past the left or right edge of the parent. + // CGCS addition + try { + var parentRect = this.element.parentNode.getBoundingClientRect(); + } catch(e) { + var parentRect = this.element.getBoundingClientRect(); + } + // CGCS addition + try { parent.subclasses.push(klass) } catch(e) {} + var error = 0; + var alignRight = alignables.forEach(function(el) { + var rect = el.getBoundingClientRect(); + if (!rect.width) { + return; + } + + if (rect.right > parentRect.right) { + error += rect.right - parentRect.right; + } + + if (rect.left < parentRect.left) { + error += parentRect.left - rect.left; + } + }); + return error; + }, + + _addListeners: function() { + + this.graph.element.addEventListener( + 'mousemove', + function(e) { + this.visible = true; + this.update(e); + }.bind(this), + false + ); + + this.graph.onUpdate( function() { this.update() }.bind(this) ); + + this.graph.element.addEventListener( + 'mouseout', + function(e) { + if (e.relatedTarget && !(e.relatedTarget.compareDocumentPosition(this.graph.element) & Node.DOCUMENT_POSITION_CONTAINS)) { + this.hide(); + } + }.bind(this), + false + ); + } +}); + + +Rickshaw.namespace('Rickshaw.Series.HoverDetail.Panel'); + +Rickshaw.Graph.HoverDetail.Panel = Rickshaw.Class.create(Rickshaw.Graph.HoverDetail, { + // CGCS addition + formatter: function(series, x, y, formattedX, formattedY, d) { + if (d.value.formattedY !== undefined) { + formattedY = d.value.formattedY; + } + var date = '' + new Date(x * 1000).toLocaleString() + ''; + var swatch = ''; + var value = '' + series.label + ': ' + formattedY + '
' + date; + var content = swatch + value; + return content; + } +}); diff --git a/starlingx_dashboard/theme/.keep b/starlingx_dashboard/theme/.keep new file mode 100644 index 00000000..e69de29b diff --git a/starlingx_dashboard/usage/quotas.py b/starlingx_dashboard/usage/quotas.py new file mode 100644 index 00000000..49235aac --- /dev/null +++ b/starlingx_dashboard/usage/quotas.py @@ -0,0 +1,5 @@ +# +# Copyright (c) 2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 +# \ No newline at end of file diff --git a/cgcs_dashboard/version.py b/starlingx_dashboard/version.py similarity index 81% rename from cgcs_dashboard/version.py rename to starlingx_dashboard/version.py index 66623cf9..30f8f2ed 100755 --- a/cgcs_dashboard/version.py +++ b/starlingx_dashboard/version.py @@ -10,7 +10,8 @@ # 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 pbr.version +from pbr import version -version_info = pbr.version.VersionInfo('cgcs-dashboard') +version_info = version.VersionInfo('starlingx_dashboard') +__version__ = version_info.cached_version_string() \ No newline at end of file