summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpengyuesheng <pengyuesheng@gohighsec.com>2019-11-22 10:50:21 +0800
committerVishal Manchanda <manchandavishal143@gmail.com>2021-03-08 08:08:13 +0000
commit862c37cf19d25c4c4a7345b43ed7a1224be9342c (patch)
treeed379735cd8ea4d00f8b3b22b83bc66c9ffdd624
parent77df0abd6c687b69a3d5941541a69ece7464d3ba (diff)
downloadhorizon-862c37cf19d25c4c4a7345b43ed7a1224be9342c.tar.gz
On the create instance from, when the image name is empty, show id
Change-Id: I4ac734e0fb4ac3151ff56fa2c53d3071cdb9131d Closes-Bug: #1853551 (cherry picked from commit a8158f6c31675297c3d35ecfee2ef0e22243e529)
-rw-r--r--openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js1
-rw-r--r--openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js16
-rw-r--r--openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js2
3 files changed, 10 insertions, 9 deletions
diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js
index 337558427..c8878c411 100644
--- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js
+++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js
@@ -682,6 +682,7 @@
if (isValidSnapshot(image) && enabledSnapshot) {
model.imageSnapshots.push(image);
} else if (isValidImage(image) && enabledImage) {
+ image.name_or_id = image.name || image.id;
model.images.push(image);
}
});
diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js
index d3b70cdf4..112803a3e 100644
--- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js
+++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js
@@ -135,10 +135,10 @@
var images = [
{container_format: 'aki', properties: {}},
{container_format: 'ari', properties: {}},
- {container_format: 'ami', properties: {}},
- {container_format: 'raw', properties: {}},
- {container_format: 'ami', properties: {image_type: 'image'}},
- {container_format: 'raw', properties: {image_type: 'image'}},
+ {container_format: 'ami', properties: {}, name: 'ami_image'},
+ {container_format: 'raw', properties: {}, name: 'raw_image'},
+ {container_format: 'ami', properties: {image_type: 'image'}, id: '1'},
+ {container_format: 'raw', properties: {image_type: 'image'}, id: '2'},
{container_format: 'ami', properties: {
block_device_mapping: '[{"source_type": "snapshot"}]'}},
{container_format: 'raw', properties: {
@@ -387,10 +387,10 @@
expect(model.newInstanceSpec).toBeDefined();
var expectedImages = [
- {container_format: 'ami', properties: {}},
- {container_format: 'raw', properties: {}},
- {container_format: 'ami', properties: {image_type: 'image'}},
- {container_format: 'raw', properties: {image_type: 'image'}}
+ {container_format: 'ami', properties: {}, name: 'ami_image', name_or_id: 'ami_image'},
+ {container_format: 'raw', properties: {}, name: 'raw_image', name_or_id: 'raw_image'},
+ {container_format: 'ami', properties: {image_type: 'image'}, id: '1', name_or_id: '1'},
+ {container_format: 'raw', properties: {image_type: 'image'}, id: '2', name_or_id: '2'}
];
expect(model.images).toEqual(expectedImages);
diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js
index 464a8c322..9f0801723 100644
--- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js
+++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js
@@ -165,7 +165,7 @@
// Mapping for dynamic table columns
var tableColumnsMap = {
image: [
- { id: 'name', title: gettext('Name'), priority: 1 },
+ { id: 'name_or_id', title: gettext('Name'), priority: 1 },
{ id: 'updated_at', title: gettext('Updated'), filters: ['simpleDate'], priority: 2 },
{ id: 'size', title: gettext('Size'), filters: ['bytes'], priority: 2 },
{ id: 'disk_format', title: gettext('Type'), filters: [getImageDiskFormat], priority: 2 },