diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties index a0ed7c9a277..7374bd8ced3 100644 --- a/client/WEB-INF/classes/resources/messages.properties +++ b/client/WEB-INF/classes/resources/messages.properties @@ -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 diff --git a/ui/dictionary.jsp b/ui/dictionary.jsp index 3a10258029d..98f6bf86e07 100644 --- a/ui/dictionary.jsp +++ b/ui/dictionary.jsp @@ -25,6 +25,9 @@ under the License. <% long now = System.currentTimeMillis(); %> + diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js index 3c5dfe15ad0..f9b5a58545c 100644 --- a/ui/scripts/cloudStack.js +++ b/ui/scripts/cloudStack.js @@ -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 diff --git a/ui/scripts/regions.js b/ui/scripts/regions.js new file mode 100644 index 00000000000..f29dc6d1282 --- /dev/null +++ b/ui/scripts/regions.js @@ -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);