There is a duplicated keyword in the list of keywords specified for
translation. This is incorrect and should be ugettext_noop.
Change-Id: Ie8b5b91255412cb6615e758a4c5615bee9989b4f
Closes-Bug: #1472385
An approach to i18n for Angular HTML templates using babel. This patch
allows only singular translation. Plurals and context will be
addressed in subsequent patches.
Based on Thai Tran's work at https://review.openstack.org/#/c/187321
This patch implements a custom extractor in
horizon/utils/babel_extract_angular.py. pybabel really wants this to be
a package installed into site-packages. I have not done this so as to
avoid introducing a dependency on another change to global requirements
just yet. I will upload a package to pypi in parallel so that we can
start using it in the future.
For now, I have had to modify tools/with_venv.sh to add horizon to the
PYTHONPATH. This is less than ideal but seemed to be the least worst
option.
Steps to verify that it works:
1. Create a new html file in horizon/static or openstack_dashboard/static
2. Add something like <div translate>hello world!</div> to the html
To test interpolation add something like:
<div translate>hello {$name$}!</div>
3. Run ./run_tests.sh --makemessages
4. Inspect your djangojs.po file, it should be there.
The following steps are optional:
5. Run ./run_tests.sh --pseudo de
6. Run ./run_tests.sh --compilemessages
7. Go to http://localhost:8000/settings
8. Change Language to Deutsch
9. Go to http://localhost:8000/i18n/js/horizon+openstack_dashboard
10. Your translated text should be there as well.
Note: There are now unit tests as well.
Partially-Implements: blueprint angular-translate-makemessages
Depends on: If4352aba01ce0ca6337f590c0689d8fe9f0867c8
Change-Id: I26d4fef8646d5f038918cd3376dbbdbef37eb603
JSHint is being deprecated by the Horizon project. This removes all
references, commands, and documentation related to this tool. The
patch depends on the deactivation patch for jshint in infra.
Change-Id: I1a799f39023e0598a58d912a4288300ec8340dd9
Depends-on: Ifb59af36ae37926133769c655e54f4c2e1edf095
Partially-Implements: blueprint jscs-cleanup
This patch switches horizon from using JSCS to using ESlint. It
adds the john papa style guides as an eslint plugin, and deactivates
additional linting rules so current cleanup efforts can focus on the
issues remaining from JSCS. Once that cleanup effort is complete,
we can switch our linting job to voting and move forward from there.
YAML for .eslintrc was chosen because the JSON specification does
not allow comments, and having comments (including rule links) will
make it easier to discuss linting changes.
Deactivated eslint rules have each been annotated with a # TODO
statement, so we can address them in the future. Links in the
documentation have been updated to new contributor guidelines, which
will be updated after this patch lands.
Linting may be executed by first installing npm dependencies using
`npm install`, and then executing `npm run lint` at any time in the
future. No python venv is required.
For clarification: We are switching to ESLint because JSCS explicitly
focuses on code-style, not on language use errors. For that purpose,
JSCS explicitly defers to JSHint, which due to the 'do no evil' license is
not usable. Since ESLint provides both the codestyle functionality, and
the language use checks, of both JSCS and JSHint, it was deemed the
only viable tool,
http://lists.openstack.org/pipermail/openstack-dev/2015-June/067030.html
Change-Id: Ib4c3f77f8cc3cdaa3c7558b7bc3a6d1299b6dcbe
Partially-Implements: blueprint jscs-cleanup
These English po files are not needed anymore, they are the source files.
Update run_tests.sh to use the .pot files as source for generation of
pseudos.
Update transifex config file so that it references the new pot files.
Depends-On: Ibd7069c68e458d655a879e552f69f7146b47abc9
Change-Id: I6c6989176fd7c969ad6cb4ecb4ff4f5e4641e723
All other OpenStack projects use *.pot files for the source language.
In the OpenStack CI scripts, we need to special case horizon since
it uses */locale/en/LC_MESSAGES/*po instead. Remove the special handling
from the horizon scripts so that we can simplify the CI scripts.
Note that this simplifies also the run_tests.sh script.
Add empty files for the pot files so that the infra scripts will work.
The next import from the Proposol Bot will add real content for these
files.
Change-Id: I2ae68207994ba549b5d8e551a40a468d63e0a4bb
Replace django's makemessages with babel and babel-django.
This changes the makemessages command to use babel rather than
Django's builtin makemessages.
There is a follow on patch to add support for angular-gettext.
Change-Id: If4352aba01ce0ca6337f590c0689d8fe9f0867c8
Depends-On: Iaa835b03af3929b7314b174210079c34de976755
Establish features for running Karma tests. Separate karma configurations
are used due to current overlap of template file structure.
You can run the karma tests via:
./run_tests.sh --karma
The Karma framework allows for many features like unit test coverage and
provides a common configuration for different test runners.
Change-Id: I79680ef6369383c148da68e6677945886a48df81
Implements: blueprint karma
This patch simply renames:
horizon/horizon/static/angular
to:
horizon/horizon/static/framework
This is one step in a larger effort to restructure the Angular
source. See https://review.openstack.org/#/c/176152/ for the
full set of planned changes.
Partial-Bug: 1454880
Change-Id: I2bbcc64caa42f97c7d92688f4c5d7915146966bc
We now have javascript files in openstack_dashboard as well. However,
the run_test script does not account for this and only run translation on
the horizon folder. This patch address this problem. Also removed the
invalid gettext('') since that causes the msgid to be blank.
Steps to test:
1. ./run_tests.sh --makemessages
2. ./run_tests.sh --pseudo de
3. ./run_tests.sh --compilemessages
4. set LAUNCH_INSTANCE_NG_ENABLED = True in local_settings.py
5. localhost:8001/settings/ and change to deutsch
6. localhost:port/project/instances/ and click on launch instance
Co-Authored-By: Doug Fish <drfish@us.ibm.com>
Change-Id: If1cd1937d40d359a4a4ecd75406f62e8f8802082
Closes-bug: #1444150
Establishes the ability to have JSCS (JS Code Style) run from the
run_tests.sh script. Also provides basis for code style configuration.
Co-Authored-By: Brian Tully <brian.tully@hp.com>
Change-Id: Ib22da5ae05c353d12507a1809ec79e93379acecf
Closes-Bug: 1450626
- Setting up base launch instance wizard to enable parallel
development on steps in the work flow.
- Adding business logic related code to openstack_dashboard
project.
- Using Horizon's well-defined plug-in architecture to hook
launch instance to Horizon.
Partially Implements: blueprint launch-instance-redesign
Change-Id: Ibbbbfc7f49c58a78b0d1b29e363531d5ae1a9aab
- Including JS files under horizon/static/angular/ folder.
- Adding .jshintrc to allow globals defined by jQuery, Angular,
Angular mock, Jasmine, d3 and jsi18n.
- Allowing global strict mode in spec files.
Change-Id: I07359a4b3044cd5f675eef3b7df99398df909f81
Closes-Bug: #1419625
A tool to allow pseudo translations to be created in order to identify
potential translation problems. To use the tool:
Make sure your English file is up to date:
./run_tests.sh --makemessages
Run the pseudo tool to create pseudo translations:
./run_tests.sh --pseudo de
Compile the catalog:
./run_tests.sh --compilemessages
Run your dev server. Log in and change to the language you pseudo translated.
It should look weird. More specifically, every translatable string is going
to start and end with a bracket and they are going to have some added
characters. For example, "Log In" will become "[~Log In~您好яшçあ]"
This is useful because you can inspect for the following:
- If you see a string in English it's not translatable. Should it be?
- If you see brackets next to each other that might be concatenation.
- If there is unexpected wrapping/truncation there might not be enough
space for translations
- If you see a string in the proper translated language, it comes from an
external source. (That's not bad, just sometimes useful to know)
- If you get new crashes, there is probably a bug. :-)
Implements blueprint: pseudo-translation-tool
Change-Id: If97754c2d4234b12b3d73616ff60527f6ad82d55
It is painful to increment the venv version manually because
requirements.txt and test-requirements.txt are now updated by cron job.
This commit changes run_tests.sh to just store two requirements
files to .venv/environments file and check if it is up-to-date.
(Note that the environment cache file is moved to .venv directory
as there is no reason to store it in the top directory.)
Closes-Bug: #1376485
Change-Id: Ie44ccf6e2e65890baca3f316468254b600c518b1
This commit adds a check of extracting message catalogs to
tox PEP8 check. It is useful to avoid a bug like bug 1379054.
It also fixes a warning "WARNING:root:No local_settings file found."
in run_tests.sh --makemessages and --compilemessages by specifying
Django settings.
Closes-Bug: #1379507
Change-Id: I5541e28a87d48601202bf8180a18eadb5a91770b
This uses the xstatic-packaged versions of bootstrap and bootstrap-datepicker.
It requires newer versions of pyscss and django-pyscss, as there were some
bugs in there that were just fixed upstream.
Change-Id: I0a7660d29fecde915eb46916453a9ea96296798d
Implements: bluperint remove-javascript-bundling
Closes-bug: #1375883
This points to datepicker 1.3.1 in xstatic.
Also fixes a couple of minor bugs in forms with
the new datepicker. The datepicker patch is:
https://review.openstack.org/#/c/116866/
Change-Id: I0a8cb7a16e50addbbdb10df8bdd4be427937bd81
Closes-Bug: 1361666
Recent requirements updates have not been reflected in the
environment version.
Change-Id: Icaf4a3260725e6229bc174b72e5a2feeb8fe4cdf
Closes-Bug: #1365107
"run_tests.sh -p" always checks every file for errors even though you
have probably only changed a handful. This patch adds "run_tests.sh -8"
which only checks the files that were modified in the HEAD commit or
the current working tree.
It is borrowed from the recent nova commit b011325cc6.
The related ML post is:
http://lists.openstack.org/pipermail/openstack-dev/2014-August/043346.html
Change-Id: If3c8e5e3e442257f796374edba02c3a23a85839e
Remove all external JS libraries from Horizon, and pull them in as
xstatic packages instead.
Bootstrap, jquery-ui and jquery.bootstrap.wizard will be unbundled in separate
patches, as there are some problems adding them to global-requirements.
Partial-Implements: blueprint remove-javascript-bundling
Change-Id: Icbbcf8e58db2dcce96d187f7307201f728812cd2
Added nodeenv as a test requirement.
Added a jshint environment to tox.ini, which installs node.js into the
python virtual environment with nodeenv, installs jshint using npm,
and calls runtest.sh to run the tests.
runtest.sh now supports the -j|--jshint flags to run jshint on the
javascript files. jshint must be installed before running runtest.sh
The documentation also got updated to include some info about jshint.
This patch does not add jshint to the OpenStack codebase, just provides
a way to install it for testing, to avoid license clash (jshint has a
slightly modified MIT license, which is incompatible with OpenStack's
Apache license).
Change-Id: I9dd0743eaee50fdba3dbb527c29f2501bdd44ca6
Implements: blueprint node-toolchain
Implements: blueprint jshint-codestyle
When building the documentation via run_tests.sh, doc/source/conf.py
explicitly sets the DJANGO_SETTINGS_MODULE environment variable,
overriding any existing value that it already has. Furthermore, it sets
it to point to a settings file that does not use keystone v3, which
is expected by the tests (and is the source of the warning). Note that
when running unit tests via run_tests.sh, a different settings file is
supplied which DOES use keystone v3.
Change the doc/source/conf.py to only set DJANGO_SETTINGS_MODULE if it
is not already set. Change tox.ini and run_tests.sh to set
DJANGO_SETTINGS_MODULE to the same settings file used by the unit tests,
with keystone v3 support.
Change-Id: Ib297e4188f2426cf575300998bc9d50f36e48f4f
Closes-Bug: #1257725
- Add requirement for xfvbwrapper
- Add CLI option for running tests headless
- Update Selenium TestCase to start virtual display if the option is set
- Update documentation about running Selenium tests
Change-Id: Icb1ac3491b8eef6c168bf1421cf073da67600982
Closes-Bug: #1290329
When coverage module is installed using a package from Debian/Ubuntu,
the command name is "python-coverage". By using "python -m coverage"
the coverage module is detected in both cases.
Change-Id: Icf9084855b83d0cc721de5325f38cf72ac85ff81
Closes-Bug: #1241332
Co-Authored-By: florent <florent.flament-ext@cloudwatt.com>
In django-based projects, we need to specify DJANGO_SETTINGS_MODULE
when running docs build. It is required to addresses the warnings of
docs build job in the gate.
This commit also changes run_tests.sh --docs to use "python setup.py
build_sphinx" to match tox docs env. This change addresses all sphinx
build warning except keystone v3 related following warning.
I believe it is useful.
NoReverseMatch: u'domains' is not a registered namespace
inside 'horizon:admin'
Closes-Bug: #1302532
Related-Bug: #1257725
Change-Id: I3663b81b58be3c6cb05e4af914f768c28b21ea07
./run_tests.sh --compilemessages compiles all languages including
English, but English is the source language and there is no need
to have compiled message catalogs for English.
Also this commit update the description of --makemessages.
Change-Id: I30cf4336cc796e8e3bea71120b6c75ce40aaf888
Closes-Bug: #1261290
In run_tests.sh --makemessages, files under openstack/common are excluded
and "--ignore=openstack/common" option to manage.py makemessages is used
to exclude these files. However, after the default version of Django is
switched to 1.6, "--ignore" option works does not work as previously it
does and strings from openstack/common are included in translation strings.
The reason of this is that ignore pattern is checked against basename of
each file/directory in Django 1.6. We need to specify basename in ignore
patterns: i.e. --ignore=openstack. At now we don't have directories named
as "openstack" other than openstack_dashboard/openstack/common, so it works.
This works both with Django 1.6 and 1.5.
Change-Id: I547be679c2f4ce49bd439b8f629e8720eebdb896
Closes-Bug: #1295920
tests require selenium to be installed, no matter if
integration tests or selenium tests are executed or
not.
Change-Id: Ie55d64c19b00b5b22f62948d4a24a3f322082b0c
Closes-Bug: #1289270
Initial setup for running the integration tests. A basic test is
included to ensure this works, although it will be rewritten to follow
the Page Object pattern. Thanks to Daniel Korn for the initial test.
https://wiki.openstack.org/wiki/Horizon/Testing/UI
Implements blueprint: selenium-integration-testing
Change-Id: Id5b62cdeac5295667a3922f7bed1db3c7617f841
Previously coverage command is always used even if coverage is
not enabled and this makes unit tests slower.
Change-Id: I4311164ef907fbdc66ac66d4999b25054bc9eebd
Closes-Bug: #1272979
Unit tests would fail if run from a symlinked directory.
To fix this, this patch adds the -P switch to the pwd command,
to make sure all files are referred to by their actual paths
and not symlinks.
Change-Id: Ib7087c11f9dc2c44be3aca8cf94db227a2db72f3
Closes-Bug: #1266220
Reduce scope of coverage to horizon/* and openstack_dashboard/*
to get a more accurate % of coverage.
As a bonus, generated report folder size gets reduced ( >50%).
Change-Id: Id375e88ae478277b2af9191937c1b91f4b616250
Specify --extension=html,txt,csv only for openstack_dashboard.
For djangojs, --extension should be 'js'.
This is the cause of the warning.
Change-Id: Ia5ac03fa82c18356b8d210005f8696ae148981bd
Closes-Bug: #1243526
run_tests.sh -N -p
It will call the flake8 installed on your host to detect PEP8, and
the flake8 plugin "OpenStack hacking" may not installed on your
host, so this command may not detect the OpenStack Style Commandment
supplied by hacking(e.g H202).
run_tests.sh -p
it will call the flake8 from virtual env, flake8 plugin "OpenStack
hacking" installed in virtual env will be triggered.
The result from "run_tests.sh -p" should be trusted, and jenkins uses
virtual env to run flake8 too.
When "-N" is enabled, check whether hacking can be imported, if not,
emit warning to stderr to remind user.
Test method
-----------
Suppose hacking is not installed on your host
$ ./run_tests.sh -p
no warning
$ ./run_tests.sh -p -N
emit warning
$ source .venv/bin/activate
$ ./run_tests.sh -p
no warning
$ ./run_tests.sh -p -N
no warning
Close-Bug #1215400
Change-Id: If5125c180a3ebea72dc1fb96817523a6e07b2d66