Implement region list view

This commit is contained in:
Brian Federle 2013-02-26 13:09:32 -08:00
parent 47816a4e04
commit 142a5a8fba
5 changed files with 81 additions and 2 deletions

View File

@ -17,6 +17,9 @@
#new labels (begin) **********************************************************************************************
label.menu.regions=Regions
label.region=Region
label.endpoint=Endpoint
label.plugins=Plugins
label.plugin.details=Plugin details
label.author.name=Author name

View File

@ -25,6 +25,9 @@ under the License.
<% long now = System.currentTimeMillis(); %>
<script language="javascript">
dictionary = {
'label.region': '<fmt:message key="label.region"/>',
'label.endpoint': '<fmt:message key="label.endpoint"/>',
'label.menu.regions': '<fmt:message key="label.menu.regions"/>',
'label.plugins': '<fmt:message key="label.plugins"/>',
'label.plugin.details': '<fmt:message key="label.plugin.details"/>',
'label.author.name': '<fmt:message key="label.author.name"/>',

View File

@ -1656,6 +1656,7 @@ under the License.
<script type="text/javascript" src="scripts/instanceWizard.js?t=<%=now%>"></script>
<script type="text/javascript" src="scripts/instances.js?t=<%=now%>"></script>
<script type="text/javascript" src="scripts/events.js?t=<%=now%>"></script>
<script type="text/javascript" src="scripts/regions.js?t=<%=now%>"></script>
<script type="text/javascript" src="scripts/ui-custom/ipRules.js?t=<%=now%>"></script>
<script type="text/javascript" src="scripts/ui-custom/enableStaticNAT.js?t=<%=now%>"></script>
<script type="text/javascript" src="scripts/ui-custom/securityRules.js?t=<%=now%>"></script>

View File

@ -22,7 +22,7 @@
var sections = [];
if(isAdmin()) {
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "system", "global-settings", "configuration", "projects"];
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "system", "global-settings", "configuration", "projects", "regions"];
}
else if(isDomainAdmin()) {
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "projects"];
@ -54,7 +54,8 @@
accounts: {},
domains: {}, //domain-admin and root-admin only
regions: {}, //root-admin only
system: {}, //root-admin only
'global-settings': {}, //root-admin only
configuration: {}, //root-admin only

71
ui/scripts/regions.js Normal file
View File

@ -0,0 +1,71 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you 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(cloudStack) {
cloudStack.sections.regions = {
title: 'label.menu.regions',
id: 'regions',
listView: {
section: 'regions',
fields: {
name: { label: 'label.name' },
endpoint: { label: 'label.endpoint' }
},
dataProvider: function(args) {
$.ajax({
url: createURL('listRegions&listAll=true'),
success: function(json) {
var regions = json.listregionsresponse.region
args.response.success({
data: regions ? regions : []
});
}
});
},
detailView: {
name: 'Region details',
tabs: {
details: {
title: 'label.details',
fields: [
{
name: { label: 'label.name' },
},
{
endpoint: { label: 'label.endpoint' },
id: { label: 'label.id' }
}
],
dataProvider: function(args) {
$.ajax({
url: createURL('listRegions&listAll=true'),
data: { id: args.context.regions[0].id },
success: function(json) {
var region = json.listregionsresponse.region
args.response.success({
data: region ? region[0] : {}
});
}
});
}
}
}
}
}
};
})(cloudStack);