Skip to content
Snippets Groups Projects
Commit e46586d7 authored by xiaohua guan's avatar xiaohua guan Committed by Yas Naoi
Browse files

Issue #3071849 by Xiaohua Guan, yas, baldwinlouie: Check the cost of a...

Issue #3071849 by Xiaohua Guan, yas, baldwinlouie: Check the cost of a Instance Type from the Instance listing page (2)
parent ad5dd913
No related branches found
No related tags found
No related merge requests found
......@@ -57,6 +57,8 @@ aws_cloud_view_builder:
aws_cloud_instance_type_prices:
version: 8.x-1.x
js:
js/aws_cloud_instance_type_prices.js: {}
css:
theme:
css/aws_cloud_instance_type_prices.css: {}
......
(function ($) {
'use strict';
if (!window.location.hash) {
return;
}
var instance_type = window.location.hash.substr(1);
var instance_type_underscore = instance_type.replace(".", "_");
// Find the column with instance type.
var $td = $("tr." + instance_type_underscore + " td:first");
if (!$td.html()) {
return;
}
// Highlight the row.
$("tr." + instance_type_underscore).addClass("highlight");
// Caculate position.
var navbar_top = $("#navbar").offset().top;
var header_height = $("table.aws_cloud_instance_type_prices thead").height();
var top = $td.offset().top - header_height - navbar_top;
$(window).scrollTop(top);
})(jQuery);
......@@ -31,7 +31,11 @@ class InstanceTypeLinkFormatter extends FormatterBase {
if (!$item->isEmpty()) {
$elements[$delta] = [
'#type' => 'link',
'#url' => Url::fromRoute('aws_cloud.instance_type_prices', ['cloud_context' => $entity->getCloudContext()]),
'#url' => Url::fromRoute(
'aws_cloud.instance_type_prices',
['cloud_context' => $entity->getCloudContext()],
['fragment' => $item->value]
),
'#title' => $item->value,
];
}
......
......@@ -98,8 +98,9 @@ class InstanceTypePriceTableRenderer {
$this->buildCell($row, $col_name, $col_val);
}
$row['#attributes']['class'] = [str_replace('.', '_', $row_data['instance_type'])];
if ($row_data['instance_type'] == $instance_type) {
$row['#attributes'] = ['class' => ['highlight']];
$row['#attributes']['class'][] = 'highlight';
}
$rows[] = $row;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment