first commit
This commit is contained in:
commit
8fca7e3753
176
LICENSE
Normal file
176
LICENSE
Normal file
@ -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.
|
||||||
|
|
58
README.rst
Normal file
58
README.rst
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
==========
|
||||||
|
meteos-ui
|
||||||
|
==========
|
||||||
|
|
||||||
|
Meteos UI
|
||||||
|
|
||||||
|
* Free software: Apache license
|
||||||
|
* Source: http://git.openstack.org/cgit/openstack/meteos-ui
|
||||||
|
* Bugs: http://bugs.launchpad.net/meteos-ui
|
||||||
|
|
||||||
|
Enabling in DevStack
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Add this repo as an external repository into your ``local.conf`` file::
|
||||||
|
|
||||||
|
[[local|localrc]]
|
||||||
|
enable_plugin meteos-ui https://github.com/openstack/meteos-ui
|
||||||
|
|
||||||
|
Manual Installation
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
Begin by cloning the Horizon and Meteos UI repositories::
|
||||||
|
|
||||||
|
git clone https://github.com/openstack/horizon
|
||||||
|
git clone https://github.com/openstack/meteos-ui
|
||||||
|
|
||||||
|
Create a virtual environment and install Horizon dependencies::
|
||||||
|
|
||||||
|
cd horizon
|
||||||
|
python tools/install_venv.py
|
||||||
|
|
||||||
|
Set up your ``local_settings.py`` file::
|
||||||
|
|
||||||
|
cp openstack_dashboard/local/local_settings.py.example openstack_dashboard/local/local_settings.py
|
||||||
|
|
||||||
|
Open up the copied ``local_settings.py`` file in your preferred text
|
||||||
|
editor. You will want to customize several settings:
|
||||||
|
|
||||||
|
- ``OPENSTACK_HOST`` should be configured with the hostname of your
|
||||||
|
OpenStack server. Verify that the ``OPENSTACK_KEYSTONE_URL`` and
|
||||||
|
``OPENSTACK_KEYSTONE_DEFAULT_ROLE`` settings are correct for your
|
||||||
|
environment. (They should be correct unless you modified your
|
||||||
|
OpenStack server to change them.)
|
||||||
|
|
||||||
|
Install Meteos UI with all dependencies in your virtual environment::
|
||||||
|
|
||||||
|
tools/with_venv.sh pip install -e ../meteos-ui/
|
||||||
|
|
||||||
|
And enable it in Horizon::
|
||||||
|
|
||||||
|
cp ../meteos-ui/meteos_ui/enabled/* openstack_dashboard/local/enabled/
|
||||||
|
|
||||||
|
To run horizon with the newly enabled Meteos UI plugin run::
|
||||||
|
|
||||||
|
./run_tests.sh --runserver 0.0.0.0:8080
|
||||||
|
|
||||||
|
to have the application start on port 8080 and the horizon dashboard will be
|
||||||
|
available in your browser at http://localhost:8080/
|
5
babel-django.cfg
Normal file
5
babel-django.cfg
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[extractors]
|
||||||
|
django = django_babel.extract:extract_django
|
||||||
|
|
||||||
|
[python: **.py]
|
||||||
|
[django: templates/**.html]
|
14
babel-djangojs.cfg
Normal file
14
babel-djangojs.cfg
Normal file
@ -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]
|
60
devstack/plugin.sh
Normal file
60
devstack/plugin.sh
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
# plugin.sh - DevStack plugin.sh dispatch script meteos-ui
|
||||||
|
|
||||||
|
METEOS_UI_DIR=$(cd $(dirname $BASH_SOURCE)/.. && pwd)
|
||||||
|
|
||||||
|
function install_meteos_ui {
|
||||||
|
# NOTE(shu-mutou): workaround for devstack bug: 1540328
|
||||||
|
# where devstack install 'test-requirements' but should not do it
|
||||||
|
# for meteos-ui project as it installs Horizon from url.
|
||||||
|
# Remove following two 'mv' commands when mentioned bug is fixed.
|
||||||
|
mv $METEOS_UI_DIR/test-requirements.txt $METEOS_UI_DIR/_test-requirements.txt
|
||||||
|
|
||||||
|
setup_develop ${METEOS_UI_DIR}
|
||||||
|
|
||||||
|
mv $METEOS_UI_DIR/_test-requirements.txt $METEOS_UI_DIR/test-requirements.txt
|
||||||
|
}
|
||||||
|
|
||||||
|
function configure_meteos_ui {
|
||||||
|
cp -a ${METEOS_UI_DIR}/meteos_ui/enabled/* ${DEST}/horizon/openstack_dashboard/local/enabled/
|
||||||
|
# NOTE: If locale directory does not exist, compilemessages will fail,
|
||||||
|
# so check for an existence of locale directory is required.
|
||||||
|
if [ -d ${METEOS_UI_DIR}/meteos_ui/locale ]; then
|
||||||
|
(cd ${METEOS_UI_DIR}/meteos_ui; DJANGO_SETTINGS_MODULE=openstack_dashboard.settings ../manage.py compilemessages)
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# check for service enabled
|
||||||
|
if is_service_enabled meteos-ui; then
|
||||||
|
|
||||||
|
if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
|
||||||
|
# Set up system services
|
||||||
|
# no-op
|
||||||
|
:
|
||||||
|
|
||||||
|
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
|
||||||
|
# Perform installation of service source
|
||||||
|
echo_summary "Installing Meteos UI"
|
||||||
|
install_meteos_ui
|
||||||
|
|
||||||
|
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
|
||||||
|
# Configure after the other layer 1 and 2 services have been configured
|
||||||
|
echo_summary "Configurng Meteos UI"
|
||||||
|
configure_meteos_ui
|
||||||
|
|
||||||
|
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
|
||||||
|
# no-op
|
||||||
|
:
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$1" == "unstack" ]]; then
|
||||||
|
# no-op
|
||||||
|
:
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$1" == "clean" ]]; then
|
||||||
|
# Remove state and transient data
|
||||||
|
# Remember clean.sh first calls unstack.sh
|
||||||
|
# no-op
|
||||||
|
:
|
||||||
|
fi
|
||||||
|
fi
|
2
devstack/settings
Normal file
2
devstack/settings
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# settings file for meteos-ui plugin
|
||||||
|
enable_service meteos-ui
|
152
doc/Makefile
Normal file
152
doc/Makefile
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
# Makefile for Sphinx documentation
|
||||||
|
|
||||||
|
# You can set these variables from the command line.
|
||||||
|
SPHINXOPTS =
|
||||||
|
SPHINXBUILD = sphinx-build
|
||||||
|
PAPER =
|
||||||
|
BUILDDIR = build
|
||||||
|
|
||||||
|
# Internal variables.
|
||||||
|
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||||
|
PAPEROPT_letter = -D latex_paper_size=letter
|
||||||
|
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||||
|
# the i18n builder cannot share the environment and doctrees with the others
|
||||||
|
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||||
|
|
||||||
|
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
|
||||||
|
|
||||||
|
help:
|
||||||
|
@echo "Please use \`make <target>' where <target> is one of"
|
||||||
|
@echo " html to make standalone HTML files"
|
||||||
|
@echo " dirhtml to make HTML files named index.html in directories"
|
||||||
|
@echo " singlehtml to make a single large HTML file"
|
||||||
|
@echo " pickle to make pickle files"
|
||||||
|
@echo " json to make JSON files"
|
||||||
|
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||||
|
@echo " qthelp to make HTML files and a qthelp project"
|
||||||
|
@echo " devhelp to make HTML files and a Devhelp project"
|
||||||
|
@echo " epub to make an epub"
|
||||||
|
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||||
|
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
||||||
|
@echo " text to make text files"
|
||||||
|
@echo " man to make manual pages"
|
||||||
|
@echo " texinfo to make Texinfo files"
|
||||||
|
@echo " info to make Texinfo files and run them through makeinfo"
|
||||||
|
@echo " gettext to make PO message catalogs"
|
||||||
|
@echo " changes to make an overview of all changed/added/deprecated items"
|
||||||
|
@echo " linkcheck to check all external links for integrity"
|
||||||
|
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-rm -rf $(BUILDDIR)/*
|
||||||
|
|
||||||
|
html:
|
||||||
|
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||||
|
|
||||||
|
dirhtml:
|
||||||
|
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
||||||
|
|
||||||
|
singlehtml:
|
||||||
|
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
||||||
|
|
||||||
|
pickle:
|
||||||
|
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
||||||
|
@echo
|
||||||
|
@echo "Build finished; now you can process the pickle files."
|
||||||
|
|
||||||
|
json:
|
||||||
|
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
||||||
|
@echo
|
||||||
|
@echo "Build finished; now you can process the JSON files."
|
||||||
|
|
||||||
|
htmlhelp:
|
||||||
|
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
||||||
|
@echo
|
||||||
|
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||||
|
".hhp project file in $(BUILDDIR)/htmlhelp."
|
||||||
|
|
||||||
|
qthelp:
|
||||||
|
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
||||||
|
@echo
|
||||||
|
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
||||||
|
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
||||||
|
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Meteos-UI.qhcp"
|
||||||
|
@echo "To view the help file:"
|
||||||
|
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Meteos-UI.qhc"
|
||||||
|
|
||||||
|
devhelp:
|
||||||
|
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
||||||
|
@echo
|
||||||
|
@echo "Build finished."
|
||||||
|
@echo "To view the help file:"
|
||||||
|
@echo "# mkdir -p $$HOME/.local/share/devhelp/Meteos-UI"
|
||||||
|
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Meteos-UI"
|
||||||
|
@echo "# devhelp"
|
||||||
|
|
||||||
|
epub:
|
||||||
|
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
||||||
|
|
||||||
|
latex:
|
||||||
|
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||||
|
@echo
|
||||||
|
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
||||||
|
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
||||||
|
"(use \`make latexpdf' here to do that automatically)."
|
||||||
|
|
||||||
|
latexpdf:
|
||||||
|
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||||
|
@echo "Running LaTeX files through pdflatex..."
|
||||||
|
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
||||||
|
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||||
|
|
||||||
|
text:
|
||||||
|
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
||||||
|
|
||||||
|
man:
|
||||||
|
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
||||||
|
|
||||||
|
texinfo:
|
||||||
|
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
||||||
|
@echo "Run \`make' in that directory to run these through makeinfo" \
|
||||||
|
"(use \`make info' here to do that automatically)."
|
||||||
|
|
||||||
|
info:
|
||||||
|
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||||
|
@echo "Running Texinfo files through makeinfo..."
|
||||||
|
make -C $(BUILDDIR)/texinfo info
|
||||||
|
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
||||||
|
|
||||||
|
gettext:
|
||||||
|
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
||||||
|
|
||||||
|
changes:
|
||||||
|
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
||||||
|
@echo
|
||||||
|
@echo "The overview file is in $(BUILDDIR)/changes."
|
||||||
|
|
||||||
|
linkcheck:
|
||||||
|
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
||||||
|
@echo
|
||||||
|
@echo "Link check complete; look for any errors in the above output " \
|
||||||
|
"or in $(BUILDDIR)/linkcheck/output.txt."
|
||||||
|
|
||||||
|
doctest:
|
||||||
|
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
||||||
|
@echo "Testing of doctests in the sources finished, look at the " \
|
||||||
|
"results in $(BUILDDIR)/doctest/output.txt."
|
441
doc/source/conf.py
Normal file
441
doc/source/conf.py
Normal file
@ -0,0 +1,441 @@
|
|||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# Horizon documentation build configuration file, created by
|
||||||
|
# sphinx-quickstart on Thu Oct 27 11:38:59 2011.
|
||||||
|
#
|
||||||
|
# This file is execfile()d with the current directory set to its
|
||||||
|
# containing dir.
|
||||||
|
#
|
||||||
|
# Note that not all possible configuration values are present in this
|
||||||
|
# autogenerated file.
|
||||||
|
#
|
||||||
|
# All configuration values have a default; values that are commented out
|
||||||
|
# serve to show the default.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
ROOT = os.path.abspath(os.path.join(BASE_DIR, "..", ".."))
|
||||||
|
|
||||||
|
sys.path.insert(0, ROOT)
|
||||||
|
|
||||||
|
# This is required for ReadTheDocs.org, but isn't a bad idea anyway.
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE',
|
||||||
|
'meteos_ui.test.settings')
|
||||||
|
|
||||||
|
from meteos_ui \
|
||||||
|
import version as meteosui_ver
|
||||||
|
|
||||||
|
|
||||||
|
def write_autodoc_index():
|
||||||
|
|
||||||
|
def find_autodoc_modules(module_name, sourcedir):
|
||||||
|
"""returns a list of modules in the SOURCE directory."""
|
||||||
|
modlist = []
|
||||||
|
os.chdir(os.path.join(sourcedir, module_name))
|
||||||
|
print("SEARCHING %s" % sourcedir)
|
||||||
|
for root, dirs, files in os.walk("."):
|
||||||
|
for filename in files:
|
||||||
|
if filename == 'tests.py':
|
||||||
|
continue
|
||||||
|
if filename.endswith(".py"):
|
||||||
|
# remove the pieces of the root
|
||||||
|
elements = root.split(os.path.sep)
|
||||||
|
# replace the leading "." with the module name
|
||||||
|
elements[0] = module_name
|
||||||
|
# and get the base module name
|
||||||
|
base, extension = os.path.splitext(filename)
|
||||||
|
if not (base == "__init__"):
|
||||||
|
elements.append(base)
|
||||||
|
result = ".".join(elements)
|
||||||
|
# print result
|
||||||
|
modlist.append(result)
|
||||||
|
return modlist
|
||||||
|
|
||||||
|
RSTDIR = os.path.abspath(os.path.join(BASE_DIR, "sourcecode"))
|
||||||
|
SRCS = [('meteos_ui', ROOT), ]
|
||||||
|
|
||||||
|
EXCLUDED_MODULES = ()
|
||||||
|
CURRENT_SOURCES = {}
|
||||||
|
|
||||||
|
if not(os.path.exists(RSTDIR)):
|
||||||
|
os.mkdir(RSTDIR)
|
||||||
|
CURRENT_SOURCES[RSTDIR] = ['autoindex.rst']
|
||||||
|
|
||||||
|
INDEXOUT = open(os.path.join(RSTDIR, "autoindex.rst"), "w")
|
||||||
|
INDEXOUT.write("""
|
||||||
|
=================
|
||||||
|
Source Code Index
|
||||||
|
=================
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
:depth: 1
|
||||||
|
:local:
|
||||||
|
|
||||||
|
""")
|
||||||
|
|
||||||
|
for modulename, path in SRCS:
|
||||||
|
sys.stdout.write("Generating source documentation for %s\n" %
|
||||||
|
modulename)
|
||||||
|
INDEXOUT.write("\n%s\n" % modulename.capitalize())
|
||||||
|
INDEXOUT.write("%s\n" % ("=" * len(modulename),))
|
||||||
|
INDEXOUT.write(".. toctree::\n")
|
||||||
|
INDEXOUT.write(" :maxdepth: 1\n")
|
||||||
|
INDEXOUT.write("\n")
|
||||||
|
|
||||||
|
MOD_DIR = os.path.join(RSTDIR, modulename)
|
||||||
|
CURRENT_SOURCES[MOD_DIR] = []
|
||||||
|
if not(os.path.exists(MOD_DIR)):
|
||||||
|
os.mkdir(MOD_DIR)
|
||||||
|
for module in find_autodoc_modules(modulename, path):
|
||||||
|
if any([module.startswith(exclude) for exclude
|
||||||
|
in EXCLUDED_MODULES]):
|
||||||
|
print("Excluded module %s." % module)
|
||||||
|
continue
|
||||||
|
mod_path = os.path.join(path, *module.split("."))
|
||||||
|
generated_file = os.path.join(MOD_DIR, "%s.rst" % module)
|
||||||
|
|
||||||
|
INDEXOUT.write(" %s/%s\n" % (modulename, module))
|
||||||
|
|
||||||
|
# Find the __init__.py module if this is a directory
|
||||||
|
if os.path.isdir(mod_path):
|
||||||
|
source_file = ".".join((os.path.join(mod_path, "__init__"),
|
||||||
|
"py",))
|
||||||
|
else:
|
||||||
|
source_file = ".".join((os.path.join(mod_path), "py"))
|
||||||
|
|
||||||
|
CURRENT_SOURCES[MOD_DIR].append("%s.rst" % module)
|
||||||
|
# Only generate a new file if the source has changed or we don't
|
||||||
|
# have a doc file to begin with.
|
||||||
|
if not os.access(generated_file, os.F_OK) or (
|
||||||
|
os.stat(generated_file).st_mtime <
|
||||||
|
os.stat(source_file).st_mtime):
|
||||||
|
print("Module %s updated, generating new documentation."
|
||||||
|
% module)
|
||||||
|
FILEOUT = open(generated_file, "w")
|
||||||
|
header = "The :mod:`%s` Module" % module
|
||||||
|
FILEOUT.write("%s\n" % ("=" * len(header),))
|
||||||
|
FILEOUT.write("%s\n" % header)
|
||||||
|
FILEOUT.write("%s\n" % ("=" * len(header),))
|
||||||
|
FILEOUT.write(".. automodule:: %s\n" % module)
|
||||||
|
FILEOUT.write(" :members:\n")
|
||||||
|
FILEOUT.write(" :undoc-members:\n")
|
||||||
|
FILEOUT.write(" :show-inheritance:\n")
|
||||||
|
FILEOUT.write(" :noindex:\n")
|
||||||
|
FILEOUT.close()
|
||||||
|
|
||||||
|
INDEXOUT.close()
|
||||||
|
|
||||||
|
# Delete auto-generated .rst files for sources which no longer exist
|
||||||
|
for directory, subdirs, files in list(os.walk(RSTDIR)):
|
||||||
|
for old_file in files:
|
||||||
|
if old_file not in CURRENT_SOURCES.get(directory, []):
|
||||||
|
print("Removing outdated file for %s" % old_file)
|
||||||
|
os.remove(os.path.join(directory, old_file))
|
||||||
|
|
||||||
|
|
||||||
|
write_autodoc_index()
|
||||||
|
|
||||||
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
|
# sys.path.insert(0, os.path.abspath('.'))
|
||||||
|
|
||||||
|
# -- General configuration ----------------------------------------------------
|
||||||
|
|
||||||
|
# If your documentation needs a minimal Sphinx version, state it here.
|
||||||
|
# needs_sphinx = '1.0'
|
||||||
|
|
||||||
|
# Add any Sphinx extension module names here, as strings.
|
||||||
|
# They can be extensions coming with Sphinx (named 'sphinx.ext.*')
|
||||||
|
# or your custom ones.
|
||||||
|
extensions = ['sphinx.ext.autodoc',
|
||||||
|
'sphinx.ext.todo',
|
||||||
|
'sphinx.ext.coverage',
|
||||||
|
'sphinx.ext.viewcode',
|
||||||
|
'oslosphinx',
|
||||||
|
]
|
||||||
|
|
||||||
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
|
templates_path = ['_templates']
|
||||||
|
|
||||||
|
# The suffix of source filenames.
|
||||||
|
source_suffix = '.rst'
|
||||||
|
|
||||||
|
# The encoding of source files.
|
||||||
|
# source_encoding = 'utf-8-sig'
|
||||||
|
|
||||||
|
# The master toctree document.
|
||||||
|
master_doc = 'index'
|
||||||
|
|
||||||
|
# General information about the project.
|
||||||
|
project = u'Meteos UI'
|
||||||
|
copyright = u'2016, OpenStack Foundation'
|
||||||
|
|
||||||
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
|
# |version| and |release|, also used in various other places throughout the
|
||||||
|
# built documents.
|
||||||
|
#
|
||||||
|
# The short X.Y version.
|
||||||
|
version = meteosui_ver.version_info.version_string()
|
||||||
|
# The full version, including alpha/beta/rc tags.
|
||||||
|
release = meteosui_ver.version_info.release_string()
|
||||||
|
|
||||||
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
|
# for a list of supported languages.
|
||||||
|
# language = None
|
||||||
|
|
||||||
|
# There are two options for replacing |today|: either, you set today to some
|
||||||
|
# non-false value, then it is used:
|
||||||
|
# today = ''
|
||||||
|
# Else, today_fmt is used as the format for a strftime call.
|
||||||
|
# today_fmt = '%B %d, %Y'
|
||||||
|
|
||||||
|
# List of patterns, relative to source directory, that match files and
|
||||||
|
# directories to ignore when looking for source files.
|
||||||
|
exclude_patterns = ['**/#*', '**~', '**/#*#']
|
||||||
|
|
||||||
|
# The reST default role (used for this markup: `text`)
|
||||||
|
# to use for all documents.
|
||||||
|
# default_role = None
|
||||||
|
|
||||||
|
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||||
|
# add_function_parentheses = True
|
||||||
|
|
||||||
|
# If true, the current module name will be prepended to all description
|
||||||
|
# unit titles (such as .. function::).
|
||||||
|
# add_module_names = True
|
||||||
|
|
||||||
|
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||||
|
# output. They are ignored by default.
|
||||||
|
show_authors = False
|
||||||
|
|
||||||
|
# The name of the Pygments (syntax highlighting) style to use.
|
||||||
|
pygments_style = 'sphinx'
|
||||||
|
|
||||||
|
# A list of ignored prefixes for module index sorting.
|
||||||
|
# modindex_common_prefix = []
|
||||||
|
|
||||||
|
primary_domain = 'py'
|
||||||
|
nitpicky = False
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for HTML output --------------------------------------------------
|
||||||
|
|
||||||
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||||
|
# a list of builtin themes.
|
||||||
|
# html_theme_path = ['.']
|
||||||
|
# html_theme = '_theme'
|
||||||
|
|
||||||
|
# Theme options are theme-specific and customize the look and feel of a theme
|
||||||
|
# further. For a list of options available for each theme, see the
|
||||||
|
# documentation.
|
||||||
|
html_theme_options = {
|
||||||
|
"nosidebar": "false"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Add any paths that contain custom themes here, relative to this directory.
|
||||||
|
# html_theme_path = []
|
||||||
|
|
||||||
|
# The name for this set of Sphinx documents. If None, it defaults to
|
||||||
|
# "<project> v<release> documentation".
|
||||||
|
# html_title = None
|
||||||
|
|
||||||
|
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||||
|
# html_short_title = None
|
||||||
|
|
||||||
|
# The name of an image file (relative to this directory) to place at the top
|
||||||
|
# of the sidebar.
|
||||||
|
# html_logo = None
|
||||||
|
|
||||||
|
# The name of an image file (within the static path) to use as favicon of the
|
||||||
|
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||||
|
# pixels large.
|
||||||
|
# html_favicon = None
|
||||||
|
|
||||||
|
# Add any paths that contain custom static files (such as style sheets) here,
|
||||||
|
# relative to this directory. They are copied after the builtin static files,
|
||||||
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||||
|
html_static_path = ['_static']
|
||||||
|
|
||||||
|
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||||
|
# using the given strftime format.
|
||||||
|
# html_last_updated_fmt = '%b %d, %Y'
|
||||||
|
git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local",
|
||||||
|
"-n1"]
|
||||||
|
html_last_updated_fmt = subprocess.check_output(git_cmd,
|
||||||
|
stdin=subprocess.PIPE)
|
||||||
|
|
||||||
|
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||||
|
# typographically correct entities.
|
||||||
|
# html_use_smartypants = True
|
||||||
|
|
||||||
|
# Custom sidebar templates, maps document names to template names.
|
||||||
|
# html_sidebars = {}
|
||||||
|
|
||||||
|
# Additional templates that should be rendered to pages, maps page names to
|
||||||
|
# template names.
|
||||||
|
# html_additional_pages = {}
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
# html_domain_indices = True
|
||||||
|
|
||||||
|
# If false, no index is generated.
|
||||||
|
# html_use_index = True
|
||||||
|
|
||||||
|
# If true, the index is split into individual pages for each letter.
|
||||||
|
# html_split_index = False
|
||||||
|
|
||||||
|
# If true, links to the reST sources are added to the pages.
|
||||||
|
# html_show_sourcelink = True
|
||||||
|
|
||||||
|
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||||
|
# html_show_sphinx = True
|
||||||
|
|
||||||
|
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||||
|
# html_show_copyright = True
|
||||||
|
|
||||||
|
# If true, an OpenSearch description file will be output, and all pages will
|
||||||
|
# contain a <link> tag referring to it. The value of this option must be the
|
||||||
|
# base URL from which the finished HTML is served.
|
||||||
|
# html_use_opensearch = ''
|
||||||
|
|
||||||
|
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||||
|
# html_file_suffix = None
|
||||||
|
|
||||||
|
# Output file base name for HTML help builder.
|
||||||
|
htmlhelp_basename = 'Horizondoc'
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for LaTeX output -------------------------------------------------
|
||||||
|
|
||||||
|
latex_elements = {
|
||||||
|
# The paper size ('letterpaper' or 'a4paper').
|
||||||
|
# 'papersize': 'letterpaper',
|
||||||
|
|
||||||
|
# The font size ('10pt', '11pt' or '12pt').
|
||||||
|
# 'pointsize': '10pt',
|
||||||
|
|
||||||
|
# Additional stuff for the LaTeX preamble.
|
||||||
|
# 'preamble': '',
|
||||||
|
}
|
||||||
|
|
||||||
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
|
# (source start file, target name, title, author, documentclass
|
||||||
|
# [howto/manual]).
|
||||||
|
latex_documents = [
|
||||||
|
('index', 'Horizon.tex', u'Horizon Documentation',
|
||||||
|
u'OpenStack Foundation', 'manual'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# The name of an image file (relative to this directory) to place at the top of
|
||||||
|
# the title page.
|
||||||
|
# latex_logo = None
|
||||||
|
|
||||||
|
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||||
|
# not chapters.
|
||||||
|
# latex_use_parts = False
|
||||||
|
|
||||||
|
# If true, show page references after internal links.
|
||||||
|
# latex_show_pagerefs = False
|
||||||
|
|
||||||
|
# If true, show URL addresses after external links.
|
||||||
|
# latex_show_urls = False
|
||||||
|
|
||||||
|
# Documents to append as an appendix to all manuals.
|
||||||
|
# latex_appendices = []
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
# latex_domain_indices = True
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for manual page output -------------------------------------------
|
||||||
|
|
||||||
|
# One entry per manual page. List of tuples
|
||||||
|
# (source start file, name, description, authors, manual section).
|
||||||
|
man_pages = [
|
||||||
|
('index', u'Meteos UI Documentation',
|
||||||
|
'Documentation for the Meteos UI plugin to the Openstack\
|
||||||
|
Dashboard (Horizon)',
|
||||||
|
[u'OpenStack'], 1)
|
||||||
|
]
|
||||||
|
|
||||||
|
# If true, show URL addresses after external links.
|
||||||
|
# man_show_urls = False
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for Texinfo output -----------------------------------------------
|
||||||
|
|
||||||
|
# Grouping the document tree into Texinfo files. List of tuples
|
||||||
|
# (source start file, target name, title, author,
|
||||||
|
# dir menu entry, description, category)
|
||||||
|
texinfo_documents = [
|
||||||
|
('index', 'Horizon', u'Horizon Documentation', u'OpenStack',
|
||||||
|
'Horizon', 'One line description of project.', 'Miscellaneous'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# Documents to append as an appendix to all manuals.
|
||||||
|
# texinfo_appendices = []
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
# texinfo_domain_indices = True
|
||||||
|
|
||||||
|
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||||
|
# texinfo_show_urls = 'footnote'
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for Epub output --------------------------------------------------
|
||||||
|
|
||||||
|
# Bibliographic Dublin Core info.
|
||||||
|
epub_title = u'Horizon'
|
||||||
|
epub_author = u'OpenStack'
|
||||||
|
epub_publisher = u'OpenStack'
|
||||||
|
epub_copyright = u'2012, OpenStack'
|
||||||
|
|
||||||
|
# The language of the text. It defaults to the language option
|
||||||
|
# or en if the language is not set.
|
||||||
|
# epub_language = ''
|
||||||
|
|
||||||
|
# The scheme of the identifier. Typical schemes are ISBN or URL.
|
||||||
|
# epub_scheme = ''
|
||||||
|
|
||||||
|
# The unique identifier of the text. This can be an ISBN number
|
||||||
|
# or the project homepage.
|
||||||
|
# epub_identifier = ''
|
||||||
|
|
||||||
|
# A unique identification for the text.
|
||||||
|
# epub_uid = ''
|
||||||
|
|
||||||
|
# A tuple containing the cover image and cover page html template filenames.
|
||||||
|
# epub_cover = ()
|
||||||
|
|
||||||
|
# HTML files that should be inserted before the pages created by sphinx.
|
||||||
|
# The format is a list of tuples containing the path and title.
|
||||||
|
# epub_pre_files = []
|
||||||
|
|
||||||
|
# HTML files shat should be inserted after the pages created by sphinx.
|
||||||
|
# The format is a list of tuples containing the path and title.
|
||||||
|
# epub_post_files = []
|
||||||
|
|
||||||
|
# A list of files that should not be packed into the epub file.
|
||||||
|
# epub_exclude_files = []
|
||||||
|
|
||||||
|
# The depth of the table of contents in toc.ncx.
|
||||||
|
# epub_tocdepth = 3
|
||||||
|
|
||||||
|
# Allow duplicate toc entries.
|
||||||
|
# epub_tocdup = True
|
78
doc/source/index.rst
Normal file
78
doc/source/index.rst
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
==========
|
||||||
|
meteos-ui
|
||||||
|
==========
|
||||||
|
|
||||||
|
Meteos UI
|
||||||
|
|
||||||
|
* Free software: Apache license
|
||||||
|
* Source: http://git.openstack.org/cgit/openstack/meteos-ui
|
||||||
|
* Bugs: http://bugs.launchpad.net/meteos-ui
|
||||||
|
|
||||||
|
Enabling in DevStack
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Add this repo as an external repository into your ``local.conf`` file::
|
||||||
|
|
||||||
|
[[local|localrc]]
|
||||||
|
enable_plugin meteos-ui https://github.com/openstack/meteos-ui
|
||||||
|
|
||||||
|
Manual Installation
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
Begin by cloning the Horizon and Meteos UI repositories::
|
||||||
|
|
||||||
|
git clone https://github.com/openstack/horizon
|
||||||
|
git clone https://github.com/openstack/meteos-ui
|
||||||
|
|
||||||
|
Create a virtual environment and install Horizon dependencies::
|
||||||
|
|
||||||
|
cd horizon
|
||||||
|
python tools/install_venv.py
|
||||||
|
|
||||||
|
Set up your ``local_settings.py`` file::
|
||||||
|
|
||||||
|
cp openstack_dashboard/local/local_settings.py.example openstack_dashboard/local/local_settings.py
|
||||||
|
|
||||||
|
Open up the copied ``local_settings.py`` file in your preferred text
|
||||||
|
editor. You will want to customize several settings:
|
||||||
|
|
||||||
|
- ``OPENSTACK_HOST`` should be configured with the hostname of your
|
||||||
|
OpenStack server. Verify that the ``OPENSTACK_KEYSTONE_URL`` and
|
||||||
|
``OPENSTACK_KEYSTONE_DEFAULT_ROLE`` settings are correct for your
|
||||||
|
environment. (They should be correct unless you modified your
|
||||||
|
OpenStack server to change them.)
|
||||||
|
|
||||||
|
Install Meteos UI with all dependencies in your virtual environment::
|
||||||
|
|
||||||
|
tools/with_venv.sh pip install -e ../meteos-ui/
|
||||||
|
|
||||||
|
And enable it in Horizon::
|
||||||
|
|
||||||
|
cp ../meteos-ui/meteos_ui/enabled/* openstack_dashboard/local/enabled/
|
||||||
|
|
||||||
|
To run horizon with the newly enabled Meteos UI plugin run::
|
||||||
|
|
||||||
|
./run_tests.sh --runserver 0.0.0.0:8080
|
||||||
|
|
||||||
|
to have the application start on port 8080 and the horizon dashboard will be
|
||||||
|
available in your browser at http://localhost:8080/
|
||||||
|
|
||||||
|
Release Notes
|
||||||
|
=============
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:glob:
|
||||||
|
:maxdepth: 1
|
||||||
|
|
||||||
|
releases/*
|
||||||
|
|
||||||
|
Source Code Reference
|
||||||
|
=====================
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:glob:
|
||||||
|
:maxdepth: 1
|
||||||
|
|
||||||
|
sourcecode/autoindex
|
||||||
|
|
||||||
|
|
2
doc/source/releases/0.1.0.rst
Normal file
2
doc/source/releases/0.1.0.rst
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Meteos UI 0.1.0
|
||||||
|
============
|
23
manage.py
Executable file
23
manage.py
Executable file
@ -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 # noqa
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
|
||||||
|
"meteos_ui.test.settings")
|
||||||
|
execute_from_command_line(sys.argv)
|
0
meteos_ui/__init__.py
Normal file
0
meteos_ui/__init__.py
Normal file
0
meteos_ui/api/__init__.py
Normal file
0
meteos_ui/api/__init__.py
Normal file
226
meteos_ui/api/client.py
Normal file
226
meteos_ui/api/client.py
Normal file
@ -0,0 +1,226 @@
|
|||||||
|
# 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 horizon import exceptions
|
||||||
|
from horizon.utils.memoized import memoized
|
||||||
|
import logging
|
||||||
|
from openstack_dashboard.api import base
|
||||||
|
from meteosclient.api import client as meteos_client
|
||||||
|
|
||||||
|
|
||||||
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
TEMPLATE_CREATE_ATTRS = ['display_name', 'display_description', 'image_id',
|
||||||
|
'master_nodes_num', 'master_flavor_id',
|
||||||
|
'worker_nodes_num', 'worker_flavor_id',
|
||||||
|
'spark_version', 'floating_ip_pool']
|
||||||
|
EXPERIMENT_CREATE_ATTRS = ['display_name', 'display_description', 'key_name',
|
||||||
|
'neutron_management_network', 'template_id']
|
||||||
|
DATASET_CREATE_ATTRS = ['method', 'source_dataset_url', 'display_name',
|
||||||
|
'display_description', 'experiment_id', 'params',
|
||||||
|
'swift_tenant', 'swift_username', 'swift_password']
|
||||||
|
MODEL_CREATE_ATTRS = ['source_dataset_url', 'display_name',
|
||||||
|
'display_description', 'experiment_id',
|
||||||
|
'model_type', 'model_params', 'dataset_format',
|
||||||
|
'swift_tenant', 'swift_username', 'swift_password']
|
||||||
|
MODEL_EVA_CREATE_ATTRS = ['source_dataset_url', 'display_name',
|
||||||
|
'display_description', 'model_id', 'dataset_format',
|
||||||
|
'swift_tenant', 'swift_username', 'swift_password']
|
||||||
|
LEARNING_CREATE_ATTRS = ['display_name', 'display_description',
|
||||||
|
'model_id', 'method', 'args']
|
||||||
|
|
||||||
|
|
||||||
|
@memoized
|
||||||
|
def meteosclient(request):
|
||||||
|
meteos_url = ""
|
||||||
|
try:
|
||||||
|
meteos_url = base.url_for(request, 'machine-learning')
|
||||||
|
except exceptions.ServiceCatalogException:
|
||||||
|
LOG.debug('No Machine Learning service is configured.')
|
||||||
|
return None
|
||||||
|
|
||||||
|
LOG.debug('meteosclient connection created using the token "%s" and url'
|
||||||
|
'"%s"' % (request.user.token.id, meteos_url))
|
||||||
|
c = meteos_client.Client(username=request.user.username,
|
||||||
|
project_id=request.user.tenant_id,
|
||||||
|
input_auth_token=request.user.token.id,
|
||||||
|
meteos_url=meteos_url)
|
||||||
|
return c
|
||||||
|
|
||||||
|
|
||||||
|
def template_create(request, **kwargs):
|
||||||
|
args = {}
|
||||||
|
for (key, value) in kwargs.items():
|
||||||
|
if key in TEMPLATE_CREATE_ATTRS:
|
||||||
|
args[str(key)] = str(value)
|
||||||
|
else:
|
||||||
|
raise exceptions.BadRequest(
|
||||||
|
"Key must be in %s" % ",".join(TEMPLATE_CREATE_ATTRS))
|
||||||
|
return meteosclient(request).templates.create(**args)
|
||||||
|
|
||||||
|
|
||||||
|
def template_delete(request, id):
|
||||||
|
return meteosclient(request).templates.delete(id)
|
||||||
|
|
||||||
|
|
||||||
|
def template_list(request, search_opts=None, limit=None, marker=None,
|
||||||
|
sort_key=None, sort_dir=None):
|
||||||
|
return meteosclient(request).templates.list(search_opts,
|
||||||
|
limit,
|
||||||
|
marker,
|
||||||
|
sort_key,
|
||||||
|
sort_dir)
|
||||||
|
|
||||||
|
|
||||||
|
def template_show(request, id):
|
||||||
|
return meteosclient(request).templates.get(id)
|
||||||
|
|
||||||
|
|
||||||
|
def experiment_create(request, **kwargs):
|
||||||
|
args = {}
|
||||||
|
for (key, value) in kwargs.items():
|
||||||
|
if key in EXPERIMENT_CREATE_ATTRS:
|
||||||
|
args[str(key)] = str(value)
|
||||||
|
else:
|
||||||
|
raise exceptions.BadRequest(
|
||||||
|
"Key must be in %s" % ",".join(EXPERIMENT_CREATE_ATTRS))
|
||||||
|
return meteosclient(request).experiments.create(**args)
|
||||||
|
|
||||||
|
|
||||||
|
def experiment_delete(request, id):
|
||||||
|
return meteosclient(request).experiments.delete(id)
|
||||||
|
|
||||||
|
|
||||||
|
def experiment_list(request, search_opts=None, limit=None, marker=None,
|
||||||
|
sort_key=None, sort_dir=None):
|
||||||
|
return meteosclient(request).experiments.list(search_opts,
|
||||||
|
limit,
|
||||||
|
marker,
|
||||||
|
sort_key,
|
||||||
|
sort_dir)
|
||||||
|
|
||||||
|
|
||||||
|
def experiment_show(request, id):
|
||||||
|
return meteosclient(request).experiments.get(id)
|
||||||
|
|
||||||
|
|
||||||
|
def dataset_create(request, **kwargs):
|
||||||
|
args = {}
|
||||||
|
for (key, value) in kwargs.items():
|
||||||
|
if key in DATASET_CREATE_ATTRS:
|
||||||
|
args[str(key)] = str(value)
|
||||||
|
else:
|
||||||
|
raise exceptions.BadRequest(
|
||||||
|
"Key must be in %s" % ",".join(DATASET_CREATE_ATTRS))
|
||||||
|
return meteosclient(request).datasets.create(**args)
|
||||||
|
|
||||||
|
|
||||||
|
def dataset_delete(request, id):
|
||||||
|
return meteosclient(request).datasets.delete(id)
|
||||||
|
|
||||||
|
|
||||||
|
def dataset_list(request, search_opts=None, limit=None, marker=None,
|
||||||
|
sort_key=None, sort_dir=None):
|
||||||
|
return meteosclient(request).datasets.list(search_opts,
|
||||||
|
limit,
|
||||||
|
marker,
|
||||||
|
sort_key,
|
||||||
|
sort_dir)
|
||||||
|
|
||||||
|
|
||||||
|
def dataset_show(request, id):
|
||||||
|
return meteosclient(request).datasets.get(id)
|
||||||
|
|
||||||
|
|
||||||
|
def model_create(request, **kwargs):
|
||||||
|
args = {}
|
||||||
|
for (key, value) in kwargs.items():
|
||||||
|
if key in MODEL_CREATE_ATTRS:
|
||||||
|
args[str(key)] = str(value)
|
||||||
|
else:
|
||||||
|
raise exceptions.BadRequest(
|
||||||
|
"Key must be in %s" % ",".join(MODEL_CREATE_ATTRS))
|
||||||
|
return meteosclient(request).models.create(**args)
|
||||||
|
|
||||||
|
|
||||||
|
def model_delete(request, id):
|
||||||
|
return meteosclient(request).models.delete(id)
|
||||||
|
|
||||||
|
|
||||||
|
def model_list(request, search_opts=None, limit=None, marker=None,
|
||||||
|
sort_key=None, sort_dir=None):
|
||||||
|
return meteosclient(request).models.list(search_opts,
|
||||||
|
limit,
|
||||||
|
marker,
|
||||||
|
sort_key,
|
||||||
|
sort_dir)
|
||||||
|
|
||||||
|
|
||||||
|
def model_show(request, id):
|
||||||
|
return meteosclient(request).models.get(id)
|
||||||
|
|
||||||
|
|
||||||
|
def model_evaluation_create(request, **kwargs):
|
||||||
|
args = {}
|
||||||
|
for (key, value) in kwargs.items():
|
||||||
|
if key in MODEL_EVA_CREATE_ATTRS:
|
||||||
|
args[str(key)] = str(value)
|
||||||
|
else:
|
||||||
|
raise exceptions.BadRequest(
|
||||||
|
"Key must be in %s" % ",".join(MODEL_EVA_CREATE_ATTRS))
|
||||||
|
return meteosclient(request).model_evaluations.create(**args)
|
||||||
|
|
||||||
|
|
||||||
|
def model_evaluation_delete(request, id):
|
||||||
|
return meteosclient(request).model_evaluations.delete(id)
|
||||||
|
|
||||||
|
|
||||||
|
def model_evaluation_list(request, search_opts=None, limit=None, marker=None,
|
||||||
|
sort_key=None, sort_dir=None):
|
||||||
|
return meteosclient(request).model_evaluations.list(search_opts,
|
||||||
|
limit,
|
||||||
|
marker,
|
||||||
|
sort_key,
|
||||||
|
sort_dir)
|
||||||
|
|
||||||
|
|
||||||
|
def model_evaluation_show(request, id):
|
||||||
|
return meteosclient(request).model_evaluations.get(id)
|
||||||
|
|
||||||
|
|
||||||
|
def learning_create(request, **kwargs):
|
||||||
|
args = {}
|
||||||
|
for (key, value) in kwargs.items():
|
||||||
|
if key in LEARNING_CREATE_ATTRS:
|
||||||
|
args[str(key)] = str(value)
|
||||||
|
else:
|
||||||
|
raise exceptions.BadRequest(
|
||||||
|
"Key must be in %s" % ",".join(LEARNING_CREATE_ATTRS))
|
||||||
|
return meteosclient(request).learnings.create(**args)
|
||||||
|
|
||||||
|
|
||||||
|
def learning_delete(request, id):
|
||||||
|
return meteosclient(request).learnings.delete(id)
|
||||||
|
|
||||||
|
|
||||||
|
def learning_list(request, search_opts=None, limit=None, marker=None,
|
||||||
|
sort_key=None, sort_dir=None):
|
||||||
|
return meteosclient(request).learnings.list(search_opts,
|
||||||
|
limit,
|
||||||
|
marker,
|
||||||
|
sort_key,
|
||||||
|
sort_dir)
|
||||||
|
|
||||||
|
|
||||||
|
def learning_show(request, id):
|
||||||
|
return meteosclient(request).learnings.get(id)
|
337
meteos_ui/api/rest_api.py
Normal file
337
meteos_ui/api/rest_api.py
Normal file
@ -0,0 +1,337 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
from meteos_ui.api import client
|
||||||
|
|
||||||
|
from openstack_dashboard.api.rest import urls
|
||||||
|
from openstack_dashboard.api.rest import utils as rest_utils
|
||||||
|
|
||||||
|
|
||||||
|
@urls.register
|
||||||
|
class Template(generic.View):
|
||||||
|
"""API for retrieving a single template"""
|
||||||
|
url_regex = r'meteos/templates/(?P<id>[^/]+)$'
|
||||||
|
|
||||||
|
@rest_utils.ajax()
|
||||||
|
def get(self, request, id):
|
||||||
|
"""Get a specific template"""
|
||||||
|
return change_to_id(client.template_show(request, id).to_dict())
|
||||||
|
|
||||||
|
|
||||||
|
@urls.register
|
||||||
|
class TemplateActions(generic.View):
|
||||||
|
"""API for retrieving a single template"""
|
||||||
|
url_regex = r'meteos/templates/(?P<id>[^/]+)/(?P<action>[^/]+)$'
|
||||||
|
|
||||||
|
|
||||||
|
@urls.register
|
||||||
|
class Templates(generic.View):
|
||||||
|
"""API for Meteos Templates"""
|
||||||
|
url_regex = r'meteos/templates/$'
|
||||||
|
|
||||||
|
@rest_utils.ajax()
|
||||||
|
def get(self, request):
|
||||||
|
"""Get a list of the Templates for a project.
|
||||||
|
|
||||||
|
The returned result is an object with property 'items' and each
|
||||||
|
item under this is a Template.
|
||||||
|
"""
|
||||||
|
result = client.template_list(request)
|
||||||
|
return {'items': [n.to_dict() for n in result]}
|
||||||
|
|
||||||
|
@rest_utils.ajax(data_required=True)
|
||||||
|
def delete(self, request):
|
||||||
|
"""Delete one or more Templates by id.
|
||||||
|
|
||||||
|
Returns HTTP 204 (no content) on successful deletion.
|
||||||
|
"""
|
||||||
|
for id in request.DATA:
|
||||||
|
client.template_delete(request, id)
|
||||||
|
|
||||||
|
@rest_utils.ajax(data_required=True)
|
||||||
|
def post(self, request):
|
||||||
|
"""Create a new Template.
|
||||||
|
|
||||||
|
Returns the new Template object on success.
|
||||||
|
"""
|
||||||
|
new_template = client.template_create(request, **request.DATA)
|
||||||
|
return rest_utils.CreatedResponse(
|
||||||
|
'/api/meteos/template/%s' % new_template.id,
|
||||||
|
new_template.to_dict())
|
||||||
|
|
||||||
|
|
||||||
|
@urls.register
|
||||||
|
class Experiment(generic.View):
|
||||||
|
"""API for retrieving a single experiment"""
|
||||||
|
url_regex = r'meteos/experiments/(?P<id>[^/]+)$'
|
||||||
|
|
||||||
|
@rest_utils.ajax()
|
||||||
|
def get(self, request, id):
|
||||||
|
"""Get a specific experiment"""
|
||||||
|
return change_to_id(client.experiment_show(request, id).to_dict())
|
||||||
|
|
||||||
|
|
||||||
|
@urls.register
|
||||||
|
class ExperimentActions(generic.View):
|
||||||
|
"""API for retrieving a single experiment"""
|
||||||
|
url_regex = r'meteos/experiments/(?P<id>[^/]+)/(?P<action>[^/]+)$'
|
||||||
|
|
||||||
|
|
||||||
|
@urls.register
|
||||||
|
class Experiments(generic.View):
|
||||||
|
"""API for Meteos Experiments"""
|
||||||
|
url_regex = r'meteos/experiments/$'
|
||||||
|
|
||||||
|
@rest_utils.ajax()
|
||||||
|
def get(self, request):
|
||||||
|
"""Get a list of the Experiments for a project.
|
||||||
|
|
||||||
|
The returned result is an object with property 'items' and each
|
||||||
|
item under this is a Experiment.
|
||||||
|
"""
|
||||||
|
result = client.experiment_list(request)
|
||||||
|
return {'items': [n.to_dict() for n in result]}
|
||||||
|
|
||||||
|
@rest_utils.ajax(data_required=True)
|
||||||
|
def delete(self, request):
|
||||||
|
"""Delete one or more Experiments by id.
|
||||||
|
|
||||||
|
Returns HTTP 204 (no content) on successful deletion.
|
||||||
|
"""
|
||||||
|
for id in request.DATA:
|
||||||
|
client.experiment_delete(request, id)
|
||||||
|
|
||||||
|
@rest_utils.ajax(data_required=True)
|
||||||
|
def post(self, request):
|
||||||
|
"""Create a new Experiment.
|
||||||
|
|
||||||
|
Returns the new Experiment object on success.
|
||||||
|
"""
|
||||||
|
new_experiment = client.experiment_create(request, **request.DATA)
|
||||||
|
return rest_utils.CreatedResponse(
|
||||||
|
'/api/meteos/experiment/%s' % new_experiment.id,
|
||||||
|
new_experiment.to_dict())
|
||||||
|
|
||||||
|
|
||||||
|
@urls.register
|
||||||
|
class Dataset(generic.View):
|
||||||
|
"""API for retrieving a single dataset"""
|
||||||
|
url_regex = r'meteos/datasets/(?P<id>[^/]+)$'
|
||||||
|
|
||||||
|
@rest_utils.ajax()
|
||||||
|
def get(self, request, id):
|
||||||
|
"""Get a specific dataset"""
|
||||||
|
return change_to_id(client.dataset_show(request, id).to_dict())
|
||||||
|
|
||||||
|
|
||||||
|
@urls.register
|
||||||
|
class DatasetActions(generic.View):
|
||||||
|
"""API for retrieving a single dataset"""
|
||||||
|
url_regex = r'meteos/datasets/(?P<id>[^/]+)/(?P<action>[^/]+)$'
|
||||||
|
|
||||||
|
|
||||||
|
@urls.register
|
||||||
|
class Datasets(generic.View):
|
||||||
|
"""API for Meteos Datasets"""
|
||||||
|
url_regex = r'meteos/datasets/$'
|
||||||
|
|
||||||
|
@rest_utils.ajax()
|
||||||
|
def get(self, request):
|
||||||
|
"""Get a list of the Datasets for a project.
|
||||||
|
|
||||||
|
The returned result is an object with property 'items' and each
|
||||||
|
item under this is a Dataset.
|
||||||
|
"""
|
||||||
|
result = client.dataset_list(request)
|
||||||
|
return {'items': [n.to_dict() for n in result]}
|
||||||
|
|
||||||
|
@rest_utils.ajax(data_required=True)
|
||||||
|
def delete(self, request):
|
||||||
|
"""Delete one or more Datasets by id.
|
||||||
|
|
||||||
|
Returns HTTP 204 (no content) on successful deletion.
|
||||||
|
"""
|
||||||
|
for id in request.DATA:
|
||||||
|
client.dataset_delete(request, id)
|
||||||
|
|
||||||
|
@rest_utils.ajax(data_required=True)
|
||||||
|
def post(self, request):
|
||||||
|
"""Create a new Dataset.
|
||||||
|
|
||||||
|
Returns the new Dataset object on success.
|
||||||
|
"""
|
||||||
|
new_dataset = client.dataset_create(request, **request.DATA)
|
||||||
|
return rest_utils.CreatedResponse(
|
||||||
|
'/api/meteos/dataset/%s' % new_dataset.id,
|
||||||
|
new_dataset.to_dict())
|
||||||
|
|
||||||
|
|
||||||
|
@urls.register
|
||||||
|
class Model(generic.View):
|
||||||
|
"""API for retrieving a single model"""
|
||||||
|
url_regex = r'meteos/models/(?P<id>[^/]+)$'
|
||||||
|
|
||||||
|
@rest_utils.ajax()
|
||||||
|
def get(self, request, id):
|
||||||
|
"""Get a specific model"""
|
||||||
|
return change_to_id(client.model_show(request, id).to_dict())
|
||||||
|
|
||||||
|
|
||||||
|
@urls.register
|
||||||
|
class ModelActions(generic.View):
|
||||||
|
"""API for retrieving a single model"""
|
||||||
|
url_regex = r'meteos/models/(?P<id>[^/]+)/(?P<action>[^/]+)$'
|
||||||
|
|
||||||
|
|
||||||
|
@urls.register
|
||||||
|
class Models(generic.View):
|
||||||
|
"""API for Meteos Models"""
|
||||||
|
url_regex = r'meteos/models/$'
|
||||||
|
|
||||||
|
@rest_utils.ajax()
|
||||||
|
def get(self, request):
|
||||||
|
"""Get a list of the Models for a project.
|
||||||
|
|
||||||
|
The returned result is an object with property 'items' and each
|
||||||
|
item under this is a Model.
|
||||||
|
"""
|
||||||
|
result = client.model_list(request)
|
||||||
|
return {'items': [n.to_dict() for n in result]}
|
||||||
|
|
||||||
|
@rest_utils.ajax(data_required=True)
|
||||||
|
def delete(self, request):
|
||||||
|
"""Delete one or more Models by id.
|
||||||
|
|
||||||
|
Returns HTTP 204 (no content) on successful deletion.
|
||||||
|
"""
|
||||||
|
for id in request.DATA:
|
||||||
|
client.model_delete(request, id)
|
||||||
|
|
||||||
|
@rest_utils.ajax(data_required=True)
|
||||||
|
def post(self, request):
|
||||||
|
"""Create a new Model.
|
||||||
|
|
||||||
|
Returns the new Model object on success.
|
||||||
|
"""
|
||||||
|
new_model = client.model_create(request, **request.DATA)
|
||||||
|
return rest_utils.CreatedResponse(
|
||||||
|
'/api/meteos/model/%s' % new_model.id,
|
||||||
|
new_model.to_dict())
|
||||||
|
|
||||||
|
|
||||||
|
@urls.register
|
||||||
|
class ModelEvaluation(generic.View):
|
||||||
|
"""API for retrieving a single model_evaluation"""
|
||||||
|
url_regex = r'meteos/model_evaluations/(?P<id>[^/]+)$'
|
||||||
|
|
||||||
|
@rest_utils.ajax()
|
||||||
|
def get(self, request, id):
|
||||||
|
"""Get a specific model_evaluation"""
|
||||||
|
return change_to_id(client.model_evaluation_show(request, id).to_dict())
|
||||||
|
|
||||||
|
|
||||||
|
@urls.register
|
||||||
|
class ModelEvaluationActions(generic.View):
|
||||||
|
"""API for retrieving a single model_evaluation"""
|
||||||
|
url_regex = r'meteos/model_evaluations/(?P<id>[^/]+)/(?P<action>[^/]+)$'
|
||||||
|
|
||||||
|
|
||||||
|
@urls.register
|
||||||
|
class ModelEvaluations(generic.View):
|
||||||
|
"""API for Meteos ModelEvaluations"""
|
||||||
|
url_regex = r'meteos/model_evaluations/$'
|
||||||
|
|
||||||
|
@rest_utils.ajax()
|
||||||
|
def get(self, request):
|
||||||
|
"""Get a list of the ModelEvaluations for a project.
|
||||||
|
|
||||||
|
The returned result is an object with property 'items' and each
|
||||||
|
item under this is a ModelEvaluation.
|
||||||
|
"""
|
||||||
|
result = client.model_evaluation_list(request)
|
||||||
|
return {'items': [n.to_dict() for n in result]}
|
||||||
|
|
||||||
|
@rest_utils.ajax(data_required=True)
|
||||||
|
def delete(self, request):
|
||||||
|
"""Delete one or more ModelEvaluations by id.
|
||||||
|
|
||||||
|
Returns HTTP 204 (no content) on successful deletion.
|
||||||
|
"""
|
||||||
|
for id in request.DATA:
|
||||||
|
client.model_evaluation_delete(request, id)
|
||||||
|
|
||||||
|
@rest_utils.ajax(data_required=True)
|
||||||
|
def post(self, request):
|
||||||
|
"""Create a new ModelEvaluation.
|
||||||
|
|
||||||
|
Returns the new ModelEvaluation object on success.
|
||||||
|
"""
|
||||||
|
new_model_evaluation = client.model_evaluation_create(request,
|
||||||
|
**request.DATA)
|
||||||
|
return rest_utils.CreatedResponse(
|
||||||
|
'/api/meteos/model_evaluation/%s' % new_model_evaluation.id,
|
||||||
|
new_model_evaluation.to_dict())
|
||||||
|
|
||||||
|
|
||||||
|
@urls.register
|
||||||
|
class Learning(generic.View):
|
||||||
|
"""API for retrieving a single learning"""
|
||||||
|
url_regex = r'meteos/learnings/(?P<id>[^/]+)$'
|
||||||
|
|
||||||
|
@rest_utils.ajax()
|
||||||
|
def get(self, request, id):
|
||||||
|
"""Get a specific learning"""
|
||||||
|
return change_to_id(client.learning_show(request, id).to_dict())
|
||||||
|
|
||||||
|
|
||||||
|
@urls.register
|
||||||
|
class LearningActions(generic.View):
|
||||||
|
"""API for retrieving a single learning"""
|
||||||
|
url_regex = r'meteos/learnings/(?P<id>[^/]+)/(?P<action>[^/]+)$'
|
||||||
|
|
||||||
|
|
||||||
|
@urls.register
|
||||||
|
class Learnings(generic.View):
|
||||||
|
"""API for Meteos Learnings"""
|
||||||
|
url_regex = r'meteos/learnings/$'
|
||||||
|
|
||||||
|
@rest_utils.ajax()
|
||||||
|
def get(self, request):
|
||||||
|
"""Get a list of the Learnings for a project.
|
||||||
|
|
||||||
|
The returned result is an object with property 'items' and each
|
||||||
|
item under this is a Learning.
|
||||||
|
"""
|
||||||
|
result = client.learning_list(request)
|
||||||
|
return {'items': [n.to_dict() for n in result]}
|
||||||
|
|
||||||
|
@rest_utils.ajax(data_required=True)
|
||||||
|
def delete(self, request):
|
||||||
|
"""Delete one or more Learnings by id.
|
||||||
|
|
||||||
|
Returns HTTP 204 (no content) on successful deletion.
|
||||||
|
"""
|
||||||
|
for id in request.DATA:
|
||||||
|
client.learning_delete(request, id)
|
||||||
|
|
||||||
|
@rest_utils.ajax(data_required=True)
|
||||||
|
def post(self, request):
|
||||||
|
"""Create a new Learning.
|
||||||
|
|
||||||
|
Returns the new Learning object on success.
|
||||||
|
"""
|
||||||
|
new_learning = client.learning_create(request, **request.DATA)
|
||||||
|
return rest_utils.CreatedResponse(
|
||||||
|
'/api/meteos/learning/%s' % new_learning.id,
|
||||||
|
new_learning.to_dict())
|
0
meteos_ui/content/__init__.py
Normal file
0
meteos_ui/content/__init__.py
Normal file
14
meteos_ui/content/machine_learning/__init__.py
Normal file
14
meteos_ui/content/machine_learning/__init__.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
# Register the REST API URLs so they can be called from the JavaScript files
|
||||||
|
import meteos_ui.api.rest_api # noqa
|
23
meteos_ui/content/machine_learning/datasets/panel.py
Normal file
23
meteos_ui/content/machine_learning/datasets/panel.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
# This panel will be loaded from horizon, because specified in enabled file.
|
||||||
|
# To register REST api, import below here.
|
||||||
|
from meteos_ui.api import rest_api # noqa
|
||||||
|
|
||||||
|
|
||||||
|
class Datasets(horizon.Panel):
|
||||||
|
name = _("Datasets")
|
||||||
|
slug = "machine_learning.datasets"
|
19
meteos_ui/content/machine_learning/datasets/tests.py
Normal file
19
meteos_ui/content/machine_learning/datasets/tests.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# 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 openstack_dashboard.test import helpers as test
|
||||||
|
|
||||||
|
|
||||||
|
class DatasetTests(test.TestCase):
|
||||||
|
# Unit tests for Dataset.
|
||||||
|
def test_me(self):
|
||||||
|
self.assertTrue(1 + 1 == 2)
|
20
meteos_ui/content/machine_learning/datasets/urls.py
Normal file
20
meteos_ui/content/machine_learning/datasets/urls.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# 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 url
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from horizon.browsers import views
|
||||||
|
|
||||||
|
title = _("Datasets")
|
||||||
|
urlpatterns = [
|
||||||
|
url('', views.AngularIndexView.as_view(title=title), name='index'),
|
||||||
|
]
|
23
meteos_ui/content/machine_learning/experiments/panel.py
Normal file
23
meteos_ui/content/machine_learning/experiments/panel.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
# This panel will be loaded from horizon, because specified in enabled file.
|
||||||
|
# To register REST api, import below here.
|
||||||
|
from meteos_ui.api import rest_api # noqa
|
||||||
|
|
||||||
|
|
||||||
|
class Experiments(horizon.Panel):
|
||||||
|
name = _("Experiments")
|
||||||
|
slug = "machine_learning.experiments"
|
19
meteos_ui/content/machine_learning/experiments/tests.py
Normal file
19
meteos_ui/content/machine_learning/experiments/tests.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# 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 openstack_dashboard.test import helpers as test
|
||||||
|
|
||||||
|
|
||||||
|
class ExperimentTests(test.TestCase):
|
||||||
|
# Unit tests for Experiment.
|
||||||
|
def test_me(self):
|
||||||
|
self.assertTrue(1 + 1 == 2)
|
20
meteos_ui/content/machine_learning/experiments/urls.py
Normal file
20
meteos_ui/content/machine_learning/experiments/urls.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# 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 url
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from horizon.browsers import views
|
||||||
|
|
||||||
|
title = _("Experiments")
|
||||||
|
urlpatterns = [
|
||||||
|
url('', views.AngularIndexView.as_view(title=title), name='index'),
|
||||||
|
]
|
23
meteos_ui/content/machine_learning/learnings/panel.py
Normal file
23
meteos_ui/content/machine_learning/learnings/panel.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
# This panel will be loaded from horizon, because specified in enabled file.
|
||||||
|
# To register REST api, import below here.
|
||||||
|
from meteos_ui.api import rest_api # noqa
|
||||||
|
|
||||||
|
|
||||||
|
class Learnings(horizon.Panel):
|
||||||
|
name = _("Learnings")
|
||||||
|
slug = "machine_learning.learnings"
|
19
meteos_ui/content/machine_learning/learnings/tests.py
Normal file
19
meteos_ui/content/machine_learning/learnings/tests.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# 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 openstack_dashboard.test import helpers as test
|
||||||
|
|
||||||
|
|
||||||
|
class LearningTests(test.TestCase):
|
||||||
|
# Unit tests for Learning.
|
||||||
|
def test_me(self):
|
||||||
|
self.assertTrue(1 + 1 == 2)
|
20
meteos_ui/content/machine_learning/learnings/urls.py
Normal file
20
meteos_ui/content/machine_learning/learnings/urls.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# 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 url
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from horizon.browsers import views
|
||||||
|
|
||||||
|
title = _("Learnings")
|
||||||
|
urlpatterns = [
|
||||||
|
url('', views.AngularIndexView.as_view(title=title), name='index'),
|
||||||
|
]
|
@ -0,0 +1,23 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
# This panel will be loaded from horizon, because specified in enabled file.
|
||||||
|
# To register REST api, import below here.
|
||||||
|
from meteos_ui.api import rest_api # noqa
|
||||||
|
|
||||||
|
|
||||||
|
class ModelEvaluations(horizon.Panel):
|
||||||
|
name = _("ModelEvaluations")
|
||||||
|
slug = "machine_learning.model_evaluations"
|
@ -0,0 +1,19 @@
|
|||||||
|
# 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 openstack_dashboard.test import helpers as test
|
||||||
|
|
||||||
|
|
||||||
|
class ModelEvaluationTests(test.TestCase):
|
||||||
|
# Unit tests for ModelEvaluation.
|
||||||
|
def test_me(self):
|
||||||
|
self.assertTrue(1 + 1 == 2)
|
20
meteos_ui/content/machine_learning/model_evaluations/urls.py
Normal file
20
meteos_ui/content/machine_learning/model_evaluations/urls.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# 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 url
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from horizon.browsers import views
|
||||||
|
|
||||||
|
title = _("ModelEvaluations")
|
||||||
|
urlpatterns = [
|
||||||
|
url('', views.AngularIndexView.as_view(title=title), name='index'),
|
||||||
|
]
|
23
meteos_ui/content/machine_learning/models/panel.py
Normal file
23
meteos_ui/content/machine_learning/models/panel.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
# This panel will be loaded from horizon, because specified in enabled file.
|
||||||
|
# To register REST api, import below here.
|
||||||
|
from meteos_ui.api import rest_api # noqa
|
||||||
|
|
||||||
|
|
||||||
|
class Models(horizon.Panel):
|
||||||
|
name = _("Models")
|
||||||
|
slug = "machine_learning.models"
|
19
meteos_ui/content/machine_learning/models/tests.py
Normal file
19
meteos_ui/content/machine_learning/models/tests.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# 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 openstack_dashboard.test import helpers as test
|
||||||
|
|
||||||
|
|
||||||
|
class ModelTests(test.TestCase):
|
||||||
|
# Unit tests for Model.
|
||||||
|
def test_me(self):
|
||||||
|
self.assertTrue(1 + 1 == 2)
|
20
meteos_ui/content/machine_learning/models/urls.py
Normal file
20
meteos_ui/content/machine_learning/models/urls.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# 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 url
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from horizon.browsers import views
|
||||||
|
|
||||||
|
title = _("Models")
|
||||||
|
urlpatterns = [
|
||||||
|
url('', views.AngularIndexView.as_view(title=title), name='index'),
|
||||||
|
]
|
23
meteos_ui/content/machine_learning/templates/panel.py
Normal file
23
meteos_ui/content/machine_learning/templates/panel.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
# This panel will be loaded from horizon, because specified in enabled file.
|
||||||
|
# To register REST api, import below here.
|
||||||
|
from meteos_ui.api import rest_api # noqa
|
||||||
|
|
||||||
|
|
||||||
|
class Templates(horizon.Panel):
|
||||||
|
name = _("Templates")
|
||||||
|
slug = "machine_learning.templates"
|
19
meteos_ui/content/machine_learning/templates/tests.py
Normal file
19
meteos_ui/content/machine_learning/templates/tests.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# 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 openstack_dashboard.test import helpers as test
|
||||||
|
|
||||||
|
|
||||||
|
class TemplateTests(test.TestCase):
|
||||||
|
# Unit tests for Template.
|
||||||
|
def test_me(self):
|
||||||
|
self.assertTrue(1 + 1 == 2)
|
20
meteos_ui/content/machine_learning/templates/urls.py
Normal file
20
meteos_ui/content/machine_learning/templates/urls.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# 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 url
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from horizon.browsers import views
|
||||||
|
|
||||||
|
title = _("Templates")
|
||||||
|
urlpatterns = [
|
||||||
|
url('', views.AngularIndexView.as_view(title=title), name='index'),
|
||||||
|
]
|
36
meteos_ui/enabled/_1710_machine_learning_panel_group.py
Normal file
36
meteos_ui/enabled/_1710_machine_learning_panel_group.py
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# 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 _
|
||||||
|
|
||||||
|
# The slug of the panel group to be added to HORIZON_CONFIG. Required.
|
||||||
|
PANEL_GROUP = 'machine_learning'
|
||||||
|
# The display name of the PANEL_GROUP. Required.
|
||||||
|
PANEL_GROUP_NAME = _('Machine Learning')
|
||||||
|
# The slug of the dashboard the PANEL_GROUP associated with. Required.
|
||||||
|
PANEL_GROUP_DASHBOARD = 'project'
|
||||||
|
|
||||||
|
ADD_INSTALLED_APPS = ['meteos_ui']
|
||||||
|
|
||||||
|
ADD_ANGULAR_MODULES = [
|
||||||
|
'horizon.dashboard.machine_learning'
|
||||||
|
]
|
||||||
|
|
||||||
|
ADD_JS_FILES = [
|
||||||
|
'horizon/lib/angular/angular-route.js'
|
||||||
|
]
|
||||||
|
|
||||||
|
ADD_SCSS_FILES = [
|
||||||
|
'dashboard/machine_learning/machine_learning.scss'
|
||||||
|
]
|
||||||
|
|
||||||
|
AUTO_DISCOVER_STATIC_FILES = True
|
21
meteos_ui/enabled/_1720_machine_learning_templates_panel.py
Normal file
21
meteos_ui/enabled/_1720_machine_learning_templates_panel.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# 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 = 'machine_learning.templates'
|
||||||
|
# The slug of the panel group the PANEL is associated with.
|
||||||
|
PANEL_GROUP = 'machine_learning'
|
||||||
|
# The slug of the dashboard the PANEL associated with. Required.
|
||||||
|
PANEL_DASHBOARD = 'project'
|
||||||
|
|
||||||
|
# Python panel class of the PANEL to be added.
|
||||||
|
ADD_PANEL = 'meteos_ui.content.machine_learning.templates.panel.Templates'
|
@ -0,0 +1,21 @@
|
|||||||
|
# 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 = 'machine_learning.experiments'
|
||||||
|
# The slug of the panel group the PANEL is associated with.
|
||||||
|
PANEL_GROUP = 'machine_learning'
|
||||||
|
# The slug of the dashboard the PANEL associated with. Required.
|
||||||
|
PANEL_DASHBOARD = 'project'
|
||||||
|
|
||||||
|
# Python panel class of the PANEL to be added.
|
||||||
|
ADD_PANEL = 'meteos_ui.content.machine_learning.experiments.panel.Experiments'
|
21
meteos_ui/enabled/_1740_machine_learning_datasets_panel.py
Normal file
21
meteos_ui/enabled/_1740_machine_learning_datasets_panel.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# 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 = 'machine_learning.datasets'
|
||||||
|
# The slug of the panel group the PANEL is associated with.
|
||||||
|
PANEL_GROUP = 'machine_learning'
|
||||||
|
# The slug of the dashboard the PANEL associated with. Required.
|
||||||
|
PANEL_DASHBOARD = 'project'
|
||||||
|
|
||||||
|
# Python panel class of the PANEL to be added.
|
||||||
|
ADD_PANEL = 'meteos_ui.content.machine_learning.datasets.panel.Datasets'
|
21
meteos_ui/enabled/_1750_machine_learning_models_panel.py
Normal file
21
meteos_ui/enabled/_1750_machine_learning_models_panel.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# 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 = 'machine_learning.models'
|
||||||
|
# The slug of the panel group the PANEL is associated with.
|
||||||
|
PANEL_GROUP = 'machine_learning'
|
||||||
|
# The slug of the dashboard the PANEL associated with. Required.
|
||||||
|
PANEL_DASHBOARD = 'project'
|
||||||
|
|
||||||
|
# Python panel class of the PANEL to be added.
|
||||||
|
ADD_PANEL = 'meteos_ui.content.machine_learning.models.panel.Models'
|
@ -0,0 +1,21 @@
|
|||||||
|
# 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 = 'machine_learning.model_evaluations'
|
||||||
|
# The slug of the panel group the PANEL is associated with.
|
||||||
|
PANEL_GROUP = 'machine_learning'
|
||||||
|
# The slug of the dashboard the PANEL associated with. Required.
|
||||||
|
PANEL_DASHBOARD = 'project'
|
||||||
|
|
||||||
|
# Python panel class of the PANEL to be added.
|
||||||
|
ADD_PANEL = 'meteos_ui.content.machine_learning.model_evaluations.panel.ModelEvaluations'
|
21
meteos_ui/enabled/_1770_machine_learning_learnings_panel.py
Normal file
21
meteos_ui/enabled/_1770_machine_learning_learnings_panel.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# 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 = 'machine_learning.learnings'
|
||||||
|
# The slug of the panel group the PANEL is associated with.
|
||||||
|
PANEL_GROUP = 'machine_learning'
|
||||||
|
# The slug of the dashboard the PANEL associated with. Required.
|
||||||
|
PANEL_DASHBOARD = 'project'
|
||||||
|
|
||||||
|
# Python panel class of the PANEL to be added.
|
||||||
|
ADD_PANEL = 'meteos_ui.content.machine_learning.learnings.panel.Learnings'
|
0
meteos_ui/enabled/__init__.py
Normal file
0
meteos_ui/enabled/__init__.py
Normal file
154
meteos_ui/karma.conf.js
Normal file
154
meteos_ui/karma.conf.js
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var fs = require('fs');
|
||||||
|
var path = require('path');
|
||||||
|
|
||||||
|
module.exports = function (config) {
|
||||||
|
// This tox venv is setup in the post-install npm step
|
||||||
|
var toxPath = '../.tox/py27/lib/python2.7/site-packages/';
|
||||||
|
|
||||||
|
config.set({
|
||||||
|
preprocessors: {
|
||||||
|
// Used to collect templates for preprocessing.
|
||||||
|
// NOTE: the templates must also be listed in the files section below.
|
||||||
|
'./static/**/*.html': ['ng-html2js'],
|
||||||
|
// Used to indicate files requiring coverage reports.
|
||||||
|
'./static/**/!(*.spec).js': ['coverage'],
|
||||||
|
},
|
||||||
|
|
||||||
|
// Sets up module to process templates.
|
||||||
|
ngHtml2JsPreprocessor: {
|
||||||
|
prependPrefix: '/',
|
||||||
|
moduleName: 'templates'
|
||||||
|
},
|
||||||
|
|
||||||
|
basePath: './',
|
||||||
|
|
||||||
|
// Contains both source and test files.
|
||||||
|
files: [
|
||||||
|
/*
|
||||||
|
* shim, partly stolen from /i18n/js/horizon/
|
||||||
|
* Contains expected items not provided elsewhere (dynamically by
|
||||||
|
* Django or via jasmine template.
|
||||||
|
*/
|
||||||
|
'../test-shim.js',
|
||||||
|
|
||||||
|
// from jasmine.html
|
||||||
|
toxPath + 'xstatic/pkg/jquery/data/jquery.js',
|
||||||
|
toxPath + 'xstatic/pkg/angular/data/angular.js',
|
||||||
|
toxPath + 'xstatic/pkg/angular/data/angular-route.js',
|
||||||
|
toxPath + 'xstatic/pkg/angular/data/angular-mocks.js',
|
||||||
|
toxPath + 'xstatic/pkg/angular/data/angular-cookies.js',
|
||||||
|
toxPath + 'xstatic/pkg/angular_bootstrap/data/angular-bootstrap.js',
|
||||||
|
toxPath + 'xstatic/pkg/angular_gettext/data/angular-gettext.js',
|
||||||
|
toxPath + 'xstatic/pkg/angular_fileupload/data/ng-file-upload-all.js',
|
||||||
|
toxPath + 'xstatic/pkg/angular/data/angular-sanitize.js',
|
||||||
|
toxPath + 'xstatic/pkg/d3/data/d3.js',
|
||||||
|
toxPath + 'xstatic/pkg/rickshaw/data/rickshaw.js',
|
||||||
|
toxPath + 'xstatic/pkg/angular_smart_table/data/smart-table.js',
|
||||||
|
toxPath + 'xstatic/pkg/angular_lrdragndrop/data/lrdragndrop.js',
|
||||||
|
toxPath + 'xstatic/pkg/spin/data/spin.js',
|
||||||
|
toxPath + 'xstatic/pkg/spin/data/spin.jquery.js',
|
||||||
|
toxPath + 'xstatic/pkg/tv4/data/tv4.js',
|
||||||
|
toxPath + 'xstatic/pkg/objectpath/data/ObjectPath.js',
|
||||||
|
toxPath + 'xstatic/pkg/angular_schema_form/data/schema-form.js',
|
||||||
|
|
||||||
|
// TODO: These should be mocked.
|
||||||
|
toxPath + '/horizon/static/horizon/js/horizon.js',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Include framework source code from horizon that we need.
|
||||||
|
* Otherwise, karma will not be able to find them when testing.
|
||||||
|
* These files should be mocked in the foreseeable future.
|
||||||
|
*/
|
||||||
|
toxPath + 'horizon/static/framework/**/*.module.js',
|
||||||
|
toxPath + 'horizon/static/framework/**/!(*.spec|*.mock).js',
|
||||||
|
toxPath + 'openstack_dashboard/static/**/*.module.js',
|
||||||
|
toxPath + 'openstack_dashboard/static/**/!(*.spec|*.mock).js',
|
||||||
|
toxPath + 'openstack_dashboard/dashboards/**/static/**/*.module.js',
|
||||||
|
toxPath + 'openstack_dashboard/dashboards/**/static/**/!(*.spec|*.mock).js',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* First, list all the files that defines application's angular modules.
|
||||||
|
* Those files have extension of `.module.js`. The order among them is
|
||||||
|
* not significant.
|
||||||
|
*/
|
||||||
|
'./static/**/*.module.js',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Followed by other JavaScript files that defines angular providers
|
||||||
|
* on the modules defined in files listed above. And they are not mock
|
||||||
|
* files or spec files defined below. The order among them is not
|
||||||
|
* significant.
|
||||||
|
*/
|
||||||
|
'./static/**/!(*.spec|*.mock).js',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Then, list files for mocks with `mock.js` extension. The order
|
||||||
|
* among them should not be significant.
|
||||||
|
*/
|
||||||
|
toxPath + 'openstack_dashboard/static/**/*.mock.js',
|
||||||
|
//'./static/**/*.mock.js',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finally, list files for spec with `spec.js` extension. The order
|
||||||
|
* among them should not be significant.
|
||||||
|
*/
|
||||||
|
'./static/**/*.spec.js',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Angular external templates
|
||||||
|
*/
|
||||||
|
'./static/**/*.html'
|
||||||
|
],
|
||||||
|
|
||||||
|
autoWatch: true,
|
||||||
|
|
||||||
|
frameworks: ['jasmine'],
|
||||||
|
|
||||||
|
browsers: ['Chrome'],
|
||||||
|
|
||||||
|
phantomjsLauncher: {
|
||||||
|
// Have phantomjs exit if a ResourceError is encountered
|
||||||
|
// (useful if karma exits without killing phantom)
|
||||||
|
exitOnResourceError: true
|
||||||
|
},
|
||||||
|
|
||||||
|
reporters: ['progress', 'coverage', 'threshold'],
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
'karma-chrome-launcher',
|
||||||
|
'karma-jasmine',
|
||||||
|
'karma-ng-html2js-preprocessor',
|
||||||
|
'karma-coverage',
|
||||||
|
'karma-threshold-reporter'
|
||||||
|
],
|
||||||
|
|
||||||
|
coverageReporter: {
|
||||||
|
type: 'html',
|
||||||
|
dir: '../cover/meteos_ui'
|
||||||
|
},
|
||||||
|
|
||||||
|
// Coverage threshold values.
|
||||||
|
thresholdReporter: {
|
||||||
|
statements: 45,
|
||||||
|
branches: 0,
|
||||||
|
functions: 15,
|
||||||
|
lines: 45
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
3
meteos_ui/models.py
Normal file
3
meteos_ui/models.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"""
|
||||||
|
Stub file to work around django bug: https://code.djangoproject.com/ticket/7198
|
||||||
|
"""
|
@ -0,0 +1,66 @@
|
|||||||
|
/**
|
||||||
|
* 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
|
||||||
|
* @ngname horizon.dashboard.machine_learning.datasets.actions
|
||||||
|
*
|
||||||
|
* @description
|
||||||
|
* Provides all of the actions for datasets.
|
||||||
|
*/
|
||||||
|
angular.module('horizon.dashboard.machine_learning.datasets.actions', ['horizon.framework', 'horizon.dashboard.machine_learning'])
|
||||||
|
.run(registerDatasetActions);
|
||||||
|
|
||||||
|
registerDatasetActions.$inject = [
|
||||||
|
'horizon.framework.conf.resource-type-registry.service',
|
||||||
|
'horizon.framework.util.i18n.gettext',
|
||||||
|
'horizon.dashboard.machine_learning.datasets.create.service',
|
||||||
|
'horizon.dashboard.machine_learning.datasets.delete.service',
|
||||||
|
'horizon.dashboard.machine_learning.datasets.resourceType',
|
||||||
|
];
|
||||||
|
|
||||||
|
function registerDatasetActions(
|
||||||
|
registry,
|
||||||
|
gettext,
|
||||||
|
createDatasetService,
|
||||||
|
deleteDatasetService,
|
||||||
|
resourceType)
|
||||||
|
{
|
||||||
|
var datasetsResourceType = registry.getResourceType(resourceType);
|
||||||
|
|
||||||
|
datasetsResourceType.globalActions
|
||||||
|
.append({
|
||||||
|
id: 'createDatasetAction',
|
||||||
|
service: createDatasetService,
|
||||||
|
template: {
|
||||||
|
type: 'create',
|
||||||
|
text: gettext('Create Dataset')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
datasetsResourceType.batchActions
|
||||||
|
.append({
|
||||||
|
id: 'batchDeleteDatasetAction',
|
||||||
|
service: deleteDatasetService,
|
||||||
|
template: {
|
||||||
|
type: 'delete-selected',
|
||||||
|
text: gettext('Delete Datasets')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
@ -0,0 +1,56 @@
|
|||||||
|
/**
|
||||||
|
* 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';
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.datasets')
|
||||||
|
.factory('horizon.dashboard.machine_learning.datasets.workflow', datasetWorkflow);
|
||||||
|
|
||||||
|
datasetWorkflow.$inject = [
|
||||||
|
'horizon.dashboard.machine_learning.basePath',
|
||||||
|
'horizon.app.core.workflow.factory',
|
||||||
|
'horizon.framework.util.i18n.gettext'
|
||||||
|
];
|
||||||
|
|
||||||
|
function datasetWorkflow(basePath, dashboardWorkflow, gettext) {
|
||||||
|
return dashboardWorkflow({
|
||||||
|
title: gettext('Create Dataset'),
|
||||||
|
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
title: gettext('Info'),
|
||||||
|
templateUrl: basePath + 'datasets/create/info/info.html',
|
||||||
|
helpUrl: basePath + 'datasets/create/info/info.help.html',
|
||||||
|
formName: 'datasetInfoForm'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: gettext('Spec'),
|
||||||
|
templateUrl: basePath + 'datasets/create/spec/spec.html',
|
||||||
|
helpUrl: basePath + 'datasets/create/spec/spec.help.html',
|
||||||
|
formName: 'datasetSpecForm'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
btnText: {
|
||||||
|
finish: gettext('Create')
|
||||||
|
},
|
||||||
|
|
||||||
|
btnIcon: {
|
||||||
|
finish: 'fa fa-check'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,97 @@
|
|||||||
|
/**
|
||||||
|
* 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.machine_learning.datasets.create.service
|
||||||
|
* @description Service for the dataset create modal
|
||||||
|
*/
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.datasets')
|
||||||
|
.factory('horizon.dashboard.machine_learning.datasets.create.service', createService);
|
||||||
|
|
||||||
|
createService.$inject = [
|
||||||
|
'$location',
|
||||||
|
'horizon.app.core.openstack-service-api.policy',
|
||||||
|
'horizon.framework.util.actions.action-result.service',
|
||||||
|
'horizon.framework.util.i18n.gettext',
|
||||||
|
'horizon.framework.util.q.extensions',
|
||||||
|
'horizon.framework.widgets.modal.wizard-modal.service',
|
||||||
|
'horizon.framework.widgets.toast.service',
|
||||||
|
'horizon.dashboard.machine_learning.datasets.datasetModel',
|
||||||
|
'horizon.dashboard.machine_learning.datasets.events',
|
||||||
|
'horizon.dashboard.machine_learning.datasets.resourceType',
|
||||||
|
'horizon.dashboard.machine_learning.datasets.workflow'
|
||||||
|
];
|
||||||
|
|
||||||
|
function createService(
|
||||||
|
$location, policy, actionResult, gettext, $qExtensions, wizardModalService, toast, model, events, resourceType, createWorkflow
|
||||||
|
) {
|
||||||
|
var scope;
|
||||||
|
var message = {
|
||||||
|
success: gettext('Dataset %s was successfully created.')
|
||||||
|
};
|
||||||
|
|
||||||
|
var service = {
|
||||||
|
initAction: initAction,
|
||||||
|
perform: perform,
|
||||||
|
allowed: allowed
|
||||||
|
};
|
||||||
|
|
||||||
|
return service;
|
||||||
|
|
||||||
|
//////////////
|
||||||
|
|
||||||
|
function initAction() {
|
||||||
|
}
|
||||||
|
|
||||||
|
function perform(selected, newScope) {
|
||||||
|
scope = newScope;
|
||||||
|
scope.workflow = createWorkflow;
|
||||||
|
scope.model = model;
|
||||||
|
scope.model.init();
|
||||||
|
// for creation according to selected item
|
||||||
|
scope.selected = selected;
|
||||||
|
return wizardModalService.modal({
|
||||||
|
scope: scope,
|
||||||
|
workflow: createWorkflow,
|
||||||
|
submit: submit
|
||||||
|
}).result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function allowed() {
|
||||||
|
return $qExtensions.booleanAsPromise(true);
|
||||||
|
//return policy.ifAllowed({ rules: [['dataset', 'add_dataset']] });
|
||||||
|
}
|
||||||
|
|
||||||
|
function submit(){
|
||||||
|
return model.createDataset().then(success);
|
||||||
|
}
|
||||||
|
|
||||||
|
function success(response) {
|
||||||
|
response.data.id = response.data.id;
|
||||||
|
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/machine_learning/datasets');
|
||||||
|
}else{
|
||||||
|
return result.result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,75 @@
|
|||||||
|
/**
|
||||||
|
* 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';
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.datasets')
|
||||||
|
.factory('horizon.dashboard.machine_learning.datasets.datasetModel', datasetModel);
|
||||||
|
|
||||||
|
datasetModel.$inject = [
|
||||||
|
'horizon.app.core.openstack-service-api.meteos'
|
||||||
|
];
|
||||||
|
|
||||||
|
function datasetModel(meteos) {
|
||||||
|
var model = {
|
||||||
|
newDatasetSpec: {},
|
||||||
|
|
||||||
|
// API methods
|
||||||
|
init: init,
|
||||||
|
createDataset: createDataset
|
||||||
|
};
|
||||||
|
|
||||||
|
function initNewDatasetSpec() {
|
||||||
|
model.newDatasetSpec = {
|
||||||
|
method: null,
|
||||||
|
display_name: null,
|
||||||
|
display_description: null,
|
||||||
|
source_dataset_url: null,
|
||||||
|
experiment_id: null,
|
||||||
|
params: null,
|
||||||
|
swift_tenant: null,
|
||||||
|
swift_username: null,
|
||||||
|
swift_password: null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
// Reset the new Dataset spec
|
||||||
|
initNewDatasetSpec();
|
||||||
|
}
|
||||||
|
|
||||||
|
function createDataset() {
|
||||||
|
var finalSpec = angular.copy(model.newDatasetSpec);
|
||||||
|
|
||||||
|
cleanNullProperties(finalSpec);
|
||||||
|
|
||||||
|
return meteos.createDataset(finalSpec);
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanNullProperties(finalSpec) {
|
||||||
|
// Initially clean fields that don't have any value.
|
||||||
|
// Not only "null", blank too.
|
||||||
|
for (var key in finalSpec) {
|
||||||
|
if (finalSpec.hasOwnProperty(key) && finalSpec[key] === null
|
||||||
|
|| finalSpec[key] === "") {
|
||||||
|
delete finalSpec[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,8 @@
|
|||||||
|
<dl>
|
||||||
|
<dt translate>Dataset Name</dt>
|
||||||
|
<dd translate>An arbitrary human-readable name.</dd>
|
||||||
|
<dt translate>Dataset Description</dt>
|
||||||
|
<dd translate>An arbitrary human-readable description.</dd>
|
||||||
|
<dt translate>Template</dt>
|
||||||
|
<dd translate>Name or ID of dataset template.</dd>
|
||||||
|
</dl>
|
@ -0,0 +1,32 @@
|
|||||||
|
<div ng-controller="createDatasetInfoController as ctrl">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="dataset-name" translate>Dataset Name</label>
|
||||||
|
<input name="dataset-name" type="text" class="form-control" id="dataset-name"
|
||||||
|
ng-model="model.newDatasetSpec.display_name"
|
||||||
|
placeholder="{$ 'Name of the dataset to create.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="dataset-description" translate>Dataset Description</label>
|
||||||
|
<input name="dataset-description" type="text" class="form-control" id="dataset-description"
|
||||||
|
ng-model="model.newDatasetSpec.display_description"
|
||||||
|
placeholder="{$ 'Description of the dataset to create.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="dataset-experiment-id">
|
||||||
|
<translate>Experiment</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<input name="dataset-experiment-id" type="text" class="form-control" id="dataset-experiment-id"
|
||||||
|
ng-model="model.newDatasetSpec.experiment_id"
|
||||||
|
ng-required="true"
|
||||||
|
placeholder="{$ 'ID of the experiment.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,34 @@
|
|||||||
|
/**
|
||||||
|
* 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 controller
|
||||||
|
* @name createDatasetInfoController
|
||||||
|
* @ngController
|
||||||
|
* @description
|
||||||
|
* Controller for the dataset info step in create workflow
|
||||||
|
*/
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.datasets')
|
||||||
|
.controller('createDatasetInfoController', createDatasetInfoController);
|
||||||
|
|
||||||
|
createDatasetInfoController.$inject = [
|
||||||
|
];
|
||||||
|
|
||||||
|
function createDatasetInfoController() {
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,14 @@
|
|||||||
|
<dl>
|
||||||
|
<dt translate>Spark Version</dt>
|
||||||
|
<dd translate> Version of Apache Spark.</dd>
|
||||||
|
<dt translate>Master Nodes</dt>
|
||||||
|
<dd translate> Number of Master Node.</dd>
|
||||||
|
<dt translate>Master Flavor</dt>
|
||||||
|
<dd translate> Flavor ID of Master Node.</dd>
|
||||||
|
<dt translate>Worker Nodes</dt>
|
||||||
|
<dd translate> Number of Worker Node.</dd>
|
||||||
|
<dt translate>Worker Flavor</dt>
|
||||||
|
<dd translate> Flavor ID of Worker Node.</dd>
|
||||||
|
<dt translate>Floating IP Pool</dt>
|
||||||
|
<dd translate> The UUID of Neutron External Network.</dd>
|
||||||
|
</dl>
|
@ -0,0 +1,76 @@
|
|||||||
|
<div ng-controller="createDatasetSpecController as ctrl">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="dataset-method">
|
||||||
|
<translate>Method</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<div class="form-field">
|
||||||
|
<div class="btn-group">
|
||||||
|
<label class="btn btn-default"
|
||||||
|
ng-repeat="option in ctrl.datasetMethodOptions"
|
||||||
|
ng-model="model.newDatasetSpec.method"
|
||||||
|
uib-btn-radio="option.value">{$ ::option.label $}</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="dataset-source-dataset-url">
|
||||||
|
<translate>Source Dataset URL</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<input name="dataset-source-dataset-url" type="text" class="form-control" id="dataset-source-dataset-url"
|
||||||
|
ng-model="model.newDatasetSpec.source_dataset_url"
|
||||||
|
ng-required="true"
|
||||||
|
placeholder="{$ 'URL of Dataset stored Swift of Internal HDFS.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="dataset-params">
|
||||||
|
<translate>Params</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<input name="dataset-params" type="text" class="form-control" id="dataset-params"
|
||||||
|
ng-model="model.newDatasetSpec.params"
|
||||||
|
placeholder="{$ 'Parameters when parsing dataset.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="dataset-swift-tenant">
|
||||||
|
<translate>Swift Tenant</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<input name="dataset-swift-tenant" type="text" class="form-control" id="dataset-swift-tenant"
|
||||||
|
ng-model="model.newDatasetSpec.swift_tenant"
|
||||||
|
placeholder="{$ 'Tenant name of Swift.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="dataset-swift-username">
|
||||||
|
<translate>Swift User Name</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<input name="dataset-swift-username" type="text" class="form-control" id="dataset-swift-username"
|
||||||
|
ng-model="model.newDatasetSpec.swift_username"
|
||||||
|
placeholder="{$ 'User name of Swift.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="dataset-swift-password">
|
||||||
|
<translate>Swift User Password</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<input name="dataset-swift-password" type="text" class="form-control" id="dataset-swift-password"
|
||||||
|
ng-model="model.newDatasetSpec.swift_password"
|
||||||
|
placeholder="{$ 'Password of Swift User.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,44 @@
|
|||||||
|
/**
|
||||||
|
* 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 controller
|
||||||
|
* @name createDatasetSpecController
|
||||||
|
* @ngController
|
||||||
|
* @description
|
||||||
|
* Controller for the dataset spec step in create workflow
|
||||||
|
*/
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.datasets')
|
||||||
|
.controller('createDatasetSpecController', createDatasetSpecController);
|
||||||
|
|
||||||
|
createDatasetSpecController.$inject = [
|
||||||
|
'$scope',
|
||||||
|
'horizon.framework.util.i18n.gettext'
|
||||||
|
];
|
||||||
|
|
||||||
|
function createDatasetSpecController($scope, gettext) {
|
||||||
|
var ctrl = this;
|
||||||
|
|
||||||
|
ctrl.datasetMethodOptions = [
|
||||||
|
{ label: gettext('Download'), value: 'download' },
|
||||||
|
{ label: gettext('Parse'), value: 'parse' }
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
@ -0,0 +1,156 @@
|
|||||||
|
/**
|
||||||
|
* 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.machine_learning.datasets
|
||||||
|
* @ngModule
|
||||||
|
* @description
|
||||||
|
* Provides all the services and widgets require to display the dataset
|
||||||
|
* panel
|
||||||
|
*/
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.datasets', [
|
||||||
|
'ngRoute',
|
||||||
|
'horizon.dashboard.machine_learning.datasets.actions'
|
||||||
|
])
|
||||||
|
.constant('horizon.dashboard.machine_learning.datasets.events', events())
|
||||||
|
.constant('horizon.dashboard.machine_learning.datasets.resourceType', 'OS::Meteos::Dataset')
|
||||||
|
.run(run)
|
||||||
|
.config(config);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ngdoc constant
|
||||||
|
* @name horizon.dashboard.machine_learning.datasets.events
|
||||||
|
* @description A list of events used by Dataset
|
||||||
|
*/
|
||||||
|
function events() {
|
||||||
|
return {
|
||||||
|
CREATE_SUCCESS: 'horizon.dashboard.machine_learning.datasets.CREATE_SUCCESS',
|
||||||
|
DELETE_SUCCESS: 'horizon.dashboard.machine_learning.datasets.DELETE_SUCCESS'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
run.$inject = [
|
||||||
|
'horizon.framework.conf.resource-type-registry.service',
|
||||||
|
'horizon.app.core.openstack-service-api.meteos',
|
||||||
|
'horizon.dashboard.machine_learning.datasets.basePath',
|
||||||
|
'horizon.dashboard.machine_learning.datasets.resourceType'
|
||||||
|
];
|
||||||
|
|
||||||
|
function run(registry, meteos, basePath, resourceType) {
|
||||||
|
registry.getResourceType(resourceType)
|
||||||
|
.setNames(gettext('Machine Learning'), gettext('Datasets'))
|
||||||
|
// for detail summary view on table row.
|
||||||
|
.setSummaryTemplateUrl(basePath + 'details/drawer.html')
|
||||||
|
// for table row items and detail summary view.
|
||||||
|
.setProperty('name', {
|
||||||
|
label: gettext('Name')
|
||||||
|
})
|
||||||
|
.setProperty('id', {
|
||||||
|
label: gettext('ID')
|
||||||
|
})
|
||||||
|
.setProperty('status', {
|
||||||
|
label: gettext('Status')
|
||||||
|
})
|
||||||
|
.setProperty('source_dataset_url', {
|
||||||
|
label: gettext('Source Dataset URL')
|
||||||
|
})
|
||||||
|
.setListFunction(listFunction)
|
||||||
|
.tableColumns
|
||||||
|
.append({
|
||||||
|
id: 'name',
|
||||||
|
priority: 1,
|
||||||
|
sortDefault: true,
|
||||||
|
filters: ['noName'],
|
||||||
|
urlFunction: urlFunction
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
id: 'id',
|
||||||
|
priority: 3
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
id: 'status',
|
||||||
|
priority: 2
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
id: 'source_dataset_url',
|
||||||
|
priority: 2
|
||||||
|
})
|
||||||
|
// for magic-search
|
||||||
|
registry.getResourceType(resourceType).filterFacets
|
||||||
|
.append({
|
||||||
|
'label': gettext('Name'),
|
||||||
|
'name': 'name',
|
||||||
|
'singleton': true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
'label': gettext('ID'),
|
||||||
|
'name': 'id',
|
||||||
|
'singleton': true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
'label': gettext('Status'),
|
||||||
|
'name': 'status',
|
||||||
|
'singleton': true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
'label': gettext('Source Dataset URL'),
|
||||||
|
'name': 'source_dataset_url',
|
||||||
|
'singleton': true
|
||||||
|
});
|
||||||
|
|
||||||
|
function listFunction(params) {
|
||||||
|
return meteos.getDatasets(params).then(modifyResponse);
|
||||||
|
|
||||||
|
function modifyResponse(response) {
|
||||||
|
return {data: {items: response.data.items.map(addTrackBy)}};
|
||||||
|
|
||||||
|
function addTrackBy(item) {
|
||||||
|
item.trackBy = item.id;
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function urlFunction(item) {
|
||||||
|
return 'project/ngdetails/OS::Meteos::Dataset/' + item.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config.$inject = [
|
||||||
|
'$provide',
|
||||||
|
'$windowProvider',
|
||||||
|
'$routeProvider'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name config
|
||||||
|
* @param {Object} $provide
|
||||||
|
* @param {Object} $windowProvider
|
||||||
|
* @param {Object} $routeProvider
|
||||||
|
* @description Routes used by this module.
|
||||||
|
* @returns {undefined} Returns nothing
|
||||||
|
*/
|
||||||
|
function config($provide, $windowProvider, $routeProvider) {
|
||||||
|
var path = $windowProvider.$get().STATIC_URL + 'dashboard/machine_learning/datasets/';
|
||||||
|
$provide.constant('horizon.dashboard.machine_learning.datasets.basePath', path);
|
||||||
|
$routeProvider.when('/project/machine_learning/datasets', {
|
||||||
|
templateUrl: path + 'panel.html'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* 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.machine_learning.datasets', function() {
|
||||||
|
it('should exist', function() {
|
||||||
|
expect(angular.module('horizon.dashboard.machine_learning.datasets')).toBeDefined();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
})();
|
@ -0,0 +1,3 @@
|
|||||||
|
.logs {
|
||||||
|
margin-top: 18px;
|
||||||
|
}
|
@ -0,0 +1,149 @@
|
|||||||
|
/**
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use self 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';
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.datasets')
|
||||||
|
.factory('horizon.dashboard.machine_learning.datasets.delete.service', deleteService);
|
||||||
|
|
||||||
|
deleteService.$inject = [
|
||||||
|
'$location',
|
||||||
|
'$q',
|
||||||
|
'horizon.app.core.openstack-service-api.meteos',
|
||||||
|
'horizon.app.core.openstack-service-api.policy',
|
||||||
|
'horizon.framework.util.actions.action-result.service',
|
||||||
|
'horizon.framework.util.i18n.gettext',
|
||||||
|
'horizon.framework.util.q.extensions',
|
||||||
|
'horizon.framework.widgets.modal.deleteModalService',
|
||||||
|
'horizon.framework.widgets.toast.service',
|
||||||
|
'horizon.dashboard.machine_learning.datasets.resourceType',
|
||||||
|
'horizon.dashboard.machine_learning.datasets.events'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ngDoc factory
|
||||||
|
* @name horizon.dashboard.machine_learning.datasets.delete.service
|
||||||
|
* @Description
|
||||||
|
* Brings up the delete datasets confirmation modal dialog.
|
||||||
|
* On submit, delete selected resources.
|
||||||
|
* On cancel, do nothing.
|
||||||
|
*/
|
||||||
|
function deleteService(
|
||||||
|
$location, $q, meteos, policy, actionResult, gettext, $qExtensions, deleteModal, toast, resourceType, events
|
||||||
|
) {
|
||||||
|
var scope;
|
||||||
|
var context = {
|
||||||
|
labels: null,
|
||||||
|
deleteEntity: deleteEntity,
|
||||||
|
successEvent: events.DELETE_SUCCESS
|
||||||
|
};
|
||||||
|
var service = {
|
||||||
|
initAction: initAction,
|
||||||
|
allowed: allowed,
|
||||||
|
perform: perform
|
||||||
|
};
|
||||||
|
var notAllowedMessage = gettext("You are not allowed to delete datasets: %s");
|
||||||
|
|
||||||
|
return service;
|
||||||
|
|
||||||
|
//////////////
|
||||||
|
|
||||||
|
function initAction() {
|
||||||
|
}
|
||||||
|
|
||||||
|
function allowed() {
|
||||||
|
return $qExtensions.booleanAsPromise(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete selected resource objects
|
||||||
|
function perform(selected, newScope) {
|
||||||
|
scope = newScope;
|
||||||
|
var selected = angular.isArray(selected) ? selected : [selected];
|
||||||
|
context.labels = labelize(selected.length);
|
||||||
|
return $qExtensions.allSettled(selected.map(checkPermission)).then(afterCheck);
|
||||||
|
}
|
||||||
|
|
||||||
|
function labelize(count){
|
||||||
|
return {
|
||||||
|
title: ngettext('Confirm Delete Dataset',
|
||||||
|
'Confirm Delete Datasets', count),
|
||||||
|
/* eslint-disable max-len */
|
||||||
|
message: ngettext('You have selected "%s". Please confirm your selection. Deleted dataset is not recoverable.',
|
||||||
|
'You have selected "%s". Please confirm your selection. Deleted datasets are not recoverable.', count),
|
||||||
|
/* eslint-enable max-len */
|
||||||
|
submit: ngettext('Delete Dataset',
|
||||||
|
'Delete Datasets', count),
|
||||||
|
success: ngettext('Deleted Dataset: %s.',
|
||||||
|
'Deleted Datasets: %s.', count),
|
||||||
|
error: ngettext('Unable to delete Dataset: %s.',
|
||||||
|
'Unable to delete Datasets: %s.', count)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// for batch delete
|
||||||
|
function checkPermission(selected) {
|
||||||
|
return {promise: allowed(selected), context: selected};
|
||||||
|
}
|
||||||
|
|
||||||
|
// for batch delete
|
||||||
|
function afterCheck(result){
|
||||||
|
var outcome = $q.reject(); // Reject the promise by default
|
||||||
|
if (result.fail.length > 0) {
|
||||||
|
toast.add('error', getMessage(notAllowedMessage, result.fail));
|
||||||
|
outcome = $q.reject(result.fail);
|
||||||
|
}
|
||||||
|
if (result.pass.length > 0) {
|
||||||
|
outcome = deleteModal.open(scope, result.pass.map(getEntity), context).then(createResult);
|
||||||
|
}
|
||||||
|
return outcome;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createResult(deleteModalResult) {
|
||||||
|
// To make the result of this action generically useful, reformat the return
|
||||||
|
// from the deleteModal into a standard form
|
||||||
|
var result = actionResult.getActionResult();
|
||||||
|
deleteModalResult.pass.forEach(function markDeleted(item) {
|
||||||
|
result.deleted(resourceType, getEntity(item).id);
|
||||||
|
});
|
||||||
|
deleteModalResult.fail.forEach(function markFailed(item) {
|
||||||
|
result.failed(resourceType, getEntity(item).id);
|
||||||
|
});
|
||||||
|
if(result.result.failed.length == 0 && result.result.deleted.length > 0){
|
||||||
|
$location.path('/project/machine_learning/datasets');
|
||||||
|
}else{
|
||||||
|
return result.result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getMessage(message, entities) {
|
||||||
|
return interpolate(message, [entities.map(getName).join(", ")]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getName(result) {
|
||||||
|
return getEntity(result).name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// for batch delete
|
||||||
|
function getEntity(result) {
|
||||||
|
return result.context;
|
||||||
|
}
|
||||||
|
|
||||||
|
// call delete REST API
|
||||||
|
function deleteEntity(id){
|
||||||
|
return meteos.deleteDataset(id, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* 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 controller
|
||||||
|
* @name horizon.dashboard.machine_learning.datasets.DrawerController
|
||||||
|
* @description
|
||||||
|
* This is the controller for the drawer (summary) view.
|
||||||
|
* Its primary purpose is to provide the metadata definitions to
|
||||||
|
* the dataset via the ctrl.metadataDefs member.
|
||||||
|
*/
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.datasets')
|
||||||
|
.controller('horizon.dashboard.machine_learning.datasets.DrawerController', controller);
|
||||||
|
|
||||||
|
controller.$inject = [
|
||||||
|
];
|
||||||
|
|
||||||
|
function controller() {
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
@ -0,0 +1,14 @@
|
|||||||
|
<div ng-controller="horizon.dashboard.machine_learning.datasets.DrawerController as drawerCtrl">
|
||||||
|
<div class="row">
|
||||||
|
<span class="rsp-alt-p3">
|
||||||
|
<dl class="col-md-4">
|
||||||
|
<dt translate>ID</dt>
|
||||||
|
<dd>{$ item.id $}</dd>
|
||||||
|
</dl>
|
||||||
|
<dl class="col-md-4">
|
||||||
|
<dt translate>Description</dt>
|
||||||
|
<dd>{$ item.description $}</dd>
|
||||||
|
</dl>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,4 @@
|
|||||||
|
<hz-resource-panel resource-type-name="OS::Meteos::Dataset">
|
||||||
|
<hz-resource-table resource-type-name="OS::Meteos::Dataset"
|
||||||
|
track-by="trackBy"></hz-resource-table>
|
||||||
|
</hz-resource-panel>
|
@ -0,0 +1,66 @@
|
|||||||
|
/**
|
||||||
|
* 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
|
||||||
|
* @ngname horizon.dashboard.machine_learning.experiments.actions
|
||||||
|
*
|
||||||
|
* @description
|
||||||
|
* Provides all of the actions for experiments.
|
||||||
|
*/
|
||||||
|
angular.module('horizon.dashboard.machine_learning.experiments.actions', ['horizon.framework', 'horizon.dashboard.machine_learning'])
|
||||||
|
.run(registerExperimentActions);
|
||||||
|
|
||||||
|
registerExperimentActions.$inject = [
|
||||||
|
'horizon.framework.conf.resource-type-registry.service',
|
||||||
|
'horizon.framework.util.i18n.gettext',
|
||||||
|
'horizon.dashboard.machine_learning.experiments.create.service',
|
||||||
|
'horizon.dashboard.machine_learning.experiments.delete.service',
|
||||||
|
'horizon.dashboard.machine_learning.experiments.resourceType',
|
||||||
|
];
|
||||||
|
|
||||||
|
function registerExperimentActions(
|
||||||
|
registry,
|
||||||
|
gettext,
|
||||||
|
createExperimentService,
|
||||||
|
deleteExperimentService,
|
||||||
|
resourceType)
|
||||||
|
{
|
||||||
|
var experimentsResourceType = registry.getResourceType(resourceType);
|
||||||
|
|
||||||
|
experimentsResourceType.globalActions
|
||||||
|
.append({
|
||||||
|
id: 'createExperimentAction',
|
||||||
|
service: createExperimentService,
|
||||||
|
template: {
|
||||||
|
type: 'create',
|
||||||
|
text: gettext('Create Experiment')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
experimentsResourceType.batchActions
|
||||||
|
.append({
|
||||||
|
id: 'batchDeleteExperimentAction',
|
||||||
|
service: deleteExperimentService,
|
||||||
|
template: {
|
||||||
|
type: 'delete-selected',
|
||||||
|
text: gettext('Delete Experiments')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
@ -0,0 +1,56 @@
|
|||||||
|
/**
|
||||||
|
* 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';
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.experiments')
|
||||||
|
.factory('horizon.dashboard.machine_learning.experiments.workflow', experimentWorkflow);
|
||||||
|
|
||||||
|
experimentWorkflow.$inject = [
|
||||||
|
'horizon.dashboard.machine_learning.basePath',
|
||||||
|
'horizon.app.core.workflow.factory',
|
||||||
|
'horizon.framework.util.i18n.gettext'
|
||||||
|
];
|
||||||
|
|
||||||
|
function experimentWorkflow(basePath, dashboardWorkflow, gettext) {
|
||||||
|
return dashboardWorkflow({
|
||||||
|
title: gettext('Create Experiment'),
|
||||||
|
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
title: gettext('Info'),
|
||||||
|
templateUrl: basePath + 'experiments/create/info/info.html',
|
||||||
|
helpUrl: basePath + 'experiments/create/info/info.help.html',
|
||||||
|
formName: 'experimentInfoForm'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: gettext('Spec'),
|
||||||
|
templateUrl: basePath + 'experiments/create/spec/spec.html',
|
||||||
|
helpUrl: basePath + 'experiments/create/spec/spec.help.html',
|
||||||
|
formName: 'experimentSpecForm'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
btnText: {
|
||||||
|
finish: gettext('Create')
|
||||||
|
},
|
||||||
|
|
||||||
|
btnIcon: {
|
||||||
|
finish: 'fa fa-check'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,97 @@
|
|||||||
|
/**
|
||||||
|
* 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.machine_learning.experiments.create.service
|
||||||
|
* @description Service for the experiment create modal
|
||||||
|
*/
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.experiments')
|
||||||
|
.factory('horizon.dashboard.machine_learning.experiments.create.service', createService);
|
||||||
|
|
||||||
|
createService.$inject = [
|
||||||
|
'$location',
|
||||||
|
'horizon.app.core.openstack-service-api.policy',
|
||||||
|
'horizon.framework.util.actions.action-result.service',
|
||||||
|
'horizon.framework.util.i18n.gettext',
|
||||||
|
'horizon.framework.util.q.extensions',
|
||||||
|
'horizon.framework.widgets.modal.wizard-modal.service',
|
||||||
|
'horizon.framework.widgets.toast.service',
|
||||||
|
'horizon.dashboard.machine_learning.experiments.experimentModel',
|
||||||
|
'horizon.dashboard.machine_learning.experiments.events',
|
||||||
|
'horizon.dashboard.machine_learning.experiments.resourceType',
|
||||||
|
'horizon.dashboard.machine_learning.experiments.workflow'
|
||||||
|
];
|
||||||
|
|
||||||
|
function createService(
|
||||||
|
$location, policy, actionResult, gettext, $qExtensions, wizardModalService, toast, model, events, resourceType, createWorkflow
|
||||||
|
) {
|
||||||
|
var scope;
|
||||||
|
var message = {
|
||||||
|
success: gettext('Experiment %s was successfully created.')
|
||||||
|
};
|
||||||
|
|
||||||
|
var service = {
|
||||||
|
initAction: initAction,
|
||||||
|
perform: perform,
|
||||||
|
allowed: allowed
|
||||||
|
};
|
||||||
|
|
||||||
|
return service;
|
||||||
|
|
||||||
|
//////////////
|
||||||
|
|
||||||
|
function initAction() {
|
||||||
|
}
|
||||||
|
|
||||||
|
function perform(selected, newScope) {
|
||||||
|
scope = newScope;
|
||||||
|
scope.workflow = createWorkflow;
|
||||||
|
scope.model = model;
|
||||||
|
scope.model.init();
|
||||||
|
// for creation according to selected item
|
||||||
|
scope.selected = selected;
|
||||||
|
return wizardModalService.modal({
|
||||||
|
scope: scope,
|
||||||
|
workflow: createWorkflow,
|
||||||
|
submit: submit
|
||||||
|
}).result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function allowed() {
|
||||||
|
return $qExtensions.booleanAsPromise(true);
|
||||||
|
//return policy.ifAllowed({ rules: [['experiment', 'add_experiment']] });
|
||||||
|
}
|
||||||
|
|
||||||
|
function submit(){
|
||||||
|
return model.createExperiment().then(success);
|
||||||
|
}
|
||||||
|
|
||||||
|
function success(response) {
|
||||||
|
response.data.id = response.data.id;
|
||||||
|
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/machine_learning/experiments');
|
||||||
|
}else{
|
||||||
|
return result.result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,71 @@
|
|||||||
|
/**
|
||||||
|
* 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';
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.experiments')
|
||||||
|
.factory('horizon.dashboard.machine_learning.experiments.experimentModel', experimentModel);
|
||||||
|
|
||||||
|
experimentModel.$inject = [
|
||||||
|
'horizon.app.core.openstack-service-api.meteos'
|
||||||
|
];
|
||||||
|
|
||||||
|
function experimentModel(meteos) {
|
||||||
|
var model = {
|
||||||
|
newExperimentSpec: {},
|
||||||
|
|
||||||
|
// API methods
|
||||||
|
init: init,
|
||||||
|
createExperiment: createExperiment
|
||||||
|
};
|
||||||
|
|
||||||
|
function initNewExperimentSpec() {
|
||||||
|
model.newExperimentSpec = {
|
||||||
|
display_name: null,
|
||||||
|
display_description: null,
|
||||||
|
key_name: null,
|
||||||
|
neutron_management_network: null,
|
||||||
|
template_id: null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
// Reset the new Experiment spec
|
||||||
|
initNewExperimentSpec();
|
||||||
|
}
|
||||||
|
|
||||||
|
function createExperiment() {
|
||||||
|
var finalSpec = angular.copy(model.newExperimentSpec);
|
||||||
|
|
||||||
|
cleanNullProperties(finalSpec);
|
||||||
|
|
||||||
|
return meteos.createExperiment(finalSpec);
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanNullProperties(finalSpec) {
|
||||||
|
// Initially clean fields that don't have any value.
|
||||||
|
// Not only "null", blank too.
|
||||||
|
for (var key in finalSpec) {
|
||||||
|
if (finalSpec.hasOwnProperty(key) && finalSpec[key] === null
|
||||||
|
|| finalSpec[key] === "") {
|
||||||
|
delete finalSpec[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,8 @@
|
|||||||
|
<dl>
|
||||||
|
<dt translate>Experiment Name</dt>
|
||||||
|
<dd translate>An arbitrary human-readable name.</dd>
|
||||||
|
<dt translate>Experiment Description</dt>
|
||||||
|
<dd translate>An arbitrary human-readable description.</dd>
|
||||||
|
<dt translate>Template</dt>
|
||||||
|
<dd translate>Name or ID of experiment template.</dd>
|
||||||
|
</dl>
|
@ -0,0 +1,32 @@
|
|||||||
|
<div ng-controller="createExperimentInfoController as ctrl">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="experiment-name" translate>Experiment Name</label>
|
||||||
|
<input name="experiment-name" type="text" class="form-control" id="experiment-name"
|
||||||
|
ng-model="model.newExperimentSpec.display_name"
|
||||||
|
placeholder="{$ 'Name of the experiment to create.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="experiment-description" translate>Experiment Description</label>
|
||||||
|
<input name="experiment-description" type="text" class="form-control" id="experiment-description"
|
||||||
|
ng-model="model.newExperimentSpec.display_description"
|
||||||
|
placeholder="{$ 'Description of the experiment to create.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="experiment-template-id">
|
||||||
|
<translate>Template</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<input name="experiment-template-id" type="text" class="form-control" id="experiment-template-id"
|
||||||
|
ng-model="model.newExperimentSpec.template_id"
|
||||||
|
ng-required="true"
|
||||||
|
placeholder="{$ 'Name or ID of the template.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,34 @@
|
|||||||
|
/**
|
||||||
|
* 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 controller
|
||||||
|
* @name createExperimentInfoController
|
||||||
|
* @ngController
|
||||||
|
* @description
|
||||||
|
* Controller for the experiment info step in create workflow
|
||||||
|
*/
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.experiments')
|
||||||
|
.controller('createExperimentInfoController', createExperimentInfoController);
|
||||||
|
|
||||||
|
createExperimentInfoController.$inject = [
|
||||||
|
];
|
||||||
|
|
||||||
|
function createExperimentInfoController() {
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,14 @@
|
|||||||
|
<dl>
|
||||||
|
<dt translate>Spark Version</dt>
|
||||||
|
<dd translate> Version of Apache Spark.</dd>
|
||||||
|
<dt translate>Master Nodes</dt>
|
||||||
|
<dd translate> Number of Master Node.</dd>
|
||||||
|
<dt translate>Master Flavor</dt>
|
||||||
|
<dd translate> Flavor ID of Master Node.</dd>
|
||||||
|
<dt translate>Worker Nodes</dt>
|
||||||
|
<dd translate> Number of Worker Node.</dd>
|
||||||
|
<dt translate>Worker Flavor</dt>
|
||||||
|
<dd translate> Flavor ID of Worker Node.</dd>
|
||||||
|
<dt translate>Floating IP Pool</dt>
|
||||||
|
<dd translate> The UUID of Neutron External Network.</dd>
|
||||||
|
</dl>
|
@ -0,0 +1,28 @@
|
|||||||
|
<div ng-controller="createExperimentSpecController as ctrl">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="experiment-key-name">
|
||||||
|
<translate>Key Name</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<input name="experiment-key-name" type="text" class="form-control" id="experiment-key-name"
|
||||||
|
ng-model="model.newExperimentSpec.key_name"
|
||||||
|
ng-required="true"
|
||||||
|
placeholder="{$ 'Number of Master Node.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="experiment-neutron-management-network">
|
||||||
|
<translate>Neutron Management Network</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<input name="experiment-neutron-management-network" type="text" class="form-control" id="experiment-neutron-management-network"
|
||||||
|
ng-model="model.newExperimentSpec.neutron_management_network"
|
||||||
|
ng-required="true"
|
||||||
|
placeholder="{$ 'The UUID of Neutron Management Network.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* 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 controller
|
||||||
|
* @name createExperimentSpecController
|
||||||
|
* @ngController
|
||||||
|
* @description
|
||||||
|
* Controller for the experiment spec step in create workflow
|
||||||
|
*/
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.experiments')
|
||||||
|
.controller('createExperimentSpecController', createExperimentSpecController);
|
||||||
|
|
||||||
|
createExperimentSpecController.$inject = [
|
||||||
|
'$scope',
|
||||||
|
'horizon.framework.util.i18n.gettext'
|
||||||
|
];
|
||||||
|
|
||||||
|
function createExperimentSpecController($scope, gettext) {
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,149 @@
|
|||||||
|
/**
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use self 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';
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.experiments')
|
||||||
|
.factory('horizon.dashboard.machine_learning.experiments.delete.service', deleteService);
|
||||||
|
|
||||||
|
deleteService.$inject = [
|
||||||
|
'$location',
|
||||||
|
'$q',
|
||||||
|
'horizon.app.core.openstack-service-api.meteos',
|
||||||
|
'horizon.app.core.openstack-service-api.policy',
|
||||||
|
'horizon.framework.util.actions.action-result.service',
|
||||||
|
'horizon.framework.util.i18n.gettext',
|
||||||
|
'horizon.framework.util.q.extensions',
|
||||||
|
'horizon.framework.widgets.modal.deleteModalService',
|
||||||
|
'horizon.framework.widgets.toast.service',
|
||||||
|
'horizon.dashboard.machine_learning.experiments.resourceType',
|
||||||
|
'horizon.dashboard.machine_learning.experiments.events'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ngDoc factory
|
||||||
|
* @name horizon.dashboard.machine_learning.experiments.delete.service
|
||||||
|
* @Description
|
||||||
|
* Brings up the delete experiments confirmation modal dialog.
|
||||||
|
* On submit, delete selected resources.
|
||||||
|
* On cancel, do nothing.
|
||||||
|
*/
|
||||||
|
function deleteService(
|
||||||
|
$location, $q, meteos, policy, actionResult, gettext, $qExtensions, deleteModal, toast, resourceType, events
|
||||||
|
) {
|
||||||
|
var scope;
|
||||||
|
var context = {
|
||||||
|
labels: null,
|
||||||
|
deleteEntity: deleteEntity,
|
||||||
|
successEvent: events.DELETE_SUCCESS
|
||||||
|
};
|
||||||
|
var service = {
|
||||||
|
initAction: initAction,
|
||||||
|
allowed: allowed,
|
||||||
|
perform: perform
|
||||||
|
};
|
||||||
|
var notAllowedMessage = gettext("You are not allowed to delete experiments: %s");
|
||||||
|
|
||||||
|
return service;
|
||||||
|
|
||||||
|
//////////////
|
||||||
|
|
||||||
|
function initAction() {
|
||||||
|
}
|
||||||
|
|
||||||
|
function allowed() {
|
||||||
|
return $qExtensions.booleanAsPromise(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete selected resource objects
|
||||||
|
function perform(selected, newScope) {
|
||||||
|
scope = newScope;
|
||||||
|
var selected = angular.isArray(selected) ? selected : [selected];
|
||||||
|
context.labels = labelize(selected.length);
|
||||||
|
return $qExtensions.allSettled(selected.map(checkPermission)).then(afterCheck);
|
||||||
|
}
|
||||||
|
|
||||||
|
function labelize(count){
|
||||||
|
return {
|
||||||
|
title: ngettext('Confirm Delete Experiment',
|
||||||
|
'Confirm Delete Experiments', count),
|
||||||
|
/* eslint-disable max-len */
|
||||||
|
message: ngettext('You have selected "%s". Please confirm your selection. Deleted experiment is not recoverable.',
|
||||||
|
'You have selected "%s". Please confirm your selection. Deleted experiments are not recoverable.', count),
|
||||||
|
/* eslint-enable max-len */
|
||||||
|
submit: ngettext('Delete Experiment',
|
||||||
|
'Delete Experiments', count),
|
||||||
|
success: ngettext('Deleted Experiment: %s.',
|
||||||
|
'Deleted Experiments: %s.', count),
|
||||||
|
error: ngettext('Unable to delete Experiment: %s.',
|
||||||
|
'Unable to delete Experiments: %s.', count)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// for batch delete
|
||||||
|
function checkPermission(selected) {
|
||||||
|
return {promise: allowed(selected), context: selected};
|
||||||
|
}
|
||||||
|
|
||||||
|
// for batch delete
|
||||||
|
function afterCheck(result){
|
||||||
|
var outcome = $q.reject(); // Reject the promise by default
|
||||||
|
if (result.fail.length > 0) {
|
||||||
|
toast.add('error', getMessage(notAllowedMessage, result.fail));
|
||||||
|
outcome = $q.reject(result.fail);
|
||||||
|
}
|
||||||
|
if (result.pass.length > 0) {
|
||||||
|
outcome = deleteModal.open(scope, result.pass.map(getEntity), context).then(createResult);
|
||||||
|
}
|
||||||
|
return outcome;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createResult(deleteModalResult) {
|
||||||
|
// To make the result of this action generically useful, reformat the return
|
||||||
|
// from the deleteModal into a standard form
|
||||||
|
var result = actionResult.getActionResult();
|
||||||
|
deleteModalResult.pass.forEach(function markDeleted(item) {
|
||||||
|
result.deleted(resourceType, getEntity(item).id);
|
||||||
|
});
|
||||||
|
deleteModalResult.fail.forEach(function markFailed(item) {
|
||||||
|
result.failed(resourceType, getEntity(item).id);
|
||||||
|
});
|
||||||
|
if(result.result.failed.length == 0 && result.result.deleted.length > 0){
|
||||||
|
$location.path('/project/machine_learning/experiments');
|
||||||
|
}else{
|
||||||
|
return result.result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getMessage(message, entities) {
|
||||||
|
return interpolate(message, [entities.map(getName).join(", ")]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getName(result) {
|
||||||
|
return getEntity(result).name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// for batch delete
|
||||||
|
function getEntity(result) {
|
||||||
|
return result.context;
|
||||||
|
}
|
||||||
|
|
||||||
|
// call delete REST API
|
||||||
|
function deleteEntity(id){
|
||||||
|
return meteos.deleteExperiment(id, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* 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 controller
|
||||||
|
* @name horizon.dashboard.machine_learning.experiments.DrawerController
|
||||||
|
* @description
|
||||||
|
* This is the controller for the drawer (summary) view.
|
||||||
|
* Its primary purpose is to provide the metadata definitions to
|
||||||
|
* the experiment via the ctrl.metadataDefs member.
|
||||||
|
*/
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.experiments')
|
||||||
|
.controller('horizon.dashboard.machine_learning.experiments.DrawerController', controller);
|
||||||
|
|
||||||
|
controller.$inject = [
|
||||||
|
];
|
||||||
|
|
||||||
|
function controller() {
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
@ -0,0 +1,14 @@
|
|||||||
|
<div ng-controller="horizon.dashboard.machine_learning.experiments.DrawerController as drawerCtrl">
|
||||||
|
<div class="row">
|
||||||
|
<span class="rsp-alt-p3">
|
||||||
|
<dl class="col-md-4">
|
||||||
|
<dt translate>ID</dt>
|
||||||
|
<dd>{$ item.id $}</dd>
|
||||||
|
</dl>
|
||||||
|
<dl class="col-md-4">
|
||||||
|
<dt translate>Description</dt>
|
||||||
|
<dd>{$ item.description $}</dd>
|
||||||
|
</dl>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,168 @@
|
|||||||
|
/**
|
||||||
|
* 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.machine_learning.experiments
|
||||||
|
* @ngModule
|
||||||
|
* @description
|
||||||
|
* Provides all the services and widgets require to display the experiment
|
||||||
|
* panel
|
||||||
|
*/
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.experiments', [
|
||||||
|
'ngRoute',
|
||||||
|
'horizon.dashboard.machine_learning.experiments.actions'
|
||||||
|
])
|
||||||
|
.constant('horizon.dashboard.machine_learning.experiments.events', events())
|
||||||
|
.constant('horizon.dashboard.machine_learning.experiments.resourceType', 'OS::Meteos::Experiment')
|
||||||
|
.run(run)
|
||||||
|
.config(config);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ngdoc constant
|
||||||
|
* @name horizon.dashboard.machine_learning.experiments.events
|
||||||
|
* @description A list of events used by Experiment
|
||||||
|
*/
|
||||||
|
function events() {
|
||||||
|
return {
|
||||||
|
CREATE_SUCCESS: 'horizon.dashboard.machine_learning.experiments.CREATE_SUCCESS',
|
||||||
|
DELETE_SUCCESS: 'horizon.dashboard.machine_learning.experiments.DELETE_SUCCESS'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
run.$inject = [
|
||||||
|
'horizon.framework.conf.resource-type-registry.service',
|
||||||
|
'horizon.app.core.openstack-service-api.meteos',
|
||||||
|
'horizon.dashboard.machine_learning.experiments.basePath',
|
||||||
|
'horizon.dashboard.machine_learning.experiments.resourceType'
|
||||||
|
];
|
||||||
|
|
||||||
|
function run(registry, meteos, basePath, resourceType) {
|
||||||
|
registry.getResourceType(resourceType)
|
||||||
|
.setNames(gettext('Machine Learning'), gettext('Experiments'))
|
||||||
|
// for detail summary view on table row.
|
||||||
|
.setSummaryTemplateUrl(basePath + 'details/drawer.html')
|
||||||
|
// for table row items and detail summary view.
|
||||||
|
.setProperty('name', {
|
||||||
|
label: gettext('Name')
|
||||||
|
})
|
||||||
|
.setProperty('id', {
|
||||||
|
label: gettext('ID')
|
||||||
|
})
|
||||||
|
.setProperty('status', {
|
||||||
|
label: gettext('Status')
|
||||||
|
})
|
||||||
|
.setProperty('key_name', {
|
||||||
|
label: gettext('Key Name')
|
||||||
|
})
|
||||||
|
.setProperty('management_network', {
|
||||||
|
label: gettext('Management Network')
|
||||||
|
})
|
||||||
|
.setListFunction(listFunction)
|
||||||
|
.tableColumns
|
||||||
|
.append({
|
||||||
|
id: 'name',
|
||||||
|
priority: 1,
|
||||||
|
sortDefault: true,
|
||||||
|
filters: ['noName'],
|
||||||
|
urlFunction: urlFunction
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
id: 'id',
|
||||||
|
priority: 3
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
id: 'status',
|
||||||
|
priority: 2
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
id: 'key_name',
|
||||||
|
priority: 2
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
id: 'management_network',
|
||||||
|
priority: 2
|
||||||
|
})
|
||||||
|
// for magic-search
|
||||||
|
registry.getResourceType(resourceType).filterFacets
|
||||||
|
.append({
|
||||||
|
'label': gettext('Name'),
|
||||||
|
'name': 'name',
|
||||||
|
'singleton': true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
'label': gettext('ID'),
|
||||||
|
'name': 'id',
|
||||||
|
'singleton': true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
'label': gettext('Status'),
|
||||||
|
'name': 'status',
|
||||||
|
'singleton': true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
'label': gettext('Key Name'),
|
||||||
|
'name': 'key_name',
|
||||||
|
'singleton': true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
'label': gettext('Management Network'),
|
||||||
|
'name': 'management_network',
|
||||||
|
'singleton': true
|
||||||
|
});
|
||||||
|
|
||||||
|
function listFunction(params) {
|
||||||
|
return meteos.getExperiments(params).then(modifyResponse);
|
||||||
|
|
||||||
|
function modifyResponse(response) {
|
||||||
|
return {data: {items: response.data.items.map(addTrackBy)}};
|
||||||
|
|
||||||
|
function addTrackBy(item) {
|
||||||
|
item.trackBy = item.id;
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function urlFunction(item) {
|
||||||
|
return 'project/ngdetails/OS::Meteos::Experiment/' + item.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config.$inject = [
|
||||||
|
'$provide',
|
||||||
|
'$windowProvider',
|
||||||
|
'$routeProvider'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name config
|
||||||
|
* @param {Object} $provide
|
||||||
|
* @param {Object} $windowProvider
|
||||||
|
* @param {Object} $routeProvider
|
||||||
|
* @description Routes used by this module.
|
||||||
|
* @returns {undefined} Returns nothing
|
||||||
|
*/
|
||||||
|
function config($provide, $windowProvider, $routeProvider) {
|
||||||
|
var path = $windowProvider.$get().STATIC_URL + 'dashboard/machine_learning/experiments/';
|
||||||
|
$provide.constant('horizon.dashboard.machine_learning.experiments.basePath', path);
|
||||||
|
$routeProvider.when('/project/machine_learning/experiments', {
|
||||||
|
templateUrl: path + 'panel.html'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* 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.machine_learning.experiments', function() {
|
||||||
|
it('should exist', function() {
|
||||||
|
expect(angular.module('horizon.dashboard.machine_learning.experiments')).toBeDefined();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
})();
|
@ -0,0 +1,3 @@
|
|||||||
|
.logs {
|
||||||
|
margin-top: 18px;
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
<hz-resource-panel resource-type-name="OS::Meteos::Experiment">
|
||||||
|
<hz-resource-table resource-type-name="OS::Meteos::Experiment"
|
||||||
|
track-by="trackBy"></hz-resource-table>
|
||||||
|
</hz-resource-panel>
|
@ -0,0 +1,66 @@
|
|||||||
|
/**
|
||||||
|
* 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
|
||||||
|
* @ngname horizon.dashboard.machine_learning.learnings.actions
|
||||||
|
*
|
||||||
|
* @description
|
||||||
|
* Provides all of the actions for learnings.
|
||||||
|
*/
|
||||||
|
angular.module('horizon.dashboard.machine_learning.learnings.actions', ['horizon.framework', 'horizon.dashboard.machine_learning'])
|
||||||
|
.run(registerLearningActions);
|
||||||
|
|
||||||
|
registerLearningActions.$inject = [
|
||||||
|
'horizon.framework.conf.resource-type-registry.service',
|
||||||
|
'horizon.framework.util.i18n.gettext',
|
||||||
|
'horizon.dashboard.machine_learning.learnings.create.service',
|
||||||
|
'horizon.dashboard.machine_learning.learnings.delete.service',
|
||||||
|
'horizon.dashboard.machine_learning.learnings.resourceType',
|
||||||
|
];
|
||||||
|
|
||||||
|
function registerLearningActions(
|
||||||
|
registry,
|
||||||
|
gettext,
|
||||||
|
createLearningService,
|
||||||
|
deleteLearningService,
|
||||||
|
resourceType)
|
||||||
|
{
|
||||||
|
var learningsResourceType = registry.getResourceType(resourceType);
|
||||||
|
|
||||||
|
learningsResourceType.globalActions
|
||||||
|
.append({
|
||||||
|
id: 'createLearningAction',
|
||||||
|
service: createLearningService,
|
||||||
|
template: {
|
||||||
|
type: 'create',
|
||||||
|
text: gettext('Create Learning')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
learningsResourceType.batchActions
|
||||||
|
.append({
|
||||||
|
id: 'batchDeleteLearningAction',
|
||||||
|
service: deleteLearningService,
|
||||||
|
template: {
|
||||||
|
type: 'delete-selected',
|
||||||
|
text: gettext('Delete Learnings')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
@ -0,0 +1,56 @@
|
|||||||
|
/**
|
||||||
|
* 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';
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.learnings')
|
||||||
|
.factory('horizon.dashboard.machine_learning.learnings.workflow', learningWorkflow);
|
||||||
|
|
||||||
|
learningWorkflow.$inject = [
|
||||||
|
'horizon.dashboard.machine_learning.basePath',
|
||||||
|
'horizon.app.core.workflow.factory',
|
||||||
|
'horizon.framework.util.i18n.gettext'
|
||||||
|
];
|
||||||
|
|
||||||
|
function learningWorkflow(basePath, dashboardWorkflow, gettext) {
|
||||||
|
return dashboardWorkflow({
|
||||||
|
title: gettext('Create Learning'),
|
||||||
|
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
title: gettext('Info'),
|
||||||
|
templateUrl: basePath + 'learnings/create/info/info.html',
|
||||||
|
helpUrl: basePath + 'learnings/create/info/info.help.html',
|
||||||
|
formName: 'learningInfoForm'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: gettext('Spec'),
|
||||||
|
templateUrl: basePath + 'learnings/create/spec/spec.html',
|
||||||
|
helpUrl: basePath + 'learnings/create/spec/spec.help.html',
|
||||||
|
formName: 'learningSpecForm'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
btnText: {
|
||||||
|
finish: gettext('Create')
|
||||||
|
},
|
||||||
|
|
||||||
|
btnIcon: {
|
||||||
|
finish: 'fa fa-check'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,97 @@
|
|||||||
|
/**
|
||||||
|
* 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.machine_learning.learnings.create.service
|
||||||
|
* @description Service for the learning create modal
|
||||||
|
*/
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.learnings')
|
||||||
|
.factory('horizon.dashboard.machine_learning.learnings.create.service', createService);
|
||||||
|
|
||||||
|
createService.$inject = [
|
||||||
|
'$location',
|
||||||
|
'horizon.app.core.openstack-service-api.policy',
|
||||||
|
'horizon.framework.util.actions.action-result.service',
|
||||||
|
'horizon.framework.util.i18n.gettext',
|
||||||
|
'horizon.framework.util.q.extensions',
|
||||||
|
'horizon.framework.widgets.modal.wizard-modal.service',
|
||||||
|
'horizon.framework.widgets.toast.service',
|
||||||
|
'horizon.dashboard.machine_learning.learnings.learningModel',
|
||||||
|
'horizon.dashboard.machine_learning.learnings.events',
|
||||||
|
'horizon.dashboard.machine_learning.learnings.resourceType',
|
||||||
|
'horizon.dashboard.machine_learning.learnings.workflow'
|
||||||
|
];
|
||||||
|
|
||||||
|
function createService(
|
||||||
|
$location, policy, actionResult, gettext, $qExtensions, wizardModalService, toast, model, events, resourceType, createWorkflow
|
||||||
|
) {
|
||||||
|
var scope;
|
||||||
|
var message = {
|
||||||
|
success: gettext('Learning %s was successfully created.')
|
||||||
|
};
|
||||||
|
|
||||||
|
var service = {
|
||||||
|
initAction: initAction,
|
||||||
|
perform: perform,
|
||||||
|
allowed: allowed
|
||||||
|
};
|
||||||
|
|
||||||
|
return service;
|
||||||
|
|
||||||
|
//////////////
|
||||||
|
|
||||||
|
function initAction() {
|
||||||
|
}
|
||||||
|
|
||||||
|
function perform(selected, newScope) {
|
||||||
|
scope = newScope;
|
||||||
|
scope.workflow = createWorkflow;
|
||||||
|
scope.model = model;
|
||||||
|
scope.model.init();
|
||||||
|
// for creation according to selected item
|
||||||
|
scope.selected = selected;
|
||||||
|
return wizardModalService.modal({
|
||||||
|
scope: scope,
|
||||||
|
workflow: createWorkflow,
|
||||||
|
submit: submit
|
||||||
|
}).result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function allowed() {
|
||||||
|
return $qExtensions.booleanAsPromise(true);
|
||||||
|
//return policy.ifAllowed({ rules: [['learning', 'add_learning']] });
|
||||||
|
}
|
||||||
|
|
||||||
|
function submit(){
|
||||||
|
return model.createLearning().then(success);
|
||||||
|
}
|
||||||
|
|
||||||
|
function success(response) {
|
||||||
|
response.data.id = response.data.id;
|
||||||
|
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/machine_learning/learnings');
|
||||||
|
}else{
|
||||||
|
return result.result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,8 @@
|
|||||||
|
<dl>
|
||||||
|
<dt translate>Learning Name</dt>
|
||||||
|
<dd translate>An arbitrary human-readable name.</dd>
|
||||||
|
<dt translate>Learning Description</dt>
|
||||||
|
<dd translate>An arbitrary human-readable description.</dd>
|
||||||
|
<dt translate>Template</dt>
|
||||||
|
<dd translate>Name or ID of learning template.</dd>
|
||||||
|
</dl>
|
@ -0,0 +1,32 @@
|
|||||||
|
<div ng-controller="createLearningInfoController as ctrl">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="learning-name" translate>Learning Name</label>
|
||||||
|
<input name="learning-name" type="text" class="form-control" id="learning-name"
|
||||||
|
ng-model="model.newLearningSpec.display_name"
|
||||||
|
placeholder="{$ 'Name of the learning to create.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="learning-description" translate>Learning Description</label>
|
||||||
|
<input name="learning-description" type="text" class="form-control" id="learning-description"
|
||||||
|
ng-model="model.newLearningSpec.display_description"
|
||||||
|
placeholder="{$ 'Description of the learning to create.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="learning-model-id">
|
||||||
|
<translate>Template</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<input name="learning-model-id" type="text" class="form-control" id="learning-model-id"
|
||||||
|
ng-model="model.newLearningSpec.model_id"
|
||||||
|
ng-required="true"
|
||||||
|
placeholder="{$ 'Name or ID of the template.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,34 @@
|
|||||||
|
/**
|
||||||
|
* 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 controller
|
||||||
|
* @name createLearningInfoController
|
||||||
|
* @ngController
|
||||||
|
* @description
|
||||||
|
* Controller for the learning info step in create workflow
|
||||||
|
*/
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.learnings')
|
||||||
|
.controller('createLearningInfoController', createLearningInfoController);
|
||||||
|
|
||||||
|
createLearningInfoController.$inject = [
|
||||||
|
];
|
||||||
|
|
||||||
|
function createLearningInfoController() {
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,71 @@
|
|||||||
|
/**
|
||||||
|
* 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';
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.learnings')
|
||||||
|
.factory('horizon.dashboard.machine_learning.learnings.learningModel', learningModel);
|
||||||
|
|
||||||
|
learningModel.$inject = [
|
||||||
|
'horizon.app.core.openstack-service-api.meteos'
|
||||||
|
];
|
||||||
|
|
||||||
|
function learningModel(meteos) {
|
||||||
|
var model = {
|
||||||
|
newLearningSpec: {},
|
||||||
|
|
||||||
|
// API methods
|
||||||
|
init: init,
|
||||||
|
createLearning: createLearning
|
||||||
|
};
|
||||||
|
|
||||||
|
function initNewLearningSpec() {
|
||||||
|
model.newLearningSpec = {
|
||||||
|
display_name: null,
|
||||||
|
display_description: null,
|
||||||
|
model_id: null,
|
||||||
|
method: null,
|
||||||
|
args: null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
// Reset the new Learning spec
|
||||||
|
initNewLearningSpec();
|
||||||
|
}
|
||||||
|
|
||||||
|
function createLearning() {
|
||||||
|
var finalSpec = angular.copy(model.newLearningSpec);
|
||||||
|
|
||||||
|
cleanNullProperties(finalSpec);
|
||||||
|
|
||||||
|
return meteos.createLearning(finalSpec);
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanNullProperties(finalSpec) {
|
||||||
|
// Initially clean fields that don't have any value.
|
||||||
|
// Not only "null", blank too.
|
||||||
|
for (var key in finalSpec) {
|
||||||
|
if (finalSpec.hasOwnProperty(key) && finalSpec[key] === null
|
||||||
|
|| finalSpec[key] === "") {
|
||||||
|
delete finalSpec[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,14 @@
|
|||||||
|
<dl>
|
||||||
|
<dt translate>Spark Version</dt>
|
||||||
|
<dd translate> Version of Apache Spark.</dd>
|
||||||
|
<dt translate>Master Nodes</dt>
|
||||||
|
<dd translate> Number of Master Node.</dd>
|
||||||
|
<dt translate>Master Flavor</dt>
|
||||||
|
<dd translate> Flavor ID of Master Node.</dd>
|
||||||
|
<dt translate>Worker Nodes</dt>
|
||||||
|
<dd translate> Number of Worker Node.</dd>
|
||||||
|
<dt translate>Worker Flavor</dt>
|
||||||
|
<dd translate> Flavor ID of Worker Node.</dd>
|
||||||
|
<dt translate>Floating IP Pool</dt>
|
||||||
|
<dd translate> The UUID of Neutron External Network.</dd>
|
||||||
|
</dl>
|
@ -0,0 +1,28 @@
|
|||||||
|
<div ng-controller="createLearningSpecController as ctrl">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="learning-method">
|
||||||
|
<translate>Method</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<input name="learning-method" type="text" class="form-control" id="learning-method"
|
||||||
|
ng-model="model.newLearningSpec.method"
|
||||||
|
ng-required="true"
|
||||||
|
placeholder="{$ 'Currently, a predict method is only supported.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="learning-args">
|
||||||
|
<translate>Input Data</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<input name="learning-args" type="text" class="form-control" id="learning-args"
|
||||||
|
ng-model="model.newLearningSpec.args"
|
||||||
|
ng-required="true"
|
||||||
|
placeholder="{$ 'Input Data for Prediction.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* 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 controller
|
||||||
|
* @name createLearningSpecController
|
||||||
|
* @ngController
|
||||||
|
* @description
|
||||||
|
* Controller for the learning spec step in create workflow
|
||||||
|
*/
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.learnings')
|
||||||
|
.controller('createLearningSpecController', createLearningSpecController);
|
||||||
|
|
||||||
|
createLearningSpecController.$inject = [
|
||||||
|
'$scope',
|
||||||
|
'horizon.framework.util.i18n.gettext'
|
||||||
|
];
|
||||||
|
|
||||||
|
function createLearningSpecController($scope, gettext) {
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,149 @@
|
|||||||
|
/**
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use self 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';
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.learnings')
|
||||||
|
.factory('horizon.dashboard.machine_learning.learnings.delete.service', deleteService);
|
||||||
|
|
||||||
|
deleteService.$inject = [
|
||||||
|
'$location',
|
||||||
|
'$q',
|
||||||
|
'horizon.app.core.openstack-service-api.meteos',
|
||||||
|
'horizon.app.core.openstack-service-api.policy',
|
||||||
|
'horizon.framework.util.actions.action-result.service',
|
||||||
|
'horizon.framework.util.i18n.gettext',
|
||||||
|
'horizon.framework.util.q.extensions',
|
||||||
|
'horizon.framework.widgets.modal.deleteModalService',
|
||||||
|
'horizon.framework.widgets.toast.service',
|
||||||
|
'horizon.dashboard.machine_learning.learnings.resourceType',
|
||||||
|
'horizon.dashboard.machine_learning.learnings.events'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ngDoc factory
|
||||||
|
* @name horizon.dashboard.machine_learning.learnings.delete.service
|
||||||
|
* @Description
|
||||||
|
* Brings up the delete learnings confirmation modal dialog.
|
||||||
|
* On submit, delete selected resources.
|
||||||
|
* On cancel, do nothing.
|
||||||
|
*/
|
||||||
|
function deleteService(
|
||||||
|
$location, $q, meteos, policy, actionResult, gettext, $qExtensions, deleteModal, toast, resourceType, events
|
||||||
|
) {
|
||||||
|
var scope;
|
||||||
|
var context = {
|
||||||
|
labels: null,
|
||||||
|
deleteEntity: deleteEntity,
|
||||||
|
successEvent: events.DELETE_SUCCESS
|
||||||
|
};
|
||||||
|
var service = {
|
||||||
|
initAction: initAction,
|
||||||
|
allowed: allowed,
|
||||||
|
perform: perform
|
||||||
|
};
|
||||||
|
var notAllowedMessage = gettext("You are not allowed to delete learnings: %s");
|
||||||
|
|
||||||
|
return service;
|
||||||
|
|
||||||
|
//////////////
|
||||||
|
|
||||||
|
function initAction() {
|
||||||
|
}
|
||||||
|
|
||||||
|
function allowed() {
|
||||||
|
return $qExtensions.booleanAsPromise(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete selected resource objects
|
||||||
|
function perform(selected, newScope) {
|
||||||
|
scope = newScope;
|
||||||
|
var selected = angular.isArray(selected) ? selected : [selected];
|
||||||
|
context.labels = labelize(selected.length);
|
||||||
|
return $qExtensions.allSettled(selected.map(checkPermission)).then(afterCheck);
|
||||||
|
}
|
||||||
|
|
||||||
|
function labelize(count){
|
||||||
|
return {
|
||||||
|
title: ngettext('Confirm Delete Learning',
|
||||||
|
'Confirm Delete Learnings', count),
|
||||||
|
/* eslint-disable max-len */
|
||||||
|
message: ngettext('You have selected "%s". Please confirm your selection. Deleted learning is not recoverable.',
|
||||||
|
'You have selected "%s". Please confirm your selection. Deleted learnings are not recoverable.', count),
|
||||||
|
/* eslint-enable max-len */
|
||||||
|
submit: ngettext('Delete Learning',
|
||||||
|
'Delete Learnings', count),
|
||||||
|
success: ngettext('Deleted Learning: %s.',
|
||||||
|
'Deleted Learnings: %s.', count),
|
||||||
|
error: ngettext('Unable to delete Learning: %s.',
|
||||||
|
'Unable to delete Learnings: %s.', count)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// for batch delete
|
||||||
|
function checkPermission(selected) {
|
||||||
|
return {promise: allowed(selected), context: selected};
|
||||||
|
}
|
||||||
|
|
||||||
|
// for batch delete
|
||||||
|
function afterCheck(result){
|
||||||
|
var outcome = $q.reject(); // Reject the promise by default
|
||||||
|
if (result.fail.length > 0) {
|
||||||
|
toast.add('error', getMessage(notAllowedMessage, result.fail));
|
||||||
|
outcome = $q.reject(result.fail);
|
||||||
|
}
|
||||||
|
if (result.pass.length > 0) {
|
||||||
|
outcome = deleteModal.open(scope, result.pass.map(getEntity), context).then(createResult);
|
||||||
|
}
|
||||||
|
return outcome;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createResult(deleteModalResult) {
|
||||||
|
// To make the result of this action generically useful, reformat the return
|
||||||
|
// from the deleteModal into a standard form
|
||||||
|
var result = actionResult.getActionResult();
|
||||||
|
deleteModalResult.pass.forEach(function markDeleted(item) {
|
||||||
|
result.deleted(resourceType, getEntity(item).id);
|
||||||
|
});
|
||||||
|
deleteModalResult.fail.forEach(function markFailed(item) {
|
||||||
|
result.failed(resourceType, getEntity(item).id);
|
||||||
|
});
|
||||||
|
if(result.result.failed.length == 0 && result.result.deleted.length > 0){
|
||||||
|
$location.path('/project/machine_learning/learnings');
|
||||||
|
}else{
|
||||||
|
return result.result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getMessage(message, entities) {
|
||||||
|
return interpolate(message, [entities.map(getName).join(", ")]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getName(result) {
|
||||||
|
return getEntity(result).name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// for batch delete
|
||||||
|
function getEntity(result) {
|
||||||
|
return result.context;
|
||||||
|
}
|
||||||
|
|
||||||
|
// call delete REST API
|
||||||
|
function deleteEntity(id){
|
||||||
|
return meteos.deleteLearning(id, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* 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 controller
|
||||||
|
* @name horizon.dashboard.machine_learning.learnings.DrawerController
|
||||||
|
* @description
|
||||||
|
* This is the controller for the drawer (summary) view.
|
||||||
|
* Its primary purpose is to provide the metadata definitions to
|
||||||
|
* the learning via the ctrl.metadataDefs member.
|
||||||
|
*/
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.learnings')
|
||||||
|
.controller('horizon.dashboard.machine_learning.learnings.DrawerController', controller);
|
||||||
|
|
||||||
|
controller.$inject = [
|
||||||
|
];
|
||||||
|
|
||||||
|
function controller() {
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
@ -0,0 +1,14 @@
|
|||||||
|
<div ng-controller="horizon.dashboard.machine_learning.learnings.DrawerController as drawerCtrl">
|
||||||
|
<div class="row">
|
||||||
|
<span class="rsp-alt-p3">
|
||||||
|
<dl class="col-md-4">
|
||||||
|
<dt translate>ID</dt>
|
||||||
|
<dd>{$ item.id $}</dd>
|
||||||
|
</dl>
|
||||||
|
<dl class="col-md-4">
|
||||||
|
<dt translate>Description</dt>
|
||||||
|
<dd>{$ item.description $}</dd>
|
||||||
|
</dl>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,180 @@
|
|||||||
|
/**
|
||||||
|
* 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.machine_learning.learnings
|
||||||
|
* @ngModule
|
||||||
|
* @description
|
||||||
|
* Provides all the services and widgets require to display the learning
|
||||||
|
* panel
|
||||||
|
*/
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.machine_learning.learnings', [
|
||||||
|
'ngRoute',
|
||||||
|
'horizon.dashboard.machine_learning.learnings.actions'
|
||||||
|
])
|
||||||
|
.constant('horizon.dashboard.machine_learning.learnings.events', events())
|
||||||
|
.constant('horizon.dashboard.machine_learning.learnings.resourceType', 'OS::Meteos::Learning')
|
||||||
|
.run(run)
|
||||||
|
.config(config);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ngdoc constant
|
||||||
|
* @name horizon.dashboard.machine_learning.learnings.events
|
||||||
|
* @description A list of events used by Learning
|
||||||
|
*/
|
||||||
|
function events() {
|
||||||
|
return {
|
||||||
|
CREATE_SUCCESS: 'horizon.dashboard.machine_learning.learnings.CREATE_SUCCESS',
|
||||||
|
DELETE_SUCCESS: 'horizon.dashboard.machine_learning.learnings.DELETE_SUCCESS'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
run.$inject = [
|
||||||
|
'horizon.framework.conf.resource-type-registry.service',
|
||||||
|
'horizon.app.core.openstack-service-api.meteos',
|
||||||
|
'horizon.dashboard.machine_learning.learnings.basePath',
|
||||||
|
'horizon.dashboard.machine_learning.learnings.resourceType'
|
||||||
|
];
|
||||||
|
|
||||||
|
function run(registry, meteos, basePath, resourceType) {
|
||||||
|
registry.getResourceType(resourceType)
|
||||||
|
.setNames(gettext('Machine Learning'), gettext('Learnings'))
|
||||||
|
// for detail summary view on table row.
|
||||||
|
.setSummaryTemplateUrl(basePath + 'details/drawer.html')
|
||||||
|
// for table row items and detail summary view.
|
||||||
|
.setProperty('name', {
|
||||||
|
label: gettext('Name')
|
||||||
|
})
|
||||||
|
.setProperty('id', {
|
||||||
|
label: gettext('ID')
|
||||||
|
})
|
||||||
|
.setProperty('status', {
|
||||||
|
label: gettext('Status')
|
||||||
|
})
|
||||||
|
.setProperty('type', {
|
||||||
|
label: gettext('Model Type')
|
||||||
|
})
|
||||||
|
.setProperty('args', {
|
||||||
|
label: gettext('Input Data')
|
||||||
|
})
|
||||||
|
.setProperty('stdout', {
|
||||||
|
label: gettext('Result')
|
||||||
|
})
|
||||||
|
.setListFunction(listFunction)
|
||||||
|
.tableColumns
|
||||||
|
.append({
|
||||||
|
id: 'name',
|
||||||
|
priority: 1,
|
||||||
|
sortDefault: true,
|
||||||
|
filters: ['noName'],
|
||||||
|
urlFunction: urlFunction
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
id: 'id',
|
||||||
|
priority: 3
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
id: 'status',
|
||||||
|
priority: 2
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
id: 'type',
|
||||||
|
priority: 2
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
id: 'args',
|
||||||
|
priority: 2
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
id: 'stdout',
|
||||||
|
priority: 2
|
||||||
|
})
|
||||||
|
// for magic-search
|
||||||
|
registry.getResourceType(resourceType).filterFacets
|
||||||
|
.append({
|
||||||
|
'label': gettext('Name'),
|
||||||
|
'name': 'name',
|
||||||
|
'singleton': true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
'label': gettext('ID'),
|
||||||
|
'name': 'id',
|
||||||
|
'singleton': true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
'label': gettext('Status'),
|
||||||
|
'name': 'status',
|
||||||
|
'singleton': true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
'label': gettext('Model Type'),
|
||||||
|
'name': 'type',
|
||||||
|
'singleton': true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
'label': gettext('Input Data'),
|
||||||
|
'name': 'args',
|
||||||
|
'singleton': true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
'label': gettext('Result'),
|
||||||
|
'name': 'stdout',
|
||||||
|
'singleton': true
|
||||||
|
});
|
||||||
|
|
||||||
|
function listFunction(params) {
|
||||||
|
return meteos.getLearnings(params).then(modifyResponse);
|
||||||
|
|
||||||
|
function modifyResponse(response) {
|
||||||
|
return {data: {items: response.data.items.map(addTrackBy)}};
|
||||||
|
|
||||||
|
function addTrackBy(item) {
|
||||||
|
item.trackBy = item.id;
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function urlFunction(item) {
|
||||||
|
return 'project/ngdetails/OS::Meteos::Learning/' + item.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config.$inject = [
|
||||||
|
'$provide',
|
||||||
|
'$windowProvider',
|
||||||
|
'$routeProvider'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name config
|
||||||
|
* @param {Object} $provide
|
||||||
|
* @param {Object} $windowProvider
|
||||||
|
* @param {Object} $routeProvider
|
||||||
|
* @description Routes used by this module.
|
||||||
|
* @returns {undefined} Returns nothing
|
||||||
|
*/
|
||||||
|
function config($provide, $windowProvider, $routeProvider) {
|
||||||
|
var path = $windowProvider.$get().STATIC_URL + 'dashboard/machine_learning/learnings/';
|
||||||
|
$provide.constant('horizon.dashboard.machine_learning.learnings.basePath', path);
|
||||||
|
$routeProvider.when('/project/machine_learning/learnings', {
|
||||||
|
templateUrl: path + 'panel.html'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* 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.machine_learning.learnings', function() {
|
||||||
|
it('should exist', function() {
|
||||||
|
expect(angular.module('horizon.dashboard.machine_learning.learnings')).toBeDefined();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
})();
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user