diff --git a/horizon/static/horizon/js/horizon.quota.js b/horizon/static/horizon/js/horizon.quota.js index bf5b03a1e..2bd630210 100644 --- a/horizon/static/horizon/js/horizon.quota.js +++ b/horizon/static/horizon/js/horizon.quota.js @@ -239,7 +239,6 @@ horizon.Quota = { this.getSelectedFlavor(); if (this.selected_flavor) { - var name = horizon.Quota.truncate(this.selected_flavor.name, 14, true); var vcpus = horizon.Quota.humanizeNumbers(this.selected_flavor.vcpus); var disk = horizon.Quota.humanizeNumbers(this.selected_flavor.disk); var ephemeral = horizon.Quota.humanizeNumbers(this.selected_flavor["OS-FLV-EXT-DATA:ephemeral"]); @@ -247,7 +246,7 @@ horizon.Quota = { var disk_total_display = horizon.Quota.humanizeNumbers(disk_total); var ram = horizon.Quota.humanizeNumbers(this.selected_flavor.ram); - $("#flavor_name").html(name); + $("#flavor_name").text(this.selected_flavor.name); $("#flavor_vcpus").text(vcpus); $("#flavor_disk").text(disk); $("#flavor_ephemeral").text(ephemeral); @@ -264,27 +263,6 @@ horizon.Quota = { } }, - /* - * Truncate a string at the desired length. Optionally append an ellipsis - * to the end of the string. - * - * Example: - * horizon.Quota.truncate("String that is too long.", 18, true); -> - * "String that is too…" - * - */ - truncate: function (string, size, includeEllipsis) { - if (string.length > size) { - if (includeEllipsis) { - return string.substring(0, (size - 3)) + '…'; - } - - return string.substring(0, size); - } - - return string; - }, - /* * Adds commas to any integer or numbers within a string for human display. * diff --git a/horizon/static/horizon/tests/jasmine/quota.legacy-spec.js b/horizon/static/horizon/tests/jasmine/quota.legacy-spec.js index f07b3cc05..9ec7bc7be 100644 --- a/horizon/static/horizon/tests/jasmine/quota.legacy-spec.js +++ b/horizon/static/horizon/tests/jasmine/quota.legacy-spec.js @@ -20,22 +20,4 @@ describe("Quotas (horizon.quota.js)", function() { }); - describe("truncate", function() { - var string = 'This will be cut'; - var ellipsis = '…'; - - it('should truncate a string at a given length', function () { - expect(horizon.Quota.truncate(string, 15)).toEqual(string.slice(0, 15)); - expect(horizon.Quota.truncate(string, 20)).toEqual(string); - }); - - it('should add an ellipsis if needed ', function () { - expect(horizon.Quota.truncate(string, 15, true)).toEqual(string.slice(0, 12) + ellipsis); - - expect(horizon.Quota.truncate(string, 20, true)).toEqual(string); - - expect(horizon.Quota.truncate(string, 2, true)).toEqual(ellipsis); - }); - }); - }); diff --git a/openstack_dashboard/dashboards/project/instances/templates/instances/_flavors_and_quotas.html b/openstack_dashboard/dashboards/project/instances/templates/instances/_flavors_and_quotas.html index ca3e42ba9..53ecb6e3c 100644 --- a/openstack_dashboard/dashboards/project/instances/templates/instances/_flavors_and_quotas.html +++ b/openstack_dashboard/dashboards/project/instances/templates/instances/_flavors_and_quotas.html @@ -4,9 +4,9 @@ {% endblock %}

{% trans "Flavor Details" %}

- +
- + diff --git a/openstack_dashboard/static/dashboard/scss/_util.scss b/openstack_dashboard/static/dashboard/scss/_util.scss index 3c626fe90..a76d141fa 100644 --- a/openstack_dashboard/static/dashboard/scss/_util.scss +++ b/openstack_dashboard/static/dashboard/scss/_util.scss @@ -50,4 +50,11 @@ input::-ms-clear, input::-ms-reveal { .word-wrap { width: 100%; word-wrap: break-word; -} \ No newline at end of file +} + +.truncate { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + display: block; +}
{% trans "Name" %}
{% trans "Name" %}
{% trans "VCPUs" %}
{% trans "Root Disk" %} {% trans "GB" %}
{% trans "Ephemeral Disk" %} {% trans "GB" %}