Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7429


Ignore:
Timestamp:
01/30/12 17:39:27 (12 years ago)
Author:
spimming
Message:

#1680:

  • ChangeInstanceCount method added
  • Deployment: added properties to indicate modification and the new instance count
  • Textbox validation
  • Form resized
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/Azure/AzureProvider.cs

    r7424 r7429  
    168168      return services;
    169169    }
     170
     171    public string ChangeInstanceCount(Subscription subscription, string serviceName, string deploymentSlot, string roleName, int instanceCount) {
     172      if (subscription == null) {
     173        throw new ArgumentNullException("Subscription must not be null.", "subscription");
     174      }
     175      return ServiceManagementOperation.ChangeInstanceCount(subscription.SubscriptionID, subscription.CertificateThumbprint, serviceName, deploymentSlot, roleName, instanceCount);
     176    }
    170177  }
    171178}
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/IAzureProvider.cs

    r7386 r7429  
    3838
    3939    List<HostedService> DiscoverSlaveService(Subscription subscription);
     40    string ChangeInstanceCount(Subscription subscription, string serviceName, string deploymentSlot, string roleName, int instanceCount);
     41
    4042  }
    4143}
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/ServiceManagementOperation.cs

    r7421 r7429  
    232232    }
    233233
     234    public static string ChangeInstanceCount(string subscriptionId, string thumbprint, string serviceName, string deploymentSlot, string roleName, int instanceCount) {
     235      string requestId = string.Empty;
     236      XElement configuration = LoadConfiguration(subscriptionId, thumbprint, serviceName, deploymentSlot);
     237      if (instanceCount != GetInstanceCount(configuration, roleName)) {
     238        SetInstanceCount(configuration, roleName, instanceCount);
     239        requestId = SaveConfiguration(subscriptionId, thumbprint, serviceName, deploymentSlot, configuration);
     240      }
     241      return requestId;
     242    }
     243
    234244    public static string GetOperationStatus(string subscriptionId, string thumbprint, string requestId) {
    235245      string uri = string.Format(Constants.URIGetOperationStatusFormat, subscriptionId, requestId);
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Model/Deployment.cs

    r7402 r7429  
    3838    public List<Role> RoleList { get; set; }
    3939    public Subscription Subscription { get; set; }
     40    public bool Modified { get; set; }
     41    public int NewInstanceCount { get; set; }
    4042
    4143    public Deployment() {
    42 
     44      this.Modified = false;
    4345    }
    4446
     
    5658      this.RoleList = new List<Role>(original.RoleList);
    5759      this.Subscription = cloner.Clone(original.Subscription);
     60      this.Modified = original.Modified;
     61      this.NewInstanceCount = original.NewInstanceCount;
    5862
    5963    }
     
    9397      this.RoleList = deployment.RoleList;
    9498      this.Subscription = deployment.Subscription;
     99      //this.Modified = deployment.Modified;
     100      //this.NewInstanceCount = deployment.NewInstanceCount;
    95101    }
    96102  }
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.Designer.cs

    r7424 r7429  
    7474      this.cmbChooseSubscription.Location = new System.Drawing.Point(15, 25);
    7575      this.cmbChooseSubscription.Name = "cmbChooseSubscription";
    76       this.cmbChooseSubscription.Size = new System.Drawing.Size(471, 21);
     76      this.cmbChooseSubscription.Size = new System.Drawing.Size(486, 21);
    7777      this.cmbChooseSubscription.TabIndex = 2;
    7878      this.cmbChooseSubscription.SelectedValueChanged += new System.EventHandler(this.cmbChooseSubscription_SelectedValueChanged);
     
    9292      this.cmbChooseHostedService.Location = new System.Drawing.Point(15, 65);
    9393      this.cmbChooseHostedService.Name = "cmbChooseHostedService";
    94       this.cmbChooseHostedService.Size = new System.Drawing.Size(471, 21);
     94      this.cmbChooseHostedService.Size = new System.Drawing.Size(486, 21);
    9595      this.cmbChooseHostedService.TabIndex = 6;
    9696      //
     
    109109      this.gbNewHostedService.Location = new System.Drawing.Point(15, 115);
    110110      this.gbNewHostedService.Name = "gbNewHostedService";
    111       this.gbNewHostedService.Size = new System.Drawing.Size(469, 145);
     111      this.gbNewHostedService.Size = new System.Drawing.Size(486, 145);
    112112      this.gbNewHostedService.TabIndex = 7;
    113113      this.gbNewHostedService.TabStop = false;
     
    277277      this.tbInstanceCount.Location = new System.Drawing.Point(13, 378);
    278278      this.tbInstanceCount.Name = "tbInstanceCount";
    279       this.tbInstanceCount.Size = new System.Drawing.Size(469, 20);
     279      this.tbInstanceCount.Size = new System.Drawing.Size(488, 20);
    280280      this.tbInstanceCount.TabIndex = 13;
     281      this.tbInstanceCount.Validating += new System.ComponentModel.CancelEventHandler(this.tbInstanceCount_Validating);
    281282      //
    282283      // lblCores
    283284      //
    284285      this.lblCores.AutoSize = true;
    285       this.lblCores.Location = new System.Drawing.Point(452, 361);
     286      this.lblCores.Location = new System.Drawing.Point(471, 361);
    286287      this.lblCores.Name = "lblCores";
    287288      this.lblCores.Size = new System.Drawing.Size(30, 13);
     
    292293      //
    293294      this.label10.AutoSize = true;
    294       this.label10.Location = new System.Drawing.Point(417, 361);
     295      this.label10.Location = new System.Drawing.Point(436, 361);
    295296      this.label10.Name = "label10";
    296297      this.label10.Size = new System.Drawing.Size(40, 13);
     
    303304      this.progressBar.MarqueeAnimationSpeed = 10;
    304305      this.progressBar.Name = "progressBar";
    305       this.progressBar.Size = new System.Drawing.Size(307, 23);
     306      this.progressBar.Size = new System.Drawing.Size(326, 23);
    306307      this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
    307308      this.progressBar.TabIndex = 16;
     
    309310      // btnOk
    310311      //
    311       this.btnOk.Location = new System.Drawing.Point(326, 404);
     312      this.btnOk.Location = new System.Drawing.Point(345, 404);
    312313      this.btnOk.Name = "btnOk";
    313314      this.btnOk.Size = new System.Drawing.Size(75, 23);
     
    319320      // btnCancel
    320321      //
    321       this.btnCancel.Location = new System.Drawing.Point(407, 404);
     322      this.btnCancel.Location = new System.Drawing.Point(426, 404);
    322323      this.btnCancel.Name = "btnCancel";
    323324      this.btnCancel.Size = new System.Drawing.Size(75, 23);
     
    344345      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    345346      this.AutoValidate = System.Windows.Forms.AutoValidate.EnableAllowFocusChange;
    346       this.ClientSize = new System.Drawing.Size(496, 436);
     347      this.ClientSize = new System.Drawing.Size(517, 436);
    347348      this.Controls.Add(this.lblCertificateFile);
    348349      this.Controls.Add(this.lblCores);
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.cs

    r7424 r7429  
    306306          e.Cancel = true;
    307307        } else if (!isValidHostedServiceUrl(url)) {
    308           errorProvider.SetError(tbLabel, "A hosted service name must be between 1 and 63 " +
    309                                           "characters long, and be composed of letters, numbers " +
    310                                           "and hyphens. Hyphens shouldn't be first or last letter.");
     308          errorProvider.SetError(tbServiceName, "A hosted service name must be between 1 and 63 " +
     309                                                "characters long, and be composed of letters, numbers " +
     310                                                "and hyphens. Hyphens shouldn't be first or last letter.");
    311311          e.Cancel = true;
    312312        } else {
     
    336336      }
    337337    }
     338
     339    private void tbInstanceCount_Validating(object sender, CancelEventArgs e) {
     340      if (!isValidInstanceCount(tbInstanceCount.Text)) {
     341        errorProvider.SetError(tbInstanceCount, "Instance count must be a number greater than 0 and " +
     342                                                 "less or equal than the difference between maximum and available cores.");
     343        e.Cancel = true;
     344      } else {
     345        int instanceCount = Convert.ToInt32(tbInstanceCount.Text);
     346        Subscription subscription = (Subscription)cmbChooseSubscription.SelectedItem;
     347        if (instanceCount > subscription.MaxCoreCount - subscription.CurrentCoreCount) {
     348          errorProvider.SetError(tbInstanceCount, "Instance count must be less or equal than the difference between maximum and available cores.");
     349        } else {
     350          e.Cancel = true;
     351          errorProvider.SetError(tbInstanceCount, "");
     352        }
     353      }
     354    }
     355
     356    private bool isValidInstanceCount(string text) {
     357      string regexString = @"[1-9]+[0-9-]*";  //TODO
     358      Regex regex = new Regex(regexString);
     359      if (regex.IsMatch(text)) {
     360        return true;
     361      } else {
     362        return false;
     363      }
     364    }
    338365  }
    339366}
Note: See TracChangeset for help on using the changeset viewer.