From e5fe575f20627351fefacf9f7ca6f2302ddcf7e7 Mon Sep 17 00:00:00 2001 From: Ishita Mandhan Date: Thu, 28 Jan 2016 13:39:06 -0800 Subject: [PATCH] Adding angular database backups panel This patch initiates the creation of an angular panel for backups. To test it, set DISABLED to False in _1731_project_database_backups_panel.py Change-Id: Ia100fa1b52eebe491999571a9b7a6e2043d50e0c --- .../content/ng_database_backups/__init__.py | 0 .../content/ng_database_backups/panel.py | 24 ++++++++++++ .../templates/ng_database_backups/index.html | 10 +++++ .../content/ng_database_backups/urls.py | 23 +++++++++++ .../content/ng_database_backups/views.py | 19 ++++++++++ .../_1731_project_database_backups_panel.py | 29 ++++++++++++++ .../project/ngbackups/backups.module.js | 38 +++++++++++++++++++ .../project/ngbackups/backups.module.spec.js | 26 +++++++++++++ .../dashboard/project/ngbackups/backups.scss | 0 9 files changed, 169 insertions(+) create mode 100644 trove_dashboard/content/ng_database_backups/__init__.py create mode 100644 trove_dashboard/content/ng_database_backups/panel.py create mode 100644 trove_dashboard/content/ng_database_backups/templates/ng_database_backups/index.html create mode 100644 trove_dashboard/content/ng_database_backups/urls.py create mode 100644 trove_dashboard/content/ng_database_backups/views.py create mode 100644 trove_dashboard/enabled/_1731_project_database_backups_panel.py create mode 100644 trove_dashboard/static/dashboard/project/ngbackups/backups.module.js create mode 100644 trove_dashboard/static/dashboard/project/ngbackups/backups.module.spec.js create mode 100644 trove_dashboard/static/dashboard/project/ngbackups/backups.scss diff --git a/trove_dashboard/content/ng_database_backups/__init__.py b/trove_dashboard/content/ng_database_backups/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/trove_dashboard/content/ng_database_backups/panel.py b/trove_dashboard/content/ng_database_backups/panel.py new file mode 100644 index 0000000..8a9c9b1 --- /dev/null +++ b/trove_dashboard/content/ng_database_backups/panel.py @@ -0,0 +1,24 @@ +# Copyright 2016 IBM Corp. +# +# 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. + +from django.utils.translation import ugettext_lazy as _ + +import horizon + + +class NGBackups(horizon.Panel): + name = _("Backups") + slug = 'ng_database_backups' + policy_rules = ('openstack.services.database', + 'openstack.services.object-store',) diff --git a/trove_dashboard/content/ng_database_backups/templates/ng_database_backups/index.html b/trove_dashboard/content/ng_database_backups/templates/ng_database_backups/index.html new file mode 100644 index 0000000..b8c3ceb --- /dev/null +++ b/trove_dashboard/content/ng_database_backups/templates/ng_database_backups/index.html @@ -0,0 +1,10 @@ +{% extends 'base.html' %} +{% load i18n %} +{% block title %}{% trans "Backups" %}{% endblock %} + +{% block page_header %} + +{% endblock page_header %} + +{% block main %} +{% endblock %} diff --git a/trove_dashboard/content/ng_database_backups/urls.py b/trove_dashboard/content/ng_database_backups/urls.py new file mode 100644 index 0000000..290154e --- /dev/null +++ b/trove_dashboard/content/ng_database_backups/urls.py @@ -0,0 +1,23 @@ +# Copyright 2015 IBM Corp. +# +# 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. + +from django.conf.urls import patterns +from django.conf.urls import url + +from trove_dashboard.content.ng_database_backups import views + +urlpatterns = patterns( + '', + url(r'^$', views.IndexView.as_view(), name='index'), +) diff --git a/trove_dashboard/content/ng_database_backups/views.py b/trove_dashboard/content/ng_database_backups/views.py new file mode 100644 index 0000000..30cc03d --- /dev/null +++ b/trove_dashboard/content/ng_database_backups/views.py @@ -0,0 +1,19 @@ +# Copyright 2016 IBM Corp. +# +# 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. + +from django.views import generic + + +class IndexView(generic.TemplateView): + template_name = 'project/ng_database_backups/index.html' diff --git a/trove_dashboard/enabled/_1731_project_database_backups_panel.py b/trove_dashboard/enabled/_1731_project_database_backups_panel.py new file mode 100644 index 0000000..6e1c295 --- /dev/null +++ b/trove_dashboard/enabled/_1731_project_database_backups_panel.py @@ -0,0 +1,29 @@ +# Copyright 2016 IBM Corp. +# +# 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. + + +# The slug of the panel to be added to HORIZON_CONFIG. Required. +PANEL = 'ng_database_backups' +# 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 = 'database' + +# If set to True, this settings file will not be added to the settings. +DISABLED = True + +# Python panel class of the PANEL to be added. +ADD_PANEL = ('trove_dashboard.content.ng_database_backups.panel.NGBackups') + +AUTO_DISCOVER_STATIC_FILES = True diff --git a/trove_dashboard/static/dashboard/project/ngbackups/backups.module.js b/trove_dashboard/static/dashboard/project/ngbackups/backups.module.js new file mode 100644 index 0000000..ad052d5 --- /dev/null +++ b/trove_dashboard/static/dashboard/project/ngbackups/backups.module.js @@ -0,0 +1,38 @@ +/** + * Copyright 2016 IBM Corp. + * + * 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. + */ + +(function() { + 'use strict'; + + /** + * @ngdoc overview + * @name horizon.dashboard.project + * + * @description + * Dashboard module to host various backup panels. + */ + angular + .module('horizon.dashboard.project.backups', []) + .config(config); + + config.$inject = ['$provide', '$windowProvider']; + + function config($provide, $windowProvider) { + var path = $windowProvider.$get().STATIC_URL + 'dashboard/project/'; + $provide.constant('horizon.dashboard.project.basePath', path); + } + +})(); \ No newline at end of file diff --git a/trove_dashboard/static/dashboard/project/ngbackups/backups.module.spec.js b/trove_dashboard/static/dashboard/project/ngbackups/backups.module.spec.js new file mode 100644 index 0000000..b1cbbb8 --- /dev/null +++ b/trove_dashboard/static/dashboard/project/ngbackups/backups.module.spec.js @@ -0,0 +1,26 @@ +/** + * Copyright 2016 IBM Corp. + * + * 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. + */ + +(function() { + 'use strict'; + + describe('horizon.dashboard.project.backups', function() { + it('should exist', function() { + expect(angular.module('horizon.dashboard.project.backups')).toBeDefined(); + }); + }); + +})(); \ No newline at end of file diff --git a/trove_dashboard/static/dashboard/project/ngbackups/backups.scss b/trove_dashboard/static/dashboard/project/ngbackups/backups.scss new file mode 100644 index 0000000..e69de29