mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-1065: cloudstack UI - AWS Style Regions - set current region (whose end point matches current URL) to region button and region dropdown on top menu.
This commit is contained in:
parent
918a7c7481
commit
ae7e5b025e
@ -29,8 +29,7 @@
|
|||||||
data: regions ? regions : [
|
data: regions ? regions : [
|
||||||
{ id: -1, name: '(Default)' }
|
{ id: -1, name: '(Default)' }
|
||||||
],
|
],
|
||||||
activeRegionID: cloudStack.context.users.regionid ?
|
activeRegionID: cloudStack.context.users[0].regionid
|
||||||
cloudStack.context.users.regionid : 1
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -29,23 +29,28 @@
|
|||||||
var data = args.data;
|
var data = args.data;
|
||||||
var activeRegionID = args.activeRegionID;
|
var activeRegionID = args.activeRegionID;
|
||||||
|
|
||||||
|
var currentRegion;
|
||||||
$(data).each(function() {
|
$(data).each(function() {
|
||||||
var region = this;
|
var region = this;
|
||||||
var regionName = region.name;
|
var regionName = region.name;
|
||||||
var $li = $('<li>').append($('<span>').html(_s(region.name)));
|
var $li = $('<li>').append($('<span>').html(_s(region.name)));
|
||||||
|
|
||||||
$li.data('region-data', region);
|
$li.data('region-data', region);
|
||||||
|
|
||||||
|
if(document.location.href == region.endpoint) {
|
||||||
|
currentRegion = region;
|
||||||
|
$li.addClass('active');
|
||||||
|
}
|
||||||
|
/*
|
||||||
if (region.id == activeRegionID) {
|
if (region.id == activeRegionID) {
|
||||||
$li.addClass('active');
|
$li.addClass('active');
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
$regionSwitcherButton.find('.title')
|
|
||||||
.html(regionName)
|
$regionList.append($li);
|
||||||
.attr('title', regionName);
|
|
||||||
|
|
||||||
$regionList.append($li);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$regionSwitcherButton.find('.title').html(_s(currentRegion.name)).attr('title', _s(currentRegion.name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user