Changeset 1832
- Timestamp:
- 05/15/09 14:37:04 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Hive.Server.Console/3.2
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server.Console/3.2/HeuristicLab.Hive.Server.Console-3.2.csproj
r1534 r1832 89 89 </ItemGroup> 90 90 <ItemGroup> 91 <Compile Include="AddGroup.cs"> 92 <SubType>Form</SubType> 93 </Compile> 94 <Compile Include="AddGroup.Designer.cs"> 95 <DependentUpon>AddGroup.cs</DependentUpon> 96 </Compile> 91 97 <Compile Include="AddJobForm.cs"> 92 98 <SubType>Form</SubType> … … 111 117 <Compile Include="HiveServerConsolePlugin.cs" /> 112 118 <Compile Include="Properties\AssemblyInfo.cs" /> 119 <EmbeddedResource Include="AddGroup.resx"> 120 <DependentUpon>AddGroup.cs</DependentUpon> 121 </EmbeddedResource> 113 122 <EmbeddedResource Include="AddJobForm.resx"> 114 123 <DependentUpon>AddJobForm.cs</DependentUpon> -
trunk/sources/HeuristicLab.Hive.Server.Console/3.2/HiveServerConsole.cs
r1753 r1832 44 44 tbIp.Text = "10.20.53.1"; 45 45 tbPort.Text = WcfSettings.GetDefaultPort().ToString(); 46 tbUserName.Text = " a";47 tbPwd.Text = " a";46 tbUserName.Text = "test45"; 47 tbPwd.Text = "test"; 48 48 } 49 49 … … 62 62 newIp = newIp.Replace(" ", ""); 63 63 64 65 64 ServiceLocator.Address = newIp; 65 ServiceLocator.Port = this.tbPort.Text; 66 66 67 if (IsValid()) { 68 this.Visible = false; 69 information = new HiveServerManagementConsole(); 70 information.closeFormEvent += new closeForm(EnableForm); 71 information.Show(); 72 } 67 if (IsValid()) { 68 this.Visible = false; 69 information = new HiveServerManagementConsole(); 70 information.closeFormEvent += new closeForm(EnableForm); 71 information.Show(); 72 } else { 73 lblError.Text = "Problem with login"; 74 } 73 75 } 74 76 -
trunk/sources/HeuristicLab.Hive.Server.Console/3.2/HiveServerManagementConsole.Designer.cs
r1774 r1832 87 87 this.btnRefresh = new System.Windows.Forms.Button(); 88 88 this.tvClientControl = new System.Windows.Forms.TreeView(); 89 this.contextMenuGroup = new System.Windows.Forms.ContextMenuStrip(this.components); 90 this.menuItemAddGroup = new System.Windows.Forms.ToolStripMenuItem(); 91 this.menuItemDeleteGroup = new System.Windows.Forms.ToolStripMenuItem(); 89 92 this.lvClientControl = new System.Windows.Forms.ListView(); 90 93 this.tcManagementConsole = new System.Windows.Forms.TabControl(); … … 110 113 this.splitContainer1.Panel2.SuspendLayout(); 111 114 this.splitContainer1.SuspendLayout(); 115 this.contextMenuGroup.SuspendLayout(); 112 116 this.tcManagementConsole.SuspendLayout(); 113 117 this.SuspendLayout(); … … 354 358 this.lvJobDetails.FullRowSelect = true; 355 359 this.lvJobDetails.GridLines = true; 356 this.lvJobDetails.Location = new System.Drawing.Point( 20, 129);360 this.lvJobDetails.Location = new System.Drawing.Point(17, 129); 357 361 this.lvJobDetails.Name = "lvJobDetails"; 358 this.lvJobDetails.Size = new System.Drawing.Size(3 75, 137);362 this.lvJobDetails.Size = new System.Drawing.Size(382, 175); 359 363 this.lvJobDetails.TabIndex = 17; 360 364 this.lvJobDetails.UseCompatibleStateImageBehavior = false; … … 369 373 // 370 374 this.chDetails.Text = "Details"; 371 this.chDetails.Width = 2 47;375 this.chDetails.Width = 255; 372 376 // 373 377 // lvSnapshots … … 380 384 this.lvSnapshots.FullRowSelect = true; 381 385 this.lvSnapshots.GridLines = true; 382 this.lvSnapshots.Location = new System.Drawing.Point(17, 269);386 this.lvSnapshots.Location = new System.Drawing.Point(17, 310); 383 387 this.lvSnapshots.Name = "lvSnapshots"; 384 this.lvSnapshots.Size = new System.Drawing.Size(382, 102);388 this.lvSnapshots.Size = new System.Drawing.Size(382, 69); 385 389 this.lvSnapshots.TabIndex = 16; 386 390 this.lvSnapshots.UseCompatibleStateImageBehavior = false; … … 390 394 // 391 395 this.chClientCalculated.Text = "Client Calculated"; 392 this.chClientCalculated.Width = 88;396 this.chClientCalculated.Width = 112; 393 397 // 394 398 // chProgress 395 399 // 396 400 this.chProgress.Text = "Progress"; 397 this.chProgress.Width = 67;401 this.chProgress.Width = 100; 398 402 // 399 403 // chSnapshotTime … … 686 690 // tvClientControl 687 691 // 692 this.tvClientControl.AllowDrop = true; 693 this.tvClientControl.ContextMenuStrip = this.contextMenuGroup; 688 694 this.tvClientControl.Dock = System.Windows.Forms.DockStyle.Top; 689 695 this.tvClientControl.Location = new System.Drawing.Point(0, 0); … … 691 697 this.tvClientControl.Size = new System.Drawing.Size(151, 357); 692 698 this.tvClientControl.TabIndex = 0; 699 this.tvClientControl.MouseUp += new System.Windows.Forms.MouseEventHandler(this.tvClientControl_MouseUp); 693 700 this.tvClientControl.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.tvClientControl_NodeMouseClick); 701 // 702 // contextMenuGroup 703 // 704 this.contextMenuGroup.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 705 this.menuItemAddGroup, 706 this.menuItemDeleteGroup}); 707 this.contextMenuGroup.Name = "contextMenuJob"; 708 this.contextMenuGroup.Size = new System.Drawing.Size(149, 48); 709 // 710 // menuItemAddGroup 711 // 712 this.menuItemAddGroup.Name = "menuItemAddGroup"; 713 this.menuItemAddGroup.Size = new System.Drawing.Size(148, 22); 714 this.menuItemAddGroup.Text = "Add Group"; 715 // 716 // menuItemDeleteGroup 717 // 718 this.menuItemDeleteGroup.Name = "menuItemDeleteGroup"; 719 this.menuItemDeleteGroup.Size = new System.Drawing.Size(148, 22); 720 this.menuItemDeleteGroup.Text = "Delete Group"; 694 721 // 695 722 // lvClientControl … … 764 791 this.splitContainer1.Panel2.ResumeLayout(false); 765 792 this.splitContainer1.ResumeLayout(false); 793 this.contextMenuGroup.ResumeLayout(false); 766 794 this.tcManagementConsole.ResumeLayout(false); 767 795 this.ResumeLayout(false); … … 836 864 private System.Windows.Forms.Button btnRefresh; 837 865 private System.Windows.Forms.TreeView tvClientControl; 866 private System.Windows.Forms.ContextMenuStrip contextMenuGroup; 867 private System.Windows.Forms.ToolStripMenuItem menuItemAddGroup; 868 private System.Windows.Forms.ToolStripMenuItem menuItemDeleteGroup; 838 869 } 839 870 } -
trunk/sources/HeuristicLab.Hive.Server.Console/3.2/HiveServerManagementConsole.cs
r1774 r1832 58 58 private Job currentJob = null; 59 59 private ClientInfo currentClient = null; 60 60 61 61 TreeNode currentNode = null; 62 62 … … 132 132 }; 133 133 134 //adding group 135 menuItemAddGroup.Click += (s, e) => { 136 AddGroup addgroup = new AddGroup(); 137 parentgroup = Guid.Empty; 138 if ((tvClientControl.SelectedNode != null) && (((ClientGroup)tvClientControl.SelectedNode.Tag).Id != Guid.Empty)) { 139 parentgroup = ((ClientGroup)tvClientControl.SelectedNode.Tag).Id; 140 } 141 addgroup.addGroupEvent += new AddGroupDelegate(addgroup_addGroupEvent); 142 addgroup.Show(); 143 }; 144 145 //adding group 146 menuItemDeleteGroup.Click += (s, e) => { 147 IClientManager clientManager = ServiceLocator.GetClientManager(); 148 if (tvClientControl.SelectedNode != null) { 149 // Delete Group 150 } 151 }; 152 } 153 154 Guid parentgroup = Guid.Empty; 155 156 void addgroup_addGroupEvent(string name) { 157 IClientManager clientManager = ServiceLocator.GetClientManager(); 158 159 if (parentgroup != Guid.Empty) { 160 ClientGroup cg = new ClientGroup() { Name = name }; 161 ResponseObject<ClientGroup> respcg = clientManager.AddClientGroup(cg); 162 Response res = clientManager.AddResourceToGroup(parentgroup, respcg.Obj); 163 if (res != null && !res.Success) { 164 MessageBox.Show(res.StatusMessage, "Error adding Group", MessageBoxButtons.OK, MessageBoxIcon.Error); 165 } 166 } else { 167 ClientGroup cg = new ClientGroup() { Name = name }; 168 clientManager.AddClientGroup(cg); 169 } 170 134 171 } 135 172 … … 150 187 } 151 188 152 ///// <summary>153 ///// Adds clients to ListView and TreeView154 ///// </summary>155 //private void AddClients() {156 // try {157 // clientObjects = new Dictionary<Guid, ListViewGroup>();158 // clientInfoObjects = new Dictionary<Guid, ListViewItem>();159 160 // clients = ClientManager.GetAllClientGroups();161 162 // List<Guid> inGroup = new List<Guid>();163 // foreach (ClientGroup cg in clients.List) {164 // TreeNode tn = new TreeNode(cg.Name);165 // tn.Tag = cg;166 // tvClientControl.Nodes.Add(tn);167 168 // ListViewGroup lvg = new ListViewGroup(cg.Name, HorizontalAlignment.Left);169 170 // foreach (ClientInfo ci in cg.Resources) {171 // ListViewItem item = null;172 // if ((ci.State == State.offline) || (ci.State == State.nullState)) {173 // item = new ListViewItem(ci.Name, 3, lvg);174 // } else {175 // int percentageUsage = CapacityRam(ci.NrOfCores, ci.NrOfFreeCores);176 // int usage = 0;177 // if ((percentageUsage >= 0) && (percentageUsage <= 25)) {178 // usage = 0;179 // } else if ((percentageUsage > 25) && (percentageUsage <= 75)) {180 // usage = 1;181 // } else if ((percentageUsage > 75) && (percentageUsage <= 100)) {182 // usage = 2;183 // }184 185 // item = new ListViewItem(ci.Name, usage, lvg);186 // }187 // item.Tag = ci.Id;188 // lvClientControl.Items.Add(item);189 // clientInfoObjects.Add(ci.Id, item);190 // inGroup.Add(ci.Id);191 192 // }193 // lvClientControl.BeginUpdate();194 // lvClientControl.Groups.Add(lvg);195 // lvClientControl.EndUpdate();196 // clientObjects.Add(cg.Id, lvg);197 // } // Groups198 199 // clientInfo = ClientManager.GetAllClients();200 // ListViewGroup lvunsorted = new ListViewGroup("no group", HorizontalAlignment.Left);201 // foreach (ClientInfo ci in clientInfo.List) {202 // bool help = false;203 // foreach (Guid client in inGroup) {204 // if (client == ci.Id) {205 // help = true;206 // break;207 // }208 // }209 // if (!help) {210 // ListViewItem item = null;211 // if ((ci.State == State.offline) || (ci.State == State.nullState)) {212 // item = new ListViewItem(ci.Name, 3, lvunsorted);213 // } else {214 // int percentageUsage = CapacityRam(ci.NrOfCores, ci.NrOfFreeCores);215 // int usage = 0;216 // if ((percentageUsage >= 0) && (percentageUsage <= 25)) {217 // usage = 0;218 // } else if ((percentageUsage > 25) && (percentageUsage <= 75)) {219 // usage = 1;220 // } else if ((percentageUsage > 75) && (percentageUsage <= 100)) {221 // usage = 2;222 // }223 // item = new ListViewItem(ci.Name, usage, lvunsorted);224 // }225 // item.Tag = ci.Id;226 // lvClientControl.Items.Add(item);227 // }228 // }229 // lvClientControl.BeginUpdate();230 // lvClientControl.Groups.Add(lvunsorted);231 // lvClientControl.EndUpdate();232 // if (flagClient) {233 // ClientClicked();234 // }235 // }236 // catch (Exception ex) {237 // closeFormEvent(true, true);238 // this.Close();239 // }240 //}241 242 189 private void AddClients() { 243 190 clientList.Clear(); … … 256 203 } 257 204 tvClientControl.ExpandAll(); 258 Thread.Sleep(5000);259 205 } 260 206 … … 343 289 lvi.ToolTipText = (job.Percentage * 100) + "% of job calculated"; 344 290 } else if (job.State == State.finished) { 345 ListViewItem lvi = new ListViewItem(job.Id.ToString(), 0, lvJobFinished);291 ListViewItem lvi = new ListViewItem(job.Id.ToString(), 0, lvJobFinished); 346 292 lvi.Tag = job; 347 293 jobObjects.Add(job.Id, lvi); … … 385 331 currentClient = (ClientInfo)lvClientControl.SelectedItems[0].Tag; 386 332 } 387 if (currentClient != null) {388 int percentageUsage = CapacityRam(currentClient.NrOfCores, currentClient.NrOfFreeCores);389 int usage = 3;390 if ((currentClient.State != State.offline) && (currentClient.State != State.nullState)) {391 if ((percentageUsage >= 0) && (percentageUsage <= 25)) {392 usage = 0;393 } else if ((percentageUsage > 25) && (percentageUsage <= 75)) {394 usage = 1;395 } else if ((percentageUsage > 75) && (percentageUsage <= 100)) {396 usage = 2;397 }398 }399 pbClientControl.Image = ilLargeImgClient.Images[usage];400 lblClientName.Text = currentClient.Name;401 lblLogin.Text = currentClient.Login.ToString();402 lblState.Text = currentClient.State.ToString();333 if (currentClient != null) { 334 int percentageUsage = CapacityRam(currentClient.NrOfCores, currentClient.NrOfFreeCores); 335 int usage = 3; 336 if ((currentClient.State != State.offline) && (currentClient.State != State.nullState)) { 337 if ((percentageUsage >= 0) && (percentageUsage <= 25)) { 338 usage = 0; 339 } else if ((percentageUsage > 25) && (percentageUsage <= 75)) { 340 usage = 1; 341 } else if ((percentageUsage > 75) && (percentageUsage <= 100)) { 342 usage = 2; 343 } 344 } 345 pbClientControl.Image = ilLargeImgClient.Images[usage]; 346 lblClientName.Text = currentClient.Name; 347 lblLogin.Text = currentClient.Login.ToString(); 348 lblState.Text = currentClient.State.ToString(); 403 349 } 404 350 } … … 437 383 lvJobDetails.Items.Add(lvi); 438 384 439 440 441 442 443 385 lvi = null; 386 lvi = new ListViewItem(); 387 lvi.Text = "created at:"; 388 lvi.SubItems.Add(currentJob.DateCreated.ToString()); 389 lvJobDetails.Items.Add(lvi); 444 390 445 391 if (currentJob.ParentJob != null) { … … 449 395 lvi.SubItems.Add(currentJob.ParentJob.ToString()); 450 396 lvJobDetails.Items.Add(lvi); 451 // lblParentJob.Text = currentJob.ParentJob.Id + " is parent job";397 // lblParentJob.Text = currentJob.ParentJob.Id + " is parent job"; 452 398 }// else { 453 399 // lblParentJob.Text = ""; … … 460 406 lvJobDetails.Items.Add(lvi); 461 407 462 // lblPriorityJob.Text = "Priority of job is " + currentJob.Priority;408 // lblPriorityJob.Text = "Priority of job is " + currentJob.Priority; 463 409 if (currentJob.Client != null) { 464 410 lvi = null; … … 482 428 ServiceLocator.GetJobManager(); 483 429 ResponseObject<JobResult> jobRes = jobManager.GetLastJobResultOf(currentJob.Id, false); 484 430 485 431 lvi = null; 486 432 lvi = new ListViewItem(); … … 488 434 lvi.SubItems.Add(jobRes.Obj.DateFinished.ToString()); 489 435 lvJobDetails.Items.Add(lvi); 490 // lblJobCalculationEnd.Text = "Calculation ended at " + jobRes.Obj.DateFinished;436 // lblJobCalculationEnd.Text = "Calculation ended at " + jobRes.Obj.DateFinished; 491 437 } 492 438 } else { 493 // lblClientCalculating.Text = "";494 // lblJobCalculationBegin.Text = "";495 // lblJobCalculationEnd.Text = "";439 // lblClientCalculating.Text = ""; 440 // lblJobCalculationBegin.Text = ""; 441 // lblJobCalculationEnd.Text = ""; 496 442 } 497 443 if (currentJob.State != State.offline) { 498 444 lvSnapshots.Items.Clear(); 499 if (currentJob.State == State.finished)500 501 lvSnapshots.Visible = true;445 //if (currentJob.State == State.finished) 446 GetSnapshotList(); 447 //lvSnapshots.Visible = true; 502 448 } else { 503 449 lvSnapshots.Visible = false; … … 686 632 //ResponseList<ClientGroup> clientsOld = clients; 687 633 688 // newClients = ClientManager.GetAllClientGroups();634 // newClients = ClientManager.GetAllClientGroups(); 689 635 690 636 //IDictionary<Guid, ClientGroup> clientsOldHelp; … … 795 741 796 742 private void DetermineDelta() { 797 798 799 800 } 801 743 744 } 802 745 803 746 //private void GetDelta(IList<ClientGroup> oldClient, IDictionary<Guid, ClientGroup> helpClients) { … … 896 839 IJobManager jobManager = ServiceLocator.GetJobManager(); 897 840 898 ResponseObject<JobResult> jobRes = jobManager.GetLastJobResultOf(currentJob.Id, false); 899 900 // iterate threw all snapshots if method is implemented 901 902 ListViewItem curSnapshot = new ListViewItem(jobRes.Obj.Client.Name); 903 double percentage = jobRes.Obj.Percentage * 100; 904 curSnapshot.SubItems.Add(percentage.ToString() + " %"); 905 curSnapshot.SubItems.Add(jobRes.Obj.Timestamp.ToString()); 906 lvSnapshots.Items.Add(curSnapshot); 841 ResponseList<JobResult> jobRes = jobManager.GetAllJobResults(currentJob.Id); 842 843 if (jobRes.List != null) { 844 foreach (JobResult jobresult in jobRes.List) { 845 ListViewItem curSnapshot = new ListViewItem(jobresult.Client.Name); 846 double percentage = jobresult.Percentage * 100; 847 curSnapshot.SubItems.Add(percentage.ToString() + " %"); 848 curSnapshot.SubItems.Add(jobresult.Timestamp.ToString()); 849 lvSnapshots.Items.Add(curSnapshot); 850 } 851 } 852 853 if ((jobRes.List == null) && (jobRes.List.Count == 0)) { 854 lvSnapshots.Visible = false; 855 } else { 856 lvSnapshots.Visible = true; 857 } 858 907 859 } 908 860 … … 959 911 private void Refresh_Click(object sender, EventArgs e) { 960 912 Form overlayingForm = new Form(); 961 //Label loadingLabel = new Label();962 //loadingLabel.Text = "Loading";963 //loadingLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));964 //loadingLabel.Location = new Point(this.Width / 2, this.Height / 2);965 //overlayingForm.Controls.Add(loadingLabel);966 967 913 968 914 overlayingForm.Show(); … … 971 917 overlayingForm.Opacity = 0.4; 972 918 overlayingForm.Size = this.Size; 973 //overlayingForm.PointToClient(new Point(this.Left, this.Top));974 919 overlayingForm.Location = this.Location; 975 Console.WriteLine(this.Left + ", " + this.Top); 976 //overlayingForm.Left = this.Left; 977 //overlayingForm.Top = this.Top; 978 979 980 981 920 921 //Label lbl = new Label(); 922 //overlayingForm.Controls.Add(lbl); 923 //lbl.AutoSize = true; 924 //lbl.Text = "Loading"; 925 //lbl.Name = "lblName"; 926 //lbl.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 927 //lbl.ForeColor = Color.Black; 928 //lbl.BackColor = Color.Transparent; 929 //lbl.Location = new Point(overlayingForm.Width / 2, overlayingForm.Height / 2); 982 930 983 931 AddClients(); 984 932 985 933 overlayingForm.Close(); 934 } 935 936 private void tvClientControl_MouseUp(object sender, MouseEventArgs e) { 937 // If the right mouse button was clicked and released, 938 // display the shortcut menu assigned to the ListView. 939 contextMenuGroup.Items.Clear(); 940 TreeViewHitTestInfo hitTestInfo = tvClientControl.HitTest(e.Location); 941 tvClientControl.SelectedNode = hitTestInfo.Node; 942 if (e.Button != MouseButtons.Right) return; 943 if (hitTestInfo.Node != null) { 944 Resource selectedGroup = (Resource)tvClientControl.SelectedNode.Tag; 945 946 if (selectedGroup != null) { 947 contextMenuGroup.Items.Add(menuItemAddGroup); 948 contextMenuGroup.Items.Add(menuItemDeleteGroup); 949 } 950 } else { 951 contextMenuGroup.Items.Add(menuItemAddGroup); 952 } 953 tvClientControl.ContextMenuStrip.Show(new Point(e.X, e.Y)); 986 954 } 987 955 } -
trunk/sources/HeuristicLab.Hive.Server.Console/3.2/HiveServerManagementConsole.resx
r1774 r1832 331 331 </value> 332 332 </data> 333 <metadata name="contextMenuGroup.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 334 <value>504, 38</value> 335 </metadata> 333 336 <metadata name="contextMenuJob.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 334 <value>2 52, 44</value>337 <value>246, 40</value> 335 338 </metadata> 336 339 <metadata name="ilSmallImgJob.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
Note: See TracChangeset
for help on using the changeset viewer.