Rename bay and baymodel for 'Soft StringFreeze' milestone

"bay" and "baymodel" is not common term.
This patch renames "bay" to "cluster", and "baymodel" to
"cluster template" for 'Soft StringFreeze'[1] in Newton
Release Schedule[2].

[1] Soft StringFreeze: Aug 29 - Sep 02
[2] https://releases.openstack.org/newton/schedule.html

For translation work, this patch should focus to changing
strings to be translated and should be merged soon.

So, until "cluster" and "cluster template" is implemented
into Magnum API, Magnum-UI uses bay and baymodel of magnumclient.

Change-Id: I0db5472c4f19638cc57116101b552ad21fe34651
Implements: blueprint rename-bay-to-cluster
This commit is contained in:
Shu Muto 2016-08-26 16:32:00 +09:00
parent df2d57124b
commit 04c6e4433a
88 changed files with 1114 additions and 1111 deletions

View File

@ -48,9 +48,9 @@ Install Magnum UI with all dependencies in your virtual environment::
And enable it in Horizon::
cp ../magnum-ui/magnum_ui/enabled/_1370_project_container-infra_panelgroup.py openstack_dashboard/local/enabled
cp ../magnum-ui/magnum_ui/enabled/_1371_project_container-infra_bays_panel.py openstack_dashboard/local/enabled
cp ../magnum-ui/magnum_ui/enabled/_1372_project_container-infra_baymodels_panel.py openstack_dashboard/local/enabled
cp ../magnum-ui/magnum_ui/enabled/_1370_project_container_infra_panel_group.py openstack_dashboard/local/enabled
cp ../magnum-ui/magnum_ui/enabled/_1371_project_container_infra_clusters_panel.py openstack_dashboard/local/enabled
cp ../magnum-ui/magnum_ui/enabled/_1372_project_container_infra_cluster_templates_panel.py openstack_dashboard/local/enabled
To run horizon with the newly enabled Magnum UI plugin run::

View File

@ -48,9 +48,9 @@ Install Magnum UI with all dependencies in your virtual environment::
And enable it in Horizon::
cp ../magnum-ui/magnum_ui/enabled/_1370_project_containers-infra_panelgroup.py openstack_dashboard/local/enabled
cp ../magnum-ui/magnum_ui/enabled/_1371_project_containers-infra_bays_panel.py openstack_dashboard/local/enabled
cp ../magnum-ui/magnum_ui/enabled/_1372_project_containers-infra_baymodels_panel.py openstack_dashboard/local/enabled
cp ../magnum-ui/magnum_ui/enabled/_1370_project_container_infra_panelgroup.py openstack_dashboard/local/enabled
cp ../magnum-ui/magnum_ui/enabled/_1371_project_container_infra_clusters_panel.py openstack_dashboard/local/enabled
cp ../magnum-ui/magnum_ui/enabled/_1372_project_container_infra_cluster_templates_panel.py openstack_dashboard/local/enabled
To run horizon with the newly enabled Magnum UI plugin run::

View File

@ -25,16 +25,17 @@ from openstack_dashboard.api import base
LOG = logging.getLogger(__name__)
BAYMODEL_CREATE_ATTRS = ['name', 'image_id', 'flavor_id', 'master_flavor_id',
'keypair_id', 'external_network_id', 'fixed_network',
'dns_nameserver', 'docker_volume_size', 'labels',
'coe', 'http_proxy',
'https_proxy', 'no_proxy', 'network_driver',
'volume_driver',
'public', 'registry_enabled', 'tls_disabled']
CLUSTER_TEMPLATE_CREATE_ATTRS = ['name', 'image_id', 'flavor_id',
'master_flavor_id', 'keypair_id',
'external_network_id', 'fixed_network',
'dns_nameserver', 'docker_volume_size',
'labels', 'coe', 'http_proxy', 'https_proxy',
'no_proxy', 'network_driver', 'volume_driver',
'public', 'registry_enabled', 'tls_disabled']
BAY_CREATE_ATTRS = ['name', 'baymodel_id', 'node_count', 'discovery_url',
'bay_create_timeout', 'master_count']
CLUSTER_CREATE_ATTRS = ['name', 'baymodel_id', 'node_count',
'discovery_url', 'cluster_create_timeout',
'master_count']
@memoized
@ -62,14 +63,14 @@ def magnumclient(request):
return c
def baymodel_create(request, **kwargs):
def cluster_template_create(request, **kwargs):
args = {}
for (key, value) in kwargs.items():
if key in BAYMODEL_CREATE_ATTRS:
if key in CLUSTER_TEMPLATE_CREATE_ATTRS:
args[str(key)] = str(value)
else:
raise exceptions.InvalidAttribute(
"Key must be in %s" % ",".join(BAYMODEL_CREATE_ATTRS))
"Key must be in %s" % ",".join(CLUSTER_TEMPLATE_CREATE_ATTRS))
if key == "labels":
labels = {}
vals = value.split(",")
@ -80,44 +81,44 @@ def baymodel_create(request, **kwargs):
return magnumclient(request).baymodels.create(**args)
def baymodel_delete(request, id):
def cluster_template_delete(request, id):
return magnumclient(request).baymodels.delete(id)
def baymodel_list(request, limit=None, marker=None, sort_key=None,
sort_dir=None, detail=True):
def cluster_template_list(request, limit=None, marker=None, sort_key=None,
sort_dir=None, detail=True):
return magnumclient(request).baymodels.list(limit, marker, sort_key,
sort_dir, detail)
def baymodel_show(request, id):
def cluster_template_show(request, id):
return magnumclient(request).baymodels.get(id)
def bay_create(request, **kwargs):
def cluster_create(request, **kwargs):
args = {}
for (key, value) in kwargs.items():
if key in BAY_CREATE_ATTRS:
if key in CLUSTER_CREATE_ATTRS:
args[key] = value
else:
raise exceptions.InvalidAttribute(
"Key must be in %s" % ",".join(BAY_CREATE_ATTRS))
"Key must be in %s" % ",".join(CLUSTER_CREATE_ATTRS))
return magnumclient(request).bays.create(**args)
def bay_update(request, id, patch):
def cluster_update(request, id, patch):
return magnumclient(request).bays.update(id, patch)
def bay_delete(request, id):
def cluster_delete(request, id):
return magnumclient(request).bays.delete(id)
def bay_list(request, limit=None, marker=None, sort_key=None,
sort_dir=None, detail=True):
def cluster_list(request, limit=None, marker=None, sort_key=None,
sort_dir=None, detail=True):
return magnumclient(request).bays.list(limit, marker, sort_key,
sort_dir, detail)
def bay_show(request, id):
def cluster_show(request, id):
return magnumclient(request).bays.get(id)

View File

@ -31,95 +31,95 @@ def change_to_id(obj):
@urls.register
class Baymodel(generic.View):
"""API for retrieving a single baymodel"""
url_regex = r'container-infra/baymodels/(?P<baymodel_id>[^/]+)$'
class ClusterTemplate(generic.View):
"""API for retrieving a single cluster template"""
url_regex = r'container_infra/cluster_templates/(?P<template_id>[^/]+)$'
@rest_utils.ajax()
def get(self, request, baymodel_id):
"""Get a specific baymodel"""
return change_to_id(magnum.baymodel_show(request, baymodel_id)
def get(self, request, template_id):
"""Get a specific cluster template"""
return change_to_id(magnum.cluster_template_show(request, template_id)
.to_dict())
@urls.register
class Baymodels(generic.View):
"""API for Magnum Baymodels"""
url_regex = r'container-infra/baymodels/$'
class ClusterTemplates(generic.View):
"""API for Magnum Cluster Templates"""
url_regex = r'container_infra/cluster_templates/$'
@rest_utils.ajax()
def get(self, request):
"""Get a list of the Baymodels for a project.
"""Get a list of the Cluster Templates for a project.
The returned result is an object with property 'items' and each
item under this is a Baymodel.
item under this is a Cluster Template.
"""
result = magnum.baymodel_list(request)
result = magnum.cluster_template_list(request)
return {'items': [change_to_id(n.to_dict()) for n in result]}
@rest_utils.ajax(data_required=True)
def delete(self, request):
"""Delete one or more Baymodels by id.
"""Delete one or more Cluster Templates by id.
Returns HTTP 204 (no content) on successful deletion.
"""
for baymodel_id in request.DATA:
magnum.baymodel_delete(request, baymodel_id)
for template_id in request.DATA:
magnum.cluster_template_delete(request, template_id)
@rest_utils.ajax(data_required=True)
def post(self, request):
"""Create a new Baymodel.
"""Create a new Cluster Template.
Returns the new Baymodel object on success.
Returns the new ClusterTemplate object on success.
"""
new_baymodel = magnum.baymodel_create(request, **request.DATA)
new_template = magnum.cluster_template_create(request, **request.DATA)
return rest_utils.CreatedResponse(
'/api/container-infra/baymodel/%s' % new_baymodel.uuid,
new_baymodel.to_dict())
'/api/container_infra/cluster_template/%s' % new_template.uuid,
new_template.to_dict())
@urls.register
class Bay(generic.View):
"""API for retrieving a single bay"""
url_regex = r'container-infra/bays/(?P<bay_id>[^/]+)$'
class Cluster(generic.View):
"""API for retrieving a single cluster"""
url_regex = r'container_infra/clusters/(?P<cluster_id>[^/]+)$'
@rest_utils.ajax()
def get(self, request, bay_id):
"""Get a specific bay"""
return change_to_id(magnum.bay_show(request, bay_id).to_dict())
def get(self, request, cluster_id):
"""Get a specific cluster"""
return change_to_id(magnum.cluster_show(request, cluster_id).to_dict())
@urls.register
class Bays(generic.View):
"""API for Magnum Bays"""
url_regex = r'container-infra/bays/$'
class Clusters(generic.View):
"""API for Magnum Clusters"""
url_regex = r'container_infra/clusters/$'
@rest_utils.ajax()
def get(self, request):
"""Get a list of the Bays for a project.
"""Get a list of the Clusters for a project.
The returned result is an object with property 'items' and each
item under this is a Bay.
item under this is a Cluster.
"""
result = magnum.bay_list(request)
result = magnum.cluster_list(request)
return {'items': [change_to_id(n.to_dict()) for n in result]}
@rest_utils.ajax(data_required=True)
def delete(self, request):
"""Delete one or more Bays by id.
"""Delete one or more Clusters by id.
Returns HTTP 204 (no content) on successful deletion.
"""
for bay_id in request.DATA:
magnum.bay_delete(request, bay_id)
for cluster_id in request.DATA:
magnum.cluster_delete(request, cluster_id)
@rest_utils.ajax(data_required=True)
def post(self, request):
"""Create a new Bay.
"""Create a new Cluster.
Returns the new Bay object on success.
Returns the new Cluster object on success.
"""
new_bay = magnum.bay_create(request, **request.DATA)
new_cluster = magnum.cluster_create(request, **request.DATA)
return rest_utils.CreatedResponse(
'/api/container-infra/bay/%s' % new_bay.uuid,
new_bay.to_dict())
'/api/container_infra/cluster/%s' % new_cluster.uuid,
new_cluster.to_dict())

View File

@ -16,6 +16,6 @@ from django.utils.translation import ugettext_lazy as _
import horizon
class Baymodels(horizon.Panel):
name = _("Baymodels")
slug = "baymodels"
class ClusterTemplates(horizon.Panel):
name = _("Cluster Templates")
slug = "cluster_templates"

View File

@ -15,7 +15,7 @@
from openstack_dashboard.test import helpers as test
class BayModelTests(test.TestCase):
# Unit tests for bay model.
class ClusterTemplateTests(test.TestCase):
# Unit tests for cluster template.
def test_me(self):
self.assertTrue(1 + 1 == 2)

View File

@ -13,7 +13,7 @@
# under the License.
from django.conf.urls import url
from magnum_ui.content.baymodels.views import IndexView
from magnum_ui.content.cluster_templates.views import IndexView
urlpatterns = [

View File

@ -16,6 +16,6 @@ from django.utils.translation import ugettext_lazy as _
import horizon
class Bays(horizon.Panel):
name = _("Bays")
slug = "bays"
class Clusters(horizon.Panel):
name = _("Clusters")
slug = "clusters"

View File

@ -15,7 +15,7 @@
from openstack_dashboard.test import helpers as test
class BayTests(test.TestCase):
# Unit tests for bay.
class ClusterTests(test.TestCase):
# Unit tests for cluster.
def test_me(self):
self.assertTrue(1 + 1 == 2)

View File

@ -13,7 +13,7 @@
# under the License.
from django.conf.urls import url
from magnum_ui.content.bays.views import IndexView
from magnum_ui.content.clusters.views import IndexView
urlpatterns = [

View File

@ -14,7 +14,7 @@
from django.utils.translation import ugettext_lazy as _
# The slug of the panel group to be added to HORIZON_CONFIG. Required.
PANEL_GROUP = 'container-infra'
PANEL_GROUP = 'container_infra'
# The display name of the PANEL_GROUP. Required.
PANEL_GROUP_NAME = _('Container Infrastructure')
# The slug of the dashboard the PANEL_GROUP associated with. Required.

View File

@ -13,11 +13,11 @@
# under the License.
# The slug of the panel to be added to HORIZON_CONFIG. Required.
PANEL = 'bays'
PANEL = 'clusters'
# The slug of the panel group the PANEL is associated with.
PANEL_GROUP = 'container-infra'
PANEL_GROUP = 'container_infra'
# The slug of the dashboard the PANEL associated with. Required.
PANEL_DASHBOARD = 'project'
# Python panel class of the PANEL to be added.
ADD_PANEL = 'magnum_ui.content.bays.panel.Bays'
ADD_PANEL = 'magnum_ui.content.clusters.panel.Clusters'

View File

@ -13,11 +13,11 @@
# under the License.
# The slug of the panel to be added to HORIZON_CONFIG. Required.
PANEL = 'baymodels'
PANEL = 'cluster_templates'
# The slug of the panel group the PANEL is associated with.
PANEL_GROUP = 'container-infra'
PANEL_GROUP = 'container_infra'
# The slug of the dashboard the PANEL associated with. Required.
PANEL_DASHBOARD = 'project'
# Python panel class of the PANEL to be added.
ADD_PANEL = 'magnum_ui.content.baymodels.panel.Baymodels'
ADD_PANEL = 'magnum_ui.content.cluster_templates.panel.ClusterTemplates'

View File

@ -1,82 +0,0 @@
/**
* 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';
/**
* @ngdoc overview
* @ngname horizon.dashboard.container-infra.baymodels.actions
*
* @description
* Provides all of the actions for baymodels.
*/
angular.module('horizon.dashboard.container-infra.baymodels.actions', ['horizon.framework', 'horizon.dashboard.container-infra'])
.run(registerBaymodelActions);
registerBaymodelActions.$inject = [
'horizon.framework.conf.resource-type-registry.service',
'horizon.framework.util.i18n.gettext',
'horizon.dashboard.container-infra.baymodels.create.service',
'horizon.dashboard.container-infra.baymodels.delete.service',
'horizon.dashboard.container-infra.bays.create.service',
'horizon.dashboard.container-infra.baymodels.resourceType',
];
function registerBaymodelActions(
registry,
gettext,
createBaymodelService,
deleteBaymodelService,
createBayService,
resourceType)
{
var baymodelResourceType = registry.getResourceType(resourceType);
baymodelResourceType.itemActions
.append({
id: 'createBayAction',
service: createBayService,
template: {
text: gettext('Create Bay')
}
})
.append({
id: 'deleteBaymodelAction',
service: deleteBaymodelService,
template: {
type: 'delete',
text: gettext('Delete Baymodel')
}
});
baymodelResourceType.batchActions
.append({
id: 'createBaymodelAction',
service: createBaymodelService,
template: {
type: 'create',
text: gettext('Create Baymodel')
}
})
.append({
id: 'batchDeleteBaymodelAction',
service: deleteBaymodelService,
template: {
type: 'delete-selected',
text: gettext('Delete Baymodels')
}
});
}
})();

