Changeset 7433
- Timestamp:
- 01/31/12 15:25:18 (13 years ago)
- Location:
- branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/CloudManagerClient.cs
r7387 r7433 139 139 } 140 140 if (HostedServices.Contains(hostedService)) { 141 HostedServices.Remove(hostedService); 141 //HostedServices.Remove(hostedService); 142 HostedService hs = HostedServices[HostedServices.IndexOf(hostedService)]; 143 hs.Merge(hostedService); 144 145 } else { 146 HostedServices.Add(hostedService); 142 147 } 143 HostedServices.Add(hostedService);144 148 } 145 149 -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Model/Deployment.cs
r7429 r7433 99 99 //this.Modified = deployment.Modified; 100 100 //this.NewInstanceCount = deployment.NewInstanceCount; 101 102 if (!this.Modified) { 103 this.Modified = deployment.Modified; 104 this.NewInstanceCount = deployment.NewInstanceCount; 105 } 101 106 } 102 107 } -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Model/HostedService.cs
r7402 r7433 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using HeuristicLab.Common; … … 61 62 return new HostedService(this, cloner); 62 63 } 64 65 public void Merge(HostedService hostedService) { 66 if (!this.Equals(hostedService)) { 67 throw new ArgumentException("Objects must be equal to be merged.", "subscription"); 68 } 69 this.ServiceName = hostedService.ServiceName; 70 this.Url = hostedService.Url; 71 this.Subscription = hostedService.Subscription; 72 this.HostedServiceProperties = hostedService.HostedServiceProperties; 73 74 foreach (Deployment dep in hostedService.Deployments) { 75 int idx = this.Deployments.IndexOf(dep); 76 if (idx != -1) { 77 this.Deployments[idx].Merge(dep); 78 } else { 79 this.Deployments.Add(dep); 80 } 81 } 82 83 foreach (Deployment dep in this.Deployments) { 84 int idx = hostedService.Deployments.IndexOf(dep); 85 if (idx == -1) { 86 this.Deployments.Remove(dep); 87 } 88 } 89 } 63 90 } 64 91 } -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/CloudResourcesView.cs
r7403 r7433 101 101 viewHost.Content = null; 102 102 treeCloudResources.Nodes.Clear(); 103 } else {103 } else if (treeCloudResources.Nodes.Count == 0) { 104 104 treeCloudResources.BeginUpdate(); 105 treeCloudResources.Nodes.Clear();105 //treeCloudResources.Nodes.Clear(); 106 106 foreach (Subscription sub in Content) { 107 TreeNode nodeSub = new TreeNode(); 108 nodeSub.Tag = sub; 109 nodeSub.Text = sub.SubscriptionName; 110 nodeSub.ImageIndex = subscriptionImageIndex; 111 nodeSub.SelectedImageIndex = nodeSub.ImageIndex; 112 107 TreeNode nodeSub = GetTreeNode(sub, sub.SubscriptionName, subscriptionImageIndex); 113 108 foreach (HostedService s in HostedServices) { 114 109 if (s.Subscription.SubscriptionID == sub.SubscriptionID) { 115 TreeNode nodeServ = new TreeNode(); 116 nodeServ.Tag = s; 117 nodeServ.Text = s.HostedServiceProperties.Label; 118 nodeServ.ImageIndex = serviceImageIndex; 119 nodeServ.SelectedImageIndex = nodeServ.ImageIndex; 120 110 TreeNode nodeServ = GetTreeNode(s, s.HostedServiceProperties.Label, serviceImageIndex); 121 111 foreach (Deployment d in s.Deployments) { 122 TreeNode nodeDepl = new TreeNode(); 123 nodeDepl.Tag = d; 124 nodeDepl.Text = d.Label + " (" + d.DeploymentSlot + ")"; 125 nodeDepl.ImageIndex = deploymentImageIndex; 126 nodeDepl.SelectedImageIndex = nodeDepl.ImageIndex; 112 TreeNode nodeDepl = GetTreeNode(d, d.Label + " (" + d.DeploymentSlot + ")", deploymentImageIndex); 127 113 nodeServ.Nodes.Add(nodeDepl); 128 114 } … … 133 119 } 134 120 treeCloudResources.EndUpdate(); 135 } 121 } else { 122 treeCloudResources.BeginUpdate(); 123 TreeNodeCollection tncSubs = treeCloudResources.Nodes; 124 125 // Delete treenodes that have no corresponding data in Content and HosteServices 126 foreach (TreeNode tnSub in tncSubs) { 127 Subscription s = (Subscription)tnSub.Tag; 128 int idx = Content.IndexOf(s); 129 if (idx == -1) { 130 tncSubs.Remove(tnSub); 131 } else { 132 TreeNodeCollection tncHS = tnSub.Nodes; 133 foreach (TreeNode tnHS in tncHS) { 134 HostedService hs = (HostedService)tnHS.Tag; 135 int idxHS = HostedServices.IndexOf(hs); 136 if (idxHS == -1) { 137 tncHS.Remove(tnHS); 138 } else { 139 TreeNodeCollection tncDep = tnHS.Nodes; 140 foreach (TreeNode tnDep in tncDep) { 141 Deployment dep = (Deployment)tnDep.Tag; 142 HostedService hsDep = HostedServices[idxHS]; 143 int idxDep = hsDep.Deployments.IndexOf(dep); 144 if (idxDep == -1) { 145 tncDep.Remove(tnDep); 146 } 147 } 148 } 149 } 150 } 151 } 152 153 // Add missing treenodes 154 foreach (Subscription sub in Content) { 155 bool foundSub = false; 156 TreeNode foundSubNode = null; 157 foreach (TreeNode tnSub in treeCloudResources.Nodes) { 158 if (((Subscription)tnSub.Tag).Equals(sub)) { 159 foundSub = true; 160 foundSubNode = tnSub; 161 } 162 } 163 TreeNode nodeSub; 164 if (!foundSub) { 165 nodeSub = GetTreeNode(sub, sub.SubscriptionName, subscriptionImageIndex); 166 treeCloudResources.Nodes.Add(nodeSub); 167 } else { 168 nodeSub = foundSubNode; 169 } 170 foreach (HostedService s in HostedServices) { 171 if (s.Subscription.SubscriptionID == sub.SubscriptionID) { 172 bool foundHS = false; 173 TreeNode foundHSNode = null; 174 foreach (TreeNode tnHS in nodeSub.Nodes) { 175 if (((HostedService)tnHS.Tag).Equals(s)) { 176 foundHS = true; 177 foundHSNode = tnHS; 178 } 179 } 180 TreeNode nodeServ; 181 if (!foundHS) { 182 nodeServ = GetTreeNode(s, s.HostedServiceProperties.Label, serviceImageIndex); 183 nodeSub.Nodes.Add(nodeServ); 184 } else { 185 nodeServ = foundHSNode; 186 } 187 foreach (Deployment d in s.Deployments) { 188 bool foundDep = false; 189 TreeNode foundDepNode; 190 foreach (TreeNode tnDep in nodeServ.Nodes) { 191 if (((Deployment)tnDep.Tag).Equals(d)) { 192 foundDep = true; 193 foundDepNode = tnDep; 194 } 195 } 196 TreeNode nodeDepl; 197 if (!foundDep) { 198 nodeDepl = GetTreeNode(d, d.Label + " (" + d.DeploymentSlot + ")", deploymentImageIndex); 199 nodeServ.Nodes.Add(nodeDepl); 200 } else { 201 // nothing to do 202 } 203 } 204 } 205 } 206 } 207 // ---------------------------- 208 treeCloudResources.EndUpdate(); 209 } 210 } 211 212 private TreeNode GetTreeNode(Object tag, string text, int imageIndex) { 213 TreeNode node = new TreeNode(); 214 node.Tag = tag; 215 node.Text = text; 216 node.ImageIndex = imageIndex; 217 node.SelectedImageIndex = node.ImageIndex; 218 return node; 136 219 } 137 220 -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/DeploymentView.Designer.cs
r7403 r7433 37 37 this.label6 = new System.Windows.Forms.Label(); 38 38 this.txtInstanceCount = new System.Windows.Forms.TextBox(); 39 this.lblChanges = new System.Windows.Forms.Label(); 39 40 ((System.ComponentModel.ISupportInitialize)(this.tbChangeCores)).BeginInit(); 40 41 this.SuspendLayout(); … … 165 166 this.txtInstanceCount.TabIndex = 12; 166 167 // 168 // lblChanges 169 // 170 this.lblChanges.AutoSize = true; 171 this.lblChanges.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 172 this.lblChanges.Location = new System.Drawing.Point(127, 216); 173 this.lblChanges.Name = "lblChanges"; 174 this.lblChanges.Size = new System.Drawing.Size(0, 13); 175 this.lblChanges.TabIndex = 13; 176 // 167 177 // DeploymentView 168 178 // 169 179 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 170 180 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 181 this.Controls.Add(this.lblChanges); 171 182 this.Controls.Add(this.txtInstanceCount); 172 183 this.Controls.Add(this.label6); … … 205 216 private System.Windows.Forms.Label label6; 206 217 private System.Windows.Forms.TextBox txtInstanceCount; 218 private System.Windows.Forms.Label lblChanges; 207 219 } 208 220 } -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/DeploymentView.cs
r7403 r7433 9 9 [Content(typeof(Deployment), IsDefaultView = true)] 10 10 public partial class DeploymentView : ItemView { 11 private const string SaveChangesString = "Save changes to take effect."; 11 12 public new Deployment Content { 12 13 get { return (Deployment)base.Content; } … … 42 43 tbChangeCores.Minimum = 1; 43 44 tbChangeCores.Maximum = Content.Subscription.MaxCoreCount; 44 tbChangeCores.Value = Content.RoleInstanceList.Count; 45 if (Content.Modified) { 46 tbChangeCores.Value = Content.NewInstanceCount; 47 lblChanges.Text = SaveChangesString; 48 } else { 49 tbChangeCores.Value = Content.RoleInstanceList.Count; 50 } 45 51 46 52 txtCoresUsed.Text = (tbChangeCores.Value * GetCoresFromInstanceSize(txtInstanceSize.Text)).ToString(); … … 55 61 int cores = tbValue * (int)size; 56 62 txtCoresUsed.Text = cores.ToString(); 63 64 if (Content.RoleInstanceList.Count != tbValue) { 65 Content.Modified = true; 66 lblChanges.Text = SaveChangesString; 67 } else { 68 Content.Modified = false; 69 lblChanges.Text = string.Empty; 70 } 71 72 Content.NewInstanceCount = tbValue; 57 73 } 58 74
Note: See TracChangeset
for help on using the changeset viewer.