Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/28/09 17:33:37 (15 years ago)
Author:
aleitner
Message:

contextmenu is on place where clicked
Add project form
expand add job form
(#626)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Server.Console/3.2/AddJobForm.cs

    r1753 r1937  
    4242    public event addDelegate addJobEvent;
    4343
    44     ResponseList<Job> jobGroups = null;
     44    ResponseList<Project> projects = null;
    4545    IJobManager jobManager;
     46    IClientManager clientManager;
     47    ResponseList<ClientGroup> clientGroups;
     48
     49    Dictionary<Guid, string> clients = null;
    4650
    4751    public AddJobForm() {
    4852      InitializeComponent();
     53
     54      clients = new Dictionary<Guid, string>();
    4955      AddJob();
     56
    5057    }
    5158
     
    5360      jobManager =
    5461        ServiceLocator.GetJobManager();
    55       jobGroups = jobManager.GetAllJobs();
    56       cbParJob.Items.Add("none");
    57       cbParJob.SelectedIndex = 0;
    58       foreach (Job job in jobGroups.List) {
    59         cbParJob.Items.Add(job.Id);
     62      projects = jobManager.GetAllProjects();
     63      cbProject.Items.Add("none");
     64      cbProject.SelectedIndex = 0;
     65      foreach (Project project in projects.List) {
     66        cbProject.Items.Add(project.Name);
    6067      }
     68
     69
     70    }
     71
     72    private void AddClientGroups() {
     73     foreach (ClientGroup cg in clientGroups.List) {
     74       clients.Add(cg.Id, cg.Name);
     75        AddClientOrGroup(cg);
     76      }
     77    }
     78
     79    private void AddClientOrGroup(ClientGroup clientGroup) {
     80      foreach (Resource resource in clientGroup.Resources) {
     81        if (resource is ClientGroup) {
     82          clients.Add(resource.Id, resource.Name);
     83          AddClientOrGroup(resource as ClientGroup);
     84        }
     85      }
     86   
    6187    }
    6288
     
    6793        if (numJobs > 0) {
    6894          for (int i = 0; i < numJobs; i++) {
    69             if (cbParJob.SelectedIndex != 0) {
    70               foreach (Job pjob in jobGroups.List) {
    71                 if (cbParJob.SelectedItem.ToString().Equals(pjob.Id.ToString())) {
    72                   Job job = new Job { ParentJob = pjob, State = State.offline, CoresNeeded = 1 };
    73                   job.SerializedJob = PersistenceManager.SaveToGZip(new TestJob());
    74                   Response resp = jobManager.AddNewJob(job);
    75                 }
    76               }
    77             } else {
    78               Job job = new Job { State = State.offline, CoresNeeded = 1 };
    79               job.SerializedJob = PersistenceManager.SaveToGZip(new TestJob());
    80               Response resp = jobManager.AddNewJob(job);
     95            if (cbProject.SelectedIndex != 0) {
     96            //  foreach (Job pjob in jobGroups.List) {
     97            //    if (cbParJob.SelectedItem.ToString().Equals(pjob.Id.ToString())) {
     98            //      Job job = new Job { ParentJob = pjob, State = State.offline, CoresNeeded = 1 };
     99            //      job.SerializedJob = PersistenceManager.SaveToGZip(new TestJob());
     100            //      Response resp = jobManager.AddNewJob(job);
     101            //    }
     102            //  }
     103            //} else {
     104            //  Job job = new Job { State = State.offline, CoresNeeded = 1 };
     105            //  job.SerializedJob = PersistenceManager.SaveToGZip(new TestJob());
     106            //  Response resp = jobManager.AddNewJob(job);
    81107            }
    82108          }
     
    99125    }
    100126
     127    private void cbAllGroups_CheckedChanged(object sender, EventArgs e) {
     128      foreach (Control control in gbGroups.Controls) {
     129        control.Enabled = !cbAllGroups.Checked;
     130      }
     131    }
     132
    101133
    102134  }
Note: See TracChangeset for help on using the changeset viewer.