Since not all services are ready to use the system scope token,
we need a way to disable and enable the use of system scope
token on a per-service basis. This setting let us configure
which services should use the system scope token. By default
the list is empty and system scope token is not used at all.
Change-Id: I5e0cdc7288221571f183a37b800c19dc4cff5707
Kyestone V2 support was removed in Train, so it's safe to do such cleanup.
* Functions which just return horizon settings are dropped and
the settings are referred directly now.
* The service catalog in the sample test data is updated to match
the format of the keystone API v3.
* Related to the above change of the sample service catalog,
openstack_dashboard.test.unit.api.test_keystone.ServiceAPITests is
updated to specify the region name explicitly because 'RegionTwo'
endpoint is no longer the second entry of the endpoint list in the
keystone API v3.
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: Ib60f360c96341fa5c618595f4a9bfdfe7ec5ae83
We don't support Python 2 anymore so we don't need this
compatibility library.
six.reraise usages are left as is until it'll be moved to some
base lib like oslo.utils to not re-implenent this method in
Horizon.
This patch also removes Python2-specific base test case methods
assertItemsEqual and assertNotRegexpMatches in flavor of new
Python 3 analogues.
Change-Id: I26a59176be9e9f213128e4945a58b9459334b626
This commit mainly covers settings in the remaining files
under openstack_dashboard.
Note that HORIZON_CONFIG, horizon and openstack_auth are not covered.
They will be covered by follow-up patches.
Part of blueprint ini-based-configuration
Change-Id: Ibd70e030445a073d9a62da9867850f4893135a89
This commit enables template debug option to detect errors
in template rendering in unit tests.
Several errors in template rendering are found by enabling the
debug option and they are fixed in this commit.
Related-Bug: #1809983
Change-Id: I1a2d19f2eae62e16f02d3386abd65527bac4e7a0
Currently themes machinery works in such way that if we rely on
default theme in our branded theme, we have to include them both into
AVAILABLE_THEMES setting, otherwise default theme assets will be
unavailable and the branded theme assets compilation will fail. On
the other hand, mentioning them both leads to theme picker being
shown - which we would like to avoid (per marketing wish).
SELECTABLE_THEMES setting was added to allow limiting the user facing
themes by configuration.
Closes-bug: #1564543
Co-Authored-By: Ivan Kolodyazhny <e0ne@e0ne.info>
Change-Id: Ic00a9201d2d352685b1089a37a25987b75d6636d
In reviews we usually check import grouping but it is boring.
By using flake8-import-order plugin, we can avoid this.
This flake8 plugin is already used in tempest.
It enforces loose checking so it sounds good to use.
Note that flake8-import-order version is pinned to avoid unexpected
breakage of pep8 job.
Change-Id: I8ccd05eb70350a2441cc2a4d1eafc09ee690b83b
When create a service with region = None,
File "/openstack_dashboard/templatetags/context_selection.py", line 100,
in <lambda>
AttributeError: 'NoneType' object has no attribute 'lower'
The problem code:
sorted(request.user.available_services_regions,
key=lambda x: x.lower())
To fix this, if region is NoneType, use '' as key to put it first in the
list.
Change-Id: Ide8eaeeee634bf1933ef263d3b27204c7711d167
Closes-Bug: #1581667
When makes an inline update to a project name the name in the menu bar
does not get updated after reloading/refreshing the page. This happens
because the menu display is retrieved from a token in the session which
does not get updated until a switch to a different project is made.
This fix addresses this issue by retrieving project name from the request
context variable authorized_tenants which has updated information instead
of session.
Fix doc string to confirm to pep8. Update template tests to account for
tenant name in menu bar. Tests are not setting session variable for tenant
name so previosuly template did not render active tenant name, this fix
does not use session anymore so tests need to account for it.
Change-Id: Ia0d5b51699197904d1a578d188762ef39a4b67cf
Closes-Bug: 1519577
Function sorted() output the result as ASCII sequence in default.
sorted(['Region1', 'myregion']) will not change sequence.
Fix it for tenant list too.
Change-Id: I2e4e546ac70af1f758b618cf253f518a475b8392
Closes-Bug: #1439791
Horizon themes are now configurable at a user level, through the use
of cookies. The themes that can be set are configurable at a
deployment level through settings.py. Horizon can be configured to
run with multiple themes, and allow users to choose which themes
they wish to run.
Django Compressor:
In order to support dynamic themes, each theme configuration must
be pre-compiled through the Django compressor. By making use of its
built in COMPRESS_OFFLINE_CONTEXT, we now return a generator to
create each of the theme's necessary offline contexts.
Templates:
Horizon themes allowed template overrides via their 'templates'
subfolder. In order to maintain this parity, a custom theme template
loader was created. It is run before the other loads, and simply
looks for a Django template in the current theme (cookie driven)
before diverting to the previous template loaders.
Static Files:
Horizon themes allowed static overrides of the images in
'dashboard/img' folder. A template tag, 'themable_asset' was created
to maintain this parity. Any asset that is wished to be made themable,
given that it is located in Horizon's 'static/dashboard' folder, can
now be made ot be themable. By making this a template tag, this
gives the developers more granular control over what branders can
customize.
Angular and Plugins:
By far, the trickiest part of this task, Angular and Plugins are
dynamic in the files that they 'discover'. SCSS is not flexible in
this manner at ALL. SCSS disallows the importation of a variable
name. To get around this, themes.scss was created as a Django
template. This template is the top level import file for all styles
within Horizon, and therefore, allows ALL the scss files to share a
common namespace and thus, can use shared variables as well as extend
shared styles.
Other:
This change is fundamental, in that it changes the method by which
Horizon ingests its SCSS files. Many problems existing in the
previous implementation, in an effort to make Horizon flexible, its
SCSS was made very inflexible. This patch corrects those problems.
Change-Id: Ic48b4b5c1d1a41f1e01a8d52784c9d38d192c8f1
Implements: blueprint horizon-dynamic-theme
Closes-Bug: #1480427
An unintended result of a recent refactor left the context picker css
without any love. The refactor of the topbar needs to have style
parity to its previous incantation.
It was noted that the design for the current context selection is not
a good pattern to follow for responsive design. The menu grows
horizontally, which will make it difficult to see on smaller screens
as well as when it is displayed in the now responsive topbar. The
original design still applies to larger screens, but now on smaller
screens, the menu will fall back to a vertically growing responsive
menu.
The nav-header color has been changed, because it was also the same
color as the 'disabled' nav item state, which was confusing.
Refactoring of the some of the context_selection.py code was required
in order to support wrapping the menus in <li> tagss without needing
to change their corresponding HTML files. Since the files can be
used as templatetag templates outside of _header.html, it was best to
keep them as stand alone <ul> lists.
Change-Id: I6e7c7b6fed08d215bcf83941da1bf90b40cd17b2
closes-bug: #1483910
partially implements bp: bootstrap-html-standards
A Cross-Frame Scripting (XFS) vulnerability can allow an attacker to
load the vulnerable application inside an HTML iframe tag on a
malicious page. An attacker could use XFS to devise a Clickjacking
attack to conduct phishing, frame sniffing, social engineering or
Cross-Site Request Forgery attacks. Although many pages within Horizon
leverage the X-Frame-Options header with the recommended SAMEORIGIN
policy, some (still popular) older browsers don’t support this setting.
Namely, browsers older than IE 8 and Firefox 3.6.9 don’t recognize the
header and are thus vulnerable to an attack known as ClickJacking
unless an additional mitigating control is present.
To support legacy browsers, a suggested best practice is to add a
frame breaking script to the base/global template file.
Reference: http://tinyurl.com/anticlickjack
Change-Id: Ibd7acd0d7b4c4d58afcd59f025735bfc9e4c2957
Closes-Bug: 1461154
In the context selection dropdown, there is currently an always disabled
link to do more advanced filtering. The original intent was to open a
modal to do more advanced context selection. With the use of RBAC in a
previous bp, the Identity->Projects panel is always accessible. This
panel provides the entire project list for the user. We can just use
this to provide the larger project list to select from.
Change-Id: I0d6674e75785206f3be48c8bf004a29906bb6860
Closes-Bug: #1382650
E127 continuation line over-indented for visual indent
Also fixes E127 introduces by other reviews
after other E127 fixes were merged.
Closes-Bug: #1375931
Change-Id: I0a09f1c2f74c707fc8a347f0ea5975bf2679976e
When the OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT is enabled, the
domain's UUID is being shown in the dropdown to change project.
This patch corrects it to show the domain's name.
Change-Id: I7719d615f736f9d36c305a48f8b4caecb4d0c4ca
Closes-bug: 1378034
Currently tenants are displayed in random order in tenant switch list.
This change display them ordered.
Closes-Bug: #1368757
Change-Id: Ifc49b90b98d69254bf5e05206a334981c507a920
Currently regions are displayed in random order in region list. This
change display them ordered.
Closes-Bug: #1368752
Change-Id: I0029942c2762013812698a5197d2749cde9d4419
Providing the mechanism to easily switch between projects and regions.
Only shows domain info if OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT is set
to True in settings.
Will add domain switching for v3 once support for it is complete.
Will add advance filtering rules in follow up patch.
Co-Authored-By: David Lyle <david.lyle@hp.com>
Implements: blueprint context-selection
Change-Id: Ie6e81eebe822ab2394b07345d148a1c06a33a25f