View File

@ -1,45 +0,0 @@
<div ng-controller="createBaymodelInfoController as ctrl">
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label" for="baymodel-name" translate>Baymodel Name</label>
<input name="baymodel-name" type="text" class="form-control" id="baymodel-name"
ng-model="model.newBaymodelSpec.name"
placeholder="{$ 'Name of the baymodel to create.'|translate $}">
</div>
<div class="form-group">
<label class="control-label" for="baymodel-coe">
<translate>Container Orchestration Engine</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<select class="form-control" name="baymodel-coe" id="baymodel-coe"
ng-model="model.newBaymodelSpec.coe"
ng-required="true"
ng-options="coe.name as coe.label for coe in ctrl.coes"
ng-change="changeCoes()">
</select>
</div>
<div class="form-group">
<div class="themable-checkbox">
<input name="baymodel-public" type="checkbox" id="baymodel-public"
ng-model="model.newBaymodelSpec.public">
<label for="baymodel-public" translate>Public</label>
</div>
</div>
<div class="form-group">
<div class="themable-checkbox">
<input name="baymodel-registry-enabled" type="checkbox" id="baymodel-registry-enabled"
ng-model="model.newBaymodelSpec.registry_enabled">
<label for="baymodel-registry-enabled" translate>Enable Registry</label>
</div>
</div>
<div class="form-group">
<div class="themable-checkbox">
<input name="baymodel-tls-disabled" type="checkbox" id="baymodel-tls-disabled"
ng-model="model.newBaymodelSpec.tls_disabled">
<label for="baymodel-tls-disabled" translate>Disable TLS</label>
</div>
</div>
</div>
</div>
</div>

View File

@ -1 +0,0 @@
<p translate>Arbitrary labels in the form of key=value pairs to associate with a baymodel. May be used multiple times.</p>

View File

@ -1,11 +0,0 @@
<div ng-controller="createBaymodelLabelsController as ctrl">
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label" for="baymodel-labels" translate>Labels</label>
<textarea name="baymodel-labels" class="form-control" id="baymodel-labels"
rows="4" ng-model="model.newBaymodelSpec.labels"
placeholder="{$ 'KEY1=VALUE1,KEY2=VALUE2...'|translate $}"></textarea>
</div>
</div>
</div>

View File

@ -1,60 +0,0 @@
<div ng-controller="createBaymodelNetworkController as ctrl">
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label" for="baymodel-network-driver" translate>Network Driver</label>
<select name="baymodel-network-driver" type="text" class="form-control"
id="baymodel-network-driver"
ng-model="model.newBaymodelSpec.network_driver"
placeholder="{$ 'The network driver name for instantiating container networks'|translate $}"
ng-options="driver.name as driver.label for driver in model.newBaymodelSpec.network_drivers">
</select>
</div>
<div class="form-group">
<label class="control-label" for="baymodel-http-proxy" translate>HTTP Proxy</label>
<input name="baymodel-http-proxy" type="text" class="form-control"
id="baymodel-http-proxy"
ng-model="model.newBaymodelSpec.http_proxy"
placeholder="{$ 'The http_proxy address to use for nodes in bay'|translate $}">
</div>
<div class="form-group">
<label class="control-label" for="baymodel-https-proxy" translate>HTTPS Proxy</label>
<input name="baymodel-https-proxy" type="text" class="form-control"
id="baymodel-https-proxy"
ng-model="model.newBaymodelSpec.https_proxy"
placeholder="{$ 'The https_proxy address to use for nodes in bay'|translate $}">
</div>
<div class="form-group">
<label class="control-label" for="baymodel-no-proxy" translate>No Proxy</label>
<input name="baymodel-no-proxy" type="text" class="form-control"
id="baymodel-no-proxy"
ng-model="model.newBaymodelSpec.no_proxy"
placeholder="{$ 'The no_proxy address to use for nodes in bay'|translate $}">
</div>
<div class="form-group">
<label class="control-label" for="baymodel-external-network-id">
<translate>External Network ID</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<input name="baymodel-external-network-id" type="text" class="form-control"
id="baymodel-external-network-id"
ng-model="model.newBaymodelSpec.external_network_id" ng-required="true"
placeholder="{$ 'The external Neutron network ID to connect to this bay model'|translate $}">
</div>
<div class="form-group">
<label class="control-label" for="baymodel-fixed-network" translate>Fixed Network</label>
<input name="baymodel-fixed-network" type="text" class="form-control"
id="baymodel-fixed-network"
ng-model="model.newBaymodelSpec.fixed_network"
placeholder="{$ 'The private Neutron network name to connect to this bay model'|translate $}">
</div>
<div class="form-group">
<label class="control-label" for="baymodel-dns-nameserver" translate>DNS</label>
<input name="baymodel-dns-nameserver" type="text" class="form-control"
id="baymodel-dns-nameserver"
ng-model="model.newBaymodelSpec.dns_nameserver"
placeholder="{$ 'The DNS nameserver to use for this Bay'|translate $}">
</div>
</div>
</div>
</div>

View File

@ -1,67 +0,0 @@
<div ng-controller="createBaymodelSpecController as ctrl">
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label" for="baymodel-image-id">
<translate>Image</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<select name="baymodel-image-id" type="text" class="form-control" id="baymodel-image-id"
ng-model="model.newBaymodelSpec.image_id" ng-required="true"
ng-options="image.id as image.name for image in ctrl.images">
</select>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label" for="baymodel-flavor-id" translate>Flavor</label>
<select name="baymodel-flavor-id" type="text" class="form-control" id="baymodel-flavor-id"
ng-model="model.newBaymodelSpec.flavor_id"
ng-options="nflavor.id as nflavor.name for nflavor in ctrl.nflavors">
</select>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label" for="baymodel-master-flavor-id" translate>Master Flavor</label>
<select name="baymodel-master-flavor-id" type="text" class="form-control" id="baymodel-master-flavor-id"
ng-model="model.newBaymodelSpec.master_flavor_id"
ng-options="mflavor.id as mflavor.name for mflavor in ctrl.mflavors">
</select>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label" for="baymodel-volume-driver" translate>Volume Driver</label>
<select name="baymodel-volume-driver" type="text" class="form-control" id="baymodel-volume-driver"
ng-model="model.newBaymodelSpec.volume_driver"
placeholder="{$ 'The volume driver name for instantiating container volume.'|translate $}"
ng-options="driver.name as driver.label for driver in model.newBaymodelSpec.volume_drivers">
</select>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label" for="baymodel-docker-volume-size" translate>
Docker Volume Size (GB)
</label>
<input name="baymodel-docker-volume-size" type="number"
class="form-control" id="baymodel-docker-volume-size"
ng-model="model.newBaymodelSpec.docker_volume_size" min="1"
placeholder="{$ 'Specify the size in GB for the docker volume'|translate $}">
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label" for="baymodel-keypair-id">
<translate>Keypair</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<select name="baymodel-keypair-id" type="text" class="form-control" id="baymodel-keypair-id"
ng-model="model.newBaymodelSpec.keypair_id" ng-required="true"
ng-options="keypair.id as keypair.name for keypair in ctrl.keypairs">
</select>
</div>
</div>
</div>
</div>

View File

@ -1,4 +0,0 @@
<hz-resource-panel resource-type-name="OS::Magnum::Baymodel">
<hz-resource-table resource-type-name="OS::Magnum::Baymodel"
track-by="trackBy"></hz-resource-table>
</hz-resource-panel>

View File

@ -1,73 +0,0 @@
/**
* 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';
/**
* @ngdoc overview
* @ngname horizon.dashboard.container-infra.bays.actions
*
* @description
* Provides all of the actions for bays.
*/
angular.module('horizon.dashboard.container-infra.bays.actions', ['horizon.framework', 'horizon.dashboard.container-infra'])
.run(registerBayActions);
registerBayActions.$inject = [
'horizon.framework.conf.resource-type-registry.service',
'horizon.framework.util.i18n.gettext',
'horizon.dashboard.container-infra.bays.create.service',
'horizon.dashboard.container-infra.bays.delete.service',
'horizon.dashboard.container-infra.bays.resourceType',
];
function registerBayActions(
registry,
gettext,
createBayService,
deleteBayService,
resourceType)
{
var bayResourceType = registry.getResourceType(resourceType);
bayResourceType.itemActions
.append({
id: 'deleteBayAction',
service: deleteBayService,
template: {
type: 'delete',
text: gettext('Delete Bay')
}
});
bayResourceType.batchActions
.append({
id: 'createBayAction',
service: createBayService,
template: {
type: 'create',
text: gettext('Create Bay')
}
})
.append({
id: 'batchDeleteBayAction',
service: deleteBayService,
template: {
type: 'delete-selected',
text: gettext('Delete Bays')
}
});
}
})();

View File

@ -1,85 +0,0 @@
/**
* 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';
/**
* @ngdoc controller
* @name createBayInfoController
* @ngController
*
* @description
* Controller for the container-infra bay info step in create workflow
*/
angular
.module('horizon.dashboard.container-infra.bays')
.controller('createBayInfoController', createBayInfoController);
createBayInfoController.$inject = [
'$q',
'$scope',
'horizon.dashboard.container-infra.basePath',
'horizon.app.core.openstack-service-api.magnum'
];
function createBayInfoController($q, $scope, basePath, magnum) {
var ctrl = this;
ctrl.baymodels = [{id:"", name: gettext("Choose a Baymodel")}];
$scope.model.newBaySpec.baymodel_id = "";
$scope.baymodeldetail = {
name: "",
id: "",
coe: "",
image_id: "",
public: "",
registry_enabled: "",
tls_disabled: "",
apiserver_port: ""
};
$scope.changeBaymodel = function(){
angular.forEach(ctrl.baymodels, function(model, idx){
if($scope.model.newBaySpec.baymodel_id === model.id){
$scope.baymodeldetail.name = model.name;
$scope.baymodeldetail.id = model.id;
$scope.baymodeldetail.coe = model.coe;
$scope.baymodeldetail.image_id = model.image_id;
$scope.baymodeldetail.public = model.public;
$scope.baymodeldetail.registry_enabled = model.registry_enabled;
$scope.baymodeldetail.tls_disabled = model.tls_disabled;
$scope.baymodeldetail.apiserver_port = model.apiserver_port;
}
});
};
init();
function init() {
magnum.getBaymodels({paginate: false}).success(onGetBaymodels);
}
function onGetBaymodels(response) {
Array.prototype.push.apply(ctrl.baymodels, response.items);
if($scope.selected instanceof Object){
$scope.model.newBaySpec.baymodel_id = $scope.selected.id;
$scope.changeBaymodel();
}
}
}
})();

View File

@ -1 +0,0 @@
<p translate>Specify bay name and choose baymodel</p>

View File

@ -1,50 +0,0 @@
<div ng-controller="createBayInfoController as ctrl">
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label" for="bay-name" translate>Bay Name</label>
<input name="bay-name" type="text" class="form-control" id="bay-name"
ng-model="model.newBaySpec.name"
placeholder="{$ 'Name of the bay to create.'|translate $}">
</div>
<div class="form-group">
<label class="control-label" for="bay-model">
<translate>Baymodel</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<select class="form-control" name="bay-model" id="bay-model"
ng-model="model.newBaySpec.baymodel_id"
ng-required="true"
ng-options="baymodel.id as baymodel.name|noName for baymodel in ctrl.baymodels"
ng-change="changeBaymodel()">
</select>
</div>
<div class="detail" ng-show="model.newBaySpec.baymodel_id">
<span translate class="h4">Baymodel Detail</span>
<dl class="dl-horizontal">
<dt translate>Name</dt>
<dd><a ng-href="project/ngdetails/OS::Magnum::Baymodel/{$ baymodeldetail.id $}" ng-click="cancel()">
{$ baymodeldetail.name|noName $}
</a></dd>
<dt translate>ID</dt>
<dd>{$ baymodeldetail.id $}</dd>
<dt translate>COE</dt>
<dd>{$ baymodeldetail.coe $}</dd>
<dt translate>Image ID</dt>
<dd>{$ baymodeldetail.image_id $}</dd>
<dt translate>Public</dt>
<dd>{$ baymodeldetail.public $}</dd>
<dt translate>Registry Enabled</dt>
<dd>{$ baymodeldetail.registry_enabled $}</dd>
<dt translate>TLS Disabled</dt>
<dd>{$ baymodeldetail.tls_disabled $}</dd>
<dt translate>API Server Port</dt>
<dd>{$ baymodeldetail.apiserver_port $}</dd>
</dl>
</div>
</div>
</div>
</div>

View File

@ -1 +0,0 @@
<p translate>Specify conditions for bay creation.</p>

View File

@ -1,17 +0,0 @@
<div ng-controller="createBayMiscController as ctrl">
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label" for="bay-discovery-url" translate>Discovery URL</label>
<input name="bay-discovery-url" type="text" class="form-control"
ng-model="model.newBaySpec.discovery_url" id="bay-discovery-url"
placeholder="{$ 'Specifies custom discovery url for node discovery.'|translate $}">
</div>
<div class="form-group">
<label class="control-label" for="bay-timeout" translate>Timeout</label>
<input name="bay-timeout" type="number" min="0" class="form-control"
ng-model="model.newBaySpec.bay_create_timeout" id="bay-timeout"
placeholder="{$ 'The timeout for bay creation in minutes. Set to 0 for no timeout. The default is no timeout.'|translate $}">
</div>
</div>
</div>

