From 94b0c092ed32822b0b0a2389e90e82c499c3b5e8 Mon Sep 17 00:00:00 2001 From: zhurong Date: Mon, 7 Mar 2016 02:52:38 +0000 Subject: [PATCH] Fix broken dashboard tables Due to this patch: https://review.openstack.org/#/c/246625/, Horizon changes the table styles. This broke murano-dashboard tables. This patch fixes the following: 1 Fix package, images, categories, environments table looks broken 2 Fix import package descriptions displayed 3 Removes unicode symbols from README to unlock py34 gate 4 Comment out the 'multi_select=false' to pass the ci test 5 Dixed broken tests Co-Authored-By: Kirill Zaitsev Change-Id: I802aaa89021b5f20805a498ad2a17ba73c076bed Closes-bug: #1552702 Closes-bug: #1550822 Closes-bug: #1554317 --- README.rst | 4 +- muranodashboard/categories/views.py | 1 + muranodashboard/environments/tables.py | 11 +- muranodashboard/environments/views.py | 1 + muranodashboard/images/tables.py | 1 - muranodashboard/images/views.py | 1 + muranodashboard/packages/tables.py | 1 - muranodashboard/packages/views.py | 1 + .../templates/categories/index.html | 4 - .../templates/common/_data_table.html | 10 - .../templates/environments/_data_table.html | 2 +- .../templates/environments/index.html | 4 - muranodashboard/templates/images/index.html | 4 - muranodashboard/templates/packages/index.html | 3 - .../templates/services/_data_table.html | 183 ++++++++---------- .../templates/services/_service_list.html | 12 +- muranodashboard/tests/functional/base.py | 10 +- .../tests/functional/sanity_check.py | 22 ++- 18 files changed, 122 insertions(+), 153 deletions(-) delete mode 100644 muranodashboard/templates/common/_data_table.html diff --git a/README.rst b/README.rst index 81b6b716d..a0df43859 100644 --- a/README.rst +++ b/README.rst @@ -3,8 +3,8 @@ Murano Murano Project introduces an application catalog, which allows application developers and cloud administrators to publish various cloud-ready -applications in a browsable categorised catalog. Cloud users -— including inexperienced ones — can then use the catalog to +applications in a browsable categorised catalog. Cloud users, +including inexperienced ones, can then use the catalog to compose reliable application environments with the push of a button. Murano Dashboard diff --git a/muranodashboard/categories/views.py b/muranodashboard/categories/views.py index efd07cae3..3d9843f98 100644 --- a/muranodashboard/categories/views.py +++ b/muranodashboard/categories/views.py @@ -28,6 +28,7 @@ from muranodashboard.categories import tables class CategoriesView(horizon_tables.DataTableView): table_class = tables.CategoriesTable template_name = 'categories/index.html' + page_title = _("Application Categories") def has_prev_data(self, table): return self._prev diff --git a/muranodashboard/environments/tables.py b/muranodashboard/environments/tables.py index 34931364a..9d3ab67bf 100644 --- a/muranodashboard/environments/tables.py +++ b/muranodashboard/environments/tables.py @@ -323,7 +323,9 @@ class EnvironmentsTable(tables.DataTable): table_actions = (CreateEnvironment,) row_actions = (ShowEnvironmentServices, DeployEnvironment, DeleteEnvironment, AbandonEnvironment) - multi_select = False + # TODO(zhurong) Due to bug/1554087 in horizon, we should temporary + # comment out this 'multi_select = False' to pass the ci test + # multi_select = False def get_service_details_link(service): @@ -418,13 +420,14 @@ class ServicesTable(tables.DataTable): class Meta(object): name = 'services' verbose_name = _('Component List') - template = 'services/_data_table.html' no_data_message = _('No components') status_columns = ['status'] row_class = UpdateServiceRow table_actions = (AddApplication, DeployThisEnvironment) row_actions = (DeleteService,) - multi_select = False + # TODO(zhurong) Due to bug/1554087 in horizon, we should temporary + # comment out this 'multi_select = False' to pass the ci test + # multi_select = False class ShowDeploymentDetails(tables.LinkAction): @@ -458,7 +461,6 @@ class DeploymentsTable(tables.DataTable): class Meta(object): name = 'deployments' verbose_name = _('Deployments') - template = 'common/_data_table.html' row_actions = (ShowDeploymentDetails,) @@ -475,4 +477,3 @@ class EnvConfigTable(tables.DataTable): class Meta(object): name = 'environment_configuration' verbose_name = _('Deployed Components') - template = 'common/_data_table.html' diff --git a/muranodashboard/environments/views.py b/muranodashboard/environments/views.py index e39346404..b0f98c75c 100644 --- a/muranodashboard/environments/views.py +++ b/muranodashboard/environments/views.py @@ -36,6 +36,7 @@ from muranodashboard.environments import tabs as env_tabs class IndexView(tables.DataTableView): table_class = env_tables.EnvironmentsTable template_name = 'environments/index.html' + page_title = _("Environments") def get_data(self): environments = [] diff --git a/muranodashboard/images/tables.py b/muranodashboard/images/tables.py index 3a06bb01a..a766accea 100644 --- a/muranodashboard/images/tables.py +++ b/muranodashboard/images/tables.py @@ -63,6 +63,5 @@ class MarkedImagesTable(tables.DataTable): class Meta(object): name = 'marked_images' verbose_name = _('Marked Images') - template = 'common/_data_table.html' table_actions = (MarkImage, RemoveImageMetadata) row_actions = (RemoveImageMetadata,) diff --git a/muranodashboard/images/views.py b/muranodashboard/images/views.py index b1c927af5..178ffb914 100644 --- a/muranodashboard/images/views.py +++ b/muranodashboard/images/views.py @@ -31,6 +31,7 @@ from muranodashboard.images import tables class MarkedImagesView(horizon_tables.DataTableView): table_class = tables.MarkedImagesTable template_name = 'images/index.html' + page_title = _("Marked Images") def has_prev_data(self, table): return self._prev diff --git a/muranodashboard/packages/tables.py b/muranodashboard/packages/tables.py index cb09a4113..7258385db 100644 --- a/muranodashboard/packages/tables.py +++ b/muranodashboard/packages/tables.py @@ -238,7 +238,6 @@ class PackageDefinitionsTable(tables.DataTable): name = 'packages' prev_pagination_param = 'marker' verbose_name = _('Packages') - template = 'common/_data_table.html' table_actions_menu = (ToggleEnabled, TogglePublicEnabled) table_actions = (PackagesFilterAction, diff --git a/muranodashboard/packages/views.py b/muranodashboard/packages/views.py index 2cdb95a3d..13781235e 100644 --- a/muranodashboard/packages/views.py +++ b/muranodashboard/packages/views.py @@ -73,6 +73,7 @@ def is_app(wizard): class PackageDefinitionsView(horizon_tables.DataTableView): table_class = tables.PackageDefinitionsTable template_name = 'packages/index.html' + page_title = _("Packages") _more = False _prev = False diff --git a/muranodashboard/templates/categories/index.html b/muranodashboard/templates/categories/index.html index f825a99fc..c23d63c9d 100644 --- a/muranodashboard/templates/categories/index.html +++ b/muranodashboard/templates/categories/index.html @@ -2,10 +2,6 @@ {% load i18n %} {% block title %}{% trans "Application Categories" %}{% endblock %} -{% block page_header %} - {% include "horizon/common/_page_header.html" with title=_("Application Categories") %} -{% endblock page_header %} - {% block main %} {{ table.render }} {% endblock %} diff --git a/muranodashboard/templates/common/_data_table.html b/muranodashboard/templates/common/_data_table.html deleted file mode 100644 index 1410dc81e..000000000 --- a/muranodashboard/templates/common/_data_table.html +++ /dev/null @@ -1,10 +0,0 @@ -{% extends 'horizon/common/_data_table.html' %} -{% load i18n %} - -{% block table_caption %} - - - {{ table.render_table_actions }} - - -{% endblock table_caption %} diff --git a/muranodashboard/templates/environments/_data_table.html b/muranodashboard/templates/environments/_data_table.html index 4b594e7f2..c5f3c5b32 100644 --- a/muranodashboard/templates/environments/_data_table.html +++ b/muranodashboard/templates/environments/_data_table.html @@ -1,4 +1,4 @@ -{% extends 'common/_data_table.html' %} +{% extends 'horizon/common/_data_table.html' %} {% load i18n %} {% block title %}{% trans "Environments" %}{% endblock %} diff --git a/muranodashboard/templates/environments/index.html b/muranodashboard/templates/environments/index.html index 1c04f0a66..1764627ca 100644 --- a/muranodashboard/templates/environments/index.html +++ b/muranodashboard/templates/environments/index.html @@ -4,10 +4,6 @@ {% load compress %} {% block title %}{% trans "Environments" %}{% endblock %} -{% block page_header %} - {% include "horizon/common/_page_header.html" with title=_("Environments") %} -{% endblock page_header %} - {% block main %} {{ table.render }} {% endblock %} diff --git a/muranodashboard/templates/images/index.html b/muranodashboard/templates/images/index.html index f19c93c4d..0731c85a1 100644 --- a/muranodashboard/templates/images/index.html +++ b/muranodashboard/templates/images/index.html @@ -2,10 +2,6 @@ {% load i18n %} {% block title %}{% trans "Marked Images" %}{% endblock %} -{% block page_header %} - {% include "horizon/common/_page_header.html" with title=_("Marked Images") %} -{% endblock page_header %} - {% block main %} {{ table.render }} {% endblock %} diff --git a/muranodashboard/templates/packages/index.html b/muranodashboard/templates/packages/index.html index be32eac32..74d966f6b 100644 --- a/muranodashboard/templates/packages/index.html +++ b/muranodashboard/templates/packages/index.html @@ -11,9 +11,6 @@ {% endcompress %} {% endblock %} -{% block page_header %} - {% include "horizon/common/_page_header.html" with title=_("Packages") %} -{% endblock page_header %} {% block main %} {{ table.render }} {% endblock %} diff --git a/muranodashboard/templates/services/_data_table.html b/muranodashboard/templates/services/_data_table.html index 3910567b3..8ed01ba65 100644 --- a/muranodashboard/templates/services/_data_table.html +++ b/muranodashboard/templates/services/_data_table.html @@ -1,107 +1,93 @@ -{% extends 'common/_data_table.html' %} {% load i18n %} {% load custom_filters %} -{% block title %}{% trans "Components" %}{% endblock %} {% block table_caption %} {% with apps=table.get_apps_list %} - {% if table.actions_allowed %} - {% comment %} - Note(efedorova): We are comparing to the string, since get_apps_list - functions returns json.dumps, which is used in js later. - So to prevent extra transformations comparing to the string is used - to check for app absence. - {% endcomment %} - {% if apps != '[]' %} -
-
-

