diff --git a/magnum_ui/containers/templates/containers/index.html b/magnum_ui/containers/templates/containers/index.html index d8d13ab7..ba8f84db 100644 --- a/magnum_ui/containers/templates/containers/index.html +++ b/magnum_ui/containers/templates/containers/index.html @@ -14,5 +14,5 @@ {% endblock %} {% block main %} - +
{% endblock %} diff --git a/magnum_ui/containers/urls.py b/magnum_ui/containers/urls.py index 30b46f0e..19a90bdd 100644 --- a/magnum_ui/containers/urls.py +++ b/magnum_ui/containers/urls.py @@ -12,10 +12,14 @@ # 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 magnum_ui.containers import views + +from magnum_ui.containers.views import IndexView -urlpatterns = [ - url(r'^$', views.IndexView.as_view(), name='index'), -] +urlpatterns = patterns( + '', + url(r'^[0-9a-f\-]{36}$', IndexView.as_view(), name='detail'), + url(r'^$', IndexView.as_view(), name='index'), +) diff --git a/magnum_ui/static/dashboard/containers/containers.module.js b/magnum_ui/static/dashboard/containers/containers.module.js index 80178279..6fb87842 100644 --- a/magnum_ui/static/dashboard/containers/containers.module.js +++ b/magnum_ui/static/dashboard/containers/containers.module.js @@ -46,6 +46,12 @@ $provide.constant('horizon.dashboard.containers.basePath', path); $routeProvider + .when('/containers', { + templateUrl: path + 'containers/table/table.html' + }) + .when('/containers/:containerId', { + templateUrl: path + 'containers/detail/detail.html' + }) .when('/baymodel', { templateUrl: path + 'baymodel/table/table.html' }) diff --git a/magnum_ui/static/dashboard/containers/containers/detail/detail.controller.js b/magnum_ui/static/dashboard/containers/containers/detail/detail.controller.js new file mode 100644 index 00000000..a7dad871 --- /dev/null +++ b/magnum_ui/static/dashboard/containers/containers/detail/detail.controller.js @@ -0,0 +1,75 @@ +/* + * Copyright 2015 NEC Corporation + * + * 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.containers') + .controller('ContainerDetailController', ContainerDetailController); + + ContainerDetailController.$inject = [ + '$window', + 'horizon.app.core.openstack-service-api.magnum', + '$routeParams' + ]; + + function ContainerDetailController($window, magnum, $routeParams) { + var ctrl = this; + ctrl.container = {}; + ctrl.bay = {}; + ctrl.baymodel = {}; + ctrl.memoryunits = { "b": gettext("bytes"), + "k": gettext("KB"), + "m": gettext("MB"), + "g": gettext("GB")}; + + + var containerId = $routeParams.containerId; + + init(); + + function init() { + // Load the elements that are used in the overview. + magnum.getContainer(containerId).success(onGetContainer); + } + + function onGetContainer(container) { + ctrl.container = container; + magnum.getBay(ctrl.container.bay_uuid).success(onGetBay); + + ctrl.container.memorysize = ""; + ctrl.container.memoryunit = ""; + if(ctrl.container.memory !== null){ + // separate number and unit, then using gettext() to unit. + var regex = /(\d+)([bkmg]?)/; + var match = regex.exec(ctrl.container.memory); + ctrl.container.memorysize = match[1]; + if(match[2]){ + ctrl.container.memoryunit = ctrl.memoryunits[match[2]]; + } + } + } + + function onGetBay(bay) { + ctrl.bay = bay; + magnum.getBayModel(ctrl.bay.baymodel_id).success(onGetBayModel); + } + + function onGetBayModel(baymodel) { + ctrl.baymodel = baymodel; + } + } +})(); \ No newline at end of file diff --git a/magnum_ui/static/dashboard/containers/containers/detail/detail.html b/magnum_ui/static/dashboard/containers/containers/detail/detail.html new file mode 100644 index 00000000..e8749057 --- /dev/null +++ b/magnum_ui/static/dashboard/containers/containers/detail/detail.html @@ -0,0 +1,104 @@ +
+ + + +
+
+

Spec

+
+
+
+
Image
+
{$ ctrl.container.image $}
+
+
+
Memory
+
{$ ctrl.container.memorysize $} {$ ctrl.container.memoryunit $}
+
+
+
Command
+
{$ ctrl.container.command $}
+
+
+
+
+

Bay

+
+
+
+
Name
+
{$ ctrl.bay.name $}
+
+
+
ID
+
{$ ctrl.bay.uuid $}
+
+
+
Status
+
{$ ctrl.bay.status $}
+
+
+
Master Count
+
{$ ctrl.bay.master_count $}
+
+
+
Node Count
+
{$ ctrl.bay.node_count $}
+
+
+
+
+
+
+

Bay Model

+
+
+ +
+
ID
+
{$ ctrl.baymodel.uuid $}
+
+
+
COE
+
{$ ctrl.baymodel.coe $}
+
+
+
Image ID
+
{$ ctrl.baymodel.image_id $}
+
+
+
+
+

Record Properties

+
+
+
+
Created
+
{$ ctrl.container.created_at | date:'short' $}
+
+
+
Updated
+
{$ ctrl.container.updated_at | date:'short' $}
+
+
+
ID
+
{$ ctrl.container.uuid $}
+
+
+
Status
+
{$ ctrl.container.status $}
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/magnum_ui/static/dashboard/containers/containers/table/table.html b/magnum_ui/static/dashboard/containers/containers/table/table.html index e1f70e73..9497bfc0 100644 --- a/magnum_ui/static/dashboard/containers/containers/table/table.html +++ b/magnum_ui/static/dashboard/containers/containers/table/table.html @@ -141,7 +141,7 @@
Name
-
{$ c.name $}
+
{$ c.name $}
UUID
{$ c.id $}