- Timestamp:
- 10/18/18 14:07:32 (6 years ago)
- Location:
- branches/2931_OR-Tools_LP_MIP
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2931_OR-Tools_LP_MIP
- Property svn:mergeinfo changed
/branches/2916_IndexedDataTableSerialization (added) merged: 15918 /trunk merged: 16168-16169,16177,16179,16184-16187,16202-16209,16211,16213,16216,16218-16219,16221,16223-16224,16232
- Property svn:mergeinfo changed
-
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Clients.Hive.Administrator
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Clients.Hive.Administrator merged: 16184-16187,16202,16205,16208-16209,16211
- Property svn:mergeinfo changed
-
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Clients.Hive.Administrator/3.3/Views/HiveAdministratorView.Designer.cs
r16139 r16235 29 29 this.components = new System.ComponentModel.Container(); 30 30 this.tabAdmin = new System.Windows.Forms.TabControl(); 31 this.tab Slaves = new System.Windows.Forms.TabPage();31 this.tabResources = new System.Windows.Forms.TabPage(); 32 32 this.resourcesView = new HeuristicLab.Clients.Hive.Administrator.Views.ResourcesView(); 33 this.tabP age1= new System.Windows.Forms.TabPage();33 this.tabProjects = new System.Windows.Forms.TabPage(); 34 34 this.imageListUsers = new System.Windows.Forms.ImageList(this.components); 35 35 this.projectsView = new HeuristicLab.Clients.Hive.Administrator.Views.ProjectsView(); 36 36 this.tabAdmin.SuspendLayout(); 37 this.tab Slaves.SuspendLayout();38 this.tabP age1.SuspendLayout();37 this.tabResources.SuspendLayout(); 38 this.tabProjects.SuspendLayout(); 39 39 this.SuspendLayout(); 40 40 // … … 44 44 | System.Windows.Forms.AnchorStyles.Left) 45 45 | System.Windows.Forms.AnchorStyles.Right))); 46 this.tabAdmin.Controls.Add(this.tab Slaves);47 this.tabAdmin.Controls.Add(this.tabP age1);46 this.tabAdmin.Controls.Add(this.tabResources); 47 this.tabAdmin.Controls.Add(this.tabProjects); 48 48 this.tabAdmin.Location = new System.Drawing.Point(3, 0); 49 49 this.tabAdmin.Name = "tabAdmin"; … … 52 52 this.tabAdmin.TabIndex = 0; 53 53 // 54 // tab Slaves54 // tabResources 55 55 // 56 this.tab Slaves.Controls.Add(this.resourcesView);57 this.tab Slaves.Location = new System.Drawing.Point(4, 22);58 this.tab Slaves.Name = "tabSlaves";59 this.tab Slaves.Padding = new System.Windows.Forms.Padding(3);60 this.tab Slaves.Size = new System.Drawing.Size(734, 520);61 this.tab Slaves.TabIndex = 3;62 this.tab Slaves.Text = "Slaves";63 this.tab Slaves.UseVisualStyleBackColor = true;56 this.tabResources.Controls.Add(this.resourcesView); 57 this.tabResources.Location = new System.Drawing.Point(4, 22); 58 this.tabResources.Name = "tabResources"; 59 this.tabResources.Padding = new System.Windows.Forms.Padding(3); 60 this.tabResources.Size = new System.Drawing.Size(734, 520); 61 this.tabResources.TabIndex = 3; 62 this.tabResources.Text = "Resources"; 63 this.tabResources.UseVisualStyleBackColor = true; 64 64 // 65 65 // resourcesView … … 76 76 this.resourcesView.TabIndex = 0; 77 77 // 78 // tabP age178 // tabProjects 79 79 // 80 this.tabP age1.Controls.Add(this.projectsView);81 this.tabP age1.Location = new System.Drawing.Point(4, 22);82 this.tabP age1.Name = "tabPage1";83 this.tabP age1.Size = new System.Drawing.Size(734, 520);84 this.tabP age1.TabIndex = 4;85 this.tabP age1.Text = "Projects";86 this.tabP age1.UseVisualStyleBackColor = true;80 this.tabProjects.Controls.Add(this.projectsView); 81 this.tabProjects.Location = new System.Drawing.Point(4, 22); 82 this.tabProjects.Name = "tabProjects"; 83 this.tabProjects.Size = new System.Drawing.Size(734, 520); 84 this.tabProjects.TabIndex = 4; 85 this.tabProjects.Text = "Projects"; 86 this.tabProjects.UseVisualStyleBackColor = true; 87 87 // 88 88 // imageListUsers … … 112 112 this.Size = new System.Drawing.Size(745, 546); 113 113 this.tabAdmin.ResumeLayout(false); 114 this.tab Slaves.ResumeLayout(false);115 this.tabP age1.ResumeLayout(false);114 this.tabResources.ResumeLayout(false); 115 this.tabProjects.ResumeLayout(false); 116 116 this.ResumeLayout(false); 117 117 … … 122 122 private System.ComponentModel.IContainer components; 123 123 private System.Windows.Forms.ImageList imageListUsers; 124 private System.Windows.Forms.TabPage tab Slaves;125 private System.Windows.Forms.TabPage tabP age1;124 private System.Windows.Forms.TabPage tabResources; 125 private System.Windows.Forms.TabPage tabProjects; 126 126 private ProjectsView projectsView; 127 127 } -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectJobsView.Designer.cs
r16139 r16235 20 20 #endregion 21 21 22 using System.Windows.Forms; 22 23 using HeuristicLab.Data.Views; 23 24 … … 50 51 this.refreshButton = new System.Windows.Forms.Button(); 51 52 this.removeButton = new System.Windows.Forms.Button(); 53 this.startButton = new System.Windows.Forms.Button(); 54 this.stopButton = new System.Windows.Forms.Button(); 55 this.pauseButton = new System.Windows.Forms.Button(); 52 56 this.matrixView = new HeuristicLab.Data.Views.StringConvertibleMatrixView(); 53 57 this.toolTip = new System.Windows.Forms.ToolTip(this.components); … … 72 76 this.removeButton.Size = new System.Drawing.Size(24, 24); 73 77 this.removeButton.TabIndex = 2; 74 this.toolTip.SetToolTip(this.removeButton, " Delete job(s)");78 this.toolTip.SetToolTip(this.removeButton, "Remove job(s)"); 75 79 this.removeButton.UseVisualStyleBackColor = true; 76 80 this.removeButton.Click += new System.EventHandler(this.removeButton_Click); 81 // 82 // startButton 83 // 84 this.startButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left))); 85 this.startButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Play; 86 this.startButton.Location = new System.Drawing.Point(63, 3); 87 this.startButton.Name = "startButton"; 88 this.startButton.Size = new System.Drawing.Size(24, 24); 89 this.startButton.TabIndex = 4; 90 this.toolTip.SetToolTip(this.startButton, "Resume job(s)"); 91 this.startButton.UseVisualStyleBackColor = true; 92 this.startButton.Click += new System.EventHandler(this.startButton_Click); 93 // 94 // pauseButton 95 // 96 this.pauseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left))); 97 this.pauseButton.Enabled = false; 98 this.pauseButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Pause; 99 this.pauseButton.Location = new System.Drawing.Point(93, 3); 100 this.pauseButton.Name = "pauseButton"; 101 this.pauseButton.Size = new System.Drawing.Size(24, 24); 102 this.pauseButton.TabIndex = 5; 103 this.toolTip.SetToolTip(this.pauseButton, "Pause job(s)"); 104 this.pauseButton.UseVisualStyleBackColor = true; 105 this.pauseButton.Click += new System.EventHandler(this.pauseButton_Click); 106 // 107 // stopButton 108 // 109 this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left))); 110 this.stopButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Stop; 111 this.stopButton.Location = new System.Drawing.Point(123, 3); 112 this.stopButton.Name = "stopButton"; 113 this.stopButton.Size = new System.Drawing.Size(24, 24); 114 this.stopButton.TabIndex = 6; 115 this.toolTip.SetToolTip(this.stopButton, "Stop job(s)"); 116 this.stopButton.UseVisualStyleBackColor = true; 117 this.stopButton.Click += new System.EventHandler(this.stopButton_Click); 77 118 // 78 119 // matrixView … … 98 139 this.Controls.Add(this.refreshButton); 99 140 this.Controls.Add(this.removeButton); 141 this.Controls.Add(this.startButton); 142 this.Controls.Add(this.pauseButton); 143 this.Controls.Add(this.stopButton); 100 144 this.Name = "ProjectJobsView"; 101 145 this.Size = new System.Drawing.Size(510, 385); … … 110 154 private System.Windows.Forms.Button refreshButton; 111 155 private System.Windows.Forms.Button removeButton; 156 private System.Windows.Forms.Button startButton; 157 private System.Windows.Forms.Button stopButton; 158 private System.Windows.Forms.Button pauseButton; 112 159 private StringConvertibleMatrixView matrixView; 113 160 } -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectJobsView.cs
r16139 r16235 24 24 using System.Drawing; 25 25 using System.Linq; 26 using System.Threading.Tasks; 26 27 using System.Windows.Forms; 27 28 using HeuristicLab.MainForm; … … 30 31 using HeuristicLab.Data; 31 32 using HeuristicLab.Clients.Hive.Views; 33 using HeuristicLab.Core; 32 34 33 35 namespace HeuristicLab.Clients.Hive.Administrator.Views { … … 41 43 private const string JOB_DATECREATED = "Date Created"; 42 44 private const string JOB_STATE = "State"; 45 private const string JOB_EXECUTIONSTATE = "Execution State"; 46 private const string JOB_EXECUTIONTIME = "Execution Time"; 43 47 private const string JOB_DESCRIPTION = "Description"; 44 48 private const string JOB_TASKCOUNT = "Tasks"; 49 private const string JOB_WAITINGTASKCOUNT = "Waiting"; 45 50 private const string JOB_CALCULATINGTASKCOUNT = "Calculating"; 46 51 private const string JOB_FINISHEDTASKCOUNT = "Finished"; 47 48 52 49 53 private readonly Color onlineStatusColor = Color.FromArgb(255, 189, 249, 143); // #bdf98f … … 53 57 private readonly Color deletionPendingStatusColor2 = Color.FromArgb(255, 249, 149, 143); // #f9958f 54 58 59 private IProgress progress; 60 public IProgress Progress { 61 get { return progress; } 62 set { 63 this.progress = value; 64 OnIsProgressingChanged(); 65 } 66 } 67 55 68 public new Project Content { 56 69 get { return (Project)base.Content; } … … 60 73 public ProjectJobsView() { 61 74 InitializeComponent(); 62 63 removeButton.Enabled = false; 75 progress = new Progress(); 76 77 removeButton.Enabled = false; 78 } 79 80 protected override void RegisterContentEvents() { 81 base.RegisterContentEvents(); 64 82 matrixView.DataGridView.SelectionChanged += DataGridView_SelectionChanged; 83 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, progress); 84 } 85 86 protected override void DeregisterContentEvents() { 87 matrixView.DataGridView.SelectionChanged -= DataGridView_SelectionChanged; 88 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this, false); 89 base.DeregisterContentEvents(); 65 90 } 66 91 67 92 private void DataGridView_SelectionChanged(object sender, EventArgs e) { 68 if (matrixView.DataGridView.SelectedRows == null || matrixView.DataGridView.SelectedRows.Count == 0) return; 69 70 bool anyDeletable = false; 71 foreach (DataGridViewRow r in matrixView.DataGridView.SelectedRows) { 72 if (((string)r.Cells[0].Value) == JobState.Online.ToString()) anyDeletable = true; 73 } 74 75 removeButton.Enabled = anyDeletable; 93 SetEnabledStateOfControls(); 76 94 } 77 95 … … 81 99 removeButton.Enabled = false; 82 100 UpdateJobs(); 83 } 101 SetEnabledStateOfControls(); 102 } 103 84 104 protected override void SetEnabledStateOfControls() { 85 105 base.SetEnabledStateOfControls(); 86 106 bool enabled = Content != null && !Locked && !ReadOnly; 87 107 88 refreshButton.Enabled = enabled;89 removeButton.Enabled = false;90 108 matrixView.Enabled = enabled; 91 } 109 110 // Buttons (start/resume, pause, stop, remove) 111 refreshButton.Enabled = startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = removeButton.Enabled = false; 112 113 if (enabled && progress.ProgressState != ProgressState.Started) { 114 var jobs = GetSelectedJobs().ToList(); 115 if (jobs.Any()) { 116 117 startButton.Enabled = jobs.All(x => 118 !x.IsProgressing && HiveAdminClient.Instance.Tasks.ContainsKey(x.Id) && HiveAdminClient.Instance.Tasks[x.Id].Count > 0 119 && x.Job.ProjectId != Guid.Empty //&& x.Job.ResourceIds != null && x.Job.ResourceIds.Any() 120 && (x.ExecutionState == ExecutionState.Prepared || x.ExecutionState == ExecutionState.Paused)); 121 pauseButton.Enabled = jobs.All(x => !x.IsProgressing && x.ExecutionState == ExecutionState.Started); 122 stopButton.Enabled = jobs.All(x => !x.IsProgressing && (x.ExecutionState == ExecutionState.Started || x.ExecutionState == ExecutionState.Paused)); 123 removeButton.Enabled = jobs.All(x => !x.IsProgressing && x.Job.State == JobState.Online); 124 } 125 } 126 127 // refresh Button 128 if (Content != null && !Locked && progress.ProgressState != ProgressState.Started) { 129 refreshButton.Enabled = true; 130 } 131 } 132 92 133 #endregion Overrides 93 134 … … 98 139 99 140 private void refreshButton_Click(object sender, EventArgs e) { 100 RefreshJobs(); 101 } 102 103 private async void removeButton_Click(object sender, EventArgs e) { 104 if (matrixView.DataGridView.SelectedRows == null || matrixView.DataGridView.SelectedRows.Count == 0) return; 105 106 var jobNamesToDelete = new List<string>(); 107 var jobIdsToDelete = new List<Guid>(); 108 foreach (DataGridViewRow r in matrixView.DataGridView.SelectedRows) { 109 if(((string)r.Cells[0].Value) == JobState.Online.ToString()) { 110 jobNamesToDelete.Add(" - " + ((string)r.Cells[3].Value)); 111 jobIdsToDelete.Add(Guid.Parse((string)r.Cells[8].Value)); 112 } 113 } 114 115 if(jobIdsToDelete.Any()) { 141 progress.Start("Refreshing jobs..."); 142 SetEnabledStateOfControls(); 143 var task = System.Threading.Tasks.Task.Factory.StartNew(RefreshJobsAsync); 144 145 task.ContinueWith((t) => { 146 progress.Finish(); 147 SetEnabledStateOfControls(); 148 }); 149 } 150 151 private void removeButton_Click(object sender, EventArgs e) { 152 var jobs = GetSelectedJobs(); 153 154 if (jobs.Any()) { 116 155 var result = MessageBox.Show("Do you really want to remove following job(s):\n\n" 117 + String.Join("\n", jobNamesToDelete),156 + String.Join("\n", jobs.Select(x => x.Job.Name)), 118 157 "HeuristicLab Hive Administrator", 119 158 MessageBoxButtons.YesNo, … … 121 160 122 161 if (result == DialogResult.Yes) { 123 await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions( 124 action: () => { 125 DeleteJobs(jobIdsToDelete); 126 }, 127 finallyCallback: () => { 128 matrixView.DataGridView.ClearSelection(); 129 removeButton.Enabled = false; 130 RefreshJobs(); 131 }); 132 } 133 } 134 } 135 162 progress.Start("Removing job(s)..."); 163 SetEnabledStateOfControls(); 164 var task = System.Threading.Tasks.Task.Factory.StartNew(RemoveJobsAsync, jobs); 165 166 task.ContinueWith((t) => { 167 RefreshJobs(); 168 progress.Finish(); 169 SetEnabledStateOfControls(); 170 }, TaskContinuationOptions.NotOnFaulted); 171 172 task.ContinueWith((t) => { 173 RefreshJobs(); 174 progress.Finish(); 175 SetEnabledStateOfControls(); 176 MessageBox.Show("An error occured removing the job(s).", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 177 }, TaskContinuationOptions.OnlyOnFaulted); 178 } 179 } 180 } 181 182 private void startButton_Click(object sender, EventArgs e) { 183 var jobs = GetSelectedJobs(); 184 185 if (jobs.Any()) { 186 var result = MessageBox.Show("Do you really want to resume following job(s):\n\n" 187 + String.Join("\n", jobs.Select(x => x.Job.Name)), 188 "HeuristicLab Hive Administrator", 189 MessageBoxButtons.YesNo, 190 MessageBoxIcon.Question); 191 192 if (result == DialogResult.Yes) { 193 progress.Start("Resuming job(s)..."); 194 SetEnabledStateOfControls(); 195 var task = System.Threading.Tasks.Task.Factory.StartNew(ResumeJobsAsync, jobs); 196 197 task.ContinueWith((t) => { 198 RefreshJobs(); 199 progress.Finish(); 200 SetEnabledStateOfControls(); 201 }, TaskContinuationOptions.NotOnFaulted); 202 203 task.ContinueWith((t) => { 204 RefreshJobs(); 205 progress.Finish(); 206 SetEnabledStateOfControls(); 207 MessageBox.Show("An error occured resuming the job(s).", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 208 }, TaskContinuationOptions.OnlyOnFaulted); 209 } 210 } 211 } 212 213 private void pauseButton_Click(object sender, EventArgs e) { 214 var jobs = GetSelectedJobs(); 215 216 if (jobs.Any()) { 217 var result = MessageBox.Show("Do you really want to pause following job(s):\n\n" 218 + String.Join("\n", jobs.Select(x => x.Job.Name)), 219 "HeuristicLab Hive Administrator", 220 MessageBoxButtons.YesNo, 221 MessageBoxIcon.Question); 222 223 if (result == DialogResult.Yes) { 224 progress.Start("Pausing job(s)..."); 225 SetEnabledStateOfControls(); 226 var task = System.Threading.Tasks.Task.Factory.StartNew(PauseJobsAsync, jobs); 227 228 task.ContinueWith((t) => { 229 RefreshJobs(); 230 progress.Finish(); 231 SetEnabledStateOfControls(); 232 }, TaskContinuationOptions.NotOnFaulted); 233 234 task.ContinueWith((t) => { 235 RefreshJobs(); 236 progress.Finish(); 237 SetEnabledStateOfControls(); 238 MessageBox.Show("An error occured pausing the job(s).", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 239 }, TaskContinuationOptions.OnlyOnFaulted); 240 } 241 } 242 } 243 244 private void stopButton_Click(object sender, EventArgs e) { 245 var jobs = GetSelectedJobs(); 246 247 if (jobs.Any()) { 248 var result = MessageBox.Show("Do you really want to stop following job(s):\n\n" 249 + String.Join("\n", jobs.Select(x => x.Job.Name)), 250 "HeuristicLab Hive Administrator", 251 MessageBoxButtons.YesNo, 252 MessageBoxIcon.Question); 253 254 if (result == DialogResult.Yes) { 255 progress.Start("Stopping job(s)..."); 256 SetEnabledStateOfControls(); 257 var task = System.Threading.Tasks.Task.Factory.StartNew(StopJobsAsync, jobs); 258 259 task.ContinueWith((t) => { 260 RefreshJobs(); 261 progress.Finish(); 262 SetEnabledStateOfControls(); 263 }, TaskContinuationOptions.NotOnFaulted); 264 265 task.ContinueWith((t) => { 266 RefreshJobs(); 267 progress.Finish(); 268 SetEnabledStateOfControls(); 269 MessageBox.Show("An error occured stopping the job(s).", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 270 }, TaskContinuationOptions.OnlyOnFaulted); 271 } 272 } 273 } 274 275 public event EventHandler IsProgressingChanged; 276 private void OnIsProgressingChanged() { 277 var handler = IsProgressingChanged; 278 if (handler != null) handler(this, EventArgs.Empty); 279 } 136 280 #endregion Event Handlers 137 281 138 282 #region Helpers 283 284 private IEnumerable<RefreshableJob> GetSelectedJobs() { 285 if (Content == null || matrixView.DataGridView.SelectedRows == null || matrixView.DataGridView.SelectedRows.Count == 0) 286 return Enumerable.Empty<RefreshableJob>() ; 287 288 var jobs = new List<RefreshableJob>(); 289 foreach (DataGridViewRow r in matrixView.DataGridView.SelectedRows) { 290 if (((string)r.Cells[0].Value) == JobState.Online.ToString()) { 291 jobs.Add(HiveAdminClient.Instance.Jobs[Content.Id].FirstOrDefault(x => x.Id == Guid.Parse((string) r.Cells[11].Value))); 292 } 293 } 294 295 return jobs; 296 } 297 139 298 private void RefreshJobs() { 140 299 HiveAdminClient.Instance.RefreshJobs(); 141 300 UpdateJobs(); 301 SetEnabledStateOfControls(); 142 302 } 143 303 … … 148 308 var jobs = HiveAdminClient.Instance.Jobs[Content.Id]; 149 309 var resources = HiveAdminClient.Instance.Resources; 150 string[,] values = new string[jobs.Count, 1 0];310 string[,] values = new string[jobs.Count, 13]; 151 311 152 312 for(int i = 0; i < jobs.Count; i++) { 153 var job = jobs.ElementAt(i); 154 155 values[i, 0] = job.State.ToString(); 156 values[i, 1] = job.DateCreated.ToString(); 157 values[i, 2] = job.OwnerUsername; 158 values[i, 3] = job.Name; 159 values[i, 4] = job.JobCount.ToString(); 160 values[i, 5] = job.CalculatingCount.ToString(); 161 values[i, 6] = job.FinishedCount.ToString(); 162 values[i, 7] = job.Description; 163 values[i, 8] = job.Id.ToString(); 164 values[i, 9] = job.OwnerUserId.ToString(); 313 var job = jobs.ElementAt(i); 314 values[i, 0] = job.Job.State.ToString(); 315 values[i, 1] = job.ExecutionState.ToString(); 316 values[i, 2] = job.ExecutionTime.ToString(); 317 values[i, 3] = job.Job.DateCreated.ToString(); 318 values[i, 4] = job.Job.OwnerUsername; 319 values[i, 5] = job.Job.Name; 320 values[i, 6] = job.Job.JobCount.ToString(); 321 values[i, 7] = (job.Job.JobCount - job.Job.CalculatingCount - job.Job.FinishedCount).ToString(); 322 values[i, 8] = job.Job.CalculatingCount.ToString(); 323 values[i, 9] = job.Job.FinishedCount.ToString(); 324 values[i, 10] = job.Job.Description; 325 values[i, 11] = job.Job.Id.ToString(); 326 values[i, 12] = job.Job.OwnerUserId.ToString(); 165 327 } 166 328 167 329 var matrix = new StringMatrix(values); 168 matrix.ColumnNames = new string[] { JOB_STATE, JOB_ DATECREATED, JOB_OWNER, JOB_NAME, JOB_TASKCOUNT, JOB_CALCULATINGTASKCOUNT, JOB_FINISHEDTASKCOUNT, JOB_DESCRIPTION, JOB_ID, JOB_OWNERID };330 matrix.ColumnNames = new string[] { JOB_STATE, JOB_EXECUTIONSTATE, JOB_EXECUTIONTIME, JOB_DATECREATED, JOB_OWNER, JOB_NAME, JOB_TASKCOUNT, JOB_WAITINGTASKCOUNT, JOB_CALCULATINGTASKCOUNT, JOB_FINISHEDTASKCOUNT, JOB_DESCRIPTION, JOB_ID, JOB_OWNERID }; 169 331 matrix.SortableView = true; 170 332 return matrix; … … 193 355 matrixView.DataGridView.Columns[1].MinimumWidth = 108; 194 356 } 195 } else { 196 refreshButton.Enabled = false; 197 removeButton.Enabled = false; 198 matrixView.Content = null; 199 } 200 } 201 } 202 203 private void DeleteJobs(List<Guid> jobIds) { 204 try { 205 HiveAdminClient.DeleteJobs(jobIds); 206 } catch (AnonymousUserException) { 207 ShowHiveInformationDialog(); 208 } 357 } 358 } 359 } 360 361 private void RefreshJobsAsync() { 362 HiveAdminClient.Instance.RefreshJobs(); 363 UpdateJobs(); 364 } 365 366 private void ResumeJobsAsync(object jobs) { 367 var jobList = (IEnumerable<RefreshableJob>)jobs; 368 foreach (var job in jobList) { 369 progress.Status = "Resuming job \"" + job.Job.Name + "\"..."; 370 HiveAdminClient.ResumeJob(job); 371 } 372 } 373 374 private void PauseJobsAsync(object jobs) { 375 var jobList = (IEnumerable<RefreshableJob>)jobs; 376 foreach (var job in jobList) { 377 progress.Status = "Pausing job \"" + job.Job.Name + "\"..."; 378 HiveAdminClient.PauseJob(job); 379 } 380 } 381 382 private void StopJobsAsync(object jobs) { 383 var jobList = (IEnumerable<RefreshableJob>) jobs; 384 foreach (var job in jobList) { 385 progress.Status = "Stopping job \"" + job.Job.Name + "\"..."; 386 HiveAdminClient.StopJob(job); 387 } 388 } 389 390 private void RemoveJobsAsync(object jobs) { 391 var jobList = (IEnumerable<RefreshableJob>)jobs; 392 progress.Start(); 393 foreach (var job in jobList) { 394 progress.Status = "Removing job \"" + job.Job.Name + "\"..."; 395 HiveAdminClient.RemoveJob(job); 396 } 397 progress.Finish(); 209 398 } 210 399 -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectPermissionsView.cs
r16139 r16235 78 78 detailsViewHost.Content = null; 79 79 } else { 80 UpdatePermissionList(); 81 detailsViewHost.ActiveView.Locked = true;82 }80 UpdatePermissionList(); 81 } 82 SetEnabledStateOfControls(); 83 83 } 84 84 … … 90 90 saveButton.Enabled = enabled; 91 91 treeView.Enabled = enabled; 92 93 if (detailsViewHost != null) { 94 detailsViewHost.Locked = true; 95 } 96 92 97 } 93 98 #endregion -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectResourcesView.cs
r16139 r16235 30 30 using HeuristicLab.MainForm; 31 31 using System.Collections; 32 using HeuristicLab.Common; 32 33 33 34 namespace HeuristicLab.Clients.Hive.Administrator.Views { … … 72 73 treeView.ImageList.Images.Add(VSImageLibrary.MonitorLarge); 73 74 treeView.ImageList.Images.Add(VSImageLibrary.NetworkCenterLarge); 75 76 HiveAdminClient.Instance.Refreshing += HiveAdminClient_Instance_Refreshing; 77 HiveAdminClient.Instance.Refreshed += HiveAdminClient_Instance_Refreshed; 74 78 } 75 79 76 80 #region Overrides 81 protected override void OnClosing(FormClosingEventArgs e) { 82 HiveAdminClient.Instance.Refreshed -= HiveAdminClient_Instance_Refreshed; 83 HiveAdminClient.Instance.Refreshing -= HiveAdminClient_Instance_Refreshing; 84 base.OnClosing(e); 85 } 86 77 87 protected override void OnContentChanged() { 78 88 base.OnContentChanged(); … … 86 96 UpdateAssignedResources(); 87 97 UpdateIncludedResources(); 88 var top = BuildResourceTree(); 89 detailsViewHost.Content = top; 90 detailsViewHost.Locked = true; 91 } 98 detailsViewHost.Content = BuildResourceTree(); 99 } 100 SetEnabledStateOfControls(); 92 101 } 93 102 … … 99 108 saveButton.Enabled = enabled; 100 109 treeView.Enabled = enabled; 110 111 if (detailsViewHost != null) { 112 detailsViewHost.Locked = true; 113 } 101 114 } 102 115 #endregion 103 116 104 117 #region Event Handlers 118 private void HiveAdminClient_Instance_Refreshing(object sender, EventArgs e) { 119 if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveAdminClient_Instance_Refreshing, sender, e); 120 else { 121 SetEnabledStateOfControls(); 122 } 123 } 124 125 private void HiveAdminClient_Instance_Refreshed(object sender, EventArgs e) { 126 if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveAdminClient_Instance_Refreshed, sender, e); 127 else { 128 OnContentChanged(); 129 } 130 } 131 105 132 private void ProjectResourcesView_Load(object sender, EventArgs e) { 106 133 … … 382 409 } 383 410 384 411 if (includedResources.Contains(newResource) && newIncludedResources.Contains(newResource)) { 385 412 newNode.Text += INCLUDED_TAG; 386 413 } else if (addedIncludes.Contains(newResource)) { … … 421 448 } 422 449 450 ExpandResourceNodesOfInterest(treeView.Nodes); 451 452 bool expandUngroupedGroupNode = false; 423 453 var ungroupedSlaves = subResources.OfType<Slave>().OrderBy(x => x.Name); 424 454 if(ungroupedSlaves.Any()) { … … 433 463 foreach (var slave in ungroupedSlaves) { 434 464 var slaveNode = new TreeNode(slave.Name) { Tag = slave }; 465 if (newAssignedResources.Contains(slave)) { 466 slaveNode.Checked = true; 467 expandUngroupedGroupNode = true; 468 } 469 470 if (!HiveRoles.CheckAdminUserPermissions()) { 471 slaveNode.ForeColor = SystemColors.GrayText; 472 slaveNode.Text += IMMUTABLE_TAG; 473 } else { 474 if (addedAssignments.Contains(slave)) { 475 slaveNode.BackColor = addedAssignmentColor; 476 slaveNode.ForeColor = SystemColors.ControlText; 477 slaveNode.Text += ADDED_ASSIGNMENT_TAG; 478 } else if (removedAssignments.Contains(slave)) { 479 slaveNode.BackColor = removedAssignmentColor; 480 slaveNode.ForeColor = SystemColors.ControlText; 481 slaveNode.Text += REMOVED_ASSIGNMENT_TAG; 482 expandUngroupedGroupNode = true; 483 } 484 } 435 485 ungroupedGroupNode.Nodes.Add(slaveNode); 436 486 } 487 488 if(expandUngroupedGroupNode) ungroupedGroupNode.Expand(); 437 489 treeView.Nodes.Add(ungroupedGroupNode); 438 490 } else if (ungroupedGroupNode != null) { … … 441 493 442 494 treeView.BeforeCheck += treeView_BeforeCheck; 443 treeView.AfterCheck += treeView_AfterCheck; 444 445 ExpandResourceNodesOfInterest(treeView.Nodes); 495 treeView.AfterCheck += treeView_AfterCheck; 446 496 447 497 return top; -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectView.cs
r16139 r16235 118 118 endDateTimePicker.Enabled = !indefiniteCheckBox.Checked; 119 119 } 120 SetEnabledStateOfControls(); 120 121 RegisterControlEvents(); 121 122 } … … 134 135 135 136 if (Content != null) { 136 var parentProject = HiveAdminClient.Instance.GetAvailableProjectAncestors(Content.Id).LastOrDefault(); 137 if (parentProject == null || parentProject.EndDate.HasValue) { 137 //var parentProject = HiveAdminClient.Instance.GetAvailableProjectAncestors(Content.Id).LastOrDefault(); 138 var parentProject = HiveAdminClient.Instance.Projects.FirstOrDefault(x => x.Id == Content.ParentProjectId); 139 if ((!IsAdmin() && (parentProject == null || parentProject.EndDate.HasValue)) 140 || (IsAdmin() && parentProject != null && parentProject.EndDate.HasValue)) { 138 141 indefiniteCheckBox.Enabled = false; 139 142 } 140 143 141 if ( !IsAdmin() && !HiveAdminClient.Instance.CheckOwnershipOfParentProject(Content, UserInformation.Instance.User.Id)) {144 if (Content.Id != Guid.Empty && !IsAdmin() && !HiveAdminClient.Instance.CheckOwnershipOfParentProject(Content, UserInformation.Instance.User.Id)) { 142 145 ownerComboBox.Enabled = false; 143 146 startDateTimePicker.Enabled = false; -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs
r16139 r16235 43 43 private const string NOT_STORED_TAG = "*"; // " [not stored]"; 44 44 private const string CHANGES_NOT_STORED_TAG = "*"; // " [changes not stored]"; 45 private const string INACTIVE_TAG = " [inactive]"; 45 46 46 47 private readonly Color selectedBackColor = Color.DodgerBlue; … … 106 107 BuildProjectTree(Content); 107 108 } 109 SetEnabledStateOfControls(); 108 110 } 109 111 110 112 protected override void SetEnabledStateOfControls() { 111 base.SetEnabledStateOfControls(); 112 bool selectedProjectExists = selectedProject != null && selectedProject.Id != Guid.Empty && Content.Contains(selectedProject); 113 bool projectIsNew = selectedProject != null && selectedProject.Id == Guid.Empty; 114 bool locked = Content == null || selectedProject == null || Locked || ReadOnly; 115 bool parentOwner = HiveAdminClient.Instance.CheckOwnershipOfParentProject(selectedProject, UserInformation.Instance.User.Id); 116 bool saveLocked = locked || (!IsAdmin() && selectedProject.OwnerUserId != UserInformation.Instance.User.Id && !parentOwner); 117 bool addLocked = saveLocked || projectIsNew || selectedProject.Id == Guid.Empty; 118 bool deleteLocked = locked || (!IsAdmin() && !parentOwner) || Content.Where(x => x.ParentProjectId == selectedProject.Id).Any(); 119 120 var now = DateTime.Now; 121 if (!addLocked && (now < selectedProject.StartDate || now > selectedProject.EndDate)) addLocked = true; 113 base.SetEnabledStateOfControls(); 114 115 bool locked = Content == null || Locked || ReadOnly; 116 bool parentOwner = selectedProject != null && HiveAdminClient.Instance.CheckOwnershipOfParentProject(selectedProject, UserInformation.Instance.User.Id); 117 bool selectedProjectDisabled = selectedProject == null 118 || selectedProject != null && selectedProject.Id == Guid.Empty; 119 120 bool selectedProjectHasJobs = 121 !selectedProjectDisabled && HiveAdminClient.Instance.Jobs.ContainsKey(selectedProject.Id) 122 && HiveAdminClient.Instance.Jobs[selectedProject.Id] != null 123 && HiveAdminClient.Instance.Jobs[selectedProject.Id].Any(); 124 125 bool addLocked = locked 126 || (selectedProject == null && !IsAdmin()) 127 || (selectedProject != null && selectedProject.Id == Guid.Empty) 128 || (selectedProject != null && !IsAdmin() && !parentOwner && selectedProject.OwnerUserId != UserInformation.Instance.User.Id) 129 || (selectedProject != null && (DateTime.Now < selectedProject.StartDate || DateTime.Now > selectedProject.EndDate)); 130 131 bool deleteLocked = locked 132 || !Content.Any() 133 || selectedProject == null 134 || Content.Any(x => x.ParentProjectId == selectedProject.Id) 135 || selectedProjectHasJobs 136 || (!IsAdmin() && !parentOwner); 137 138 bool saveLocked = locked 139 || !Content.Any() 140 || selectedProject == null 141 || (!IsAdmin() && !parentOwner && selectedProject.OwnerUserId != UserInformation.Instance.User.Id); 142 122 143 123 144 addButton.Enabled = !addLocked; 124 145 removeButton.Enabled = !deleteLocked; 125 146 saveProjectButton.Enabled = !saveLocked; 147 126 148 projectView.Enabled = !locked; 127 projectPermissionsView.Enabled = !locked ;128 projectResourcesView.Enabled = !locked ;129 projectJobsView.Enabled = !locked ;149 projectPermissionsView.Enabled = !locked && !selectedProjectDisabled; 150 projectResourcesView.Enabled = !locked && !selectedProjectDisabled; 151 projectJobsView.Enabled = !locked && !selectedProjectDisabled; 130 152 131 153 projectView.Locked = locked; 132 projectPermissionsView.Locked = locked ;133 projectResourcesView.Locked = locked ;134 projectJobsView.Locked = locked ;154 projectPermissionsView.Locked = locked || selectedProjectDisabled; 155 projectResourcesView.Locked = locked || selectedProjectDisabled; 156 projectJobsView.Locked = locked || selectedProjectDisabled; 135 157 } 136 158 #endregion … … 254 276 } 255 277 256 // double check of ChangeSelectedProject(..):257 // if the user is no admin nor owner of a parent project258 if (!IsAdmin() && !HiveAdminClient.Instance.CheckOwnershipOfParentProject(selectedProject, UserInformation.Instance.User.Id)) {259 MessageBox.Show(260 "Only admins and owners of parent projects are allowed to delete this project.",261 "HeuristicLab Hive Administrator",262 MessageBoxButtons.OK,263 MessageBoxIcon.Error);264 return;265 }266 267 268 if (Content.Any(x => x.ParentProjectId == selectedProject.Id)269 || HiveAdminClient.Instance.ProjectDescendants[selectedProject.Id].Any()) {270 MessageBox.Show(271 "Only empty projects can be deleted.",272 "HeuristicLab Hive Administrator",273 MessageBoxButtons.OK,274 MessageBoxIcon.Error);275 return;276 }277 278 if (HiveAdminClient.Instance.Jobs.ContainsKey(selectedProject.Id)279 && HiveAdminClient.Instance.Jobs[selectedProject.Id] != null280 && HiveAdminClient.Instance.Jobs[selectedProject.Id].Any()) {281 MessageBox.Show(282 "There are " + HiveAdminClient.Instance.Jobs[selectedProject.Id].Count + " job(s) using this project and/or child-projects. It is necessary to delete them before the project.",283 "HeuristicLab Hive Administrator",284 MessageBoxButtons.OK,285 MessageBoxIcon.Error);286 return;287 }288 289 278 var result = MessageBox.Show( 290 279 "Do you really want to delete " + selectedProject.Name + "?", … … 297 286 action: () => { 298 287 RemoveProject(selectedProject); 299 },300 finallyCallback: () => {301 removeButton.Enabled = true;302 288 }); 303 } else { 304 removeButton.Enabled = true; 305 } 289 } 290 SetEnabledStateOfControls(); 306 291 } 307 292 … … 492 477 if (HiveAdminClient.Instance.DisabledParentProjects.Select(x => x.Id).Contains(p.Id)) { 493 478 n.ForeColor = grayTextColor; 494 } else if (p.Id == Guid.Empty) { 495 n.Text += NOT_STORED_TAG; 496 } else if (p.Modified) { 497 n.Text += CHANGES_NOT_STORED_TAG; 479 } else { 480 if (p.Id == Guid.Empty) { 481 n.Text += NOT_STORED_TAG; 482 } else if (p.Modified) { 483 n.Text += CHANGES_NOT_STORED_TAG; 484 } 485 486 if (!IsActive(p)) { 487 n.ForeColor = grayTextColor; 488 n.Text += INACTIVE_TAG; 489 } 498 490 } 499 491 } … … 540 532 try { 541 533 if (project.Id != Guid.Empty) { 542 var projectsToSave = Content.Where(x => x.Id == Guid.Empty || x.Modified);543 foreach (var p in projectsToSave)544 p.Store();545 546 534 SelectedProject = HiveAdminClient.Instance.GetAvailableProjectAncestors(project.Id).LastOrDefault(); 547 535 HiveAdminClient.Delete(project); 548 536 UpdateProjects(); 549 } else { 537 } else { 538 SelectedProject = Content.FirstOrDefault(x => x.Id == project.ParentProjectId); 550 539 Content.Remove(project); 551 540 } … … 553 542 ShowHiveInformationDialog(); 554 543 } 544 } 545 546 private bool IsActive(Project project) { 547 return DateTime.Now >= project.StartDate 548 && (project.EndDate == null 549 || DateTime.Now < project.EndDate.Value); 555 550 } 556 551 -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.Designer.cs
r16139 r16235 164 164 this.treeView.DragOver += new System.Windows.Forms.DragEventHandler(this.treeSlaveGroup_DragEnterOver); 165 165 this.treeView.BeforeCheck += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeSlaveGroup_BeforeCheck); 166 this.treeView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeSlaveGroup_AfterCheck); 166 167 // 167 168 // tabSlaveGroup -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs
r16139 r16235 125 125 126 126 HashSet<Guid> descendantResources = null; 127 bool selectedRDeleteLocked = selectedResource == null 128 || (selectedResource.Id != Guid.Empty && (!HiveAdminClient.Instance.ResourceDescendants.TryGetValue(selectedResource.Id, out descendantResources) || descendantResources.Any())); 129 130 var nodes = GetCheckedNodes(treeView.Nodes).ToList(); 131 var checkedResources = nodes.Select(x => x.Tag).OfType<Resource>().ToList(); 132 bool checkedRDeleteLocked = false; 133 for (int i = 0; !checkedRDeleteLocked && i < checkedResources.Count; i++) { 134 if (checkedResources[i].Id != Guid.Empty && 135 (!HiveAdminClient.Instance.ResourceDescendants.TryGetValue(checkedResources[i].Id, out descendantResources) || 136 descendantResources.Any())) 137 checkedRDeleteLocked = true; 138 } 127 139 128 140 bool deleteLocked = locked 129 || !IsAdmin()130 || !Content.Any()131 || selectedResource == null132 || (selectedResource.Id != Guid.Empty && (!HiveAdminClient.Instance.ResourceDescendants.TryGetValue(selectedResource.Id, out descendantResources) || descendantResources.Any()));141 || !IsAdmin() 142 || !Content.Any() 143 || checkedResources.Any() && checkedRDeleteLocked 144 || !checkedResources.Any() && selectedRDeleteLocked; 133 145 134 146 bool saveLocked = locked … … 235 247 } 236 248 237 private async void btnRemoveGroup_Click(object sender, EventArgs e) { 238 if (selectedResource == null) return; 249 private async void btnRemoveGroup_Click(object sender, EventArgs e) { 250 var nodes = GetCheckedNodes(treeView.Nodes).ToList(); 251 var checkedResources = nodes.Select(x => x.Tag).OfType<Resource>().ToList(); 252 if (selectedResource == null && !checkedResources.Any()) return; 239 253 240 254 lock (locker) { … … 243 257 } 244 258 245 var result = MessageBox.Show( 246 "Do you really want to delete " + selectedResource.Name + "?", 247 "HeuristicLab Hive Administrator", 248 MessageBoxButtons.YesNo, 249 MessageBoxIcon.Question); 250 if (result == DialogResult.Yes) { 251 await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions( 252 action: () => { 253 RemoveResource(selectedResource); 254 }); 255 256 OnContentChanged(); 257 SetEnabledStateOfControls(); 258 } 259 if (checkedResources.Count > 0) { 260 var result = MessageBox.Show( 261 "Do you really want to delete all " + checkedResources.Count + " checked resources?", 262 "HeuristicLab Hive Administrator", 263 MessageBoxButtons.YesNo, 264 MessageBoxIcon.Question); 265 if (result == DialogResult.Yes) { 266 await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions( 267 action: () => { 268 RemoveResource(checkedResources); 269 }); 270 } 271 } else { 272 var res = checkedResources.Any() ? checkedResources.First() : selectedResource; 273 var result = MessageBox.Show( 274 "Do you really want to delete the selected resource " + res.Name + "?", 275 "HeuristicLab Hive Administrator", 276 MessageBoxButtons.YesNo, 277 MessageBoxIcon.Question); 278 if (result == DialogResult.Yes) { 279 await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions( 280 action: () => { 281 RemoveResource(res); 282 }); 283 } 284 } 285 286 OnContentChanged(); 287 SetEnabledStateOfControls(); 259 288 } 260 289 … … 289 318 290 319 private void treeSlaveGroup_BeforeCheck(object sender, TreeViewCancelEventArgs e) { 291 if ( e.Node == ungroupedGroupNode) {320 if (!IsAdmin() || e.Node == ungroupedGroupNode) { 292 321 e.Cancel = true; 293 322 } else { … … 297 326 } 298 327 } 328 } 329 330 private void treeSlaveGroup_AfterCheck(object sender, TreeViewEventArgs e) { 331 SetEnabledStateOfControls(); 299 332 } 300 333 … … 535 568 if (resource.Id != Guid.Empty) { 536 569 SelectedResource = HiveAdminClient.Instance.GetAvailableResourceAncestors(resource.Id).LastOrDefault(); 537 HiveAdminClient.Delete(resource); 570 571 // deal with all new, but not yet saved resources 572 var newResources = Content.Where(x => x.ParentResourceId == resource.Id).ToList(); 573 if (newResources.Any(x => x.Id != Guid.Empty)) return; 574 foreach (var nr in newResources) Content.Remove(nr); 575 576 HiveAdminClient.Delete(resource); 538 577 UpdateResources(); 539 578 } else { 540 SelectedResource = null;579 SelectedResource = Content.FirstOrDefault(x => x.Id == resource.ParentResourceId); 541 580 Content.Remove(resource); 542 581 } 582 } catch (AnonymousUserException) { 583 ShowHiveInformationDialog(); 584 } 585 } 586 587 private void RemoveResource(IEnumerable<Resource> resources) { 588 if (resources == null || !resources.Any()) return; 589 590 var ids = resources.Select(x => x.Id).ToList(); 591 try { 592 bool update = false; 593 foreach (var r in resources) { 594 if (r.Id != Guid.Empty) { 595 if(r.Id == SelectedResource.Id) 596 SelectedResource = HiveAdminClient.Instance.GetAvailableResourceAncestors(r.Id).LastOrDefault(); 597 598 // deal with all new, but not yet saved resources 599 var newResources = Content.Where(x => x.ParentResourceId == r.Id).ToList(); 600 if (newResources.Any(x => x.Id != Guid.Empty)) return; 601 foreach (var nr in newResources) Content.Remove(nr); 602 603 HiveAdminClient.Delete(r); 604 update = true; 605 } else { 606 if (r.Id == SelectedResource.Id) 607 SelectedResource = Content.FirstOrDefault(x => x.Id == r.ParentResourceId); 608 Content.Remove(r); 609 } 610 } 611 if (update) UpdateResources(); 543 612 } catch (AnonymousUserException) { 544 613 ShowHiveInformationDialog(); … … 678 747 private Dictionary<Guid, HashSet<Resource>> GetResourceDescendants() { 679 748 var resourceDescendants = new Dictionary<Guid, HashSet<Resource>>(); 749 //var resources = Content.Where(x => x.Id != Guid.Empty).Union(HiveAdminClient.Instance.DisabledParentResources).ToList(); 680 750 var resources = Content.Union(HiveAdminClient.Instance.DisabledParentResources).ToList(); 681 751 682 foreach (var r in resources) resourceDescendants.Add(r.Id, new HashSet<Resource>()); 752 foreach (var r in resources) { 753 if(!resourceDescendants.ContainsKey(r.Id)) 754 resourceDescendants.Add(r.Id, new HashSet<Resource>()); 755 } 683 756 foreach (var r in resources) { 684 757 var parentResourceId = r.ParentResourceId; -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.cs
r16139 r16235 227 227 base.SetEnabledStateOfControls(); 228 228 bool enabled = Content != null && !Locked; 229 dtpFrom.Enabled = enabled; 230 dtpTo.Enabled = enabled; 231 chbade.Enabled = enabled; 229 232 btCreate.Enabled = enabled; 230 btbDelete.Enabled = enabled; 233 btbDelete.Enabled = enabled; 234 btnRecurrence.Enabled = enabled; 231 235 btnClearCal.Enabled = enabled; 232 btnRecurrence.Enabled = enabled;233 236 btnSaveCal.Enabled = enabled; 234 237 }
Note: See TracChangeset
for help on using the changeset viewer.