- {% trans "Application Components" %}

-
-

{% trans 'App category' %}

-
- -
- -
-
- - -
-
-
- {% else %} -

- {% with repo_url=table.get_repo_url pkg_def_url=table.get_pkg_def_url %} - {% trans "There are no applications in the catalog. You can import apps from" %} - {{ repo_url }}. -

- {% blocktrans trimmed %}Go to - - Packages - , click 'Import Package' and select Repository as Package Source. - {% endblocktrans %} - {% endwith %} -

- {% endif %} - -
-

- {% trans "There are no applications matching your criteria." %}

- {% endif %} - - {% for row in rows %} - {{ row.render }} - {% empty %} - - {{ table.get_empty_message }} - - {% endfor %} - {% endblock table_body %} diff --git a/muranodashboard/templates/services/_service_list.html b/muranodashboard/templates/services/_service_list.html index 9f5fa16c7..085ed9fe2 100644 --- a/muranodashboard/templates/services/_service_list.html +++ b/muranodashboard/templates/services/_service_list.html @@ -1,5 +1,13 @@ {% load i18n %} {% block main %} - {{ table.render }} -{% endblock %} \ No newline at end of file +
+
+ {% include "services/_data_table.html" %} +
+
+ {{ table.render }} +
+
+
+{% endblock %} diff --git a/muranodashboard/tests/functional/base.py b/muranodashboard/tests/functional/base.py index 087e690e3..3b5148e2d 100644 --- a/muranodashboard/tests/functional/base.py +++ b/muranodashboard/tests/functional/base.py @@ -275,7 +275,8 @@ class UITestCase(BaseDeps): def edit_environment(self, old_name, new_name): el_td = self.driver.find_element_by_css_selector( - 'tr[data-display="{0}"] td:first-of-type'.format(old_name)) + 'tr[data-display="{0}"] '.format(old_name) + + 'td[data-cell-name="name"]') el_pencil = el_td.find_element_by_css_selector( 'button.ajax-inline-edit') @@ -287,14 +288,15 @@ class UITestCase(BaseDeps): # fill in inline input el_inline_input = self.driver.find_element_by_css_selector( 'tr[data-display="{0}"] '.format(old_name) + - 'td:first-of-type .inline-edit-form input') + 'td[data-cell-name="name"] .inline-edit-form input') el_inline_input.clear() el_inline_input.send_keys(new_name) # click submit el_submit = self.driver.find_element_by_css_selector( 'tr[data-display="{0}"] '.format(old_name) + - 'td:first-of-type .inline-edit-actions button[type="submit"]') + 'td[data-cell-name="name"] .inline-edit-actions' + + ' button[type="submit"]') el_submit.click() # there is no alert message @@ -308,7 +310,7 @@ class UITestCase(BaseDeps): def wait_for_alert_message(self): locator = (by.By.CSS_SELECTOR, 'div.alert-success') logger.debug("Waiting for a success message") - ui.WebDriverWait(self.driver, 2).until( + ui.WebDriverWait(self.driver, 5).until( EC.presence_of_element_located(locator)) def wait_for_error_message(self, sec=20): diff --git a/muranodashboard/tests/functional/sanity_check.py b/muranodashboard/tests/functional/sanity_check.py index 5191bafbf..c245677b1 100644 --- a/muranodashboard/tests/functional/sanity_check.py +++ b/muranodashboard/tests/functional/sanity_check.py @@ -1057,12 +1057,13 @@ class TestSuitePackages(base.PackageTestCase): pkg_name = self.alt_archive_name self.fill_field(by.By.CSS_SELECTOR, "input[name='modify-name']", pkg_name) - self.driver.find_element_by_css_selector( - "input[name=modify-is_public]" - ).click() - self.driver.find_element_by_css_selector( - "input[name=modify-enabled]" - ).click() + + label = self.driver.find_element_by_css_selector( + "label[for=id_modify-is_public]") + label.click() + label = self.driver.find_element_by_css_selector( + "label[for=id_modify-enabled]") + label.click() self.driver.find_element_by_xpath(c.InputSubmit).click() self.driver.find_element_by_xpath(c.InputSubmit).click() @@ -1162,9 +1163,9 @@ class TestSuitePackages(base.PackageTestCase): # Public = OFF; Active = ON. public_checkbox = self.driver.find_element_by_id('id_modify-is_public') active_checkbox = self.driver.find_element_by_id('id_modify-enabled') - if public_checkbox.is_selected() is True: + if public_checkbox.is_selected(): public_checkbox.click() - elif active_checkbox.is_selected() is False: + if not active_checkbox.is_selected(): active_checkbox.click() self.driver.find_element_by_xpath(c.InputSubmit).click() self.driver.find_element_by_xpath(c.InputSubmit).click() @@ -1177,7 +1178,10 @@ class TestSuitePackages(base.PackageTestCase): c.AppPackages.format(self.archive_name)) pkg_id = package.get_attribute("data-object-id") self.select_action_for_package(pkg_id, 'modify_package') - self.driver.find_element_by_id('id_is_public').click() + + label = self.driver.find_element_by_css_selector( + "label[for=id_is_public]") + label.click() self.driver.find_element_by_xpath(c.InputSubmit).click() # Expecting Error self.wait_for_error_message()