From e63ec107c559fa26bddd5d1d0e38ce35a5a9f6fd Mon Sep 17 00:00:00 2001 From: Keiichi Hikita Date: Fri, 6 Oct 2017 14:46:17 +0900 Subject: [PATCH] add initial files. --- CONTRIBUTING.rst | 17 ++++ HACKING.rst | 4 + LICENSE | 176 ++++++++++++++++++++++++++++++++++++++++++ MANIFEST.in | 4 + README.rst | 38 +++++++++ babel-django.cfg | 5 ++ babel-djangojs.cfg | 14 ++++ manage.py | 23 ++++++ requirements.txt | 69 +++++++++++++++++ setup.cfg | 32 ++++++++ setup.py | 29 +++++++ test-requirements.txt | 31 ++++++++ test.py | 4 + tools/pip_install.sh | 52 +++++++++++++ 14 files changed, 498 insertions(+) create mode 100644 CONTRIBUTING.rst create mode 100644 HACKING.rst create mode 100644 LICENSE create mode 100644 MANIFEST.in create mode 100644 README.rst create mode 100644 babel-django.cfg create mode 100644 babel-djangojs.cfg create mode 100755 manage.py create mode 100644 requirements.txt create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 test-requirements.txt create mode 100644 test.py create mode 100755 tools/pip_install.sh diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 00000000..60c6a83c --- /dev/null +++ b/CONTRIBUTING.rst @@ -0,0 +1,17 @@ +If you would like to contribute to the development of OpenStack, you must +follow the steps in this page: + + http://docs.openstack.org/infra/manual/developers.html + +If you already have a good understanding of how the system works and your +OpenStack accounts are set up, you can skip to the development workflow +section of this documentation to learn how changes to OpenStack should be +submitted for review via the Gerrit tool: + + http://docs.openstack.org/infra/manual/developers.html#development-workflow + +Pull requests submitted through GitHub will be ignored. + +Bugs should be filed on Launchpad, not GitHub: + + https://bugs.launchpad.net/../horizon diff --git a/HACKING.rst b/HACKING.rst new file mode 100644 index 00000000..8c6d928d --- /dev/null +++ b/HACKING.rst @@ -0,0 +1,4 @@ +openstack Style Commandments +=============================================== + +Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..68c771a0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,176 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..87b28c01 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,4 @@ +recursive-include heat_dashboard *.html *.scss *.css *.js *.map *.svg *.png + +include AUTHORS +include ChangeLog diff --git a/README.rst b/README.rst new file mode 100644 index 00000000..caa98de1 --- /dev/null +++ b/README.rst @@ -0,0 +1,38 @@ +OpenStack Dashboard plugin for Heat project +=========================================== + +How to use with Horizon on server: +---------------------------------- + +| Use pip to install the package on the server running Horizon. +| Then either copy or link the files in heat_dashboard/enabled to +| openstack_dashboard/local/enabled like following. + + +.. code-block:: bash + + cd heat-dashboard & python setup.py sdist + horizon/tools/with_venv.sh pip install dist/package.tar.gz + + cp -rv enabled/ horizon/openstack_dashboard/local/ + # !! ADD_SCSS_FILES may be overried to your environment. + + # Restart Apache or your Django test server + # You may need to run + python manage.py collectstatic + python manage.py compress + +| This step will cause the Horizon service to pick up the heat plugin +| when it starts. + + +To run unit tests: +------------------ +:: + + ./run_tests.sh + + +Reference: +----------------------------------------------------------------------------------- +https://docs.openstack.org/horizon/latest/contributor/tutorials/plugin.html diff --git a/babel-django.cfg b/babel-django.cfg new file mode 100644 index 00000000..e78d6c0f --- /dev/null +++ b/babel-django.cfg @@ -0,0 +1,5 @@ +[extractors] +django = django_babel.extract:extract_django + +[python: **.py] +[django: **/templates/**.html] diff --git a/babel-djangojs.cfg b/babel-djangojs.cfg new file mode 100644 index 00000000..a8273b62 --- /dev/null +++ b/babel-djangojs.cfg @@ -0,0 +1,14 @@ +[extractors] +# We use a custom extractor to find translatable strings in AngularJS +# templates. The extractor is included in horizon.utils for now. +# See http://babel.pocoo.org/docs/messages/#referencing-extraction-methods for +# details on how this works. +angular = horizon.utils.babel_extract_angular:extract_angular + +[javascript: **.js] + +# We need to look into all static folders for HTML files. +# The **/static ensures that we also search within +# /openstack_dashboard/dashboards/XYZ/static which will ensure +# that plugins are also translated. +[angular: **/static/**.html] diff --git a/manage.py b/manage.py new file mode 100755 index 00000000..8cdafd94 --- /dev/null +++ b/manage.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import os +import sys + +from django.core.management import execute_from_command_line + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", + "heat_dashboard.test.settings") + execute_from_command_line(sys.argv) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..9c2385ff --- /dev/null +++ b/requirements.txt @@ -0,0 +1,69 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. +# Order matters to the pip dependency resolver, so sorting this file +# changes how packages are installed. New dependencies should be +# added in alphabetical order, however, some dependencies may need to +# be installed in a specific order. +# +# PBR should always appear first +pbr!=2.1.0,>=2.0.0 # Apache-2.0 +# Horizon Core Requirements +Babel!=2.4.0,>=2.3.4 # BSD +Django<2.0,>=1.8 # BSD +Pint>=0.5 # BSD +django-babel>=0.5.1 # BSD +django-compressor>=2.0 # MIT +django-openstack-auth>=3.5.0 # Apache-2.0 +django-pyscss>=2.0.2 # BSD License (2 clause) +futurist!=0.15.0,>=0.11.0 # Apache-2.0 +iso8601>=0.1.11 # MIT +netaddr!=0.7.16,>=0.7.13 # BSD +oslo.concurrency>=3.8.0 # Apache-2.0 +oslo.config!=4.3.0,!=4.4.0,>=4.0.0 # Apache-2.0 +oslo.i18n!=3.15.2,>=2.1.0 # Apache-2.0 +oslo.policy>=1.23.0 # Apache-2.0 +oslo.serialization!=2.19.1,>=1.10.0 # Apache-2.0 +oslo.utils>=3.20.0 # Apache-2.0 +osprofiler>=1.4.0 # Apache-2.0 +pymongo!=3.1,>=3.0.2 # Apache-2.0 +pyScss!=1.3.5,>=1.3.4 # MIT License +python-cinderclient>=3.1.0 # Apache-2.0 +python-glanceclient>=2.8.0 # Apache-2.0 +python-heatclient>=1.6.1 # Apache-2.0 +python-keystoneclient>=3.8.0 # Apache-2.0 +python-neutronclient>=6.3.0 # Apache-2.0 +python-novaclient>=9.0.0 # Apache-2.0 +python-swiftclient>=3.2.0 # Apache-2.0 +pytz>=2013.6 # MIT +PyYAML>=3.10.0 # MIT +semantic-version>=2.3.1 # BSD +six>=1.9.0 # MIT +XStatic>=1.0.0 # MIT License +XStatic-Angular>=1.5.8.0 # MIT License +XStatic-Angular-Bootstrap>=2.2.0.0 # MIT License +XStatic-Angular-FileUpload>=12.0.4.0 # MIT License +XStatic-Angular-Gettext>=2.3.8.0 # MIT License +XStatic-Angular-lrdragndrop>=1.0.2.2 # MIT License +XStatic-Angular-Schema-Form>=0.8.13.0 # MIT +XStatic-Bootstrap-Datepicker>=1.3.1.0 # Apache 2.0 License +XStatic-Bootstrap-SCSS>=3.3.7.1 # Apache 2.0 License +XStatic-bootswatch>=3.3.7.0 # MIT License +XStatic-D3>=3.5.17.0 # BSD License (3 clause) +XStatic-Hogan>=2.0.0.2 # Apache 2.0 License +XStatic-Font-Awesome>=4.7.0 # SIL OFL 1.1 License, MIT License +XStatic-Jasmine>=2.4.1.1 # MIT License +XStatic-jQuery>=1.8.2.1 # MIT License +XStatic-JQuery-Migrate>=1.2.1.1 # MIT License +XStatic-JQuery.quicksearch>=2.0.3.1 # MIT License +XStatic-JQuery.TableSorter>=2.14.5.1 # MIT License +XStatic-jquery-ui>=1.10.4.1 # MIT License +XStatic-JSEncrypt>=2.3.1.1 # MIT License +XStatic-mdi>=1.4.57.0 # SIL OPEN FONT LICENSE Version 1.1 +XStatic-objectpath>=1.2.1.0 # MIT +XStatic-Rickshaw>=1.5.0.0 # BSD License (prior) +XStatic-roboto-fontface>=0.5.0.0 # Apache 2.0 License +XStatic-smart-table>=1.4.13.2 # MIT License +XStatic-Spin>=1.2.5.2 # MIT License +XStatic-term.js>=0.0.7.0 # MIT License +XStatic-tv4>=1.2.7.0 # MIT diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..8fa2e24f --- /dev/null +++ b/setup.cfg @@ -0,0 +1,32 @@ +[metadata] +name = heat-dashboard +summary = Heat Management Dashboard +description-file = + README.rst +author = OpenStack +author-email = openstack-dev@lists.openstack.org +home-page = http://www.openstack.org/ +classifier = + Environment :: OpenStack + Intended Audience :: Information Technology + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux + Programming Language :: Python + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.3 + Programming Language :: Python :: 3.4 + +[files] +packages = + heat_dashboard + +[build_sphinx] +source-dir = doc/source +build-dir = doc/build +all_files = 1 + +[upload_sphinx] +upload-dir = doc/build/html diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..0ab2295b --- /dev/null +++ b/setup.py @@ -0,0 +1,29 @@ +# Copyright (c) 2017 NTT Communications, L.P. +# +# 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 FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT +import setuptools + +# In python < 2.7.4, a lazy loading of package `pbr` will break +# setuptools if some other modules registered functions in `atexit`. +# solution from: http://bugs.python.org/issue15881#msg170215 +try: + import multiprocessing # noqa +except ImportError: + pass + +setuptools.setup( + setup_requires=['pbr>=1.8'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000..41de00e0 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,31 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. +# Order matters to the pip dependency resolver, so sorting this file +# changes how packages are installed. New dependencies should be +# added in alphabetical order, however, some dependencies may need to +# be installed in a specific order. +# +# Hacking should appear first in case something else depends on pep8 +hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 +# +coverage!=4.4,>=4.0 # Apache-2.0 +django-nose>=1.4.4 # BSD +doc8 # Apache-2.0 +flake8-import-order==0.12 # LGPLv3 +mock>=2.0 # BSD +mox3!=0.19.0,>=0.7.0 # Apache-2.0 +nodeenv>=0.9.4 # BSD +nose # LGPL +nose-exclude # LGPL +nosehtmloutput>=0.0.3 # Apache-2.0 +nosexcover # BSD +openstack.nose-plugin>=0.7 # Apache-2.0 +openstackdocstheme>=1.16.0 # Apache-2.0 +reno!=2.3.1,>=1.8.0 # Apache-2.0 +requests>=2.14.2 # Apache-2.0 +selenium>=2.50.1 # Apache-2.0 +sphinx>=1.6.2 # BSD +testtools>=1.4.0 # MIT +# This also needs xvfb library installed on your OS +xvfbwrapper>=0.1.3 #license: MIT diff --git a/test.py b/test.py new file mode 100644 index 00000000..3918e776 --- /dev/null +++ b/test.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- + +if __name__ == '__main__': + print("do some test.") diff --git a/tools/pip_install.sh b/tools/pip_install.sh new file mode 100755 index 00000000..c7568eb9 --- /dev/null +++ b/tools/pip_install.sh @@ -0,0 +1,52 @@ +#!/bin/sh + +# This script is borrowed from Sahara who borrowed from neutron-* repos. + +# Many of horizon's repos suffer from the problem of depending on horizon, +# but it not existing on pypi. + +# This wrapper for tox's package installer will use the existing package +# if it exists, else use zuul-cloner if that program exists, else grab it +# from horizon master via a hard-coded URL. That last case should only +# happen with devs running unit tests locally. + +# From the tox.ini config page: +# install_command=ARGV +# default: +# pip install {opts} {packages} + +ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner +BRANCH_NAME=master +horizon_installed=$(echo "import horizon" | python 2>/dev/null ; echo $?) + +set -e + +install_cmd="pip install $1" +shift + +if [ $horizon_installed -eq 0 ]; then + echo "ALREADY INSTALLED" > /tmp/tox_install.txt + echo "Horizon already installed; using existing package" +elif [ -x "$ZUUL_CLONER" ]; then + export ZUUL_BRANCH=${ZUUL_BRANCH-$BRANCH} + echo "ZUUL CLONER" > /tmp/tox_install.txt + cwd=$(/bin/pwd) + cd /tmp + $ZUUL_CLONER --cache-dir \ + /opt/git \ + --branch $BRANCH_NAME \ + git://git.openstack.org \ + openstack/horizon + cd openstack/horizon + $install_cmd -e . + cd "$cwd" +else + echo "PIP HARDCODE" > /tmp/tox_install.txt + if [ -z "$HORIZON_PIP_LOCATION" ]; then + HORIZON_PIP_LOCATION="git+https://git.openstack.org/openstack/horizon@$BRANCH_NAME#egg=horizon" + fi + $install_cmd -U -e ${HORIZON_PIP_LOCATION} +fi + +$install_cmd -U $* +exit $?