View File

@ -1 +0,0 @@
<p translate>Specify the number of master nodes and bay nodes for the bay.</p>

View File

@ -1,20 +0,0 @@
<div ng-controller="createBaySizeController as ctrl">
<div class="row">
<div class="col-xs-12 col-sm-6">
<div class="form-group">
<label class="control-label" for="bay-master-count" translate>Master Count</label>
<input name="bay-master-count" type="number" min="1" id="bay-master-count"
class="form-control" ng-model="model.newBaySpec.master_count"
placeholder="{$ 'The number of master nodes for the bay.'|translate $}">
</div>
</div>
<div class="col-xs-12 col-sm-6">
<div class="form-group">
<label class="control-label" for="bay-node-count" translate>Node Count</label>
<input name="bay-node-count" type="number" min="1" id="bay-node-count"
class="form-control" ng-model="model.newBaySpec.node_count"
placeholder="{$ 'The bay node count.'|translate $}">
</div>
</div>
</div>
</div>

View File

@ -1,77 +0,0 @@
<div ng-controller="BayOverviewController as ctrl">
<div class="row">
<div class="col-md-6 detail">
<h3 translate>Baymodel</h3>
<hr>
<dl class="dl-horizontal">
<dt translate>Name</dt>
<dd><a ng-href="project/ngdetails/OS::Magnum::Baymodel/{$ ctrl.baymodel.id $}">{$ ctrl.baymodel.name|noName $}</a></dd>
<dt translate>ID</dt>
<dd>{$ ctrl.baymodel.id $}</dd>
<dt translate>COE</dt>
<dd>{$ ctrl.baymodel.coe $}</dd>
<dt translate>Image ID</dt>
<dd>{$ ctrl.baymodel.image_id $}</dd>
</dl>
</div>
<div class="col-md-6 detail">
<h3 translate>Nodes</h3>
<hr>
<dl class="dl-horizontal">
<dt translate>Master Count</dt>
<dd>{$ ctrl.bay.master_count $}</dd>
<dt translate>Node Count</dt>
<dd>{$ ctrl.bay.node_count $}</dd>
<dt translate>API Address</dt>
<dd>{$ ctrl.bay.api_address $}</dd>
<dt translate>Master Addresses</dt>
<dd>
<div ng-repeat="addr in ctrl.bay.master_addresses">{$ addr $}</div>
</dd>
<dt translate>Node Addresses</dt>
<dd>
<div ng-repeat="addr in ctrl.bay.node_addresses">{$ addr $}</div>
</dd>
</dl>
</div>
</div>
<div class="row">
<div class="col-md-6 detail">
<h3 translate>Miscellaneous</h3>
<hr>
<dl class="dl-horizontal">
<dt translate>Stack ID</dt>
<dd><a ng-href="project/stacks/stack/{$ ctrl.bay.stack_id $}" target="_self">
{$ ctrl.bay.stack_id $}
</a></dd>
<dt translate>Discovery URL</dt>
<dd>{$ ctrl.bay.discovery_url $}</dd>
<dt translate>Bay Create Timeout</dt>
<dd>
<div ng-switch on="ctrl.bay.bay_create_timeout === 0 || ctrl.bay.bay_create_timeout === null">
<div ng-switch-when="true" translate>Infinite</div>
<div ng-switch-default translate
translate-n="ctrl.bay.bay_create_timeout"
translate-plural="{$ ctrl.bay.bay_create_timeout $} minutes">
{$ ctrl.bay.bay_create_timeout $} minute
</div>
</div>
</dd>
</dl>
</div>
<div class="col-md-6 detail">
<h3 translate>Record Properties</h3>
<hr>
<dl class="dl-horizontal">
<dt translate>Created</dt>
<dd>{$ ctrl.bay.created_at | date:'short' $}</dd>
<dt translate>Updated</dt>
<dd>{$ ctrl.bay.updated_at | date:'short' $}</dd>
<dt translate>ID</dt>
<dd>{$ ctrl.bay.id $}</dd>
<dt translate>Status</dt>
<dd>{$ ctrl.bay.status $}</dd>
</dl>
</div>
</div>
</div>

View File

@ -1,4 +0,0 @@
<hz-resource-panel resource-type-name="OS::Magnum::Bay">
<hz-resource-table resource-type-name="OS::Magnum::Bay"
track-by="trackBy"></hz-resource-table>
</hz-resource-panel>

View File

@ -0,0 +1,82 @@
/**
* 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';
/**
* @ngdoc overview
* @ngname horizon.dashboard.container-infra.cluster-templates.actions
*
* @description
* Provides all of the actions for cluster templates.
*/
angular.module('horizon.dashboard.container-infra.cluster-templates.actions', ['horizon.framework', 'horizon.dashboard.container-infra'])
.run(registerClusterTemplateActions);
registerClusterTemplateActions.$inject = [
'horizon.framework.conf.resource-type-registry.service',
'horizon.framework.util.i18n.gettext',
'horizon.dashboard.container-infra.cluster-templates.create.service',
'horizon.dashboard.container-infra.cluster-templates.delete.service',
'horizon.dashboard.container-infra.clusters.create.service',
'horizon.dashboard.container-infra.cluster-templates.resourceType',
];
function registerClusterTemplateActions(
registry,
gettext,
createClusterTemplateService,
deleteClusterTemplateService,
createClusterService,
resourceType)
{
var templateResourceType = registry.getResourceType(resourceType);
templateResourceType.itemActions
.append({
id: 'createClusterAction',
service: createClusterService,
template: {
text: gettext('Create Cluster')
}
})
.append({
id: 'deleteClusterTemplateAction',
service: deleteClusterTemplateService,
template: {
type: 'delete',
text: gettext('Delete Cluster Template')
}
});
templateResourceType.batchActions
.append({
id: 'createClusterTemplateAction',
service: createClusterTemplateService,
template: {
type: 'create',
text: gettext('Create Cluster Template')
}
})
.append({
id: 'batchDeleteClusterTemplateAction',
service: deleteClusterTemplateService,
template: {
type: 'delete-selected',
text: gettext('Delete Cluster Templates')
}
});
}
})();

View File

