- Timestamp:
- 10/04/17 13:56:38 (7 years ago)
- Location:
- branches/HiveProjectManagement
- Files:
-
- 6 added
- 21 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveProjectManagement/HeuristicLab.Clients.Access/3.3/HeuristicLab.Clients.Access-3.3.csproj
r11623 r15401 106 106 <Compile Include="ClientInformation.cs" /> 107 107 <Compile Include="ClientInformationUtils.cs" /> 108 <Compile Include="HiveRoles.cs" /> 108 109 <Compile Include="Plugin.cs" /> 109 110 <Compile Include="Properties\AssemblyInfo.cs" /> -
branches/HiveProjectManagement/HeuristicLab.Clients.Access/3.3/HiveRoles.cs
r15392 r15401 21 21 22 22 using System.Linq; 23 using HeuristicLab.Clients.Access;24 23 25 namespace HeuristicLab.Clients. Hive.Administrator{24 namespace HeuristicLab.Clients.Access { 26 25 public static class HiveRoles { 27 26 public const string Administrator = "Hive Administrator"; … … 30 29 31 30 public static bool CheckAdminUserPermissions() { 32 return UserInformation.Instance.UserExists && UserInformation.Instance.User.Roles.Any(x => x.Name == HiveRoles.Administrator); 31 return UserInformation.Instance.UserExists && UserInformation.Instance.User.Roles.Any(x => x.Name == Administrator); 32 } 33 34 public static bool CheckHiveUserPermissions() { 35 return UserInformation.Instance.UserExists && UserInformation.Instance.User.Roles.Any(x => x.Name == User); 33 36 } 34 37 } -
branches/HiveProjectManagement/HeuristicLab.Clients.Common/3.3/HeuristicLab.Clients.Common-3.3.csproj
r11623 r15401 139 139 <DependentUpon>Settings.settings</DependentUpon> 140 140 </Compile> 141 <Compile Include="SecurityExceptionUtil.cs" /> 141 142 <None Include="app.config" /> 142 143 <None Include="Properties\AssemblyInfo.cs.frame" /> -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/HeuristicLab.Clients.Hive.Administrator-3.3.csproj
r14125 r15401 110 110 </ItemGroup> 111 111 <ItemGroup> 112 <Compile Include="HiveRoles.cs" />113 112 <Compile Include="Views\DowntimeTypeDialog.cs"> 114 113 <SubType>Form</SubType> … … 133 132 </Compile> 134 133 <Compile Include="MenuItems\AdministratorMenuItem.cs" /> 134 <Compile Include="Views\ProjectsView.cs"> 135 <SubType>UserControl</SubType> 136 </Compile> 137 <Compile Include="Views\ProjectsView.Designer.cs"> 138 <DependentUpon>ProjectsView.cs</DependentUpon> 139 </Compile> 140 <Compile Include="Views\ProjectView.cs"> 141 <SubType>UserControl</SubType> 142 </Compile> 143 <Compile Include="Views\ProjectView.Designer.cs"> 144 <DependentUpon>ProjectView.cs</DependentUpon> 145 </Compile> 135 146 <Compile Include="Views\Recurrence.cs"> 136 147 <SubType>Form</SubType> -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/MenuItems/AdministratorMenuItem.cs
r14185 r15401 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 using HeuristicLab.Clients.Hive; 24 using System.Windows.Forms; 25 using HeuristicLab.Clients.Access; 24 26 using HeuristicLab.MainForm; 27 using HeuristicLab.Optimizer; 25 28 26 namespace HeuristicLab. Optimizer.MenuItems{27 public class AdministratorMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider {29 namespace HeuristicLab.Clients.Hive.Administrator { 30 public class AdministratorMenuItem : MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider { 28 31 public override string Name { 29 32 get { return "&Administrator"; } 30 33 } 34 31 35 public override IEnumerable<string> Structure { 32 36 get { return new string[] { "&Services", "&Hive" }; } 33 37 } 38 34 39 public override void Execute() { 35 MainFormManager.MainForm.ShowContent(HiveAdminClient.Instance); 40 if (HiveRoles.CheckAdminUserPermissions()) { 41 MainFormManager.MainForm.ShowContent(HiveAdminClient.Instance); 42 } else if (!UserInformation.Instance.UserExists) { 43 MessageBox.Show( 44 "Couldn't fetch user information from the server." + Environment.NewLine + 45 "Please verify that you have an existing user and that your user name and password is correct.", 46 "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 47 } else { 48 MessageBox.Show( 49 "You do not seem to have the permissions to use the Hive Administrator." + Environment.NewLine + 50 "If that's not the case or you have any questions please write an email to support@heuristiclab.com", 51 "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 52 } 36 53 } 54 37 55 public override int Position { 38 get { return 10000; } 56 get { return 8000; } 57 } 58 59 public override Keys ShortCutKeys { 60 get { return Keys.Control | Keys.Shift | Keys.H; } 39 61 } 40 62 } -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/HiveAdministratorView.Designer.cs
r14185 r15401 30 30 this.tabAdmin = new System.Windows.Forms.TabControl(); 31 31 this.tabSlaves = new System.Windows.Forms.TabPage(); 32 this.resourcesView = new HeuristicLab.Clients.Hive.Administrator.Views.ResourcesView(); 33 this.tabPage1 = new System.Windows.Forms.TabPage(); 32 34 this.imageListUsers = new System.Windows.Forms.ImageList(this.components); 33 this. resourcesView = new HeuristicLab.Clients.Hive.Administrator.Views.ResourcesView();35 this.projectsView = new HeuristicLab.Clients.Hive.Administrator.Views.ProjectsView(); 34 36 this.tabAdmin.SuspendLayout(); 35 37 this.tabSlaves.SuspendLayout(); 38 this.tabPage1.SuspendLayout(); 36 39 this.SuspendLayout(); 37 40 // 38 41 // tabAdmin 39 42 // 40 this.tabAdmin.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 41 | System.Windows.Forms.AnchorStyles.Left)42 43 this.tabAdmin.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 44 | System.Windows.Forms.AnchorStyles.Left) 45 | System.Windows.Forms.AnchorStyles.Right))); 43 46 this.tabAdmin.Controls.Add(this.tabSlaves); 47 this.tabAdmin.Controls.Add(this.tabPage1); 44 48 this.tabAdmin.Location = new System.Drawing.Point(3, 0); 45 49 this.tabAdmin.Name = "tabAdmin"; … … 59 63 this.tabSlaves.UseVisualStyleBackColor = true; 60 64 // 61 // imageListUsers62 //63 this.imageListUsers.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;64 this.imageListUsers.ImageSize = new System.Drawing.Size(16, 16);65 this.imageListUsers.TransparentColor = System.Drawing.Color.Transparent;66 //67 65 // resourcesView 68 66 // 69 this.resourcesView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 70 | System.Windows.Forms.AnchorStyles.Left)71 67 this.resourcesView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 68 | System.Windows.Forms.AnchorStyles.Left) 69 | System.Windows.Forms.AnchorStyles.Right))); 72 70 this.resourcesView.Caption = "ResourcesView"; 73 71 this.resourcesView.Content = null; … … 78 76 this.resourcesView.TabIndex = 0; 79 77 // 80 // HiveAdministrationView78 // tabPage1 81 79 // 82 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 80 this.tabPage1.Controls.Add(this.projectsView); 81 this.tabPage1.Location = new System.Drawing.Point(4, 22); 82 this.tabPage1.Name = "tabPage1"; 83 this.tabPage1.Size = new System.Drawing.Size(734, 520); 84 this.tabPage1.TabIndex = 4; 85 this.tabPage1.Text = "Projects"; 86 this.tabPage1.UseVisualStyleBackColor = true; 87 // 88 // imageListUsers 89 // 90 this.imageListUsers.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit; 91 this.imageListUsers.ImageSize = new System.Drawing.Size(16, 16); 92 this.imageListUsers.TransparentColor = System.Drawing.Color.Transparent; 93 // 94 // projectsView 95 // 96 this.projectsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 97 | System.Windows.Forms.AnchorStyles.Left) 98 | System.Windows.Forms.AnchorStyles.Right))); 99 this.projectsView.Caption = "Resources View"; 100 this.projectsView.Content = null; 101 this.projectsView.Location = new System.Drawing.Point(0, 0); 102 this.projectsView.Name = "projectsView"; 103 this.projectsView.ReadOnly = false; 104 this.projectsView.Size = new System.Drawing.Size(734, 520); 105 this.projectsView.TabIndex = 0; 106 // 107 // HiveAdministratorView 108 // 83 109 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 84 110 this.Controls.Add(this.tabAdmin); 85 this.Name = "HiveAdministrat ionView";111 this.Name = "HiveAdministratorView"; 86 112 this.Size = new System.Drawing.Size(745, 546); 87 113 this.tabAdmin.ResumeLayout(false); 88 114 this.tabSlaves.ResumeLayout(false); 115 this.tabPage1.ResumeLayout(false); 89 116 this.ResumeLayout(false); 90 117 … … 96 123 private System.Windows.Forms.ImageList imageListUsers; 97 124 private System.Windows.Forms.TabPage tabSlaves; 98 125 private System.Windows.Forms.TabPage tabPage1; 126 private ProjectsView projectsView; 99 127 } 100 128 } -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.Designer.cs
r14185 r15401 37 37 components.Dispose(); 38 38 } 39 HiveAdminClient.Instance.Refreshing -= new EventHandler( Instance_Refreshing);40 HiveAdminClient.Instance.Refreshed -= new EventHandler( Instance_Refreshed);41 42 Access.AccessClient.Instance.Refreshing -= new EventHandler(AccessClient_ Refreshing);43 Access.AccessClient.Instance.Refreshed -= new EventHandler(AccessClient_ Refreshed);39 HiveAdminClient.Instance.Refreshing -= new EventHandler(HiveAdminClient_Instance_Refreshing); 40 HiveAdminClient.Instance.Refreshed -= new EventHandler(HiveAdminClient_Instance_Refreshed); 41 42 Access.AccessClient.Instance.Refreshing -= new EventHandler(AccessClient_Instance_Refreshing); 43 Access.AccessClient.Instance.Refreshed -= new EventHandler(AccessClient_Instance_Refreshed); 44 44 base.Dispose(disposing); 45 45 } … … 53 53 private void InitializeComponent() { 54 54 this.components = new System.ComponentModel.Container(); 55 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ResourcesView)); 55 56 this.imageListSlaveGroups = new System.Windows.Forms.ImageList(this.components); 56 57 this.splitSlaves = new System.Windows.Forms.SplitContainer(); 57 58 this.btnRefresh = new System.Windows.Forms.Button(); 58 this.progressBar = new System.Windows.Forms.ProgressBar();59 59 this.btnSave = new System.Windows.Forms.Button(); 60 60 this.btnRemoveGroup = new System.Windows.Forms.Button(); 61 61 this.btnAddGroup = new System.Windows.Forms.Button(); 62 this.btnPermissionsSave = new System.Windows.Forms.Button();63 62 this.treeSlaveGroup = new System.Windows.Forms.TreeView(); 64 63 this.tabSlaveGroup = new System.Windows.Forms.TabControl(); … … 68 67 this.scheduleView = new HeuristicLab.Clients.Hive.Administrator.Views.ScheduleView(); 69 68 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 70 this.tabPermissions = new System.Windows.Forms.TabPage();71 this.permissionView = new HeuristicLab.Clients.Access.Views.RefreshableLightweightUserView();72 69 ((System.ComponentModel.ISupportInitialize)(this.splitSlaves)).BeginInit(); 73 70 this.splitSlaves.Panel1.SuspendLayout(); … … 77 74 this.tabDetails.SuspendLayout(); 78 75 this.tabSchedule.SuspendLayout(); 79 this.tabPermissions.SuspendLayout();80 76 this.SuspendLayout(); 81 77 // … … 88 84 // splitSlaves 89 85 // 90 this.splitSlaves.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 91 | System.Windows.Forms.AnchorStyles.Left) 86 this.splitSlaves.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 87 | System.Windows.Forms.AnchorStyles.Left) 92 88 | System.Windows.Forms.AnchorStyles.Right))); 93 89 this.splitSlaves.Location = new System.Drawing.Point(3, 3); … … 97 93 // 98 94 this.splitSlaves.Panel1.Controls.Add(this.btnRefresh); 99 this.splitSlaves.Panel1.Controls.Add(this.progressBar);100 95 this.splitSlaves.Panel1.Controls.Add(this.btnSave); 101 96 this.splitSlaves.Panel1.Controls.Add(this.btnRemoveGroup); … … 121 116 this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click); 122 117 // 123 // progressBar124 //125 this.progressBar.Location = new System.Drawing.Point(123, 4);126 this.progressBar.Name = "progressBar";127 this.progressBar.Size = new System.Drawing.Size(123, 23);128 this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;129 this.progressBar.TabIndex = 7;130 //131 118 // btnSave 132 119 // … … 165 152 // 166 153 this.treeSlaveGroup.AllowDrop = true; 167 this.treeSlaveGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 168 | System.Windows.Forms.AnchorStyles.Left) 154 this.treeSlaveGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 155 | System.Windows.Forms.AnchorStyles.Left) 169 156 | System.Windows.Forms.AnchorStyles.Right))); 170 157 this.treeSlaveGroup.ImageIndex = 0; … … 184 171 // tabSlaveGroup 185 172 // 186 this.tabSlaveGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 187 | System.Windows.Forms.AnchorStyles.Left) 173 this.tabSlaveGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 174 | System.Windows.Forms.AnchorStyles.Left) 188 175 | System.Windows.Forms.AnchorStyles.Right))); 189 176 this.tabSlaveGroup.Controls.Add(this.tabDetails); 190 177 this.tabSlaveGroup.Controls.Add(this.tabSchedule); 191 this.tabSlaveGroup.Controls.Add(this.tabPermissions);192 178 this.tabSlaveGroup.Location = new System.Drawing.Point(3, 3); 193 179 this.tabSlaveGroup.Name = "tabSlaveGroup"; … … 210 196 // slaveView 211 197 // 212 this.slaveView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 213 | System.Windows.Forms.AnchorStyles.Left) 198 this.slaveView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 199 | System.Windows.Forms.AnchorStyles.Left) 214 200 | System.Windows.Forms.AnchorStyles.Right))); 215 201 this.slaveView.Caption = "SlaveView"; … … 234 220 // scheduleView 235 221 // 236 this.scheduleView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 237 | System.Windows.Forms.AnchorStyles.Left) 222 this.scheduleView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 223 | System.Windows.Forms.AnchorStyles.Left) 238 224 | System.Windows.Forms.AnchorStyles.Right))); 239 225 this.scheduleView.Caption = "ScheduleView"; … … 244 230 this.scheduleView.Size = new System.Drawing.Size(565, 503); 245 231 this.scheduleView.TabIndex = 0; 246 //247 // tabPermissions248 //249 this.tabPermissions.Controls.Add(this.btnPermissionsSave);250 this.tabPermissions.Controls.Add(this.permissionView);251 this.tabPermissions.Location = new System.Drawing.Point(4, 22);252 this.tabPermissions.Name = "tabPermissions";253 this.tabPermissions.Padding = new System.Windows.Forms.Padding(3);254 this.tabPermissions.Size = new System.Drawing.Size(577, 515);255 this.tabPermissions.TabIndex = 2;256 this.tabPermissions.Text = "Permissions";257 this.tabPermissions.UseVisualStyleBackColor = true;258 //259 // btnPermissionsSave260 //261 this.btnPermissionsSave.Enabled = false;262 this.btnPermissionsSave.Image = HeuristicLab.Common.Resources.VSImageLibrary.PublishToWeb;263 this.btnPermissionsSave.Location = new System.Drawing.Point(39, 9);264 this.btnPermissionsSave.Name = "btnPermissionsSave";265 this.btnPermissionsSave.Size = new System.Drawing.Size(24, 24);266 this.btnPermissionsSave.TabIndex = 1;267 this.toolTip.SetToolTip(this.btnPermissionsSave, "Store slave and group sharing permissions on the server");268 this.btnPermissionsSave.UseVisualStyleBackColor = true;269 this.btnPermissionsSave.Click += new System.EventHandler(this.btnPermissionsSave_Click);270 //271 // permissionView272 //273 this.permissionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)274 | System.Windows.Forms.AnchorStyles.Left)275 | System.Windows.Forms.AnchorStyles.Right)));276 this.permissionView.Caption = "RefreshableLightweightUser View";277 this.permissionView.Content = null;278 this.permissionView.FetchSelectedUsers = null;279 this.permissionView.Location = new System.Drawing.Point(6, 6);280 this.permissionView.Name = "permissionView";281 this.permissionView.ReadOnly = false;282 this.permissionView.Size = new System.Drawing.Size(565, 503);283 this.permissionView.TabIndex = 0;284 232 // 285 233 // ResourcesView … … 297 245 this.tabDetails.ResumeLayout(false); 298 246 this.tabSchedule.ResumeLayout(false); 299 this.tabPermissions.ResumeLayout(false);300 247 this.ResumeLayout(false); 301 248 … … 315 262 private ScheduleView scheduleView; 316 263 private System.Windows.Forms.Button btnSave; 317 private System.Windows.Forms.ProgressBar progressBar;318 264 private System.Windows.Forms.Button btnRefresh; 319 265 private System.Windows.Forms.ToolTip toolTip; 320 private System.Windows.Forms.TabPage tabPermissions;321 private Access.Views.RefreshableLightweightUserView permissionView;322 private System.Windows.Forms.Button btnPermissionsSave;323 266 } 324 267 } -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs
r14185 r15401 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 6Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Co llections.Generic;23 using System.ComponentModel; 24 24 using System.Drawing; 25 25 using System.Linq; 26 using System.ServiceModel.Security;27 using System.Threading;28 using System.Threading.Tasks;29 26 using System.Windows.Forms; 30 27 using HeuristicLab.Clients.Access; 31 28 using HeuristicLab.Clients.Hive.Views; 29 using HeuristicLab.Common.Resources; 32 30 using HeuristicLab.Core; 33 31 using HeuristicLab.Core.Views; 34 32 using HeuristicLab.MainForm; 35 using TS = System.Threading.Tasks;36 33 37 34 namespace HeuristicLab.Clients.Hive.Administrator.Views { … … 39 36 [Content(typeof(IItemList<Resource>), false)] 40 37 public partial class ResourcesView : ItemView, IDisposable { 38 private const string UngroupedGroupName = "UNGROUPED"; 39 private const int slaveImageIndex = 0; 40 private const int slaveGroupImageIndex = 1; 41 42 private readonly Color ownedResourceColor = Color.LightGreen; 43 private readonly object locker = new object(); 44 private bool updatingResources = false; 45 private bool removingResources = false; 46 private bool savingResources = false; 47 41 48 public new IItemList<Resource> Content { 42 49 get { return (IItemList<Resource>)base.Content; } … … 44 51 } 45 52 46 public const string UngroupedGroupName = "UNGROUPED";47 private const int slaveImageIndex = 0;48 private const int slaveGroupImageIndex = 1;49 private readonly Color ownedResourceColor = Color.LightGreen;50 private TS.Task progressTask;51 private bool stopProgressTask;52 private bool currentlyAuthorized;53 54 55 53 public ResourcesView() { 56 54 InitializeComponent(); 57 treeSlaveGroup.ImageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.MonitorLarge); 58 treeSlaveGroup.ImageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.NetworkCenterLarge); 59 60 HiveAdminClient.Instance.Refreshing += new EventHandler(Instance_Refreshing); 61 HiveAdminClient.Instance.Refreshed += new EventHandler(Instance_Refreshed); 62 63 Access.AccessClient.Instance.Refreshing += new EventHandler(AccessClient_Refreshing); 64 Access.AccessClient.Instance.Refreshed += new EventHandler(AccessClient_Refreshed); 65 } 66 67 private void UpdateProgress() { 68 while (!stopProgressTask) { 69 int diff = (progressBar.Maximum - progressBar.Minimum) / 10; 70 71 if (progressBar.InvokeRequired) { 72 progressBar.Invoke(new Action(delegate() { progressBar.Value = (progressBar.Value + diff) % progressBar.Maximum; })); 73 } else { 74 progressBar.Value = (progressBar.Value + diff) % progressBar.Maximum; 75 } 76 77 //ok, this is not very clever... 78 Thread.Sleep(500); 79 } 80 if (progressBar.InvokeRequired) { 81 progressBar.Invoke(new Action(delegate() { progressBar.Value = progressBar.Minimum; })); 82 } else { 83 progressBar.Value = progressBar.Minimum; 84 } 85 } 86 87 void Instance_Refreshing(object sender, EventArgs e) { 88 stopProgressTask = false; 89 progressTask = new TS.Task(UpdateProgress); 90 progressTask.Start(); 91 SetEnabledStateOfControls(); 92 } 93 94 void Instance_Refreshed(object sender, EventArgs e) { 95 stopProgressTask = true; 96 SetEnabledStateOfControls(); 97 } 98 99 void AccessClient_Refreshing(object sender, EventArgs e) { 100 stopProgressTask = false; 101 progressTask = new TS.Task(UpdateProgress); 102 progressTask.Start(); 103 SetEnabledStateOfControls(); 104 btnPermissionsSave.Enabled = false; 105 } 106 107 void AccessClient_Refreshed(object sender, EventArgs e) { 108 stopProgressTask = true; 109 SetEnabledStateOfControls(); 110 } 111 112 #region Register Content Events 113 protected override void DeregisterContentEvents() { 114 Content.ItemsAdded -= new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<Resource>>(Content_ItemsAdded); 115 Content.ItemsRemoved -= new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<Resource>>(Content_ItemsRemoved); 116 base.DeregisterContentEvents(); 117 } 55 56 treeSlaveGroup.ImageList.Images.Add(VSImageLibrary.MonitorLarge); 57 treeSlaveGroup.ImageList.Images.Add(VSImageLibrary.NetworkCenterLarge); 58 59 HiveAdminClient.Instance.Refreshing += HiveAdminClient_Instance_Refreshing; 60 HiveAdminClient.Instance.Refreshed += HiveAdminClient_Instance_Refreshed; 61 AccessClient.Instance.Refreshing += AccessClient_Instance_Refreshing; 62 AccessClient.Instance.Refreshed += AccessClient_Instance_Refreshed; 63 } 64 65 #region Overrides 66 protected override void OnClosing(FormClosingEventArgs e) { 67 AccessClient.Instance.Refreshed -= AccessClient_Instance_Refreshed; 68 AccessClient.Instance.Refreshing -= AccessClient_Instance_Refreshing; 69 HiveAdminClient.Instance.Refreshed -= HiveAdminClient_Instance_Refreshed; 70 HiveAdminClient.Instance.Refreshing -= HiveAdminClient_Instance_Refreshing; 71 base.OnClosing(e); 72 } 73 118 74 protected override void RegisterContentEvents() { 119 75 base.RegisterContentEvents(); 120 Content.ItemsAdded += new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<Resource>>(Content_ItemsAdded); 121 Content.ItemsRemoved += new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<Resource>>(Content_ItemsRemoved); 122 } 123 #endregion 76 Content.ItemsAdded += Content_ItemsAdded; 77 Content.ItemsRemoved += Content_ItemsRemoved; 78 } 79 80 protected override void DeregisterContentEvents() { 81 Content.ItemsRemoved -= Content_ItemsRemoved; 82 Content.ItemsAdded -= Content_ItemsAdded; 83 base.DeregisterContentEvents(); 84 } 124 85 125 86 protected override void OnContentChanged() { … … 128 89 slaveView.Content = null; 129 90 scheduleView.Content = null; 130 permissionView.Content = null;131 permissionView.FetchSelectedUsers = null;132 91 treeSlaveGroup.Nodes.Clear(); 133 92 } else { 134 permissionView.Content = Access.AccessClient.Instance;135 93 treeSlaveGroup.Nodes.Clear(); 136 94 … … 145 103 ungrp.Tag = newGroup; 146 104 147 foreach (Resource g in Content ) {105 foreach (Resource g in Content.OrderBy(x => x.Name)) { 148 106 if (g.GetType() == typeof(SlaveGroup)) { 149 107 //root node … … 175 133 } 176 134 177 private void BuildSlaveGroupTree(Resource g, TreeNode tn) {178 foreach (Resource r in Content.Where(s => s.ParentResourceId != null && s.ParentResourceId == g.Id)) {179 TreeNode stn = new TreeNode(r.Name);180 if (r is Slave) {181 stn.ImageIndex = slaveImageIndex;182 } else if (r is SlaveGroup) {183 stn.ImageIndex = slaveGroupImageIndex;184 }185 stn.SelectedImageIndex = stn.ImageIndex;186 stn.Tag = r;187 if (r.OwnerUserId == Access.UserInformation.Instance.User.Id) stn.BackColor = ownedResourceColor;188 tn.Nodes.Add(stn);189 190 BuildSlaveGroupTree(r, stn);191 }192 }193 194 135 protected override void SetEnabledStateOfControls() { 195 136 base.SetEnabledStateOfControls(); 196 if (Content == null) { 197 btnAddGroup.Enabled = false; 198 btnRemoveGroup.Enabled = false; 199 btnSave.Enabled = false; 200 btnPermissionsSave.Enabled = false; 201 permissionView.Enabled = false; 202 scheduleView.SetEnabledStateOfSchedule(false); 203 btnPermissionsSave.Enabled = false; 204 permissionView.Enabled = false; 205 } else { 206 btnAddGroup.Enabled = true; 207 btnRemoveGroup.Enabled = true; 208 btnSave.Enabled = true; 209 scheduleView.SetEnabledStateOfSchedule(IsAuthorized(slaveView.Content)); 210 btnPermissionsSave.Enabled = permissionView.FetchSelectedUsers != null; 211 permissionView.Enabled = permissionView.FetchSelectedUsers != null; 212 } 213 } 214 215 private bool IsAuthorized(Resource resource) { 216 return resource != null 217 && resource.Name != UngroupedGroupName 218 && resource.Id != Guid.Empty 219 && UserInformation.Instance.UserExists 220 && (resource.OwnerUserId == UserInformation.Instance.User.Id || HiveRoles.CheckAdminUserPermissions()); 221 } 222 223 private void treeSlaveGroup_AfterSelect(object sender, TreeViewEventArgs e) { 224 if (e.Action != TreeViewAction.Unknown) { 225 Resource selectedResource = ((Resource)e.Node.Tag); 226 currentlyAuthorized = IsAuthorized(selectedResource); 227 if (currentlyAuthorized) { 228 permissionView.FetchSelectedUsers = new Func<List<Guid>>(() => { 229 return HiveServiceLocator.Instance.CallHiveService<List<ResourcePermission>>(service => { 230 return service.GetResourcePermissions(selectedResource.Id); 231 }).Select(x => x.GrantedUserId).ToList(); 232 }); 233 if (!tabSlaveGroup.TabPages.Contains(tabPermissions)) tabSlaveGroup.TabPages.Add(tabPermissions); 234 } else { 235 permissionView.FetchSelectedUsers = null; 236 btnPermissionsSave.Enabled = false; 237 if (selectedResource.Id == Guid.Empty) { 238 if (!tabSlaveGroup.TabPages.Contains(tabPermissions)) tabSlaveGroup.TabPages.Add(tabPermissions); 239 } else tabSlaveGroup.TabPages.Remove(tabPermissions); 240 } 241 242 if (slaveView.Content != null && slaveView.Content is SlaveGroup) { 243 slaveView.Content.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(SlaveViewContent_PropertyChanged); 244 } 245 246 slaveView.Content = selectedResource; 247 HiveAdminClient.Instance.DowntimeForResourceId = selectedResource.Id; 248 249 if (selectedResource is SlaveGroup) { 250 slaveView.Content.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(SlaveViewContent_PropertyChanged); 251 } 252 253 if (tabSlaveGroup.SelectedIndex == 1) { 254 UpdateScheduleAsync(); 255 } else if (tabSlaveGroup.SelectedIndex == 2) { 256 UpdatePermissionsAsync(); 257 } 258 } 259 } 260 261 void SlaveViewContent_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { 137 bool enabled = Content != null; 138 btnAddGroup.Enabled = enabled; 139 btnRemoveGroup.Enabled = enabled; 140 btnSave.Enabled = enabled; 141 scheduleView.SetEnabledStateOfSchedule(enabled && IsAuthorized(slaveView.Content)); 142 } 143 #endregion 144 145 #region Event Handlers 146 private void Content_ItemsAdded(object sender, Collections.CollectionItemsChangedEventArgs<Collections.IndexedItem<Resource>> e) { 147 OnContentChanged(); 148 } 149 150 private void Content_ItemsRemoved(object sender, Collections.CollectionItemsChangedEventArgs<Collections.IndexedItem<Resource>> e) { 151 OnContentChanged(); 152 } 153 154 private void SlaveViewContent_PropertyChanged(object sender, PropertyChangedEventArgs e) { 262 155 OnContentChanged(); 263 156 if (e.PropertyName == "HbInterval") { … … 266 159 } 267 160 268 private void UpdateChildHbIntervall(Resource resource) { 269 foreach (Resource r in Content.Where(x => x.ParentResourceId == resource.Id)) { 270 r.HbInterval = resource.HbInterval; 271 if (r is SlaveGroup) { 272 UpdateChildHbIntervall(r); 273 } 274 } 161 private void HiveAdminClient_Instance_Refreshing(object sender, EventArgs e) { 162 if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveAdminClient_Instance_Refreshing, sender, e); 163 else { 164 var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>(); 165 mainForm.AddOperationProgressToView(this, "Refreshing ..."); 166 SetEnabledStateOfControls(); 167 } 168 } 169 170 private void HiveAdminClient_Instance_Refreshed(object sender, EventArgs e) { 171 if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveAdminClient_Instance_Refreshed, sender, e); 172 else { 173 var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>(); 174 mainForm.RemoveOperationProgressFromView(this); 175 SetEnabledStateOfControls(); 176 } 177 } 178 179 private void AccessClient_Instance_Refreshing(object sender, EventArgs e) { 180 if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshing, sender, e); 181 else { 182 var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>(); 183 mainForm.AddOperationProgressToView(this, "Refreshing ..."); 184 SetEnabledStateOfControls(); 185 } 186 } 187 188 private void AccessClient_Instance_Refreshed(object sender, EventArgs e) { 189 if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshed, sender, e); 190 else { 191 var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>(); 192 mainForm.RemoveOperationProgressFromView(this); 193 SetEnabledStateOfControls(); 194 } 195 } 196 197 private async void ResourcesView_Load(object sender, EventArgs e) { 198 lock (locker) { 199 if (updatingResources) return; 200 updatingResources = true; 201 } 202 203 await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions( 204 action: () => UpdateResources(), 205 finallyCallback: () => updatingResources = false); 206 } 207 208 private async void btnRefresh_Click(object sender, EventArgs e) { 209 lock (locker) { 210 if (updatingResources) return; 211 updatingResources = true; 212 } 213 214 await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions( 215 action: () => UpdateResources(), 216 finallyCallback: () => updatingResources = false); 275 217 } 276 218 277 219 private void btnAddGroup_Click(object sender, EventArgs e) { 278 SlaveGroup newGroup = new SlaveGroup(); 279 newGroup.Name = "New Group"; 280 newGroup.OwnerUserId = UserInformation.Instance.User.Id; 281 Content.Add(newGroup); 282 } 283 284 void Content_ItemsRemoved(object sender, Collections.CollectionItemsChangedEventArgs<Collections.IndexedItem<Resource>> e) { 285 OnContentChanged(); 286 } 287 288 void Content_ItemsAdded(object sender, Collections.CollectionItemsChangedEventArgs<Collections.IndexedItem<Resource>> e) { 289 OnContentChanged(); 290 } 291 292 private void btnRemoveGroup_Click(object sender, EventArgs e) { 293 if (treeSlaveGroup.SelectedNode != null && treeSlaveGroup.SelectedNode.Tag != null) { 294 Resource res = (Resource)treeSlaveGroup.SelectedNode.Tag; 295 296 DialogResult diagRes = MessageBox.Show("Do you really want to delete " + res.Name + "?", "HeuristicLab Hive Administrator", MessageBoxButtons.YesNo, MessageBoxIcon.Question); 297 if (diagRes == DialogResult.Yes) { 298 if (res is Slave) { 299 Content.Remove(res); 300 HiveAdminClient.Delete(res); 301 } else if (res is SlaveGroup) { 302 //only delete empty groups 303 if (Content.Where(s => s.ParentResourceId == res.Id).Count() < 1) { 304 Content.Remove(res); 305 HiveAdminClient.Delete(res); 306 } else { 307 MessageBox.Show("Only empty groups can be deleted.", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 308 } 309 } 310 } 311 } 312 } 313 314 private void btnSave_Click(object sender, EventArgs e) { 315 foreach (Resource res in Content) { 316 if (res is SlaveGroup && res.Id == Guid.Empty) { 317 SlaveGroup slaveGroup = (SlaveGroup)res; 318 slaveGroup.Store(); 319 } else if (res.Id != Guid.Empty && res.Modified) { 320 res.Store(); 321 } 322 } 220 var group = new SlaveGroup { 221 Name = "New Group", 222 OwnerUserId = UserInformation.Instance.User.Id 223 }; 224 Content.Add(group); 225 } 226 227 private async void btnRemoveGroup_Click(object sender, EventArgs e) { 228 lock (locker) { 229 if (removingResources) return; 230 removingResources = true; 231 } 232 233 await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions( 234 action: () => RemoveResource(), 235 finallyCallback: () => removingResources = false); 236 } 237 238 private async void btnSave_Click(object sender, EventArgs e) { 239 lock (locker) { 240 if (savingResources) return; 241 savingResources = true; 242 } 243 244 await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions( 245 action: () => { 246 var resourcesToSave = Content.Where(x => x.Id == Guid.Empty || x.Modified); 247 foreach (var resource in resourcesToSave) 248 resource.Store(); 249 }, 250 finallyCallback: () => savingResources = false); 251 } 252 253 private async void treeSlaveGroup_AfterSelect(object sender, TreeViewEventArgs e) { 254 var selectedResource = (Resource)e.Node.Tag; 255 256 if (slaveView.Content != null && slaveView.Content is SlaveGroup) 257 slaveView.Content.PropertyChanged -= SlaveViewContent_PropertyChanged; 258 259 slaveView.Content = selectedResource; 260 261 if (selectedResource is SlaveGroup) 262 slaveView.Content.PropertyChanged += SlaveViewContent_PropertyChanged; 263 264 await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions( 265 action: () => UpdateSchedule()); 323 266 } 324 267 … … 386 329 } 387 330 388 private bool CheckParentsEqualsMovedNode(TreeNode dest, TreeNode movedNode) {389 TreeNode tmp = dest;390 391 while (tmp != null) {392 if (tmp == movedNode) {393 return true;394 }395 tmp = tmp.Parent;396 }397 return false;398 }399 400 331 private void treeSlaveGroup_ItemDrag(object sender, ItemDragEventArgs e) { 401 332 TreeNode sourceNode = (TreeNode)e.Item; … … 416 347 } 417 348 418 void ResetView() { 419 if (this.InvokeRequired) { 420 Invoke(new Action(ResetView)); 421 } else { 349 private void tabSlaveGroup_SelectedIndexChanged(object sender, EventArgs e) { 350 if (tabSlaveGroup.SelectedIndex == 1) { 351 UpdateSchedule(); 352 } 353 } 354 #endregion 355 356 #region Helpers 357 private void BuildSlaveGroupTree(Resource g, TreeNode tn) { 358 foreach (Resource r in Content.Where(s => s.ParentResourceId != null && s.ParentResourceId == g.Id).OrderBy(x => x.Name)) { 359 TreeNode stn = new TreeNode(r.Name); 360 if (r is Slave) { 361 stn.ImageIndex = slaveImageIndex; 362 } else if (r is SlaveGroup) { 363 stn.ImageIndex = slaveGroupImageIndex; 364 } 365 stn.SelectedImageIndex = stn.ImageIndex; 366 stn.Tag = r; 367 if (r.OwnerUserId == Access.UserInformation.Instance.User.Id) stn.BackColor = ownedResourceColor; 368 tn.Nodes.Add(stn); 369 370 BuildSlaveGroupTree(r, stn); 371 } 372 } 373 374 private void UpdateChildHbIntervall(Resource resource) { 375 foreach (Resource r in Content.Where(x => x.ParentResourceId == resource.Id)) { 376 r.HbInterval = resource.HbInterval; 377 if (r is SlaveGroup) { 378 UpdateChildHbIntervall(r); 379 } 380 } 381 } 382 383 private bool CheckParentsEqualsMovedNode(TreeNode dest, TreeNode movedNode) { 384 TreeNode tmp = dest; 385 386 while (tmp != null) { 387 if (tmp == movedNode) { 388 return true; 389 } 390 tmp = tmp.Parent; 391 } 392 return false; 393 } 394 395 private void ResetView() { 396 if (InvokeRequired) Invoke((Action)ResetView); 397 else { 422 398 treeSlaveGroup.Nodes.Clear(); 423 399 424 400 if (slaveView.Content != null && slaveView.Content is SlaveGroup) { 425 slaveView.Content.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(SlaveViewContent_PropertyChanged); 426 } 401 slaveView.Content.PropertyChanged -= SlaveViewContent_PropertyChanged; 402 } 403 427 404 slaveView.Content = null; 428 405 if (scheduleView.Content != null) { 429 406 scheduleView.Content.Clear(); 430 407 } 408 431 409 HiveAdminClient.Instance.ResetDowntime(); 432 410 } … … 434 412 435 413 private void UpdateResources() { 436 ResetView();437 438 414 try { 439 if (!Access.UserInformation.Instance.UserExists) { 440 //do a refresh just in case that the user has changed his usr and pwd in between 441 Access.UserInformation.Instance.Refresh(); 442 } 415 ResetView(); 443 416 HiveAdminClient.Instance.Refresh(); 444 417 Content = HiveAdminClient.Instance.Resources; 445 } 446 catch (MessageSecurityException) { 447 ShowMessageSecurityException(); 448 } 449 catch (AnonymousUserException) { 418 } catch (AnonymousUserException) { 450 419 ShowHiveInformationDialog(); 451 420 } 452 421 } 453 422 454 private void ShowMessageSecurityException() { 455 if (this.InvokeRequired) { 456 Invoke(new Action(ShowMessageSecurityException)); 423 private void RemoveResource() { 424 var selectedNode = treeSlaveGroup.SelectedNode; 425 if (selectedNode == null || selectedNode.Tag == null) return; 426 427 var resource = (Resource)selectedNode.Tag; 428 var result = MessageBox.Show( 429 "Do you really want to delete " + resource.Name + "?", 430 "HeuristicLab Hive Administrator", 431 MessageBoxButtons.YesNo, 432 MessageBoxIcon.Question); 433 434 if (result == DialogResult.Yes) { 435 if (resource is Slave) { 436 Content.Remove(resource); 437 HiveAdminClient.Delete(resource); 438 } else if (resource is SlaveGroup) { 439 if (Content.Any(x => x.ParentResourceId == resource.Id)) { 440 MessageBox.Show( 441 "Only empty resources can be deleted.", 442 "HeuristicLab Hive Administrator", 443 MessageBoxButtons.OK, 444 MessageBoxIcon.Error); 445 } else { 446 Content.Remove(resource); 447 HiveAdminClient.Delete(resource); 448 } 449 } 450 } 451 } 452 453 private void UpdateSchedule() { 454 var selectedNode = treeSlaveGroup.SelectedNode; 455 var resource = (Resource)selectedNode?.Tag; 456 457 if (IsAuthorized(resource)) { 458 if (!tabSlaveGroup.TabPages.Contains(tabSchedule)) 459 tabSlaveGroup.TabPages.Add(tabSchedule); 460 461 if (tabSlaveGroup.SelectedIndex == 1) { 462 HiveAdminClient.Instance.DowntimeForResourceId = resource.Id; 463 HiveAdminClient.Instance.RefreshCalendar(); 464 scheduleView.Invoke((Action)(() => { 465 scheduleView.Content = HiveAdminClient.Instance.Downtimes; 466 SetEnabledStateOfControls(); 467 })); 468 } 457 469 } else { 458 MessageBox.Show("A Message Security error has occured. This normally means that your user name or password is wrong.", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 459 } 470 if (tabSlaveGroup.TabPages.Contains(tabSchedule)) 471 tabSlaveGroup.TabPages.Remove(tabSchedule); 472 } 473 } 474 475 private bool IsAuthorized(Resource resource) { 476 return resource != null 477 && resource.Name != UngroupedGroupName 478 && resource.Id != Guid.Empty 479 && UserInformation.Instance.UserExists 480 && (resource.OwnerUserId == UserInformation.Instance.User.Id || HiveRoles.CheckAdminUserPermissions()); 460 481 } 461 482 462 483 private void ShowHiveInformationDialog() { 463 if (this.InvokeRequired) { 464 Invoke(new Action(ShowHiveInformationDialog)); 465 } else { 484 if (InvokeRequired) Invoke((Action)ShowHiveInformationDialog); 485 else { 466 486 using (HiveInformationDialog dialog = new HiveInformationDialog()) { 467 487 dialog.ShowDialog(this); … … 469 489 } 470 490 } 471 472 private void UpdateResourcesAsync() { 473 TS.Task.Factory.StartNew(UpdateResources).ContinueWith((t) => { 474 DisplayError(t.Exception); 475 }, TaskContinuationOptions.OnlyOnFaulted); 476 } 477 478 private void UpdateSchedule() { 479 HiveAdminClient.Instance.RefreshCalendar(); 480 scheduleView.Invoke(new Action(() => { 481 scheduleView.Content = HiveAdminClient.Instance.Downtimes; 482 SetEnabledStateOfControls(); 483 })); 484 } 485 486 private void UpdateScheduleAsync() { 487 TS.Task.Factory.StartNew(UpdateSchedule).ContinueWith((t) => { 488 DisplayError(t.Exception); 489 }, TaskContinuationOptions.OnlyOnFaulted); 490 } 491 492 private void UpdatePermissions() { 493 if (permissionView.Content != null && permissionView.FetchSelectedUsers != null) 494 permissionView.Invoke(new Action(() => permissionView.ManualRefresh())); 495 } 496 497 private void UpdatePermissionsAsync() { 498 TS.Task.Factory.StartNew(UpdatePermissions).ContinueWith((t) => { 499 DisplayError(t.Exception); 500 }, TaskContinuationOptions.OnlyOnFaulted); 501 } 502 503 504 private void DisplayError(Exception ex) { 505 MessageBox.Show(string.Format("An error occured while updating: {0} {1}", Environment.NewLine, ex.Message), "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 506 } 507 508 private void tabSlaveGroup_SelectedIndexChanged(object sender, EventArgs e) { 509 if (tabSlaveGroup.SelectedIndex == 1) { 510 UpdateScheduleAsync(); 511 } else if (tabSlaveGroup.SelectedIndex == 2) { 512 UpdatePermissionsAsync(); 513 } 514 } 515 516 private void btnRefresh_Click(object sender, EventArgs e) { 517 UpdateResourcesAsync(); 518 } 519 520 private void ResourcesView_Load(object sender, EventArgs e) { 521 UpdateResourcesAsync(); 522 } 523 524 private void btnPermissionsSave_Click(object sender, EventArgs e) { 525 SetEnabledStateOfControls(); 526 HiveServiceLocator.Instance.CallHiveService(service => { 527 service.GrantResourcePermissions(((Resource)treeSlaveGroup.SelectedNode.Tag).Id, permissionView.GetAddedUsers().Select(x => x.Id).ToList()); 528 service.RevokeResourcePermissions(((Resource)treeSlaveGroup.SelectedNode.Tag).Id, permissionView.GetDeletedUsers().Select(x => x.Id).ToList()); 529 }); 530 SetEnabledStateOfControls(); 531 } 491 #endregion 532 492 } 533 493 } -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/HeuristicLab.Clients.Hive.JobManager-3.3.csproj
r14125 r15401 159 159 </ItemGroup> 160 160 <ItemGroup> 161 <ProjectReference Include="..\..\HeuristicLab.Clients.Access\3.3\HeuristicLab.Clients.Access-3.3.csproj"> 162 <Project>{494f87f4-0f25-4d33-a382-10cdb2174d48}</Project> 163 <Name>HeuristicLab.Clients.Access-3.3</Name> 164 <Private>False</Private> 165 </ProjectReference> 161 166 <ProjectReference Include="..\..\HeuristicLab.Clients.Hive.Views\3.3\HeuristicLab.Clients.Hive.Views-3.3.csproj"> 162 167 <Project>{E1D6C801-892A-406A-B606-F158E36DD3C3}</Project> -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/MenuItems/JobManagerMenuItem.cs
r14185 r15401 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Windows.Forms; 25 using HeuristicLab.Clients.Access; 24 26 using HeuristicLab.MainForm; 25 27 using HeuristicLab.Optimizer; 26 28 27 29 namespace HeuristicLab.Clients.Hive.JobManager { 28 public class JobManagerMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider {30 public class JobManagerMenuItem : MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider { 29 31 public override string Name { 30 32 get { return "&Job Manager"; } 31 33 } 34 32 35 public override IEnumerable<string> Structure { 33 36 get { return new string[] { "&Services", "&Hive" }; } 34 37 } 38 35 39 public override void Execute() { 36 MainFormManager.MainForm.ShowContent(HiveClient.Instance); 40 if (HiveRoles.CheckHiveUserPermissions()) { 41 MainFormManager.MainForm.ShowContent(HiveClient.Instance); 42 } else if (!UserInformation.Instance.UserExists) { 43 MessageBox.Show( 44 "Couldn't fetch user information from the server." + Environment.NewLine + 45 "Please verify that you have an existing user and that your user name and password is correct.", 46 "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); 47 } else { 48 MessageBox.Show( 49 "You do not seem to have the permissions to use the Hive Job Manager." + Environment.NewLine + 50 "If that's not the case or you have any questions please write an email to support@heuristiclab.com", 51 "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); 52 } 37 53 } 54 38 55 public override int Position { 39 56 get { return 10000; } 40 57 } 58 41 59 public override Keys ShortCutKeys { 42 60 get { return Keys.Control | Keys.H; } -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.Designer.cs
r14185 r15401 21 21 22 22 namespace HeuristicLab.Clients.Hive.JobManager.Views { 23 partial class Hive ResourceSelector {23 partial class HiveProjectSelector { 24 24 /// <summary> 25 25 /// Required designer variable. … … 46 46 private void InitializeComponent() { 47 47 this.components = new System.ComponentModel.Container(); 48 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HiveResourceSelector));49 48 this.resourcesGroupBox = new System.Windows.Forms.GroupBox(); 50 49 this.splitContainer = new System.Windows.Forms.SplitContainer(); … … 71 70 this.resourcesGroupBox.TabIndex = 0; 72 71 this.resourcesGroupBox.TabStop = false; 73 this.resourcesGroupBox.Text = "Available Resources";72 this.resourcesGroupBox.Text = "Available Projects"; 74 73 // 75 74 // splitContainer … … 95 94 // resourcesTreeView 96 95 // 97 this.resourcesTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 98 | System.Windows.Forms.AnchorStyles.Left) 96 this.resourcesTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 97 | System.Windows.Forms.AnchorStyles.Left) 99 98 | System.Windows.Forms.AnchorStyles.Right))); 100 99 this.resourcesTreeView.CheckBoxes = true; … … 128 127 // searchTextBox 129 128 // 130 this.searchTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 129 this.searchTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 131 130 | System.Windows.Forms.AnchorStyles.Right))); 132 131 this.searchTextBox.Location = new System.Drawing.Point(29, 3); … … 139 138 // descriptionTextBox 140 139 // 141 this.descriptionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 142 | System.Windows.Forms.AnchorStyles.Left) 140 this.descriptionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 141 | System.Windows.Forms.AnchorStyles.Left) 143 142 | System.Windows.Forms.AnchorStyles.Right))); 144 143 this.descriptionTextBox.Font = new System.Drawing.Font("Courier New", 8.25F); … … 154 153 // HiveResourceSelector 155 154 // 156 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);157 155 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 158 156 this.Controls.Add(this.resourcesGroupBox); -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.cs
r14185 r15401 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 6Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 24 24 using System.Drawing; 25 25 using System.Linq; 26 using System.Text;27 26 using System.Windows.Forms; 28 using HeuristicLab.Clients.Hive.JobManager.ExtensionMethods;29 27 using HeuristicLab.Core; 30 28 using HeuristicLab.Core.Views; … … 33 31 34 32 namespace HeuristicLab.Clients.Hive.JobManager.Views { 35 [View("Hive ResourceSelector View")]36 [Content(typeof(IItemList< Resource>), true)]37 public partial class Hive ResourceSelector : ItemView, IDisposable {38 private const int slaveImageIndex = 0;39 private const int slaveGroupImageIndex = 1;33 [View("Hive Project Selector View")] 34 [Content(typeof(IItemList<Project>), true)] 35 public partial class HiveProjectSelector : ItemView, IDisposable { 36 private const int greenFlagImageIndex = 0; 37 private const int redFlagImageIndex = 1; 40 38 private string currentSearchString; 41 39 private ISet<TreeNode> mainTreeNodes; 42 40 private ISet<TreeNode> filteredTreeNodes; 43 41 private ISet<TreeNode> nodeStore; 44 45 private ISet< Resource> selectedResources;46 public ISet< Resource> SelectedResources {42 43 private ISet<Project> selectedResources; 44 public ISet<Project> SelectedResources { 47 45 get { return selectedResources; } 48 46 set { selectedResources = value; } 49 47 } 50 48 51 public new IItemList<Resource> Content { 52 get { return (IItemList<Resource>)base.Content; } 49 public Project SelectedProject { 50 get { return (Project)resourcesTreeView.SelectedNode.Tag; } 51 } 52 53 public new IItemList<Project> Content { 54 get { return (IItemList<Project>)base.Content; } 53 55 set { base.Content = value; } 54 56 } 55 57 56 public Hive ResourceSelector() {58 public HiveProjectSelector() { 57 59 InitializeComponent(); 58 60 mainTreeNodes = new HashSet<TreeNode>(); 59 61 filteredTreeNodes = new HashSet<TreeNode>(); 60 62 nodeStore = new HashSet<TreeNode>(); 61 selectedResources = new HashSet< Resource>();62 imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary. MonitorLarge);63 imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary. NetworkCenterLarge);64 } 65 63 selectedResources = new HashSet<Project>(); 64 imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.FlagGreen); 65 imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.FlagRed); 66 } 67 66 68 public void StartProgressView() { 67 69 if (InvokeRequired) { 68 70 Invoke(new Action(StartProgressView)); 69 71 } else { 70 var message = "Downloading resources. Please be patient.";72 var message = "Downloading projects. Please be patient."; 71 73 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, message); 72 74 } … … 85 87 86 88 if (Content != null) { 87 selectedResources = new HashSet< Resource>(Content.Where(x => selectedResources.Any(y => x.Id == y.Id)));89 selectedResources = new HashSet<Project>(Content.Where(x => selectedResources.Any(y => x.Id == y.Id))); 88 90 UpdateMainTree(); 89 91 ExtractStatistics(); … … 98 100 mainTreeNodes.Clear(); 99 101 100 foreach (Resource g in Content) { 101 if (g.GetType() == typeof(SlaveGroup)) { 102 //root node 103 if (g.ParentResourceId == null) { 104 TreeNode tn = new TreeNode(); 105 tn.ImageIndex = slaveGroupImageIndex; 106 tn.SelectedImageIndex = tn.ImageIndex; 107 108 tn.Tag = g; 109 tn.Text = g.Name; 110 tn.Checked = selectedResources.Any(x => x.Id == g.Id); 111 112 BuildMainTree(tn); 113 mainTreeNodes.Add(tn); 114 } 102 foreach (Project g in Content.OrderBy(x => x.Name)) { 103 //root node 104 if (g.ParentProjectId == null) { 105 TreeNode tn = new TreeNode(); 106 tn.ImageIndex = greenFlagImageIndex; 107 tn.SelectedImageIndex = tn.ImageIndex; 108 109 tn.Tag = g; 110 tn.Text = g.Name; 111 tn.Checked = selectedResources.Any(x => x.Id == g.Id); 112 113 BuildMainTree(tn); 114 mainTreeNodes.Add(tn); 115 115 } 116 116 } … … 119 119 120 120 private void BuildMainTree(TreeNode tn) { 121 foreach ( Resource r in Content.Where(s => s.ParentResourceId != null && s.ParentResourceId == ((Resource)tn.Tag).Id)) {121 foreach (Project r in Content.Where(s => s.ParentProjectId != null && s.ParentProjectId == ((Project)tn.Tag).Id).OrderBy(x => x.Name)) { 122 122 TreeNode stn = new TreeNode(r.Name); 123 if (r is Slave) stn.ImageIndex = slaveImageIndex; 124 else if (r is SlaveGroup) stn.ImageIndex = slaveGroupImageIndex; 123 stn.ImageIndex = redFlagImageIndex; 125 124 stn.SelectedImageIndex = stn.ImageIndex; 126 125 stn.Tag = r; … … 139 138 foreach (TreeNode n in mainTreeNodes) { 140 139 n.BackColor = SystemColors.Window; 141 if (currentSearchString == null || (( Resource)n.Tag).Name.ToLower().Contains(currentSearchString)) {140 if (currentSearchString == null || ((Project)n.Tag).Name.ToLower().Contains(currentSearchString)) { 142 141 n.BackColor = string.IsNullOrEmpty(currentSearchString) ? SystemColors.Window : Color.LightBlue; 143 142 filteredTreeNodes.Add(n); … … 162 161 163 162 foreach (TreeNode node in filteredTreeNodes) { 164 var clone = nodeStore.SingleOrDefault(x => (( Resource)x.Tag).Id == ((Resource)node.Tag).Id);163 var clone = nodeStore.SingleOrDefault(x => ((Project)x.Tag).Id == ((Project)node.Tag).Id); 165 164 if (clone == null) { 166 165 clone = (TreeNode)node.Clone(); … … 169 168 } 170 169 foreach (TreeNode child in node.Nodes) 171 if (filteredTreeNodes.Any(x => (( Resource)x.Tag).Id == ((Resource)child.Tag).Id)) {172 var childClone = nodeStore.SingleOrDefault(x => (( Resource)x.Tag).Id == ((Resource)child.Tag).Id);170 if (filteredTreeNodes.Any(x => ((Project)x.Tag).Id == ((Project)child.Tag).Id)) { 171 var childClone = nodeStore.SingleOrDefault(x => ((Project)x.Tag).Id == ((Project)child.Tag).Id); 173 172 if (childClone == null) { 174 173 childClone = (TreeNode)child.Clone(); … … 179 178 } 180 179 } 181 resourcesTreeView.Nodes.AddRange(nodeStore.Where(x => (( Resource)x.Tag).ParentResourceId == null).ToArray());180 resourcesTreeView.Nodes.AddRange(nodeStore.Where(x => ((Project)x.Tag).ParentProjectId == null).ToArray()); 182 181 if (string.IsNullOrEmpty(currentSearchString)) ExpandSlaveGroupNodes(); 183 182 else resourcesTreeView.ExpandAll(); … … 187 186 #region Events 188 187 private void resourcesTreeView_AfterCheck(object sender, TreeViewEventArgs e) { 189 if (e.Action != TreeViewAction.Unknown) {190 if (e.Node.Checked) {191 IncludeChildNodes(mainTreeNodes.SingleOrDefault(x => ((Resource)x.Tag).Id == ((Resource)e.Node.Tag).Id));192 IncludeParentNodes(mainTreeNodes.SingleOrDefault(x => ((Resource)x.Tag).Id == ((Resource)e.Node.Tag).Id));193 } else {194 ExcludeChildNodes(mainTreeNodes.SingleOrDefault(x => ((Resource)x.Tag).Id == ((Resource)e.Node.Tag).Id));195 ExcludeParentNodes(mainTreeNodes.SingleOrDefault(x => ((Resource)x.Tag).Id == ((Resource)e.Node.Tag).Id));196 }197 ExtractStatistics();198 }188 //if (e.Action != TreeViewAction.Unknown) { 189 // if (e.Node.Checked) { 190 // IncludeChildNodes(mainTreeNodes.SingleOrDefault(x => ((Project)x.Tag).Id == ((Project)e.Node.Tag).Id)); 191 // IncludeParentNodes(mainTreeNodes.SingleOrDefault(x => ((Project)x.Tag).Id == ((Project)e.Node.Tag).Id)); 192 // } else { 193 // ExcludeChildNodes(mainTreeNodes.SingleOrDefault(x => ((Project)x.Tag).Id == ((Project)e.Node.Tag).Id)); 194 // ExcludeParentNodes(mainTreeNodes.SingleOrDefault(x => ((Project)x.Tag).Id == ((Project)e.Node.Tag).Id)); 195 // } 196 // ExtractStatistics(); 197 //} 199 198 } 200 199 … … 212 211 213 212 #region Helpers 214 private void IncludeChildNodes(TreeNode node) {215 if (node != null) {216 node.Checked = true;217 selectedResources.Add((Resource)node.Tag);218 AdjustNodeCheckedState(node);219 foreach (TreeNode n in node.Nodes) IncludeChildNodes(n);220 }221 }222 223 private void IncludeParentNodes(TreeNode node) {224 if (node != null && node.Parent != null) {225 TreeNode parent = node.Parent;226 if (parent.Nodes.OfType<TreeNode>().All(x => x.Checked)) {227 parent.Checked = true;228 selectedResources.Add((Resource)parent.Tag);229 AdjustNodeCheckedState(parent);230 IncludeParentNodes(parent);231 }232 }233 }234 235 private void ExcludeChildNodes(TreeNode node) {236 if (node != null) {237 node.Checked = false;238 selectedResources.Remove((Resource)node.Tag);239 AdjustNodeCheckedState(node);240 foreach (TreeNode n in node.Nodes) ExcludeChildNodes(n);241 }242 }243 244 private void ExcludeParentNodes(TreeNode node) {245 if (node != null) {246 node.Checked = false;247 selectedResources.Remove((Resource)node.Tag);248 AdjustNodeCheckedState(node);249 ExcludeParentNodes(node.Parent);250 }251 }252 253 private void AdjustNodeCheckedState(TreeNode node) {254 var filterdNode = filteredTreeNodes.SingleOrDefault(x => ((Resource)x.Tag).Id == ((Resource)node.Tag).Id);255 var storedNode = nodeStore.SingleOrDefault(x => ((Resource)x.Tag).Id == ((Resource)node.Tag).Id);256 if (filterdNode != null) filterdNode.Checked = node.Checked;257 if (storedNode != null) storedNode.Checked = node.Checked;258 }259 260 213 private void ExpandSlaveGroupNodes() { 261 214 foreach (TreeNode n in nodeStore.Where(x => x.Tag is SlaveGroup)) { … … 267 220 268 221 private void ExtractStatistics(TreeNode treeNode = null) { 269 StringBuilder sb = new StringBuilder();270 Resource resource = treeNode == null ? null : treeNode.Tag as Resource;271 ISet<Resource> resources = treeNode == null ? selectedResources : new HashSet<Resource>(treeNode.DescendantNodes().Select(x => x.Tag as Resource)); ;272 IEnumerable<SlaveGroup> slaveGroups = resources.OfType<SlaveGroup>();273 IEnumerable<Slave> slaves = resources.OfType<Slave>();274 int cpuSpeed = 0, cores = 0, freeCores = 0, memory = 0, freeMemory = 0;275 string contextString = treeNode == null ? "Selected" : "Included";276 277 if (resources.Any() || resource != null) {278 foreach (Slave s in slaves) {279 cpuSpeed += s.CpuSpeed.GetValueOrDefault();280 cores += s.Cores.GetValueOrDefault();281 freeCores += s.FreeCores.GetValueOrDefault();282 memory += s.Memory.GetValueOrDefault();283 freeMemory += s.FreeMemory.GetValueOrDefault();284 }285 if (resource != null) {286 if (resource is SlaveGroup) sb.Append("Slave group: ");287 else if (resource is Slave) {288 sb.Append("Slave: ");289 if (!resources.Any()) {290 Slave s = resource as Slave;291 cpuSpeed = s.CpuSpeed.GetValueOrDefault();292 cores = s.Cores.GetValueOrDefault();293 freeCores = s.FreeCores.GetValueOrDefault();294 memory = s.Memory.GetValueOrDefault();295 freeMemory = s.FreeMemory.GetValueOrDefault();296 }297 }298 sb.AppendLine(string.Format("{0}", resource.Name));299 }300 if (resource == null || resource is SlaveGroup) {301 if (resources.Any()) {302 sb.AppendFormat("{0} slave groups ({1}): ", contextString, slaveGroups.Count());303 foreach (SlaveGroup sg in slaveGroups) sb.AppendFormat("{0}; ", sg.Name);304 sb.AppendLine();305 sb.AppendFormat("{0} slaves ({1}): ", contextString, slaves.Count());306 foreach (Slave s in slaves) sb.AppendFormat("{0}; ", s.Name);307 sb.AppendLine();308 } else {309 sb.Append("The selection does not inlcude any further resources.");310 }311 }312 sb.AppendLine();313 sb.AppendLine(string.Format("CPU speed: {0} MHz", cpuSpeed));314 if (resources.Any()) sb.AppendLine(string.Format("Avg. CPU speed: {0:0.00} MHz", (double)cpuSpeed / resources.Count()));315 sb.AppendLine(string.Format("Cores: {0}", cores));316 sb.AppendLine(string.Format("Free cores: {0}", freeCores));317 if (resources.Any()) sb.AppendLine(string.Format("Avg. free cores: {0:0.00}", (double)freeCores / resources.Count()));318 sb.AppendLine(string.Format("Memory: {0} MB", memory));319 sb.AppendFormat("Free memory: {0} MB", freeMemory);320 if (resources.Any()) sb.Append(string.Format("{0}Avg. free memory: {1:0.00} MB", Environment.NewLine, (double)freeMemory / resources.Count()));321 } else {322 sb.Append("No resources selected.");323 }324 325 descriptionTextBox.Text = sb.ToString();222 //StringBuilder sb = new StringBuilder(); 223 //Resource resource = treeNode == null ? null : treeNode.Tag as Resource; 224 //ISet<Resource> resources = treeNode == null ? selectedResources : new HashSet<Resource>(treeNode.DescendantNodes().Select(x => x.Tag as Resource)); ; 225 //IEnumerable<SlaveGroup> slaveGroups = resources.OfType<SlaveGroup>(); 226 //IEnumerable<Slave> slaves = resources.OfType<Slave>(); 227 //int cpuSpeed = 0, cores = 0, freeCores = 0, memory = 0, freeMemory = 0; 228 //string contextString = treeNode == null ? "Selected" : "Included"; 229 230 //if (resources.Any() || resource != null) { 231 // foreach (Slave s in slaves) { 232 // cpuSpeed += s.CpuSpeed.GetValueOrDefault(); 233 // cores += s.Cores.GetValueOrDefault(); 234 // freeCores += s.FreeCores.GetValueOrDefault(); 235 // memory += s.Memory.GetValueOrDefault(); 236 // freeMemory += s.FreeMemory.GetValueOrDefault(); 237 // } 238 // if (resource != null) { 239 // if (resource is SlaveGroup) sb.Append("Slave group: "); 240 // else if (resource is Slave) { 241 // sb.Append("Slave: "); 242 // if (!resources.Any()) { 243 // Slave s = resource as Slave; 244 // cpuSpeed = s.CpuSpeed.GetValueOrDefault(); 245 // cores = s.Cores.GetValueOrDefault(); 246 // freeCores = s.FreeCores.GetValueOrDefault(); 247 // memory = s.Memory.GetValueOrDefault(); 248 // freeMemory = s.FreeMemory.GetValueOrDefault(); 249 // } 250 // } 251 // sb.AppendLine(string.Format("{0}", resource.Name)); 252 // } 253 // if (resource == null || resource is SlaveGroup) { 254 // if (resources.Any()) { 255 // sb.AppendFormat("{0} slave groups ({1}): ", contextString, slaveGroups.Count()); 256 // foreach (SlaveGroup sg in slaveGroups) sb.AppendFormat("{0}; ", sg.Name); 257 // sb.AppendLine(); 258 // sb.AppendFormat("{0} slaves ({1}): ", contextString, slaves.Count()); 259 // foreach (Slave s in slaves) sb.AppendFormat("{0}; ", s.Name); 260 // sb.AppendLine(); 261 // } else { 262 // sb.Append("The selection does not inlcude any further resources."); 263 // } 264 // } 265 // sb.AppendLine(); 266 // sb.AppendLine(string.Format("CPU speed: {0} MHz", cpuSpeed)); 267 // if (resources.Any()) sb.AppendLine(string.Format("Avg. CPU speed: {0:0.00} MHz", (double)cpuSpeed / resources.Count())); 268 // sb.AppendLine(string.Format("Cores: {0}", cores)); 269 // sb.AppendLine(string.Format("Free cores: {0}", freeCores)); 270 // if (resources.Any()) sb.AppendLine(string.Format("Avg. free cores: {0:0.00}", (double)freeCores / resources.Count())); 271 // sb.AppendLine(string.Format("Memory: {0} MB", memory)); 272 // sb.AppendFormat("Free memory: {0} MB", freeMemory); 273 // if (resources.Any()) sb.Append(string.Format("{0}Avg. free memory: {1:0.00} MB", Environment.NewLine, (double)freeMemory / resources.Count())); 274 //} else { 275 // sb.Append("No resources selected."); 276 //} 277 278 //descriptionTextBox.Text = sb.ToString(); 326 279 } 327 280 #endregion -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.Designer.cs
r14185 r15401 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HiveResourceSelectorDialog));48 47 this.okButton = new System.Windows.Forms.Button(); 49 48 this.cancelButton = new System.Windows.Forms.Button(); 50 49 this.refreshButton = new System.Windows.Forms.Button(); 51 this.hiveResourceSelector = new HeuristicLab.Clients.Hive.JobManager.Views.Hive ResourceSelector();50 this.hiveResourceSelector = new HeuristicLab.Clients.Hive.JobManager.Views.HiveProjectSelector(); 52 51 this.SuspendLayout(); 53 52 // … … 87 86 // hiveResourceSelector 88 87 // 89 this.hiveResourceSelector.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 90 | System.Windows.Forms.AnchorStyles.Left) 88 this.hiveResourceSelector.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 89 | System.Windows.Forms.AnchorStyles.Left) 91 90 | System.Windows.Forms.AnchorStyles.Right))); 92 91 this.hiveResourceSelector.Caption = "View"; … … 101 100 // 102 101 this.AcceptButton = this.okButton; 103 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);104 102 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 105 103 this.CancelButton = this.cancelButton; … … 115 113 this.ShowInTaskbar = false; 116 114 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 117 this.Text = "Select Resources";115 this.Text = "Select Project"; 118 116 this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.HiveResourceSelectorDialog_FormClosing); 119 117 this.Load += new System.EventHandler(this.HiveResourceSelectorDialog_Load); … … 126 124 protected System.Windows.Forms.Button okButton; 127 125 protected System.Windows.Forms.Button cancelButton; 128 protected Hive ResourceSelector hiveResourceSelector;126 protected HiveProjectSelector hiveResourceSelector; 129 127 protected System.Windows.Forms.Button refreshButton; 130 128 } -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.cs
r14185 r15401 31 31 } 32 32 33 public ISet<Resource> GetSelectedResources() { return hiveResourceSelector.SelectedResources; } 33 public ISet<Project> GetSelectedResources() { return hiveResourceSelector.SelectedResources; } 34 public Project SelectedProject { get { return hiveResourceSelector.SelectedProject; } } 34 35 35 36 private void HiveResourceSelectorDialog_Load(object sender, System.EventArgs e) { … … 43 44 44 45 void Instance_Refreshed(object sender, System.EventArgs e) { 45 hiveResourceSelector.Content = HiveAdminClient.Instance. Resources;46 hiveResourceSelector.Content = HiveAdminClient.Instance.Projects; 46 47 } 47 48 -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs
r14901 r15401 130 130 nameTextBox.Text = Content.Job.Name; 131 131 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 132 resourceNamesTextBox.Text = Content.Job.ResourceNames;132 //resourceNamesTextBox.Text = Content.Job.ResourceNames; 133 133 refreshAutomaticallyCheckBox.Checked = Content.RefreshAutomatically; 134 134 logView.Content = Content.Log; … … 337 337 if (hiveResourceSelectorDialog.ShowDialog(this) == DialogResult.OK) { 338 338 StringBuilder sb = new StringBuilder(); 339 foreach (Resource resource in hiveResourceSelectorDialog.GetSelectedResources()) { 340 sb.Append(resource.Name); 341 sb.Append(";"); 342 } 343 resourceNamesTextBox.Text = sb.ToString(); 344 if (Content.Job.ResourceNames != resourceNamesTextBox.Text) 345 Content.Job.ResourceNames = resourceNamesTextBox.Text; 339 //foreach (Project resource in hiveResourceSelectorDialog.GetSelectedResources()) { 340 // sb.Append(resource.Name); 341 // sb.Append(";"); 342 //} 343 //resourceNamesTextBox.Text = sb.ToString(); 344 //if (Content.Job.ResourceNames != resourceNamesTextBox.Text) 345 // Content.Job.ResourceNames = resourceNamesTextBox.Text; 346 var selectedProject = hiveResourceSelectorDialog.SelectedProject; 347 resourceNamesTextBox.Text = selectedProject.Name; 348 if (Content.Job.ProjectId != selectedProject.Id) 349 Content.Job.ProjectId = selectedProject.Id; 346 350 } 347 351 } … … 404 408 405 409 private void resourceNamesTextBox_Validated(object sender, EventArgs e) { 406 if (!SuppressEvents && Content.Job != null && Content.Job.ResourceNames != resourceNamesTextBox.Text)407 Content.Job.ResourceNames = resourceNamesTextBox.Text;410 //if (!SuppressEvents && Content.Job != null && Content.Job.ResourceNames != resourceNamesTextBox.Text) 411 // Content.Job.ResourceNames = resourceNamesTextBox.Text; 408 412 } 409 413 -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive/3.3/HeuristicLab.Clients.Hive-3.3.csproj
r14738 r15401 125 125 <Compile Include="HiveAdminClient.cs" /> 126 126 <Compile Include="HiveClient.cs" /> 127 <Compile Include="ServiceClients\Project.cs" /> 127 128 <Compile Include="ServiceClients\UserPriority.cs" /> 128 129 <Compile Include="ServiceClients\ResourcePermission.cs" /> -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive/3.3/HiveAdminClient.cs
r14185 r15401 57 57 } 58 58 59 private IItemList<Project> projects; 60 public IItemList<Project> Projects { 61 get { return projects; } 62 } 63 59 64 #region Events 60 65 public event EventHandler Refreshing; … … 78 83 try { 79 84 resources = new ItemList<Resource>(); 85 projects = new ItemList<Project>(); 80 86 81 87 HiveServiceLocator.Instance.CallHiveService(service => { 82 88 service.GetSlaveGroups().ForEach(g => resources.Add(g)); 83 89 service.GetSlaves().ForEach(s => resources.Add(s)); 90 service.GetProjects().ForEach(p => projects.Add(p)); 84 91 }); 85 92 } … … 127 134 item.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddDowntime((Downtime)item)); 128 135 } 136 if (item is Project) { 137 item.Id = HiveServiceLocator.Instance.CallHiveService(s => s.AddProject((Project)item)); 138 } 129 139 } else { 130 140 if (item is SlaveGroup) { … … 136 146 if (item is Downtime) { 137 147 HiveServiceLocator.Instance.CallHiveService((s) => s.UpdateDowntime((Downtime)item)); 148 } 149 if (item is Project) { 150 HiveServiceLocator.Instance.CallHiveService((s) => s.UpdateProject((Project)item)); 138 151 } 139 152 } … … 149 162 } else if (item is Downtime) { 150 163 HiveServiceLocator.Instance.CallHiveService((s) => s.DeleteDowntime(item.Id)); 164 } else if (item is Project) { 165 HiveServiceLocator.Instance.CallHiveService((s) => s.DeleteProject(item.Id)); 151 166 } 152 167 } -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive/3.3/HiveClient.cs
r14901 r15401 140 140 HiveServiceLocator.Instance.CallHiveService((s) => s.GrantPermission(hep.JobId, hep.GrantedUserId, hep.Permission)); 141 141 } 142 if (item is Project) { 143 HiveServiceLocator.Instance.CallHiveService(s => s.AddProject((Project)item)); 144 } 142 145 } else { 143 146 if (item is Job) 144 147 HiveServiceLocator.Instance.CallHiveService(s => s.UpdateJob((Job)item)); 148 if (item is Project) 149 HiveServiceLocator.Instance.CallHiveService(s => s.UpdateProject((Project)item)); 145 150 } 146 151 } … … 250 255 refreshableJob.IsProgressing = true; 251 256 refreshableJob.Progress.Start("Connecting to server..."); 252 IEnumerable<string> resourceNames = ToResourceNameList( refreshableJob.Job.ResourceNames);257 IEnumerable<string> resourceNames = ToResourceNameList(""); 253 258 var resourceIds = new List<Guid>(); 254 259 foreach (var resourceName in resourceNames) { … … 372 377 hiveTask.Task.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddChildTask(parentHiveTask.Task.Id, hiveTask.Task, taskData)); 373 378 } else { 374 hiveTask.Task.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddTask(hiveTask.Task, taskData , groups.ToList()));379 hiveTask.Task.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddTask(hiveTask.Task, taskData)); 375 380 } 376 381 } -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive/3.3/ServiceClients/HiveServiceClient.cs
r14738 r15401 26 26 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.SlaveGroup))] 27 27 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Plugin))] 28 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Project))] 28 29 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.JobPermission))] 29 30 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.PluginData))] 30 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive. ResourcePermission))]31 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.ProjectPermission))] 31 32 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Downtime))] 32 33 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.UserPriority))] … … 211 212 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.SlaveGroup))] 212 213 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Plugin))] 214 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Project))] 213 215 public partial class NamedHiveItem : HeuristicLab.Clients.Hive.HiveItem 214 216 { … … 284 286 285 287 [System.Runtime.Serialization.OptionalFieldAttribute()] 286 private string ResourceNamesField;288 private System.Guid ProjectIdField; 287 289 288 290 [System.Runtime.Serialization.DataMemberAttribute()] … … 406 408 407 409 [System.Runtime.Serialization.DataMemberAttribute()] 408 public string ResourceNames409 { 410 get 411 { 412 return this. ResourceNamesField;413 } 414 set 415 { 416 if (( object.ReferenceEquals(this.ResourceNamesField,value) != true))417 { 418 this. ResourceNamesField = value;419 this.RaisePropertyChanged(" ResourceNames");410 public System.Guid ProjectId 411 { 412 get 413 { 414 return this.ProjectIdField; 415 } 416 set 417 { 418 if ((this.ProjectIdField.Equals(value) != true)) 419 { 420 this.ProjectIdField = value; 421 this.RaisePropertyChanged("ProjectId"); 420 422 } 421 423 } … … 839 841 [System.Diagnostics.DebuggerStepThroughAttribute()] 840 842 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 843 [System.Runtime.Serialization.DataContractAttribute(Name="Project", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.DataTransfer")] 844 [System.SerializableAttribute()] 845 public partial class Project : HeuristicLab.Clients.Hive.NamedHiveItem 846 { 847 848 [System.Runtime.Serialization.OptionalFieldAttribute()] 849 private System.DateTime DateCreatedField; 850 851 [System.Runtime.Serialization.OptionalFieldAttribute()] 852 private System.Nullable<System.DateTime> EndDateField; 853 854 [System.Runtime.Serialization.OptionalFieldAttribute()] 855 private System.Guid OwnerUserIdField; 856 857 [System.Runtime.Serialization.OptionalFieldAttribute()] 858 private System.Nullable<System.Guid> ParentProjectIdField; 859 860 [System.Runtime.Serialization.OptionalFieldAttribute()] 861 private System.DateTime StartDateField; 862 863 [System.Runtime.Serialization.DataMemberAttribute()] 864 public System.DateTime DateCreated 865 { 866 get 867 { 868 return this.DateCreatedField; 869 } 870 set 871 { 872 if ((this.DateCreatedField.Equals(value) != true)) 873 { 874 this.DateCreatedField = value; 875 this.RaisePropertyChanged("DateCreated"); 876 } 877 } 878 } 879 880 [System.Runtime.Serialization.DataMemberAttribute()] 881 public System.Nullable<System.DateTime> EndDate 882 { 883 get 884 { 885 return this.EndDateField; 886 } 887 set 888 { 889 if ((this.EndDateField.Equals(value) != true)) 890 { 891 this.EndDateField = value; 892 this.RaisePropertyChanged("EndDate"); 893 } 894 } 895 } 896 897 [System.Runtime.Serialization.DataMemberAttribute()] 898 public System.Guid OwnerUserId 899 { 900 get 901 { 902 return this.OwnerUserIdField; 903 } 904 set 905 { 906 if ((this.OwnerUserIdField.Equals(value) != true)) 907 { 908 this.OwnerUserIdField = value; 909 this.RaisePropertyChanged("OwnerUserId"); 910 } 911 } 912 } 913 914 [System.Runtime.Serialization.DataMemberAttribute()] 915 public System.Nullable<System.Guid> ParentProjectId 916 { 917 get 918 { 919 return this.ParentProjectIdField; 920 } 921 set 922 { 923 if ((this.ParentProjectIdField.Equals(value) != true)) 924 { 925 this.ParentProjectIdField = value; 926 this.RaisePropertyChanged("ParentProjectId"); 927 } 928 } 929 } 930 931 [System.Runtime.Serialization.DataMemberAttribute()] 932 public System.DateTime StartDate 933 { 934 get 935 { 936 return this.StartDateField; 937 } 938 set 939 { 940 if ((this.StartDateField.Equals(value) != true)) 941 { 942 this.StartDateField = value; 943 this.RaisePropertyChanged("StartDate"); 944 } 945 } 946 } 947 } 948 949 [System.Diagnostics.DebuggerStepThroughAttribute()] 950 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 841 951 [System.Runtime.Serialization.DataContractAttribute(Name="JobPermission", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.DataTransfer")] 842 952 [System.SerializableAttribute()] … … 995 1105 [System.Diagnostics.DebuggerStepThroughAttribute()] 996 1106 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 997 [System.Runtime.Serialization.DataContractAttribute(Name=" ResourcePermission", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.DataTransfer")]1107 [System.Runtime.Serialization.DataContractAttribute(Name="ProjectPermission", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.DataTransfer")] 998 1108 [System.SerializableAttribute()] 999 public partial class ResourcePermission : HeuristicLab.Clients.Hive.HiveItem1109 public partial class ProjectPermission : HeuristicLab.Clients.Hive.HiveItem 1000 1110 { 1001 1111 … … 1007 1117 1008 1118 [System.Runtime.Serialization.OptionalFieldAttribute()] 1009 private System.Guid ResourceIdField;1119 private System.Guid ProjectIdField; 1010 1120 1011 1121 [System.Runtime.Serialization.DataMemberAttribute()] … … 1044 1154 1045 1155 [System.Runtime.Serialization.DataMemberAttribute()] 1046 public System.Guid ResourceId1047 { 1048 get 1049 { 1050 return this. ResourceIdField;1051 } 1052 set 1053 { 1054 if ((this. ResourceIdField.Equals(value) != true))1055 { 1056 this. ResourceIdField = value;1057 this.RaisePropertyChanged(" ResourceId");1156 public System.Guid ProjectId 1157 { 1158 get 1159 { 1160 return this.ProjectIdField; 1161 } 1162 set 1163 { 1164 if ((this.ProjectIdField.Equals(value) != true)) 1165 { 1166 this.ProjectIdField = value; 1167 this.RaisePropertyChanged("ProjectId"); 1058 1168 } 1059 1169 } … … 2100 2210 2101 2211 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/AddTask", ReplyAction="http://tempuri.org/IHiveService/AddTaskResponse")] 2102 System.Guid AddTask(HeuristicLab.Clients.Hive.Task task, HeuristicLab.Clients.Hive.TaskData taskData , System.Collections.Generic.List<System.Guid> resourceIds);2212 System.Guid AddTask(HeuristicLab.Clients.Hive.Task task, HeuristicLab.Clients.Hive.TaskData taskData); 2103 2213 2104 2214 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/AddChildTask", ReplyAction="http://tempuri.org/IHiveService/AddChildTaskResponse")] … … 2184 2294 System.Collections.Generic.List<HeuristicLab.Clients.Hive.PluginData> GetPluginDatas(System.Collections.Generic.List<System.Guid> pluginIds); 2185 2295 2186 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GrantResourcePermissions", ReplyAction="http://tempuri.org/IHiveService/GrantResourcePermissionsResponse")] 2187 void GrantResourcePermissions(System.Guid resourceId, System.Collections.Generic.List<System.Guid> grantedUserIds); 2188 2189 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/RevokeResourcePermissions", ReplyAction="http://tempuri.org/IHiveService/RevokeResourcePermissionsResponse")] 2190 void RevokeResourcePermissions(System.Guid resourceId, System.Collections.Generic.List<System.Guid> grantedUserIds); 2191 2192 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetResourcePermissions", ReplyAction="http://tempuri.org/IHiveService/GetResourcePermissionsResponse")] 2193 System.Collections.Generic.List<HeuristicLab.Clients.Hive.ResourcePermission> GetResourcePermissions(System.Guid resourceId); 2296 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/AddProject", ReplyAction="http://tempuri.org/IHiveService/AddProjectResponse")] 2297 System.Guid AddProject(HeuristicLab.Clients.Hive.Project projectDto); 2298 2299 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/UpdateProject", ReplyAction="http://tempuri.org/IHiveService/UpdateProjectResponse")] 2300 void UpdateProject(HeuristicLab.Clients.Hive.Project projectDto); 2301 2302 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/DeleteProject", ReplyAction="http://tempuri.org/IHiveService/DeleteProjectResponse")] 2303 void DeleteProject(System.Guid projectId); 2304 2305 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetProject", ReplyAction="http://tempuri.org/IHiveService/GetProjectResponse")] 2306 HeuristicLab.Clients.Hive.Project GetProject(System.Guid projectId); 2307 2308 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetProjects", ReplyAction="http://tempuri.org/IHiveService/GetProjectsResponse")] 2309 System.Collections.Generic.List<HeuristicLab.Clients.Hive.Project> GetProjects(); 2310 2311 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GrantProjectPermissions", ReplyAction="http://tempuri.org/IHiveService/GrantProjectPermissionsResponse")] 2312 void GrantProjectPermissions(System.Guid projectId, System.Collections.Generic.List<System.Guid> grantedUserIds); 2313 2314 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/RevokeProjectPermissions", ReplyAction="http://tempuri.org/IHiveService/RevokeProjectPermissionsResponse")] 2315 void RevokeProjectPermissions(System.Guid projectId, System.Collections.Generic.List<System.Guid> grantedUserIds); 2316 2317 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetProjectPermissions", ReplyAction="http://tempuri.org/IHiveService/GetProjectPermissionsResponse")] 2318 System.Collections.Generic.List<HeuristicLab.Clients.Hive.ProjectPermission> GetProjectPermissions(System.Guid projectId); 2194 2319 2195 2320 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/AddSlave", ReplyAction="http://tempuri.org/IHiveService/AddSlaveResponse")] … … 2291 2416 } 2292 2417 2293 public System.Guid AddTask(HeuristicLab.Clients.Hive.Task task, HeuristicLab.Clients.Hive.TaskData taskData , System.Collections.Generic.List<System.Guid> resourceIds)2294 { 2295 return base.Channel.AddTask(task, taskData , resourceIds);2418 public System.Guid AddTask(HeuristicLab.Clients.Hive.Task task, HeuristicLab.Clients.Hive.TaskData taskData) 2419 { 2420 return base.Channel.AddTask(task, taskData); 2296 2421 } 2297 2422 … … 2431 2556 } 2432 2557 2433 public void GrantResourcePermissions(System.Guid resourceId, System.Collections.Generic.List<System.Guid> grantedUserIds) 2434 { 2435 base.Channel.GrantResourcePermissions(resourceId, grantedUserIds); 2436 } 2437 2438 public void RevokeResourcePermissions(System.Guid resourceId, System.Collections.Generic.List<System.Guid> grantedUserIds) 2439 { 2440 base.Channel.RevokeResourcePermissions(resourceId, grantedUserIds); 2441 } 2442 2443 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.ResourcePermission> GetResourcePermissions(System.Guid resourceId) 2444 { 2445 return base.Channel.GetResourcePermissions(resourceId); 2558 public System.Guid AddProject(HeuristicLab.Clients.Hive.Project projectDto) 2559 { 2560 return base.Channel.AddProject(projectDto); 2561 } 2562 2563 public void UpdateProject(HeuristicLab.Clients.Hive.Project projectDto) 2564 { 2565 base.Channel.UpdateProject(projectDto); 2566 } 2567 2568 public void DeleteProject(System.Guid projectId) 2569 { 2570 base.Channel.DeleteProject(projectId); 2571 } 2572 2573 public HeuristicLab.Clients.Hive.Project GetProject(System.Guid projectId) 2574 { 2575 return base.Channel.GetProject(projectId); 2576 } 2577 2578 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Project> GetProjects() 2579 { 2580 return base.Channel.GetProjects(); 2581 } 2582 2583 public void GrantProjectPermissions(System.Guid projectId, System.Collections.Generic.List<System.Guid> grantedUserIds) 2584 { 2585 base.Channel.GrantProjectPermissions(projectId, grantedUserIds); 2586 } 2587 2588 public void RevokeProjectPermissions(System.Guid projectId, System.Collections.Generic.List<System.Guid> grantedUserIds) 2589 { 2590 base.Channel.RevokeProjectPermissions(projectId, grantedUserIds); 2591 } 2592 2593 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.ProjectPermission> GetProjectPermissions(System.Guid projectId) 2594 { 2595 return base.Channel.GetProjectPermissions(projectId); 2446 2596 } 2447 2597 -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive/3.3/ServiceClients/Job.cs
r14185 r15401 29 29 #region Constructors and Cloning 30 30 public Job() { 31 ResourceNames = "HEAL";31 ProjectId = Guid.Empty; 32 32 DateCreated = DateTime.Now; 33 33 Permission = Permission.Full; … … 38 38 this.OwnerUserId = original.OwnerUserId; 39 39 this.DateCreated = original.DateCreated; 40 this. ResourceNames = original.ResourceNames;40 this.ProjectId = original.ProjectId; 41 41 this.Name = original.Name; 42 42 this.Description = original.Description; -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive/3.3/ServiceClients/ResourcePermission.cs
r14185 r15401 24 24 25 25 namespace HeuristicLab.Clients.Hive { 26 public partial class ResourcePermission : IDeepCloneable, IContent {26 public partial class ProjectPermission : IDeepCloneable, IContent { 27 27 28 28 private string grantedUserName; … … 41 41 } 42 42 43 public ResourcePermission() { }43 public ProjectPermission() { } 44 44 45 45 protected override void OnPropertyChanged(PropertyChangedEventArgs e) { … … 50 50 } 51 51 52 protected ResourcePermission(ResourcePermission original, Cloner cloner)52 protected ProjectPermission(ProjectPermission original, Cloner cloner) 53 53 : base(original, cloner) { 54 54 this.GrantedByUserId = original.GrantedByUserId; 55 55 this.GrantedUserId = original.GrantedUserId; 56 this. ResourceId = original.ResourceId;56 this.ProjectId = original.ProjectId; 57 57 } 58 58 59 59 public override IDeepCloneable Clone(Cloner cloner) { 60 return new ResourcePermission(this, cloner);60 return new ProjectPermission(this, cloner); 61 61 } 62 62 -
branches/HiveProjectManagement/HeuristicLab.Optimizer/3.3/MenuItems/UsernamePasswordMenuItem.cs
r14185 r15401 22 22 using System.Collections.Generic; 23 23 using System.Windows.Forms; 24 using HeuristicLab.Clients.Access; 24 25 using HeuristicLab.Clients.Common; 25 26 using HeuristicLab.MainForm; … … 43 44 using (PasswordDialog dialog = new PasswordDialog()) { 44 45 dialog.ShowDialog((IWin32Window)MainFormManager.MainForm); 46 UserInformation.Instance.Refresh(); 45 47 } 46 48 }
Note: See TracChangeset
for help on using the changeset viewer.