mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-16 22:50:10 +03:00
Merge branch 'feature-5065'
This commit is contained in:
commit
d26a242ac1
@ -3,6 +3,7 @@ provision_logo: images/opennebula-5.0.png
|
||||
link_logo:
|
||||
text_link_logo:
|
||||
confirm_vms: false
|
||||
filter-view: true
|
||||
enabled_tabs:
|
||||
- dashboard-tab
|
||||
- instances-top-tab
|
||||
|
@ -3,6 +3,7 @@ provision_logo: images/opennebula-5.0.png
|
||||
link_logo:
|
||||
text_link_logo:
|
||||
confirm_vms: false
|
||||
filter-view: true
|
||||
enabled_tabs:
|
||||
- dashboard-tab
|
||||
- instances-top-tab
|
||||
|
@ -3,6 +3,7 @@ provision_logo: images/opennebula-5.0.png
|
||||
link_logo:
|
||||
text_link_logo:
|
||||
confirm_vms: false
|
||||
filter-view: true
|
||||
enabled_tabs:
|
||||
- dashboard-tab
|
||||
- instances-top-tab
|
||||
|
@ -3,6 +3,7 @@ provision_logo: images/opennebula-5.0.png
|
||||
link_logo:
|
||||
text_link_logo:
|
||||
confirm_vms: false
|
||||
filter-view: true
|
||||
enabled_tabs:
|
||||
- dashboard-tab
|
||||
- instances-top-tab
|
||||
|
@ -3,6 +3,7 @@ provision_logo: images/opennebula-5.0.png
|
||||
link_logo:
|
||||
text_link_logo:
|
||||
confirm_vms: false
|
||||
filter-view: true
|
||||
enabled_tabs:
|
||||
- dashboard-tab
|
||||
- instances-top-tab
|
||||
|
@ -24,8 +24,6 @@ require 'OpenNebulaJSON/JSONUtils'
|
||||
#include JSONUtils
|
||||
|
||||
class SunstoneServer < CloudServer
|
||||
# FLAG that will filter the elements retrieved from the Pools
|
||||
POOL_FILTER = Pool::INFO_ALL
|
||||
|
||||
# Secs to sleep between checks to see if image upload to repo is finished
|
||||
IMAGE_POLL_SLEEP_TIME = 5
|
||||
@ -38,14 +36,10 @@ class SunstoneServer < CloudServer
|
||||
############################################################################
|
||||
#
|
||||
############################################################################
|
||||
def get_pool(kind,gid, client=nil)
|
||||
def get_pool(kind,user_flag, client=nil)
|
||||
client = @client if !client
|
||||
|
||||
if gid == "0"
|
||||
user_flag = Pool::INFO_ALL
|
||||
else
|
||||
user_flag = POOL_FILTER
|
||||
end
|
||||
user_flag = Integer(user_flag)
|
||||
|
||||
pool = case kind
|
||||
when "group" then GroupPoolJSON.new(client)
|
||||
|
@ -37,7 +37,6 @@ define(function(require) {
|
||||
var Notifier = require('utils/notifier');
|
||||
var Menu = require('utils/menu');
|
||||
var Locale = require('utils/locale');
|
||||
|
||||
var UserAndZoneTemplate = require('hbs!sunstone/user_and_zone');
|
||||
|
||||
var _commonDialogs = [
|
||||
@ -97,13 +96,21 @@ define(function(require) {
|
||||
}
|
||||
|
||||
function _insertUserAndZoneSelector() {
|
||||
|
||||
this.idGroup = -2; /*All*/
|
||||
Config.changeFilter(false);
|
||||
|
||||
$(".user-zone-info").html(UserAndZoneTemplate({
|
||||
filterView: Config['filterView'],
|
||||
displayName: config['display_name'],
|
||||
settingsTabEnabled: Config.isTabEnabled(SETTINGS_TAB_ID),
|
||||
availableViews: config['available_views'],
|
||||
zoneName: config['zone_name']
|
||||
})).foundation();
|
||||
|
||||
$('#filter-view').hide();
|
||||
groupsRefresh();
|
||||
|
||||
$('.quickconf_view[view="' + config['user_config']["default_view"] + '"] i').addClass('fa-check');
|
||||
$(".user-zone-info a.quickconf_view_header").click(function() {
|
||||
var context = $(this).closest('ul');
|
||||
@ -117,6 +124,86 @@ define(function(require) {
|
||||
Sunstone.runAction("User.append_sunstone_setting_refresh", -1, sunstone_setting);
|
||||
});
|
||||
|
||||
function groupsRefresh() {
|
||||
|
||||
OpenNebula.User.show({
|
||||
timeout: true,
|
||||
data : {
|
||||
id: config['user_id']
|
||||
},
|
||||
success: function (request, obj_user) {
|
||||
var groups = obj_user.USER.GROUPS.ID;
|
||||
this.primaryGroup = obj_user.USER.GID;
|
||||
var groupsHTML = "<li class='groups' value='-2'> <a href='#' value='-2' id='-2'> \
|
||||
<i class='fa fa-fw'></i>" + Locale.tr("All") + "</a></li>";
|
||||
if(this.idGroup == -2){
|
||||
var groupsHTML = "<li class='groups' value='-2'> <a href='#' value='-2' id='-2'> \
|
||||
<i class='fa fa-fw fa-check'></i>" + Locale.tr("All") + "</a></li>";
|
||||
}
|
||||
|
||||
if (!$.isArray(groups)){
|
||||
groups = groups.toString();
|
||||
groups = [groups];
|
||||
}
|
||||
|
||||
that = this;
|
||||
OpenNebula.Group.list({
|
||||
timeout: true,
|
||||
success: function(request, group_list) {
|
||||
var group_list_aux = group_list;
|
||||
$.each(groups, function(key, value){
|
||||
var id = value;
|
||||
$.each(group_list_aux, function(key, value){
|
||||
if(id == value.GROUP.ID){
|
||||
if(id == that.idGroup){
|
||||
groupsHTML += "<li class='groups' value='" + id + "'id='" + id + "'> \
|
||||
<a href='#'><i class='fa fa-fw fa-check'></i>" + value.GROUP.NAME + "\
|
||||
</a></li>";
|
||||
} else {
|
||||
groupsHTML += "<li class='groups' value='" + id + "'id='" + id + "'> \
|
||||
<a href='#'><i class='fa fa-fw'></i>" + value.GROUP.NAME + "\
|
||||
</a></li>";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
error: Notifier.onError
|
||||
});
|
||||
|
||||
$('#userselector').on('click', function(){
|
||||
$('.groups-menu').empty();
|
||||
$('.groups-menu').append(groupsHTML);
|
||||
var primaryGroupChar = '<span class="fa fa-asterisk fa-fw" id="primary-char" \
|
||||
style="float: right"></span>';
|
||||
$('#'+ that.primaryGroup + ' a').append(primaryGroupChar);
|
||||
$('.groups').on('click', function(){
|
||||
that.idGroup = $(this).attr('value');
|
||||
if(that.idGroup != -2){
|
||||
$('#primary-char').remove();
|
||||
Sunstone.runAction("User.chgrp", [parseInt(config['user_id'])], parseInt(that.idGroup));
|
||||
$('a', this).append(primaryGroupChar);
|
||||
Config.changeFilter(true);
|
||||
var filterName = $(this).text();
|
||||
$('#filter-view').show();
|
||||
$('.filter-name').html(filterName);
|
||||
} else {
|
||||
$('#filter-view').hide();
|
||||
Config.changeFilter(false);
|
||||
}
|
||||
$('.groups-menu a i').removeClass('fa-check');
|
||||
$('a i', this).addClass('fa-check');
|
||||
groupsRefresh();
|
||||
$('.refresh').click();
|
||||
$('.refresh-table').click();
|
||||
});
|
||||
});
|
||||
},
|
||||
error: Notifier.onError
|
||||
});
|
||||
}
|
||||
|
||||
function zoneRefresh() {
|
||||
// Populate Zones dropdown
|
||||
OpenNebula.Zone.list({
|
||||
|
@ -17,6 +17,7 @@
|
||||
define(function(require) {
|
||||
var OpenNebulaHelper = require('./helper');
|
||||
var OpenNebulaError = require('./error');
|
||||
var Config = require('sunstone-config');
|
||||
|
||||
var listCache = {};
|
||||
var listWaiting = {};
|
||||
@ -162,13 +163,13 @@ define(function(require) {
|
||||
}
|
||||
|
||||
listWaiting[cache_name] = true;
|
||||
|
||||
var pool_filter = Config.isChangedFilter()?-4:-2;
|
||||
//console.log(cache_name+" list. NO cache, calling ajax");
|
||||
|
||||
$.ajax({
|
||||
url: reqPath,
|
||||
type: "GET",
|
||||
data: {timeout: timeout},
|
||||
data: {timeout: timeout, pool_filter: pool_filter},
|
||||
dataType: "json",
|
||||
success: function(response) {
|
||||
var list;
|
||||
|
@ -131,7 +131,9 @@ define(function(require) {
|
||||
return support;
|
||||
},
|
||||
"initMarketExportSupported": function(){
|
||||
var pool_filter = Config.isChangedFilter()? -4 : -2;
|
||||
this.list({
|
||||
data : {pool_filter : pool_filter},
|
||||
timeout: true,
|
||||
success: function (request, obj_list) {},
|
||||
//error: Notifier.onError
|
||||
|
@ -26,6 +26,14 @@ define(function(require) {
|
||||
return enabled;
|
||||
},
|
||||
|
||||
"changeFilter": function(bool) {
|
||||
_config['pool_filter'] = bool;
|
||||
},
|
||||
|
||||
"isChangedFilter": function(){
|
||||
return _config['pool_filter'];
|
||||
},
|
||||
|
||||
"isTabActionEnabled": function(tabName, actionName, panelName) {
|
||||
var enabled = false;
|
||||
var configTab = _config['view']['tabs'][tabName];
|
||||
@ -150,6 +158,7 @@ define(function(require) {
|
||||
'onedConf': _config['oned_conf'],
|
||||
'confirmVMActions': _config['view']['confirm_vms'],
|
||||
'scaleFactor': _config['view']['features']['instanciate_cpu_factor'],
|
||||
'filterView': _config['view']['filter_view'],
|
||||
|
||||
"allTabs": function() {
|
||||
return Object.keys(_config['view']['tabs']);
|
||||
|
@ -15,8 +15,16 @@
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
|
||||
<ul class="dropdown menu" data-dropdown-menu data-alignment="right">
|
||||
{{#if filterView}}
|
||||
<li>
|
||||
<a class="thin-font" href="#">
|
||||
<a class="thin-font" href="#" id="filter-view">
|
||||
<i class="fa fa-filter fa-fw header-icon"></i>
|
||||
<span class="filter-name"></span>
|
||||
</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
<li>
|
||||
<a class="thin-font" href="#" id="userselector">
|
||||
<i class="fa fa-user fa-fw header-icon"></i>
|
||||
<span class="username">
|
||||
{{displayName}}
|
||||
@ -55,6 +63,13 @@
|
||||
</ul>
|
||||
</li>
|
||||
{{/if}}
|
||||
<li>
|
||||
<a href="#">
|
||||
<i class="fa fa-fw fa-users"></i>
|
||||
{{tr "Groups"}}
|
||||
</a>
|
||||
<ul class="menu groups-menu"></ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -108,7 +108,7 @@ define(function(require) {
|
||||
this.groupsTableEdit.selectResourceTableSelect({ids: this.groups});
|
||||
|
||||
$("#cancel_update_group").hide();
|
||||
that = this;
|
||||
var that = this;
|
||||
context.off("click", "#update_group");
|
||||
context.on("click", "#update_group", function() {
|
||||
ResourceSelect.insert({
|
||||
|
@ -1226,16 +1226,17 @@ define(function(require) {
|
||||
success_func(request, []);
|
||||
Notifier.onError(request, error_json, container);
|
||||
}
|
||||
|
||||
var pool_filter = SunstoneConfig.isChangedFilter()? -4 : -2;
|
||||
if (that.selectOptions.zone_id == undefined) {
|
||||
OpenNebula[that.resource].list({
|
||||
data : {pool_filter : pool_filter},
|
||||
timeout: true,
|
||||
success: success_func,
|
||||
error: error_func
|
||||
});
|
||||
} else {
|
||||
OpenNebula[that.resource].list_in_zone({
|
||||
data: {zone_id: that.selectOptions.zone_id},
|
||||
data: {zone_id: that.selectOptions.zone_id, pool_filter : pool_filter},
|
||||
timeout: true,
|
||||
success: success_func,
|
||||
error: error_func
|
||||
@ -1246,7 +1247,9 @@ define(function(require) {
|
||||
// TODO: This is probably duplicated somewhere
|
||||
function _list() {
|
||||
var that = this;
|
||||
var pool_filter = SunstoneConfig.isChangedFilter()? -4 : -2;
|
||||
OpenNebula[that.resource].list({
|
||||
data : {pool_filter : pool_filter},
|
||||
success: function(req, resp) {
|
||||
that.updateView(req, resp);
|
||||
},
|
||||
|
@ -702,7 +702,7 @@ get '/:pool' do
|
||||
end
|
||||
|
||||
@SunstoneServer.get_pool(params[:pool],
|
||||
session[:user_gid],
|
||||
params[:pool_filter],
|
||||
zone_client)
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user