@ -19,46 +19,46 @@
/**
* @ngdoc overview
* @name horizon.dashboard.container-infra.baymodels
* @name horizon.dashboard.container-infra.cluster-templates
* @ngModule
*
* @description
* Provides all the services and widgets require to display the baymodel
* Provides all the services and widgets require to display the cluster template
* panel
*/
angular
.module('horizon.dashboard.container-infra.baymodels', [
.module('horizon.dashboard.container-infra.cluster-templates', [
'ngRoute',
'horizon.dashboard.container-infra.baymodels.actions',
'horizon.dashboard.container-infra.baymodels.details'
'horizon.dashboard.container-infra.cluster-templates.actions',
'horizon.dashboard.container-infra.cluster-templates.details'
])
.constant('horizon.dashboard.container-infra.baymodels.events', events())
.constant('horizon.dashboard.container-infra.baymodels.resourceType', 'OS::Magnum::Baymodel')
.constant('horizon.dashboard.container-infra.cluster-templates.events', events())
.constant('horizon.dashboard.container-infra.cluster-templates.resourceType', 'OS::Magnum::ClusterTemplate')
.run(run)
.config(config);
/**
* @ngdoc constant
* @name horizon.dashboard.container-infra.baymodels.events
* @description A list of events used by Baymodels
* @name horizon.dashboard.container-infra.cluster-templates.events
* @description A list of events used by cluster templates
*/
function events() {
return {
CREATE_SUCCESS: 'horizon.dashboard.container-infra.baymodels.CREATE_SUCCESS',
DELETE_SUCCESS: 'horizon.dashboard.container-infra.baymodels.DELETE_SUCCESS'
CREATE_SUCCESS: 'horizon.dashboard.container-infra.cluster-templates.CREATE_SUCCESS',
DELETE_SUCCESS: 'horizon.dashboard.container-infra.cluster-templates.DELETE_SUCCESS'
};
}
run.$inject = [
'horizon.framework.conf.resource-type-registry.service',
'horizon.app.core.openstack-service-api.magnum',
'horizon.dashboard.container-infra.baymodels.basePath',
'horizon.dashboard.container-infra.baymodels.resourceType'
'horizon.dashboard.container-infra.cluster-templates.basePath',
'horizon.dashboard.container-infra.cluster-templates.resourceType'
];
function run(registry, magnum, basePath, resourceType) {
registry.getResourceType(resourceType)
.setNames(gettext('Baymodel'), gettext('Baymodels'))
.setNames(gettext('Cluster Template'), gettext('Cluster Templates'))
// for detail summary view on table row
.setSummaryTemplateUrl(basePath + 'details/drawer.html')
@ -121,20 +121,20 @@
})
function listFunction(params) {
return magnum.getBaymodels(params).then(modifyResponse);
return magnum.getClusterTemplates(params).then(modifyResponse);
function modifyResponse(response) {
return {data: {items: response.data.items.map(addTrackBy)}};
function addTrackBy(baymodel) {
baymodel.trackBy = baymodel.id;
return baymodel;
function addTrackBy(cluster_template) {
cluster_template.trackBy = cluster_template.id;
return cluster_template;
}
}
}
function urlFunction(item) {
return 'project/ngdetails/OS::Magnum::Baymodel/' + item.id;
return 'project/ngdetails/OS::Magnum::ClusterTemplate/' + item.id;
}
}
@ -153,9 +153,9 @@
* @returns {undefined} Returns nothing
*/
function config($provide, $windowProvider, $routeProvider) {
var path = $windowProvider.$get().STATIC_URL + 'dashboard/container-infra/baymodels/';
$provide.constant('horizon.dashboard.container-infra.baymodels.basePath', path);
$routeProvider.when('/project/baymodels/', {
var path = $windowProvider.$get().STATIC_URL + 'dashboard/container-infra/cluster-templates/';
$provide.constant('horizon.dashboard.container-infra.cluster-templates.basePath', path);
$routeProvider.when('/project/cluster_templates/', {
templateUrl: path + 'panel.html'
});
}

View File

@ -16,9 +16,9 @@
(function() {
'use strict';
describe('horizon.dashboard.container-infra.baymodels', function() {
describe('horizon.dashboard.container-infra.cluster-templates', function() {
it('should exist', function() {
expect(angular.module('horizon.dashboard.container-infra.baymodels')).toBeDefined();
expect(angular.module('horizon.dashboard.container-infra.cluster-templates')).toBeDefined();
});
});

View File

@ -18,24 +18,24 @@
'use strict';
angular
.module('horizon.dashboard.container-infra.baymodels')
.factory('horizon.dashboard.container-infra.baymodels.baymodelModel', baymodelModel);
.module('horizon.dashboard.container-infra.cluster-templates')
.factory('horizon.dashboard.container-infra.cluster-templates.model', ClusterTemplateModel);
baymodelModel.$inject = [
ClusterTemplateModel.$inject = [
'horizon.app.core.openstack-service-api.magnum'
];
function baymodelModel(magnum) {
function ClusterTemplateModel(magnum) {
var model = {
newBaymodelSpec: {},
newClusterTemplateSpec: {},
// API methods
init: init,
createBaymodel: createBaymodel
createClusterTemplate: createClusterTemplate
};
function initNewBaymodelSpec() {
model.newBaymodelSpec = {
function initNewClusterTemplateSpec() {
model.newClusterTemplateSpec = {
name: null,
coe: "",
public: null,
@ -64,16 +64,16 @@
}
function init() {
// Reset the new Baymodel spec
initNewBaymodelSpec();
// Reset the new cluster template spec
initNewClusterTemplateSpec();
}
function createBaymodel() {
var finalSpec = angular.copy(model.newBaymodelSpec);
function createClusterTemplate() {
var finalSpec = angular.copy(model.newClusterTemplateSpec);
cleanNullProperties(finalSpec);
return magnum.createBaymodel(finalSpec);
return magnum.createClusterTemplate(finalSpec);
}
function cleanNullProperties(finalSpec) {

View File

@ -18,42 +18,42 @@
'use strict';
angular
.module('horizon.dashboard.container-infra.baymodels')
.factory('horizon.dashboard.container-infra.baymodels.workflow', baymodelWorkflow);
.module('horizon.dashboard.container-infra.cluster-templates')
.factory('horizon.dashboard.container-infra.cluster-templates.workflow', ClusterTemplateWorkflow);
baymodelWorkflow.$inject = [
ClusterTemplateWorkflow.$inject = [
'horizon.dashboard.container-infra.basePath',
'horizon.app.core.workflow.factory',
'horizon.framework.util.i18n.gettext'
];
function baymodelWorkflow(basePath, workflowService, gettext) {
function ClusterTemplateWorkflow(basePath, workflowService, gettext) {
return workflowService({
title: gettext('Create Baymodel'),
title: gettext('Create Cluster Template'),
steps: [
{
title: gettext('Info'),
templateUrl: basePath + 'baymodels/create/info/info.html',
helpUrl: basePath + 'baymodels/create/info/info.help.html',
formName: 'baymodelInfoForm'
templateUrl: basePath + 'cluster-templates/create/info/info.html',
helpUrl: basePath + 'cluster-templates/create/info/info.help.html',
formName: 'ClusterTemplateInfoForm'
},
{
title: gettext('Node Spec'),
templateUrl: basePath + 'baymodels/create/spec/spec.html',
helpUrl: basePath + 'baymodels/create/spec/spec.help.html',
formName: 'baymodelSpecForm'
templateUrl: basePath + 'cluster-templates/create/spec/spec.html',
helpUrl: basePath + 'cluster-templates/create/spec/spec.help.html',
formName: 'ClusterTemplateSpecForm'
},
{
title: gettext('Network'),
templateUrl: basePath + 'baymodels/create/network/network.html',
helpUrl: basePath + 'baymodels/create/network/network.help.html',
formName: 'baymodelNetworkForm'
templateUrl: basePath + 'cluster-templates/create/network/network.html',
helpUrl: basePath + 'cluster-templates/create/network/network.help.html',
formName: 'ClusterTemplateNetworkForm'
},
{
title: gettext('Labels'),
templateUrl: basePath + 'baymodels/create/labels/labels.html',
helpUrl: basePath + 'baymodels/create/labels/labels.help.html',
formName: 'baymodelLabelsForm'
templateUrl: basePath + 'cluster-templates/create/labels/labels.html',
helpUrl: basePath + 'cluster-templates/create/labels/labels.help.html',
formName: 'ClusterTemplateLabelsForm'
}
],

View File

@ -19,12 +19,12 @@
/**
* @ngdoc overview
* @name horizon.dashboard.container-infra.baymodels.create.service
* @description Service for the container-infra bay model create modal
* @name horizon.dashboard.container-infra.cluster-templates.create.service
* @description Service for the container-infra cluster template create modal
*/
angular
.module('horizon.dashboard.container-infra.baymodels')
.factory('horizon.dashboard.container-infra.baymodels.create.service', createService);
.module('horizon.dashboard.container-infra.cluster-templates')
.factory('horizon.dashboard.container-infra.cluster-templates.create.service', createService);
createService.$inject = [
'horizon.app.core.openstack-service-api.policy',
@ -33,10 +33,10 @@
'horizon.framework.util.q.extensions',
'horizon.framework.widgets.modal.wizard-modal.service',
'horizon.framework.widgets.toast.service',
'horizon.dashboard.container-infra.baymodels.baymodelModel',
'horizon.dashboard.container-infra.baymodels.events',
'horizon.dashboard.container-infra.baymodels.resourceType',
'horizon.dashboard.container-infra.baymodels.workflow'
'horizon.dashboard.container-infra.cluster-templates.model',
'horizon.dashboard.container-infra.cluster-templates.events',
'horizon.dashboard.container-infra.cluster-templates.resourceType',
'horizon.dashboard.container-infra.cluster-templates.workflow'
];
function createService(
@ -45,7 +45,7 @@
var scope;
var message = {
success: gettext('Baymodel %s was successfully created.')
success: gettext('Cluster template %s was successfully created.')
};
var service = {
@ -80,7 +80,7 @@
}
function submit(){
return model.createBaymodel().then(success);
return model.createClusterTemplate().then(success);
}
function success(response) {

View File

@ -19,17 +19,17 @@
/**
* @ngdoc controller
* @name createBaymodelInfoController
* @name createClusterTemplateInfoController
* @ngController
*
* @description
* Controller for the bay model info step in create workflow
* Controller for the cluster template info step in create workflow
*/
angular
.module('horizon.dashboard.container-infra.baymodels')
.controller('createBaymodelInfoController', createBaymodelInfoController);
.module('horizon.dashboard.container-infra.cluster-templates')
.controller('createClusterTemplateInfoController', createClusterTemplateInfoController);
createBaymodelInfoController.$inject = [
createClusterTemplateInfoController.$inject = [
'$q',
'$scope',
'horizon.dashboard.container-infra.basePath',
@ -37,7 +37,7 @@
'horizon.framework.util.i18n.gettext'
];
function createBaymodelInfoController($q, $scope, basePath, magnum, gettext) {
function createClusterTemplateInfoController($q, $scope, basePath, magnum, gettext) {
var ctrl = this;
ctrl.coes = [{name: "", label: gettext("Choose a Container Orchestration Engine")},
{name: "swarm", label: gettext("Docker Swarm")},
@ -64,16 +64,16 @@
{name:"rexray", label: gettext("Rexray")}]};
$scope.changeCoes = function(){
if($scope.model.newBaymodelSpec.coe){
$scope.model.newBaymodelSpec.network_drivers = ctrl.supportedNetworkDrivers[$scope.model.newBaymodelSpec.coe];
$scope.model.newBaymodelSpec.network_driver = ctrl.supportedNetworkDrivers[$scope.model.newBaymodelSpec.coe][0].name;
$scope.model.newBaymodelSpec.volume_drivers = ctrl.supportedVolumeDrivers[$scope.model.newBaymodelSpec.coe];
$scope.model.newBaymodelSpec.volume_driver = ctrl.supportedVolumeDrivers[$scope.model.newBaymodelSpec.coe][0].name;
if($scope.model.newClusterTemplateSpec.coe){
$scope.model.newClusterTemplateSpec.network_drivers = ctrl.supportedNetworkDrivers[$scope.model.newClusterTemplateSpec.coe];
$scope.model.newClusterTemplateSpec.network_driver = ctrl.supportedNetworkDrivers[$scope.model.newClusterTemplateSpec.coe][0].name;
$scope.model.newClusterTemplateSpec.volume_drivers = ctrl.supportedVolumeDrivers[$scope.model.newClusterTemplateSpec.coe];
$scope.model.newClusterTemplateSpec.volume_driver = ctrl.supportedVolumeDrivers[$scope.model.newClusterTemplateSpec.coe][0].name;
}else{
$scope.model.newBaymodelSpec.network_drivers = ctrl.supportedNetworkDrivers.initial;
$scope.model.newBaymodelSpec.network_driver = ctrl.supportedNetworkDrivers.initial[0].name;
$scope.model.newBaymodelSpec.volume_drivers = ctrl.supportedVolumeDrivers.initial;
$scope.model.newBaymodelSpec.volume_driver = ctrl.supportedVolumeDrivers.initial[0].name;
$scope.model.newClusterTemplateSpec.network_drivers = ctrl.supportedNetworkDrivers.initial;
$scope.model.newClusterTemplateSpec.network_driver = ctrl.supportedNetworkDrivers.initial[0].name;
$scope.model.newClusterTemplateSpec.volume_drivers = ctrl.supportedVolumeDrivers.initial;
$scope.model.newClusterTemplateSpec.volume_driver = ctrl.supportedVolumeDrivers.initial[0].name;
}
};
}

View File

@ -1,12 +1,12 @@
<dl>
<dt translate>Baymodel Name</dt>
<dt translate>Cluster Template Name</dt>
<dd translate>An arbitrary human-readable name</dd>
<dt translate>Container Orchestration Engine</dt>
<dd translate>Specify the Container Orchestration Engine to use.</dd>
<dt translate>Public</dt>
<dd translate>Make baymodel public. Default: False</dd>
<dd translate>Make cluster template public. Default: False</dd>
<dt translate>Enable Registry</dt>
<dd translate>Enable docker registry in the Bay. Default: False</dd>
<dd translate>Enable docker registry in the cluster temlate. Default: False</dd>
<dt translate>Disable TLS</dt>
<dd translate>Disable TLS in the Bay. Default: False</dd>
<dd translate>Disable TLS in the cluster template. Default: False</dd>
</dl>

View File

@ -0,0 +1,45 @@
<div ng-controller="createClusterTemplateInfoController as ctrl">
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label" for="cluster-template-name" translate>Cluster template Name</label>
<input name="cluster-template-name" type="text" class="form-control" id="cluster-template-name"
ng-model="model.newClusterTemplateSpec.name"
placeholder="{$ 'Name of the cluster template to create.'|translate $}">
</div>
<div class="form-group">
<label class="control-label" for="cluster-template-coe">
<translate>Container Orchestration Engine</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<select class="form-control" name="cluster-template-coe" id="cluster-template-coe"
ng-model="model.newClusterTemplateSpec.coe"
ng-required="true"
ng-options="coe.name as coe.label for coe in ctrl.coes"
ng-change="changeCoes()">
</select>
</div>
<div class="form-group">
<div class="themable-checkbox">
<input name="cluster-template-public" type="checkbox" id="cluster-template-public"
ng-model="model.newClusterTemplateSpec.public">
<label for="cluster-template-public" translate>Public</label>
</div>
</div>
<div class="form-group">
<div class="themable-checkbox">
<input name="cluster-template-registry-enabled" type="checkbox" id="cluster-template-registry-enabled"
ng-model="model.newClusterTemplateSpec.registry_enabled">
<label for="cluster-template-registry-enabled" translate>Enable Registry</label>
</div>
</div>
<div class="form-group">
<div class="themable-checkbox">
<input name="cluster-template-tls-disabled" type="checkbox" id="cluster-template-tls-disabled"
ng-model="model.newClusterTemplateSpec.tls_disabled">
<label for="cluster-template-tls-disabled" translate>Disable TLS</label>
</div>
</div>
</div>
</div>
</div>

View File

@ -19,24 +19,24 @@
/**
* @ngdoc controller
* @name createBaymodelLabelsController
* @name createClusterTemplateLabelsController
* @ngController
*
* @description
* Controller for the bay model labels step in create workflow
* Controller for the cluster template labels step in create workflow
*/
angular
.module('horizon.dashboard.container-infra.baymodels')
.controller('createBaymodelLabelsController', createBaymodelLabelsController);
.module('horizon.dashboard.container-infra.cluster-templates')
.controller('createClusterTemplateLabelsController', createClusterTemplateLabelsController);
createBaymodelLabelsController.$inject = [
createClusterTemplateLabelsController.$inject = [
'$q',
'$scope',
'horizon.dashboard.container-infra.basePath',
'horizon.app.core.openstack-service-api.magnum'
];
function createBaymodelLabelsController($q, $scope, basePath, magnum) {
function createClusterTemplateLabelsController($q, $scope, basePath, magnum) {
var ctrl = this;
}

View File

@ -0,0 +1 @@
<p translate>Arbitrary labels in the form of key=value pairs to associate with a cluster templates. May be used multiple times.</p>

View File

@ -0,0 +1,11 @@
<div ng-controller="createClusterTemplateLabelsController as ctrl">
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label" for="cluster-template-labels" translate>Labels</label>
<textarea name="cluster-template-labels" class="form-control" id="cluster-template-labels"
rows="4" ng-model="model.newClusterTemplateSpec.labels"
placeholder="{$ 'KEY1=VALUE1,KEY2=VALUE2...'|translate $}"></textarea>
</div>
</div>
</div>

View File

@ -19,24 +19,24 @@
/**
* @ngdoc controller
* @name createBaymodelNetworkController
* @name createClusterTemplateNetworkController
* @ngController
*
* @description
* Controller for the bay model network step in create workflow
* Controller for the cluster template network step in create workflow
*/
angular
.module('horizon.dashboard.container-infra.baymodels')
.controller('createBaymodelNetworkController', createBaymodelNetworkController);
.module('horizon.dashboard.container-infra.cluster-templates')
.controller('createClusterTemplateNetworkController', createClusterTemplateNetworkController);
createBaymodelNetworkController.$inject = [
createClusterTemplateNetworkController.$inject = [
'$q',
'$scope',
'horizon.dashboard.container-infra.basePath',
'horizon.app.core.openstack-service-api.magnum'
];
function createBaymodelNetworkController($q, $scope, basePath, magnum) {
function createClusterTemplateNetworkController($q, $scope, basePath, magnum) {
var ctrl = this;
};

View File

@ -1,4 +1,4 @@
<dt translate>Fixed Network</dt>
<dd translate>This should really be named fixed-network-cidr. Default: 10.0.0.0/24</dd>
<dt translate>DNS</dt>
<dd translate>Specify the nameserver to use for the Bay. Default: 8.8.8.8</dd>
<dd translate>Specify the nameserver to use for the cluster template. Default: 8.8.8.8</dd>

View File

@ -0,0 +1,60 @@
<div ng-controller="createClusterTemplateNetworkController as ctrl">
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label" for="cluster-template-network-driver" translate>Network Driver</label>
<select name="cluster-template-network-driver" type="text" class="form-control"
id="cluster-template-network-driver"
ng-model="model.newClusterTemplateSpec.network_driver"
placeholder="{$ 'The network driver name for instantiating container networks'|translate $}"
ng-options="driver.name as driver.label for driver in model.newClusterTemplateSpec.network_drivers">
</select>
</div>
<div class="form-group">
<label class="control-label" for="cluster-template-http-proxy" translate>HTTP Proxy</label>
<input name="cluster-template-http-proxy" type="text" class="form-control"
id="cluster-template-http-proxy"
ng-model="model.newClusterTemplateSpec.http_proxy"
placeholder="{$ 'The http_proxy address to use for nodes in cluster'|translate $}">
</div>
<div class="form-group">
<label class="control-label" for="cluster-template-https-proxy" translate>HTTPS Proxy</label>
<input name="cluster-template-https-proxy" type="text" class="form-control"
id="cluster-template-https-proxy"
ng-model="model.newClusterTemplateSpec.https_proxy"
placeholder="{$ 'The https_proxy address to use for nodes in cluster'|translate $}">
</div>
<div class="form-group">
<label class="control-label" for="cluster-template-no-proxy" translate>No Proxy</label>
<input name="cluster-template-no-proxy" type="text" class="form-control"
id="cluster-template-no-proxy"
ng-model="model.newClusterTemplateSpec.no_proxy"
placeholder="{$ 'The no_proxy address to use for nodes in cluster'|translate $}">
</div>
<div class="form-group">
<label class="control-label" for="cluster-template-external-network-id">
<translate>External Network ID</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<input name="cluster-template-external-network-id" type="text" class="form-control"
id="cluster-template-external-network-id"
ng-model="model.newClusterTemplateSpec.external_network_id" ng-required="true"
placeholder="{$ 'The external Neutron network ID to connect to this cluster template'|translate $}">
</div>
<div class="form-group">
<label class="control-label" for="cluster-template-fixed-network" translate>Fixed Network</label>
<input name="cluster-template-fixed-network" type="text" class="form-control"
id="cluster-template-fixed-network"
ng-model="model.newClusterTemplateSpec.fixed_network"
placeholder="{$ 'The private Neutron network name to connect to this cluster template'|translate $}">
</div>
<div class="form-group">
<label class="control-label" for="cluster-template-dns-nameserver" translate>DNS</label>
<input name="cluster-template-dns-nameserver" type="text" class="form-control"
id="cluster-template-dns-nameserver"
ng-model="model.newClusterTemplateSpec.dns_nameserver"
placeholder="{$ 'The DNS nameserver to use for this cluster template'|translate $}">
</div>
</div>
</div>
</div>

View File

@ -19,17 +19,17 @@
/**
* @ngdoc controller
* @name createBaymodelSpecController
* @name createClusterTemplateSpecController
* @ngController
*
* @description
* Controller for the bay model spec step in create workflow
* Controller for the cluster template spec step in create workflow
*/
angular
.module('horizon.dashboard.container-infra.baymodels')
.controller('createBaymodelSpecController', createBaymodelSpecController);
.module('horizon.dashboard.container-infra.cluster-templates')
.controller('createClusterTemplateSpecController', createClusterTemplateSpecController);
createBaymodelSpecController.$inject = [
createClusterTemplateSpecController.$inject = [
'$q',
'$scope',
'horizon.dashboard.container-infra.basePath',
@ -38,7 +38,7 @@
'horizon.app.core.openstack-service-api.glance'
];
function createBaymodelSpecController($q, $scope, basePath, magnum, nova, glance) {
function createClusterTemplateSpecController($q, $scope, basePath, magnum, nova, glance) {
var ctrl = this;
ctrl.images = [{id:"", name: gettext("Choose an Image")}];
ctrl.nflavors = [{id:"", name: gettext("Choose a Flavor for the Node")}];

View File

@ -1,12 +1,12 @@
<dl>
<dt translate>Image</dt>
<dd translate>The name or UUID of the base image to customize for the bay.</dd>
<dd translate>The name or UUID of the base image to customize for the cluster.</dd>
<dt translate>Flavor</dt>
<dd translate>The nova flavor id to use when launching the bay. Default: m1.small</dd>
<dd translate>The nova flavor id to use when launching the cluster. Default: m1.small</dd>
<dt translate>Master Flavor</dt>
<dd translate>The nova flavor id to use when launching the master node of the bay. Default: m1.small</dd>
<dd translate>The nova flavor id to use when launching the master node of the cluster. Default: m1.small</dd>
<dt translate>Docker Volume Size</dt>
<dd translate>The size in GB for Docker Volume. Default: 25</dd>
<dt translate>Keypair</dt>
<dd translate>The name or UUID of the SSH keypair to load into the Bay nodes.</dd>
<dd translate>The name or UUID of the SSH keypair to load into the cluster nodes.</dd>
</dl>

View File

@ -0,0 +1,67 @@
<div ng-controller="createClusterTemplateSpecController as ctrl">
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label" for="cluster-template-image-id">
<translate>Image</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<select name="cluster-template-image-id" type="text" class="form-control" id="cluster-template-image-id"
ng-model="model.newClusterTemplateSpec.image_id" ng-required="true"
ng-options="image.id as image.name for image in ctrl.images">
</select>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label" for="cluster-template-flavor-id" translate>Flavor</label>
<select name="cluster-template-flavor-id" type="text" class="form-control" id="cluster-template-flavor-id"
ng-model="model.newClusterTemplateSpec.flavor_id"
ng-options="nflavor.id as nflavor.name for nflavor in ctrl.nflavors">
</select>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label" for="cluster-template-master-flavor-id" translate>Master Flavor</label>
<select name="cluster-template-master-flavor-id" type="text" class="form-control" id="cluster-template-master-flavor-id"
ng-model="model.newClusterTemplateSpec.master_flavor_id"
ng-options="mflavor.id as mflavor.name for mflavor in ctrl.mflavors">
</select>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label" for="cluster-template-volume-driver" translate>Volume Driver</label>
<select name="cluster-template-volume-driver" type="text" class="form-control" id="cluster-template-volume-driver"
ng-model="model.newClusterTemplateSpec.volume_driver"
placeholder="{$ 'The volume driver name for instantiating container volume.'|translate $}"
ng-options="driver.name as driver.label for driver in model.newClusterTemplateSpec.volume_drivers">
</select>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label" for="cluster-template-docker-volume-size" translate>
Docker Volume Size (GB)
</label>
<input name="cluster-template-docker-volume-size" type="number"
class="form-control" id="cluster-template-docker-volume-size"
ng-model="model.newClusterTemplateSpec.docker_volume_size" min="1"
placeholder="{$ 'Specify the size in GB for the docker volume'|translate $}">
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label" for="cluster-template-keypair-id">
<translate>Keypair</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<select name="cluster-template-keypair-id" type="text" class="form-control" id="cluster-template-keypair-id"
ng-model="model.newClusterTemplateSpec.keypair_id" ng-required="true"
ng-options="keypair.id as keypair.name for keypair in ctrl.keypairs">
</select>
</div>
</div>
</div>
</div>

View File

@ -16,8 +16,8 @@
'use strict';
angular
.module('horizon.dashboard.container-infra.baymodels')
.factory('horizon.dashboard.container-infra.baymodels.delete.service', deleteService);
.module('horizon.dashboard.container-infra.cluster-templates')
.factory('horizon.dashboard.container-infra.cluster-templates.delete.service', deleteService);
deleteService.$inject = [
'$location',
@ -29,16 +29,16 @@
'horizon.framework.util.q.extensions',
'horizon.framework.widgets.modal.deleteModalService',
'horizon.framework.widgets.toast.service',
'horizon.dashboard.container-infra.baymodels.resourceType',
'horizon.dashboard.container-infra.baymodels.events'
'horizon.dashboard.container-infra.cluster-templates.resourceType',
'horizon.dashboard.container-infra.cluster-templates.events'
];
/**
* @ngDoc factory
* @name horizon.dashboard.container-infra.baymodels.delete.service
* @name horizon.dashboard.container-infra.cluster-templates.delete.service
*
* @Description
* Brings up the delete baymodels confirmation modal dialog.
* Brings up the delete cluster templates confirmation modal dialog.
* On submit, delete selected resources.
* On cancel, do nothing.
*/
@ -56,7 +56,7 @@
allowed: allowed,
perform: perform
};
var notAllowedMessage = gettext("You are not allowed to delete baymodels: %s");
var notAllowedMessage = gettext("You are not allowed to delete cluster templates: %s");
return service;
@ -81,18 +81,18 @@
function labelize(count){
return {
title: ngettext('Confirm Delete Baymodel',
'Confirm Delete Baymodels', count),
title: ngettext('Confirm Delete Cluster Template',
'Confirm Delete Cluster Templates', count),
/* eslint-disable max-len */
message: ngettext('You have selected "%s". Please confirm your selection. Deleted baymodel is not recoverable.',
'You have selected "%s". Please confirm your selection. Deleted baymodels are not recoverable.', count),
message: ngettext('You have selected "%s". Please confirm your selection. Deleted cluster template is not recoverable.',
'You have selected "%s". Please confirm your selection. Deleted cluster templates are not recoverable.', count),
/* eslint-enable max-len */
submit: ngettext('Delete Baymodel',
'Delete Baymodels', count),
success: ngettext('Deleted Baymodel: %s.',
'Deleted Baymodels: %s.', count),
error: ngettext('Unable to delete Baymodel: %s.',
'Unable to delete Baymodels: %s.', count)
submit: ngettext('Delete Cluster Template',
'Delete Cluster Templates', count),
success: ngettext('Deleted cluster template: %s.',
'Deleted cluster templates: %s.', count),
error: ngettext('Unable to delete cluster template: %s.',
'Unable to delete cluster templates: %s.', count)
};
}
@ -125,7 +125,7 @@
result.failed(resourceType, getEntity(item).id);
});
if(result.result.failed.length == 0 && result.result.deleted.length > 0){
$location.path("/project/baymodels");
$location.path("/project/cluster_templates");
}else{
return result.result;
}
@ -146,7 +146,7 @@
// call delete REST API
function deleteEntity(id){
return magnum.deleteBaymodel(id, true);
return magnum.deleteClusterTemplate(id, true);
}
}
})();

View File

@ -17,23 +17,23 @@
/**
* @ngdoc overview
* @ngname horizon.dashboard.container-infra.baymodels.details
* @ngname horizon.dashboard.container-infra.cluster-templates.details
*
* @description
* Provides details features for baymodels.
* Provides details features for cluster templates.
*/
angular.module('horizon.dashboard.container-infra.baymodels.details',
angular.module('horizon.dashboard.container-infra.cluster-templates.details',
['horizon.framework.conf', 'horizon.app.core'])
.run(registerBaymodelDetails);
.run(registerClusterTemplateDetails);
registerBaymodelDetails.$inject = [
'horizon.dashboard.container-infra.baymodels.basePath',
'horizon.dashboard.container-infra.baymodels.resourceType',
registerClusterTemplateDetails.$inject = [
'horizon.dashboard.container-infra.cluster-templates.basePath',
'horizon.dashboard.container-infra.cluster-templates.resourceType',
'horizon.app.core.openstack-service-api.magnum',
'horizon.framework.conf.resource-type-registry.service'
];
function registerBaymodelDetails(
function registerClusterTemplateDetails(
basePath,
resourceType,
magnum,
@ -42,13 +42,13 @@
registry.getResourceType(resourceType)
.setLoadFunction(loadFunction)
.detailsViews.append({
id: 'baymodelDetailsOverview',
id: 'templateDetailsOverview',
name: gettext('Overview'),
template: basePath + 'details/overview.html'
});
function loadFunction(identifier) {
return magnum.getBaymodel(identifier);
return magnum.getClusterTemplate(identifier);
}
}

View File

@ -17,19 +17,19 @@
/**
* @ngdoc controller
* @name horizon.dashboard.container-infra.baymodels.DrawerController
* @name horizon.dashboard.container-infra.cluster-templates.DrawerController
* @description
* This is the controller for the baymodel drawer (summary) view.
* This is the controller for the cluster templates drawer (summary) view.
* Its primary purpose is to provide the metadata definitions to
* the template via the ctrl.metadataDefs member.
*/
angular
.module('horizon.dashboard.container-infra.baymodels')
.controller('horizon.dashboard.container-infra.baymodels.DrawerController', controller);
.module('horizon.dashboard.container-infra.cluster-templates')
.controller('horizon.dashboard.container-infra.cluster-templates.DrawerController', controller);
controller.$inject = [
'horizon.app.core.openstack-service-api.magnum',
'horizon.dashboard.container-infra.baymodels.resourceType'
'horizon.dashboard.container-infra.cluster-templates.resourceType'
];
function controller(magnum, resourceType) {

View File

@ -1,4 +1,4 @@
<div ng-controller="horizon.dashboard.container-infra.baymodels.DrawerController as drawerCtrl">
<div ng-controller="horizon.dashboard.container-infra.cluster-templates.DrawerController as drawerCtrl">
<div class="row">
<span class="rsp-alt-p2">
<dl class="col-md-5">

View File

@ -15,40 +15,40 @@
"use strict";
angular
.module('horizon.dashboard.container-infra.baymodels')
.controller('BaymodelOverviewController', BaymodelOverviewController);
.module('horizon.dashboard.container-infra.cluster-templates')
.controller('ClusterTemplateOverviewController', ClusterTemplateOverviewController);
BaymodelOverviewController.$inject = [
ClusterTemplateOverviewController.$inject = [
'$scope',
'horizon.app.core.openstack-service-api.glance',
'horizon.dashboard.container-infra.baymodels.resourceType',
'horizon.dashboard.container-infra.baymodels.events',
'horizon.dashboard.container-infra.bays.events',
'horizon.dashboard.container-infra.cluster-templates.resourceType',
'horizon.dashboard.container-infra.cluster-templates.events',
'horizon.dashboard.container-infra.clusters.events',
'horizon.framework.conf.resource-type-registry.service'
];
function BaymodelOverviewController(
function ClusterTemplateOverviewController(
$scope,
glance,
resourceType,
events,
bayEvents,
clusterEvents,
registry
) {
var ctrl = this;
ctrl.baymodel = {};
ctrl.cluster_template = {};
ctrl.image_uuid;
$scope.context.loadPromise.then(onGetBaymodel);
$scope.context.loadPromise.then(onGetClusterTemplate);
function onGetBaymodel(baymodel) {
ctrl.baymodel = baymodel.data;
function onGetClusterTemplate(template) {
ctrl.cluster_template = template.data;
glance.getImages().success(onGetImages);
}
function onGetImages(images) {
angular.forEach(images.items, function(image) {
if (image.name === ctrl.baymodel.image_id) {
if (image.name === ctrl.cluster_template.image_id) {
ctrl.image_uuid = image.id;
}
});

View File

@ -1,21 +1,21 @@
<div ng-controller="BaymodelOverviewController as ctrl">
<div ng-controller="ClusterTemplateOverviewController as ctrl">
<div class="row">
<div class="col-md-6 detail">
<h3 translate>Cluster Type</h3>
<hr>
<dl class="dl-horizontal">
<dt translate>COE</dt>
<dd>{$ ctrl.baymodel.coe $}</dd>
<dd>{$ ctrl.cluster_template.coe $}</dd>
<dt translate>Cluster Distro</dt>
<dd>{$ ctrl.baymodel.cluster_distro $}</dd>
<dd>{$ ctrl.cluster_template.cluster_distro $}</dd>
<dt translate>Server Type</dt>
<dd>{$ ctrl.baymodel.server_type | uppercase $}</dd>
<dd>{$ ctrl.cluster_template.server_type | uppercase $}</dd>
<dt translate>Public</dt>
<dd>{$ ctrl.baymodel.public | yesno $}</dd>
<dd>{$ ctrl.cluster_template.public | yesno $}</dd>
<dt translate>Registry Enabled</dt>
<dd>{$ ctrl.baymodel.registry_enabled | yesno $}</dd>
<dd>{$ ctrl.cluster_template.registry_enabled | yesno $}</dd>
<dt translate>TLS Disabled</dt>
<dd>{$ ctrl.baymodel.tls_disabled | yesno $}</dd>
<dd>{$ ctrl.cluster_template.tls_disabled | yesno $}</dd>
</dl>
</div>
<div class="col-md-6 detail">
@ -23,17 +23,17 @@
<hr>
<dl class="dl-horizontal">
<dt translate>Image ID</dt>
<dd><a href="project/images/{$ ctrl.image_uuid $}/" target="_self">{$ ctrl.baymodel.image_id $}</a></dd>
<dd><a href="project/images/{$ ctrl.image_uuid $}/" target="_self">{$ ctrl.cluster_template.image_id $}</a></dd>
<dt translate>Flavor ID</dt>
<dd>{$ ctrl.baymodel.flavor_id $}</dd>
<dd>{$ ctrl.cluster_template.flavor_id $}</dd>
<dt translate>Master Flavor ID</dt>
<dd>{$ ctrl.baymodel.master_flavor_id $}</dd>
<dd>{$ ctrl.cluster_template.master_flavor_id $}</dd>
<dt translate>Volume Driver</dt>
<dd>{$ ctrl.baymodel.volume_driver $}</dd>
<dd>{$ ctrl.cluster_template.volume_driver $}</dd>
<dt translate>Docker Volume Size</dt>
<dd>{$ ctrl.baymodel.docker_volume_size | gb $}</dd>
<dd>{$ ctrl.cluster_template.docker_volume_size | gb $}</dd>
<dt translate>Keypair ID</dt>
<dd><a href="project/access_and_security/keypairs/{$ ctrl.baymodel.keypair_id $}/" target="_self">{$ ctrl.baymodel.keypair_id $}</a></dd>
<dd><a href="project/access_and_security/keypairs/{$ ctrl.cluster_template.keypair_id $}/" target="_self">{$ ctrl.cluster_template.keypair_id $}</a></dd>
</dl>
</div>
</div>
@ -43,26 +43,26 @@
<hr>
<dl class="dl-horizontal">
<dt translate>Network Driver</dt>
<dd>{$ ctrl.baymodel.network_driver $}</dd>
<dd>{$ ctrl.cluster_template.network_driver $}</dd>
<dt translate>HTTP Proxy</dt>
<dd>{$ ctrl.baymodel.http_proxy $}</dd>
<dd>{$ ctrl.cluster_template.http_proxy $}</dd>
<dt translate>HTTPS Proxy</dt>
<dd>{$ ctrl.baymodel.https_proxy $}</dd>
<dd>{$ ctrl.cluster_template.https_proxy $}</dd>
<dt translate>No Proxy</dt>
<dd>{$ ctrl.baymodel.no_proxy $}</dd>
<dd>{$ ctrl.cluster_template.no_proxy $}</dd>
<dt translate>External Network ID</dt>
<dd>{$ ctrl.baymodel.external_network_id $}</dd>
<dd>{$ ctrl.cluster_template.external_network_id $}</dd>
<dt translate>Fixed Network</dt>
<dd>{$ ctrl.baymodel.fixed_network $}</dd>
<dd>{$ ctrl.cluster_template.fixed_network $}</dd>
<dt translate>DNS</dt>
<dd>{$ ctrl.baymodel.dns_nameserver $}</dd>
<dd>{$ ctrl.cluster_template.dns_nameserver $}</dd>
</dl>
</div>
<div class="col-md-6 detail">
<h3 translate>Labels</h3>
<hr>
<dl class="dl-horizontal">
<div ng-repeat="(key, value) in ctrl.baymodel.labels">
<div ng-repeat="(key, value) in ctrl.cluster_template.labels">
<dt>{$ key $}</dt>
<dd>{$ value $}</dd>
</div>
@ -75,11 +75,11 @@
<hr>
<dl class="dl-horizontal">
<dt translate>Created</dt>
<dd>{$ ctrl.baymodel.created_at | date:'short' $}</dd>
<dd>{$ ctrl.cluster_template.created_at | date:'short' $}</dd>
<dt translate>Updated</dt>
<dd>{$ ctrl.baymodel.updated_at | date:'short' $}</dd>
<dd>{$ ctrl.cluster_template.updated_at | date:'short' $}</dd>
<dt translate>ID</dt>
<dd>{$ ctrl.baymodel.id $}</dd>
<dd>{$ ctrl.cluster_template.id $}</dd>
</dl>
</div>
</div>

View File

@ -0,0 +1,4 @@
<hz-resource-panel resource-type-name="OS::Magnum::ClusterTemplate">
<hz-resource-table resource-type-name="OS::Magnum::ClusterTemplate"
track-by="trackBy"></hz-resource-table>
</hz-resource-panel>

View File

@ -0,0 +1,73 @@
/**
* 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';
/**
* @ngdoc overview
* @ngname horizon.dashboard.container-infra.clusters.actions
*
* @description
* Provides all of the actions for clusters.
*/
angular.module('horizon.dashboard.container-infra.clusters.actions', ['horizon.framework', 'horizon.dashboard.container-infra'])
.run(registerClusterActions);
registerClusterActions.$inject = [
'horizon.framework.conf.resource-type-registry.service',
'horizon.framework.util.i18n.gettext',
'horizon.dashboard.container-infra.clusters.create.service',
'horizon.dashboard.container-infra.clusters.delete.service',
'horizon.dashboard.container-infra.clusters.resourceType',
];
function registerClusterActions(
registry,
gettext,
createClusterService,
deleteClusterService,
resourceType)
{
var clusterResourceType = registry.getResourceType(resourceType);
clusterResourceType.itemActions
.append({
id: 'deleteClusterAction',
service: deleteClusterService,
template: {
type: 'delete',
text: gettext('Delete Cluster')
}
});
clusterResourceType.batchActions
.append({
id: 'createClusterAction',
service: createClusterService,
template: {
type: 'create',
text: gettext('Create Cluster')
}
})
.append({
id: 'batchDeleteClusterAction',
service: deleteClusterService,
template: {
type: 'delete-selected',
text: gettext('Delete Clusters')
}
});
}
})();

View File

@ -19,46 +19,46 @@
/**
* @ngdoc overview
* @name horizon.dashboard.container-infra.bays
* @name horizon.dashboard.container-infra.clusters
* @ngModule
*
* @description
* Provides all the services and widgets require to display the bay
* Provides all the services and widgets require to display the cluster
* panel
*/
angular
.module('horizon.dashboard.container-infra.bays', [
.module('horizon.dashboard.container-infra.clusters', [
'ngRoute',
'horizon.dashboard.container-infra.bays.actions',
'horizon.dashboard.container-infra.bays.details'
'horizon.dashboard.container-infra.clusters.actions',
'horizon.dashboard.container-infra.clusters.details'
])
.constant('horizon.dashboard.container-infra.bays.events', events())
.constant('horizon.dashboard.container-infra.bays.resourceType', 'OS::Magnum::Bay')
.constant('horizon.dashboard.container-infra.clusters.events', events())
.constant('horizon.dashboard.container-infra.clusters.resourceType', 'OS::Magnum::Cluster')
.run(run)
.config(config);
/**
* @ngdoc constant
* @name horizon.dashboard.container-infra.bays.events
* @description A list of events used by Bays
* @name horizon.dashboard.container-infra.clusters.events
* @description A list of events used by Clusters
*/
function events() {
return {
CREATE_SUCCESS: 'horizon.dashboard.container-infra.bays.CREATE_SUCCESS',
DELETE_SUCCESS: 'horizon.dashboard.container-infra.bays.DELETE_SUCCESS'
CREATE_SUCCESS: 'horizon.dashboard.container-infra.clusters.CREATE_SUCCESS',
DELETE_SUCCESS: 'horizon.dashboard.container-infra.clusters.DELETE_SUCCESS'
};
}
run.$inject = [
'horizon.framework.conf.resource-type-registry.service',
'horizon.app.core.openstack-service-api.magnum',
'horizon.dashboard.container-infra.bays.basePath',
'horizon.dashboard.container-infra.bays.resourceType'
'horizon.dashboard.container-infra.clusters.basePath',
'horizon.dashboard.container-infra.clusters.resourceType'
];
function run(registry, magnum, basePath, resourceType) {
registry.getResourceType(resourceType)
.setNames(gettext('Bay'), gettext('Bays'))
.setNames(gettext('Cluster'), gettext('Clusters'))
// for detail summary view on table row
.setSummaryTemplateUrl(basePath + 'details/drawer.html')
@ -141,20 +141,20 @@
});
function listFunction(params) {
return magnum.getBays(params).then(modifyResponse);
return magnum.getClusters(params).then(modifyResponse);
function modifyResponse(response) {
return {data: {items: response.data.items.map(addTrackBy)}};
function addTrackBy(bay) {
bay.trackBy = bay.id;
return bay;
function addTrackBy(cluster) {
cluster.trackBy = cluster.id;
return cluster;
}
}
}
function urlFunction(item) {
return 'project/ngdetails/OS::Magnum::Bay/' + item.id;
return 'project/ngdetails/OS::Magnum::Cluster/' + item.id;
}
}
@ -173,9 +173,9 @@
* @returns {undefined} Returns nothing
*/
function config($provide, $windowProvider, $routeProvider) {
var path = $windowProvider.$get().STATIC_URL + 'dashboard/container-infra/bays/';
$provide.constant('horizon.dashboard.container-infra.bays.basePath', path);
$routeProvider.when('/project/bays/', {
var path = $windowProvider.$get().STATIC_URL + 'dashboard/container-infra/clusters/';
$provide.constant('horizon.dashboard.container-infra.clusters.basePath', path);
$routeProvider.when('/project/clusters/', {
templateUrl: path + 'panel.html'
});
}

View File

@ -16,9 +16,9 @@
(function() {
'use strict';
describe('horizon.dashboard.container-infra.bays', function() {
describe('horizon.dashboard.container-infra.clusters', function() {
it('should exist', function() {
expect(angular.module('horizon.dashboard.container-infra.bays')).toBeDefined();
expect(angular.module('horizon.dashboard.container-infra.clusters')).toBeDefined();
});
});

View File

@ -18,24 +18,24 @@
'use strict';
angular
.module('horizon.dashboard.container-infra.bays')
.factory('horizon.dashboard.container-infra.bays.bayModel', bayModel);
.module('horizon.dashboard.container-infra.clusters')
.factory('horizon.dashboard.container-infra.clusters.model', ClusterModel);
bayModel.$inject = [
ClusterModel.$inject = [
'horizon.app.core.openstack-service-api.magnum'
];
function bayModel(magnum) {
function ClusterModel(magnum) {
var model = {
newBaySpec: {},
newClusterSpec: {},
// API methods
init: init,
createBay: createBay
createCluster: createCluster
};
function initNewBaySpec() {
model.newBaySpec = {
function initNewClusterSpec() {
model.newClusterSpec = {
name: null,
baymodel_id: null,
master_count: null,
@ -46,16 +46,16 @@
}
function init() {
// Reset the new Bay spec
initNewBaySpec();
// Reset the new Cluster spec
initNewClusterSpec();
}
function createBay() {
var finalSpec = angular.copy(model.newBaySpec);
function createCluster() {
var finalSpec = angular.copy(model.newClusterSpec);
cleanNullProperties(finalSpec);
return magnum.createBay(finalSpec);
return magnum.createCluster(finalSpec);
}
function cleanNullProperties(finalSpec) {

View File

@ -18,36 +18,36 @@
'use strict';
angular
.module('horizon.dashboard.container-infra.bays')
.factory('horizon.dashboard.container-infra.bays.workflow', bayWorkflow);
.module('horizon.dashboard.container-infra.clusters')
.factory('horizon.dashboard.container-infra.clusters.workflow', ClusterWorkflow);
bayWorkflow.$inject = [
ClusterWorkflow.$inject = [
'horizon.dashboard.container-infra.basePath',
'horizon.app.core.workflow.factory',
'horizon.framework.util.i18n.gettext'
];
function bayWorkflow(basePath, workflowService, gettext) {
function ClusterWorkflow(basePath, workflowService, gettext) {
return workflowService({
title: gettext('Create Bay'),
title: gettext('Create Cluster'),
steps: [
{
title: gettext('Info'),
templateUrl: basePath + 'bays/create/info/info.html',
helpUrl: basePath + 'bays/create/info/info.help.html',
formName: 'bayInfoForm'
templateUrl: basePath + 'clusters/create/info/info.html',
helpUrl: basePath + 'clusters/create/info/info.help.html',
formName: 'clusterInfoForm'
},
{
title: gettext('Size'),
templateUrl: basePath + 'bays/create/size/size.html',
helpUrl: basePath + 'bays/create/size/size.help.html',
formName: 'baySizeForm'
templateUrl: basePath + 'clusters/create/size/size.html',
helpUrl: basePath + 'clusters/create/size/size.help.html',
formName: 'clusterSizeForm'
},
{
title: gettext('Misc'),
templateUrl: basePath + 'bays/create/misc/misc.html',
helpUrl: basePath + 'bays/create/misc/misc.help.html',
formName: 'bayMiscForm'
templateUrl: basePath + 'clusters/create/misc/misc.html',
helpUrl: basePath + 'clusters/create/misc/misc.help.html',
formName: 'clusterMiscForm'
}
],

View File

@ -17,12 +17,12 @@
/**
* @ngdoc overview
* @name horizon.dashboard.container-infra.bays.create.service
* @description Service for the container-infra bay create modal
* @name horizon.dashboard.container-infra.clusters.create.service
* @description Service for the container-infra cluster create modal
*/
angular
.module('horizon.dashboard.container-infra.bays')
.factory('horizon.dashboard.container-infra.bays.create.service', createService);
.module('horizon.dashboard.container-infra.clusters')
.factory('horizon.dashboard.container-infra.clusters.create.service', createService);
createService.$inject = [
'$location',
@ -32,10 +32,10 @@
'horizon.framework.util.q.extensions',
'horizon.framework.widgets.modal.wizard-modal.service',
'horizon.framework.widgets.toast.service',
'horizon.dashboard.container-infra.bays.bayModel',
'horizon.dashboard.container-infra.bays.events',
'horizon.dashboard.container-infra.bays.resourceType',
'horizon.dashboard.container-infra.bays.workflow'
'horizon.dashboard.container-infra.clusters.model',
'horizon.dashboard.container-infra.clusters.events',
'horizon.dashboard.container-infra.clusters.resourceType',
'horizon.dashboard.container-infra.clusters.workflow'
];
function createService(
@ -44,7 +44,7 @@
var scope;
var message = {
success: gettext('Bay %s was successfully created.')
success: gettext('Cluster %s was successfully created.')
};
var service = {
@ -80,7 +80,7 @@
}
function submit(){
return model.createBay().then(success);
return model.createCluster().then(success);
}
function success(response) {
@ -89,7 +89,7 @@
var result = actionResult.getActionResult()
.created(resourceType, response.data.id);
if(result.result.failed.length == 0 && result.result.created.length > 0){
$location.path("/project/bays");
$location.path("/project/clusters");
}else{
return result.result;
}

View File

@ -0,0 +1,85 @@
/**
* 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';
/**
* @ngdoc controller
* @name createClusterInfoController
* @ngController
*
* @description
* Controller for the container-infra cluster info step in create workflow
*/
angular
.module('horizon.dashboard.container-infra.clusters')
.controller('createClusterInfoController', createClusterInfoController);
createClusterInfoController.$inject = [
'$q',
'$scope',
'horizon.dashboard.container-infra.basePath',
'horizon.app.core.openstack-service-api.magnum'
];
function createClusterInfoController($q, $scope, basePath, magnum) {
var ctrl = this;
ctrl.cluster_templates = [{id:"", name: gettext("Choose a Cluster Template")}];
$scope.model.newClusterSpec.baymodel_id = "";
$scope.cluster_template_detail = {
name: "",
id: "",
coe: "",
image_id: "",
public: "",
registry_enabled: "",
tls_disabled: "",
apiserver_port: ""
};
$scope.changeClusterTemplate = function(){
angular.forEach(ctrl.cluster_templates, function(model, idx){
if($scope.model.newClusterSpec.baymodel_id === model.id){
$scope.cluster_template_detail.name = model.name;
$scope.cluster_template_detail.id = model.id;
$scope.cluster_template_detail.coe = model.coe;
$scope.cluster_template_detail.image_id = model.image_id;
$scope.cluster_template_detail.public = model.public;
$scope.cluster_template_detail.registry_enabled = model.registry_enabled;
$scope.cluster_template_detail.tls_disabled = model.tls_disabled;
$scope.cluster_template_detail.apiserver_port = model.apiserver_port;
}
});
};
init();
function init() {
magnum.getClusterTemplates({paginate: false}).success(onGetClusterTemplates);
}
function onGetClusterTemplates(response) {
Array.prototype.push.apply(ctrl.cluster_templates, response.items);
if($scope.selected instanceof Object){
$scope.model.newClusterSpec.baymodel_id = $scope.selected.id;
$scope.changeClusterTemplate();
}
}
}
})();

View File

@ -0,0 +1 @@
<p translate>Specify cluster name and choose cluster template</p>

View File

@ -0,0 +1,50 @@
<div ng-controller="createClusterInfoController as ctrl">
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label" for="cluster-name" translate>Cluster Name</label>
<input name="cluster-name" type="text" class="form-control" id="cluster-name"
ng-model="model.newClusterSpec.name"
placeholder="{$ 'Name of the cluster to create.'|translate $}">
</div>
<div class="form-group">
<label class="control-label" for="cluster-model">
<translate>Cluster Template</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<select class="form-control" name="cluster-model" id="cluster-model"
ng-model="model.newClusterSpec.baymodel_id"
ng-required="true"
ng-options="cluster_template.id as cluster_template.name|noName for cluster_template in ctrl.cluster_templates"
ng-change="changeClusterTemplate()">
</select>
</div>
<div class="detail" ng-show="model.newClusterSpec.baymodel_id">
<span translate class="h4">Cluster Template Detail</span>
<dl class="dl-horizontal">
<dt translate>Name</dt>
<dd><a ng-href="project/ngdetails/OS::Magnum::ClusterTemplate/{$ cluster_template_detail.id $}" ng-click="cancel()">
{$ cluster_template_detail.name|noName $}
</a></dd>
<dt translate>ID</dt>
<dd>{$ cluster_template_detail.id $}</dd>
<dt translate>COE</dt>
<dd>{$ cluster_template_detail.coe $}</dd>
<dt translate>Image ID</dt>
<dd>{$ cluster_template_detail.image_id $}</dd>
<dt translate>Public</dt>
<dd>{$ cluster_template_detail.public $}</dd>
<dt translate>Registry Enabled</dt>
<dd>{$ cluster_template_detail.registry_enabled $}</dd>
<dt translate>TLS Disabled</dt>
<dd>{$ cluster_template_detail.tls_disabled $}</dd>
<dt translate>API Server Port</dt>
<dd>{$ cluster_template_detail.apiserver_port $}</dd>
</dl>
</div>
</div>
</div>
</div>

View File

@ -19,23 +19,23 @@
/**
* @ngdoc controller
* @name createBayMiscController
* @name createClusterMiscController
* @ngController
*
* @description
* Controller for the container-infra bay misc step in create workflow
* Controller for the container-infra cluster misc step in create workflow
*/
angular
.module('horizon.dashboard.container-infra.bays')
.controller('createBayMiscController', createBayMiscController);
.module('horizon.dashboard.container-infra.clusters')
.controller('createClusterMiscController', createClusterMiscController);
createBayMiscController.$inject = [
createClusterMiscController.$inject = [
'$scope',
'horizon.dashboard.container-infra.basePath',
'horizon.app.core.openstack-service-api.magnum'
];
function createBayMiscController($scope, basePath, magnum) {
function createClusterMiscController($scope, basePath, magnum) {
var ctrl = this;
}

View File

@ -0,0 +1 @@
<p translate>Specify conditions for cluster creation.</p>

View File

@ -0,0 +1,17 @@
<div ng-controller="createClusterMiscController as ctrl">
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label" for="cluster-discovery-url" translate>Discovery URL</label>
<input name="cluster-discovery-url" type="text" class="form-control"
ng-model="model.newClusterSpec.discovery_url" id="cluster-discovery-url"
placeholder="{$ 'Specifies custom discovery url for node discovery.'|translate $}">
</div>
<div class="form-group">
<label class="control-label" for="cluster-timeout" translate>Timeout</label>
<input name="cluster-timeout" type="number" min="0" class="form-control"
ng-model="model.newClusterSpec.bay_create_timeout" id="cluster-timeout"
placeholder="{$ 'The timeout for cluster creation in minutes. Set to 0 for no timeout. The default is no timeout.'|translate $}">
</div>
</div>
</div>

View File

@ -19,23 +19,23 @@
/**
* @ngdoc controller
* @name createBaySizeController
* @name createClusterSizeController
* @ngController
*
* @description
* Controller for the container-infra bay size step in create workflow
* Controller for the container-infra cluster size step in create workflow
*/
angular
.module('horizon.dashboard.container-infra.bays')
.controller('createBaySizeController', createBaySizeController);
.module('horizon.dashboard.container-infra.clusters')
.controller('createClusterSizeController', createClusterSizeController);
createBaySizeController.$inject = [
createClusterSizeController.$inject = [
'$scope',
'horizon.dashboard.container-infra.basePath',
'horizon.app.core.openstack-service-api.magnum'
];
function createBaySizeController($scope, basePath, magnum) {
function createClusterSizeController($scope, basePath, magnum) {
var ctrl = this;
}

View File

@ -0,0 +1 @@
<p translate>Specify the number of master nodes and cluster nodes for the cluster.</p>

View File

@ -0,0 +1,20 @@
<div ng-controller="createClusterSizeController as ctrl">
<div class="row">
<div class="col-xs-12 col-sm-6">
<div class="form-group">
<label class="control-label" for="cluster-master-count" translate>Master Count</label>
<input name="cluster-master-count" type="number" min="1" id="cluster-master-count"
class="form-control" ng-model="model.newClusterSpec.master_count"
placeholder="{$ 'The number of master nodes for the cluster.'|translate $}">
</div>
</div>
<div class="col-xs-12 col-sm-6">
<div class="form-group">
<label class="control-label" for="cluster-node-count" translate>Node Count</label>
<input name="cluster-node-count" type="number" min="1" id="cluster-node-count"
class="form-control" ng-model="model.newClusterSpec.node_count"
placeholder="{$ 'The cluster node count.'|translate $}">
</div>
</div>
</div>
</div>

View File

@ -16,8 +16,8 @@
'use strict';
angular
.module('horizon.dashboard.container-infra.bays')
.factory('horizon.dashboard.container-infra.bays.delete.service', deleteService);
.module('horizon.dashboard.container-infra.clusters')
.factory('horizon.dashboard.container-infra.clusters.delete.service', deleteService);
deleteService.$inject = [
'$location',
@ -29,16 +29,16 @@
'horizon.framework.util.q.extensions',
'horizon.framework.widgets.modal.deleteModalService',
'horizon.framework.widgets.toast.service',
'horizon.dashboard.container-infra.bays.resourceType',
'horizon.dashboard.container-infra.bays.events'
'horizon.dashboard.container-infra.clusters.resourceType',
'horizon.dashboard.container-infra.clusters.events'
];
/**
* @ngDoc factory
* @name horizon.dashboard.container-infra.bays.delete.service
* @name horizon.dashboard.container-infra.clusters.delete.service
*
* @Description
* Brings up the delete bays confirmation modal dialog.
* Brings up the delete clusters confirmation modal dialog.
* On submit, delete selected resources.
* On cancel, do nothing.
*/
@ -56,7 +56,7 @@
allowed: allowed,
perform: perform
};
var notAllowedMessage = gettext("You are not allowed to delete bays: %s");
var notAllowedMessage = gettext("You are not allowed to delete clusters: %s");
return service;
@ -81,18 +81,18 @@
function labelize(count){
return {
title: ngettext('Confirm Delete Bay',
'Confirm Delete Bays', count),
title: ngettext('Confirm Delete Cluster',
'Confirm Delete Clusters', count),
/* eslint-disable max-len */
message: ngettext('You have selected "%s". Please confirm your selection. Deleted bay is not recoverable.',
'You have selected "%s". Please confirm your selection. Deleted bays are not recoverable.', count),
message: ngettext('You have selected "%s". Please confirm your selection. Deleted cluster is not recoverable.',
'You have selected "%s". Please confirm your selection. Deleted clusters are not recoverable.', count),
/* eslint-enable max-len */
submit: ngettext('Delete Bay',
'Delete Bays', count),
success: ngettext('Deleted Bay: %s.',
'Deleted Bays: %s.', count),
error: ngettext('Unable to delete Bay: %s.',
'Unable to delete Bays: %s.', count)
submit: ngettext('Delete Cluster',
'Delete Clusters', count),
success: ngettext('Deleted cluster: %s.',
'Deleted clusters: %s.', count),
error: ngettext('Unable to delete cluster: %s.',
'Unable to delete clusters: %s.', count)
};
}
@ -125,7 +125,7 @@
result.failed(resourceType, getEntity(item).id);
});
if(result.result.failed.length == 0 && result.result.deleted.length > 0){
$location.path("/project/bays");
$location.path("/project/clusters");
}else{
return result.result;
}
@ -146,7 +146,7 @@
// call delete REST API
function deleteEntity(id){
return magnum.deleteBay(id, true);
return magnum.deleteCluster(id, true);
}
}
})();

View File

@ -17,23 +17,23 @@
/**
* @ngdoc overview
* @ngname horizon.dashboard.container-infra.bays.details
* @ngname horizon.dashboard.container-infra.clusters.details
*
* @description
* Provides details features for bays.
* Provides details features for clusters.
*/
angular.module('horizon.dashboard.container-infra.bays.details',
angular.module('horizon.dashboard.container-infra.clusters.details',
['horizon.framework.conf', 'horizon.app.core'])
.run(registerBayDetails);
.run(registerClusterDetails);
registerBayDetails.$inject = [
'horizon.dashboard.container-infra.bays.basePath',
'horizon.dashboard.container-infra.bays.resourceType',
registerClusterDetails.$inject = [
'horizon.dashboard.container-infra.clusters.basePath',
'horizon.dashboard.container-infra.clusters.resourceType',
'horizon.app.core.openstack-service-api.magnum',
'horizon.framework.conf.resource-type-registry.service'
];
function registerBayDetails(
function registerClusterDetails(
basePath,
resourceType,
magnum,
@ -42,13 +42,13 @@
registry.getResourceType(resourceType)
.setLoadFunction(loadFunction)
.detailsViews.append({
id: 'bayDetailsOverview',
id: 'clusterDetailsOverview',
name: gettext('Overview'),
template: basePath + 'details/overview.html'
});
function loadFunction(identifier) {
return magnum.getBay(identifier);
return magnum.getCluster(identifier);
}
}

View File

@ -17,19 +17,19 @@
/**
* @ngdoc controller
* @name horizon.dashboard.container-infra.bays.DrawerController
* @name horizon.dashboard.container-infra.clusters.DrawerController
* @description
* This is the controller for the bay drawer (summary) view.
* This is the controller for the cluster drawer (summary) view.
* Its primary purpose is to provide the metadata definitions to
* the template via the ctrl.metadataDefs member.
*/
angular
.module('horizon.dashboard.container-infra.bays')
.controller('horizon.dashboard.container-infra.bays.DrawerController', controller);
.module('horizon.dashboard.container-infra.clusters')
.controller('horizon.dashboard.container-infra.clusters.DrawerController', controller);
controller.$inject = [
'horizon.app.core.openstack-service-api.magnum',
'horizon.dashboard.container-infra.bays.resourceType'
'horizon.dashboard.container-infra.clusters.resourceType'
];
function controller(magnum, resourceType) {

View File

@ -1,4 +1,4 @@
<div ng-controller="horizon.dashboard.container-infra.bays.DrawerController as drawerCtrl">
<div ng-controller="horizon.dashboard.container-infra.clusters.DrawerController as drawerCtrl">
<div class="row">
<span class="rsp-alt-p2">
<dl class="col-md-5">
@ -17,8 +17,8 @@
</div>
<div class="row">
<dl class="col-md-5">
<dt translate>Baymodel</dt>
<dd><a ng-href="project/ngdetails/OS::Magnum::Baymodel/{$ item.baymodel_id $}">{$ item.baymodel_id $}</a></dd>
<dt translate>Cluster Template</dt>
<dd><a ng-href="project/ngdetails/OS::Magnum::ClusterTemplate/{$ item.baymodel_id $}">{$ item.baymodel_id $}</a></dd>
</dl>
<dl class="col-md-3">
<dt translate>Node Addresses</dt>

View File

@ -15,18 +15,18 @@
"use strict";
angular
.module('horizon.dashboard.container-infra.bays')
.controller('BayOverviewController', BayOverviewController);
.module('horizon.dashboard.container-infra.clusters')
.controller('ClusterOverviewController', ClusterOverviewController);
BayOverviewController.$inject = [
ClusterOverviewController.$inject = [
'$scope',
'horizon.app.core.openstack-service-api.magnum',
'horizon.dashboard.container-infra.bays.resourceType',
'horizon.dashboard.container-infra.bays.events',
'horizon.dashboard.container-infra.clusters.resourceType',
'horizon.dashboard.container-infra.clusters.events',
'horizon.framework.conf.resource-type-registry.service'
];
function BayOverviewController(
function ClusterOverviewController(
$scope,
magnum,
resourceType,
@ -34,18 +34,18 @@
registry
) {
var ctrl = this;
ctrl.bay = {};
ctrl.baymodel = {};
ctrl.cluster = {};
ctrl.cluster_template = {};
$scope.context.loadPromise.then(onGetBay);
$scope.context.loadPromise.then(onGetCluster);
function onGetBay(bay) {
ctrl.bay = bay.data;
magnum.getBaymodel(ctrl.bay.baymodel_id).success(onGetBaymodel);
function onGetCluster(cluster) {
ctrl.cluster = cluster.data;
magnum.getClusterTemplate(ctrl.cluster.baymodel_id).success(onGetClusterTemplate);
}
function onGetBaymodel(baymodel) {
ctrl.baymodel = baymodel;
function onGetClusterTemplate(cluster_template) {
ctrl.cluster_template = cluster_template;
}
}
})();

View File

@ -0,0 +1,77 @@
<div ng-controller="ClusterOverviewController as ctrl">
<div class="row">
<div class="col-md-6 detail">
<h3 translate>Cluster Template</h3>
<hr>
<dl class="dl-horizontal">
<dt translate>Name</dt>
<dd><a ng-href="project/ngdetails/OS::Magnum::ClusterTemplate/{$ ctrl.cluster_template.id $}">{$ ctrl.cluster_template.name|noName $}</a></dd>
<dt translate>ID</dt>
<dd>{$ ctrl.cluster_template.id $}</dd>
<dt translate>COE</dt>
<dd>{$ ctrl.cluster_template.coe $}</dd>
<dt translate>Image ID</dt>
<dd>{$ ctrl.cluster_template.image_id $}</dd>
</dl>
</div>
<div class="col-md-6 detail">
<h3 translate>Nodes</h3>
<hr>
<dl class="dl-horizontal">
<dt translate>Master Count</dt>
<dd>{$ ctrl.cluster.master_count $}</dd>
<dt translate>Node Count</dt>
<dd>{$ ctrl.cluster.node_count $}</dd>
<dt translate>API Address</dt>
<dd>{$ ctrl.cluster.api_address $}</dd>
<dt translate>Master Addresses</dt>
<dd>
<div ng-repeat="addr in ctrl.cluster.master_addresses">{$ addr $}</div>
</dd>
<dt translate>Node Addresses</dt>
<dd>
<div ng-repeat="addr in ctrl.cluster.node_addresses">{$ addr $}</div>
</dd>
</dl>
</div>
</div>
<div class="row">
<div class="col-md-6 detail">
<h3 translate>Miscellaneous</h3>
<hr>
<dl class="dl-horizontal">
<dt translate>Stack ID</dt>
<dd><a ng-href="project/stacks/stack/{$ ctrl.cluster.stack_id $}" target="_self">
{$ ctrl.cluster.stack_id $}
</a></dd>
<dt translate>Discovery URL</dt>
<dd>{$ ctrl.cluster.discovery_url $}</dd>
<dt translate>Cluster Create Timeout</dt>
<dd>
<div ng-switch on="ctrl.cluster.bay_create_timeout === 0 || ctrl.cluster.bay_create_timeout === null">
<div ng-switch-when="true" translate>Infinite</div>
<div ng-switch-default translate
translate-n="ctrl.cluster.bay_create_timeout"
translate-plural="{$ ctrl.cluster.bay_create_timeout $} minutes">
{$ ctrl.cluster.bay_create_timeout $} minute
</div>
</div>
</dd>
</dl>
</div>
<div class="col-md-6 detail">
<h3 translate>Record Properties</h3>
<hr>
<dl class="dl-horizontal">
<dt translate>Created</dt>
<dd>{$ ctrl.cluster.created_at | date:'short' $}</dd>
<dt translate>Updated</dt>
<dd>{$ ctrl.cluster.updated_at | date:'short' $}</dd>
<dt translate>ID</dt>
<dd>{$ ctrl.cluster.id $}</dd>
<dt translate>Status</dt>
<dd>{$ ctrl.cluster.status $}</dd>
</dl>
</div>
</div>
</div>

View File

@ -0,0 +1,4 @@
<hz-resource-panel resource-type-name="OS::Magnum::Cluster">
<hz-resource-table resource-type-name="OS::Magnum::Cluster"
track-by="trackBy"></hz-resource-table>
</hz-resource-panel>

View File

@ -26,8 +26,8 @@
*/
angular
.module('horizon.dashboard.container-infra', [
'horizon.dashboard.container-infra.bays',
'horizon.dashboard.container-infra.baymodels',
'horizon.dashboard.container-infra.clusters',
'horizon.dashboard.container-infra.cluster-templates',
'ngRoute'
])
.config(config)

View File

@ -1,5 +1,5 @@
@import "baymodels/baymodels";
@import "bays/bays";
@import "cluster-templates/cluster-templates";
@import "clusters/clusters";
.batch-action {
float: right;

View File

@ -28,99 +28,99 @@
function MagnumAPI(apiService, toastService, gettext) {
var service = {
createBay: createBay,
getBay: getBay,
getBays: getBays,
deleteBay: deleteBay,
deleteBays: deleteBays,
createBaymodel: createBaymodel,
getBaymodel: getBaymodel,
getBaymodels: getBaymodels,
deleteBaymodel: deleteBaymodel,
deleteBaymodels: deleteBaymodels,
createCluster: createCluster,
getCluster: getCluster,
getClusters: getClusters,
deleteCluster: deleteCluster,
deleteClusters: deleteClusters,
createClusterTemplate: createClusterTemplate,
getClusterTemplate: getClusterTemplate,
getClusterTemplates: getClusterTemplates,
deleteClusterTemplate: deleteClusterTemplate,
deleteClusterTemplates: deleteClusterTemplates,
};
return service;
//////////
// Bays //
// Clusters //
//////////
function createBay(params) {
return apiService.post('/api/container-infra/bays/', params)
function createCluster(params) {
return apiService.post('/api/container_infra/clusters/', params)
.error(function() {
toastService.add('error', gettext('Unable to create Bay.'));
toastService.add('error', gettext('Unable to create cluster.'));
});
}
function getBay(id) {
return apiService.get('/api/container-infra/bays/' + id)
function getCluster(id) {
return apiService.get('/api/container_infra/clusters/' + id)
.error(function() {
toastService.add('error', gettext('Unable to retrieve the Bay.'));
toastService.add('error', gettext('Unable to retrieve the cluster.'));
});
}
function getBays() {
return apiService.get('/api/container-infra/bays/')
function getClusters() {
return apiService.get('/api/container_infra/clusters/')
.error(function() {
toastService.add('error', gettext('Unable to retrieve the Bays.'));
toastService.add('error', gettext('Unable to retrieve the clusters.'));
});
}
function deleteBay(id, suppressError) {
var promise = apiService.delete('/api/container-infra/bays/', [id]);
function deleteCluster(id, suppressError) {
var promise = apiService.delete('/api/container_infra/clusters/', [id]);
return suppressError ? promise : promise.error(function() {
var msg = gettext('Unable to delete the Bay with id: %(id)s');
var msg = gettext('Unable to delete the cluster with id: %(id)s');
toastService.add('error', interpolate(msg, { id: id }, true));
});
}
// FIXME(shu-mutou): Unused for batch-delete in Horizon framework in Feb, 2016.
function deleteBays(ids) {
return apiService.delete('/api/container-infra/bays/', ids)
function deleteClusters(ids) {
return apiService.delete('/api/container_infra/clusters/', ids)
.error(function() {
toastService.add('error', gettext('Unable to delete the Bays.'));
toastService.add('error', gettext('Unable to delete the clusters.'));
});
}
///////////////
// Baymodels //
// ClusterTemplates //
///////////////
function createBaymodel(params) {
return apiService.post('/api/container-infra/baymodels/', params)
function createClusterTemplate(params) {
return apiService.post('/api/container_infra/cluster_templates/', params)
.error(function() {
toastService.add('error', gettext('Unable to create Baymodel'));
toastService.add('error', gettext('Unable to create cluster template'));
});
}
function getBaymodel(id) {
return apiService.get('/api/container-infra/baymodels/' + id)
function getClusterTemplate(id) {
return apiService.get('/api/container_infra/cluster_templates/' + id)
.error(function() {
toastService.add('error', gettext('Unable to retrieve the Baymodel.'));
toastService.add('error', gettext('Unable to retrieve the cluster template.'));
});
}
function getBaymodels() {
return apiService.get('/api/container-infra/baymodels/')
function getClusterTemplates() {
return apiService.get('/api/container_infra/cluster_templates/')
.error(function() {
toastService.add('error', gettext('Unable to retrieve the Baymodels.'));
toastService.add('error', gettext('Unable to retrieve the cluster templates.'));
});
}
function deleteBaymodel(id, suppressError) {
var promise = apiService.delete('/api/container-infra/baymodels/', [id]);
function deleteClusterTemplate(id, suppressError) {
var promise = apiService.delete('/api/container_infra/cluster_templates/', [id]);
return suppressError ? promise : promise.error(function() {
var msg = gettext('Unable to delete the Baymodel with id: %(id)s');
var msg = gettext('Unable to delete the cluster template with id: %(id)s');
toastService.add('error', interpolate(msg, { id: id }, true));
});
}
// FIXME(shu-mutou): Unused for batch-delete in Horizon framework in Feb, 2016.
function deleteBaymodels(ids) {
return apiService.delete('/api/container-infra/baymodels/', ids)
function deleteClusterTemplates(ids) {
return apiService.delete('/api/container_infra/cluster_templates/', ids)
.error(function() {
toastService.add('error', gettext('Unable to delete the Baymodels.'));
toastService.add('error', gettext('Unable to delete the cluster templates.'));
})
}
}

View File

@ -25,81 +25,83 @@ TEST = TestData(test_data.data)
class MagnumRestTestCase(test.TestCase):
# Baymodels
# Cluster Templates
@mock.patch.object(magnum, 'magnum')
def test_baymodel_get(self, client):
def test_cluster_template_get(self, client):
request = self.mock_rest_request()
client.baymodel_list.return_value = \
mock_resource(TEST.baymodels.list())
response = magnum.Baymodels().get(request)
client.cluster_template_list.return_value = \
mock_resource(TEST.cluster_templates.list())
response = magnum.ClusterTemplates().get(request)
self.assertStatusCode(response, 200)
self.assertItemsCollectionEqual(response, TEST.baymodels.list())
client.baymodel_list.assert_called_once_with(request)
self.assertItemsCollectionEqual(response,
TEST.cluster_templates.list())
client.cluster_template_list.assert_called_once_with(request)
@mock.patch.object(magnum, 'magnum')
def test_baymodel_create(self, client):
test_baymodels = mock_resource(TEST.baymodels.list())
test_bmodel = test_baymodels[0]
test_body = json.dumps(test_bmodel.to_dict())
def test_cluster_template_create(self, client):
test_cluster_templates = mock_resource(TEST.cluster_templates.list())
test_cluster_template = test_cluster_templates[0]
test_body = json.dumps(test_cluster_template.to_dict())
request = self.mock_rest_request(body=test_body)
client.baymodel_create.return_value = test_bmodel
response = magnum.Baymodels().post(request)
client.cluster_template_create.return_value = test_cluster_template
response = magnum.ClusterTemplates().post(request)
url = '/api/container_infra/cluster_template/%s' % \
test_cluster_template.uuid
self.assertStatusCode(response, 201)
self.assertEqual(response['location'],
'/api/container-infra/baymodel/%s' % test_bmodel.uuid)
client.baymodel_create.assert_called_once_with(request,
**test_bmodel.to_dict())
self.assertEqual(response['location'], url)
client.cluster_template_create.assert_called_once_with(
request, **test_cluster_template.to_dict())
@mock.patch.object(magnum, 'magnum')
def test_baymodel_delete(self, client):
test_baymodel = TEST.baymodels.first()
def test_cluster_template_delete(self, client):
test_cluster_template = TEST.cluster_templates.first()
request = self.mock_rest_request(
body='{"baymodel_id":' + str(test_baymodel['uuid']) + '}')
response = magnum.Baymodels().delete(request)
body='{"baymodel_id":' + str(test_cluster_template['uuid']) + '}')
response = magnum.ClusterTemplates().delete(request)
self.assertStatusCode(response, 204)
client.baymodel_delete.assert_called_once_with(
client.cluster_template_delete.assert_called_once_with(
request,
u'baymodel_id')
# Bays
# Clusters
@mock.patch.object(magnum, 'magnum')
def test_bay_get(self, client):
def test_cluster_get(self, client):
request = self.mock_rest_request()
client.bay_list.return_value = \
mock_resource(TEST.bays.list())
response = magnum.Bays().get(request)
client.cluster_list.return_value = \
mock_resource(TEST.clusters.list())
response = magnum.Clusters().get(request)
self.assertStatusCode(response, 200)
self.assertItemsCollectionEqual(response, TEST.bays.list())
client.bay_list.assert_called_once_with(request)
self.assertItemsCollectionEqual(response, TEST.clusters.list())
client.cluster_list.assert_called_once_with(request)
@mock.patch.object(magnum, 'magnum')
def test_bay_create(self, client):
test_bays = mock_resource(TEST.bays.list())
test_bay = test_bays[0]
test_body = json.dumps(test_bay.to_dict())
def test_cluster_create(self, client):
test_clusters = mock_resource(TEST.clusters.list())
test_cluster = test_clusters[0]
test_body = json.dumps(test_cluster.to_dict())
request = self.mock_rest_request(body=test_body)
client.bay_create.return_value = test_bay
response = magnum.Bays().post(request)
client.cluster_create.return_value = test_cluster
response = magnum.Clusters().post(request)
url = '/api/container_infra/cluster/%s' % test_cluster.uuid
self.assertStatusCode(response, 201)
self.assertEqual(response['location'],
'/api/container-infra/bay/%s' % test_bay.uuid)
client.bay_create.assert_called_once_with(request,
**test_bay.to_dict())
self.assertEqual(response['location'], url)
client.cluster_create.assert_called_once_with(request,
**test_cluster.to_dict())
@mock.patch.object(magnum, 'magnum')
def test_bay_delete(self, client):
test_bay = TEST.bays.first()
def test_cluster_delete(self, client):
test_cluster = TEST.clusters.first()
request = self.mock_rest_request(
body='{"bay_id":' + str(test_bay['uuid']) + '}')
response = magnum.Bays().delete(request)
body='{"bay_id":' + str(test_cluster['uuid']) + '}')
response = magnum.Clusters().delete(request)
self.assertStatusCode(response, 204)
client.bay_delete.assert_called_once_with(
client.cluster_delete.assert_called_once_with(
request,
u'bay_id')

View File

@ -17,37 +17,37 @@ from openstack_dashboard.test.test_data import utils
def data(TEST):
# Test Data Container in Horizon
TEST.baymodels = utils.TestDataContainer()
TEST.bays = utils.TestDataContainer()
TEST.cluster_templates = utils.TestDataContainer()
TEST.clusters = utils.TestDataContainer()
# Bay Models
baymodel_dict_1 = {"uuid": 1,
"name": "kindofabigdeal",
"image-id": "",
"keypair-id": "",
"external-network-id": "",
"coe": "",
"fixed-network": "",
"dns-nameserver": "",
"flavor-id": "",
"master-flavor-id": "",
"docker-volume-size": "",
"http-proxy": "",
"https-proxy": "",
"no-proxy": "",
"labels": "",
"tls-disabled": "",
"public": ""}
# Cluster Templates
cluster_template_dict_1 = {"uuid": 1,
"name": "kindofabigdeal",
"image-id": "",
"keypair-id": "",
"external-network-id": "",
"coe": "",
"fixed-network": "",
"dns-nameserver": "",
"flavor-id": "",
"master-flavor-id": "",
"docker-volume-size": "",
"http-proxy": "",
"https-proxy": "",
"no-proxy": "",
"labels": "",
"tls-disabled": "",
"public": ""}
TEST.baymodels.add(baymodel_dict_1)
TEST.cluster_templates.add(cluster_template_dict_1)
# Bays
bay_dict_1 = {"uuid": 1,
"name": "peopleknowme",
"baymodel": baymodel_dict_1["uuid"],
"node-count": "",
"master-count": "",
"discovery-url": "",
"timeout": 0}
# Clusters
cluster_dict_1 = {"uuid": 1,
"name": "peopleknowme",
"baymodel": cluster_template_dict_1["uuid"],
"node-count": "",
"master-count": "",
"discovery-url": "",
"timeout": 0}
TEST.bays.add(bay_dict_1)
TEST.clusters.add(cluster_dict_1)