Merge "replacing plugins into separate panel"

This commit is contained in:
Jenkins 2016-07-21 12:44:14 +00:00 committed by Gerrit Code Review
commit 2e31bb9d23
14 changed files with 97 additions and 23 deletions

View File

@ -29,7 +29,7 @@
<dl class="dl-horizontal">
<dt>{% trans "Plugin" %}</dt>
<dd><a href="{% url 'horizon:project:data_processing.jobs:plugin-details' cluster.plugin_name %}">{{ cluster.plugin_name }}</a></dd>
<dd><a href="{% url 'horizon:project:data_processing.data_plugins:plugin-details' cluster.plugin_name %}">{{ cluster.plugin_name }}</a></dd>
<dt>{% trans "Version" %}</dt>
<dd>{{ cluster.hadoop_version }}</dd>
</dl>

View File

@ -0,0 +1,27 @@
# 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
from openstack_dashboard.dashboards.project import dashboard
class PluginsPanel(horizon.Panel):
name = _("Plugins")
slug = 'data_processing.data_plugins'
permissions = (('openstack.services.data-processing',
'openstack.services.data_processing'),)
dashboard.Project.register(PluginsPanel)

View File

@ -21,7 +21,7 @@ class PluginsTable(tables.DataTable):
title = tables.Column("title",
verbose_name=_("Title"),
link=("horizon:project:data_processing."
"jobs:plugin-details"))
"data_plugins:plugin-details"))
versions = tables.Column("versions",
verbose_name=_("Supported Versions"),

View File

@ -19,7 +19,7 @@ from horizon import exceptions
from horizon import tabs
from sahara_dashboard.api import sahara as saharaclient
from sahara_dashboard.content.data_processing.jobs.data_plugins \
from sahara_dashboard.content.data_processing.data_plugins \
import tables as plugin_tables
from sahara_dashboard.content.data_processing \
import tabs as sahara_tabs

View File

@ -20,22 +20,19 @@ from sahara_dashboard.test import helpers as test
INDEX_URL = reverse(
'horizon:project:data_processing.jobs:index')
'horizon:project:data_processing.data_plugins:index')
DETAILS_URL = reverse(
'horizon:project:data_processing.jobs:plugin-details', args=['id'])
'horizon:project:data_processing.data_plugins:plugin-details', args=['id'])
class DataProcessingPluginsTests(test.TestCase):
@test.create_stubs({api.sahara: ('job_execution_list',
'plugin_list', 'job_binary_list',
'data_source_list',
'job_list')})
@test.create_stubs({api.sahara: ('plugin_list',)})
def test_index(self):
api.sahara.plugin_list(IsA(http.HttpRequest)) \
.AndReturn(self.plugins.list())
self.mox.ReplayAll()
res = self.client.get(INDEX_URL)
self.assertTemplateUsed(res, 'jobs/index.html')
self.assertTemplateUsed(res, 'data_plugins/plugins.html')
self.assertContains(res, 'vanilla')
self.assertContains(res, 'plugin')

View File

@ -0,0 +1,25 @@
# 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 patterns
from django.conf.urls import url
from sahara_dashboard.content.data_processing.data_plugins import views
urlpatterns = patterns(
'',
url(r'^$', views.PluginsView.as_view(), name='index'),
url(r'^(?P<plugin_id>[^/]+)$',
views.PluginDetailsView.as_view(), name='plugin-details'),
)

View File

@ -18,10 +18,10 @@ from horizon import tables
from horizon import tabs
from sahara_dashboard.api import sahara as saharaclient
import sahara_dashboard.content.data_processing.jobs. \
data_plugins.tables as p_tables
import sahara_dashboard.content.data_processing.jobs. \
data_plugins.tabs as p_tabs
import sahara_dashboard.content.data_processing.data_plugins. \
tables as p_tables
import sahara_dashboard.content.data_processing.data_plugins. \
tabs as p_tabs
class PluginsView(tables.DataTableView):

View File

@ -16,8 +16,6 @@ from django.conf.urls import url
import sahara_dashboard.content.data_processing. \
jobs.views as views
import sahara_dashboard.content.data_processing. \
jobs.data_plugins.views as plugin_views
import sahara_dashboard.content.data_processing. \
jobs.job_binaries.views as job_binary_views
import sahara_dashboard.content.data_processing. \
@ -79,9 +77,6 @@ urlpatterns = patterns('',
url(r'^data-source/(?P<data_source_id>[^/]+)$',
data_source_views.DataSourceDetailsView.as_view(),
name='ds-details'),
url(r'^plugin/(?P<plugin_id>[^/]+)$',
plugin_views.PluginDetailsView.as_view(),
name='plugin-details'),
url(r'^jobex_guide$',
job_wizard_views.JobExecutionGuideView.as_view(),
name='jobex_guide'),

View File

@ -16,8 +16,6 @@ from django.utils.translation import ugettext_lazy as _
from horizon import tabs
from sahara_dashboard.content.data_processing.jobs.data_plugins \
import tabs as plugin_tabs
from sahara_dashboard.content.data_processing.jobs.data_sources \
import tabs as data_source_tabs
from sahara_dashboard.content.data_processing.jobs.job_binaries \
@ -33,8 +31,7 @@ class JobTabs(tabs.TabGroup):
tabs = (job_tabs.JobsTab,
job_template_tabs.JobTemplatesTab,
data_source_tabs.DataSourcesTab,
job_binary_tabs.JobBinariesTab,
plugin_tabs.PluginsTab,)
job_binary_tabs.JobBinariesTab,)
sticky = True

View File

@ -0,0 +1,32 @@
# 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 sahara_dashboard import exceptions
# The slug of the panel to be added to HORIZON_CONFIG. Required.
PANEL = 'data_processing.data_plugins'
# The slug of the dashboard the PANEL associated with. Required.
PANEL_DASHBOARD = 'project'
# The slug of the panel group the PANEL is associated with.
PANEL_GROUP = 'data_processing'
# Python panel class of the PANEL to be added.
ADD_PANEL = \
('sahara_dashboard.'
'content.data_processing.data_plugins.panel.PluginsPanel')
ADD_INSTALLED_APPS = \
["sahara_dashboard.content.data_processing.data_plugins", ]
ADD_EXCEPTIONS = {
'recoverable': exceptions.RECOVERABLE
}

View File

@ -16,3 +16,4 @@ from openstack_dashboard.test.settings import * # noqa
INSTALLED_APPS = list(INSTALLED_APPS)
INSTALLED_APPS.append('sahara_dashboard.content.data_processing.clusters')
INSTALLED_APPS.append('sahara_dashboard.content.data_processing.jobs')
INSTALLED_APPS.append('sahara_dashboard.content.data_processing.data_plugins')