public SendWlbConfigurationAction(Pool pool, Dictionary <string, string> configuration, SendWlbConfigurationKind kind) : base(pool.Connection, string.Format(Messages.SAVING_WLB_CONFIGURATION_FOR, Helpers.GetName(pool).Ellipsise(50)), Messages.SAVING_WLB_CONFIGURATION, false) { this.Pool = pool; this.WlbConfiguration = configuration; this._kind = kind; #region RBAC Dependencies ApiMethodsToRoleCheck.Add("pool.send_wlb_configuration"); ApiMethodsToRoleCheck.AddRange(Role.CommonTaskApiList); ApiMethodsToRoleCheck.AddRange(Role.CommonSessionApiList); #endregion }
public SendWlbConfigurationAction(Pool pool, Dictionary<string, string> configuration, SendWlbConfigurationKind kind) : base(pool.Connection, string.Format(Messages.SAVING_WLB_CONFIGURATION_FOR, Helpers.GetName(pool).Ellipsise(50)), Messages.SAVING_WLB_CONFIGURATION, false) { this.Pool = pool; this.WlbConfiguration = configuration; this._kind = kind; #region RBAC Dependencies ApiMethodsToRoleCheck.Add("pool.send_wlb_configuration"); ApiMethodsToRoleCheck.AddRange(Role.CommonTaskApiList); ApiMethodsToRoleCheck.AddRange(Role.CommonSessionApiList); #endregion }
private void SaveWLBConfig(WlbPoolConfiguration PoolConfiguration) { Dictionary <string, string> completeConfiguration = PoolConfiguration.ToDictionary(); SendWlbConfigurationKind kind = SendWlbConfigurationKind.SetPoolConfiguration; // check for host configurations in the pool configuration if (PoolConfiguration.HostConfigurations.Count > 0) { // add the flag denoting that there are host configs to be saved kind |= SendWlbConfigurationKind.SetHostConfiguration; // get the key for each host config (host.uuid) foreach (string key in PoolConfiguration.HostConfigurations.ToDictionary().Keys) { //Drop any exising copy from the pool configuration if (completeConfiguration.ContainsKey(key)) { completeConfiguration.Remove(key); } // and add the task to the collection completeConfiguration.Add(key, PoolConfiguration.HostConfigurations.ToDictionary()[key]); } } // check for scheduled tasks in the pool configuration if (PoolConfiguration.ScheduledTasks.TaskList.Count > 0) { // add the flag denoting that there are scheduled tasks to be saved kind |= SendWlbConfigurationKind.SetScheduledTask; // get the key for each scheduled task foreach (string key in PoolConfiguration.ScheduledTasks.ToDictionary().Keys) { //Drop any exising copy from the pool configuration if (completeConfiguration.ContainsKey(key)) { completeConfiguration.Remove(key); } // and add the task to the collection completeConfiguration.Add(key, PoolConfiguration.ScheduledTasks.ToDictionary()[key]); } } SendWlbConfigurationAction action = new SendWlbConfigurationAction(_pool, PoolConfiguration.ToDictionary(), kind); using (var dialog = new ActionProgressDialog(action, ProgressBarStyle.Blocks)) { dialog.ShowCancel = true; dialog.ShowDialog(this); } Program.MainWindow.UpdateToolbars(); }