Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/04/17 13:56:38 (7 years ago)
Author:
jkarder
Message:

#2839:

  • worked on hive administrator view
  • updated service clients
Location:
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/HeuristicLab.Clients.Hive.JobManager-3.3.csproj

    r14125 r15401  
    159159  </ItemGroup>
    160160  <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>
    161166    <ProjectReference Include="..\..\HeuristicLab.Clients.Hive.Views\3.3\HeuristicLab.Clients.Hive.Views-3.3.csproj">
    162167      <Project>{E1D6C801-892A-406A-B606-F158E36DD3C3}</Project>
  • branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/MenuItems/JobManagerMenuItem.cs

    r14185 r15401  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using System.Windows.Forms;
     25using HeuristicLab.Clients.Access;
    2426using HeuristicLab.MainForm;
    2527using HeuristicLab.Optimizer;
    2628
    2729namespace HeuristicLab.Clients.Hive.JobManager {
    28   public class JobManagerMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider {
     30  public class JobManagerMenuItem : MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider {
    2931    public override string Name {
    3032      get { return "&Job Manager"; }
    3133    }
     34
    3235    public override IEnumerable<string> Structure {
    3336      get { return new string[] { "&Services", "&Hive" }; }
    3437    }
     38
    3539    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      }
    3753    }
     54
    3855    public override int Position {
    3956      get { return 10000; }
    4057    }
     58
    4159    public override Keys ShortCutKeys {
    4260      get { return Keys.Control | Keys.H; }
  • branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.Designer.cs

    r14185 r15401  
    2121
    2222namespace HeuristicLab.Clients.Hive.JobManager.Views {
    23   partial class HiveResourceSelector {
     23  partial class HiveProjectSelector {
    2424    /// <summary>
    2525    /// Required designer variable.
     
    4646    private void InitializeComponent() {
    4747      this.components = new System.ComponentModel.Container();
    48       System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HiveResourceSelector));
    4948      this.resourcesGroupBox = new System.Windows.Forms.GroupBox();
    5049      this.splitContainer = new System.Windows.Forms.SplitContainer();
     
    7170      this.resourcesGroupBox.TabIndex = 0;
    7271      this.resourcesGroupBox.TabStop = false;
    73       this.resourcesGroupBox.Text = "Available Resources";
     72      this.resourcesGroupBox.Text = "Available Projects";
    7473      //
    7574      // splitContainer
     
    9594      // resourcesTreeView
    9695      //
    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) 
    9998            | System.Windows.Forms.AnchorStyles.Right)));
    10099      this.resourcesTreeView.CheckBoxes = true;
     
    128127      // searchTextBox
    129128      //
    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) 
    131130            | System.Windows.Forms.AnchorStyles.Right)));
    132131      this.searchTextBox.Location = new System.Drawing.Point(29, 3);
     
    139138      // descriptionTextBox
    140139      //
    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) 
    143142            | System.Windows.Forms.AnchorStyles.Right)));
    144143      this.descriptionTextBox.Font = new System.Drawing.Font("Courier New", 8.25F);
     
    154153      // HiveResourceSelector
    155154      //
    156       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    157155      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    158156      this.Controls.Add(this.resourcesGroupBox);
  • branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.cs

    r14185 r15401  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2424using System.Drawing;
    2525using System.Linq;
    26 using System.Text;
    2726using System.Windows.Forms;
    28 using HeuristicLab.Clients.Hive.JobManager.ExtensionMethods;
    2927using HeuristicLab.Core;
    3028using HeuristicLab.Core.Views;
     
    3331
    3432namespace HeuristicLab.Clients.Hive.JobManager.Views {
    35   [View("Hive Resource Selector View")]
    36   [Content(typeof(IItemList<Resource>), true)]
    37   public partial class HiveResourceSelector : 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;
    4038    private string currentSearchString;
    4139    private ISet<TreeNode> mainTreeNodes;
    4240    private ISet<TreeNode> filteredTreeNodes;
    4341    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 {
    4745      get { return selectedResources; }
    4846      set { selectedResources = value; }
    4947    }
    5048
    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; }
    5355      set { base.Content = value; }
    5456    }
    5557
    56     public HiveResourceSelector() {
     58    public HiveProjectSelector() {
    5759      InitializeComponent();
    5860      mainTreeNodes = new HashSet<TreeNode>();
    5961      filteredTreeNodes = new HashSet<TreeNode>();
    6062      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
    6668    public void StartProgressView() {
    6769      if (InvokeRequired) {
    6870        Invoke(new Action(StartProgressView));
    6971      } else {
    70         var message = "Downloading resources. Please be patient.";
     72        var message = "Downloading projects. Please be patient.";
    7173        MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, message);
    7274      }
     
    8587
    8688      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)));
    8890        UpdateMainTree();
    8991        ExtractStatistics();
     
    98100      mainTreeNodes.Clear();
    99101
    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);
    115115        }
    116116      }
     
    119119
    120120    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)) {
    122122        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;
    125124        stn.SelectedImageIndex = stn.ImageIndex;
    126125        stn.Tag = r;
     
    139138      foreach (TreeNode n in mainTreeNodes) {
    140139        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)) {
    142141          n.BackColor = string.IsNullOrEmpty(currentSearchString) ? SystemColors.Window : Color.LightBlue;
    143142          filteredTreeNodes.Add(n);
     
    162161
    163162      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);
    165164        if (clone == null) {
    166165          clone = (TreeNode)node.Clone();
     
    169168        }
    170169        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);
    173172            if (childClone == null) {
    174173              childClone = (TreeNode)child.Clone();
     
    179178          }
    180179      }
    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());
    182181      if (string.IsNullOrEmpty(currentSearchString)) ExpandSlaveGroupNodes();
    183182      else resourcesTreeView.ExpandAll();
     
    187186    #region Events
    188187    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      //}
    199198    }
    200199
     
    212211
    213212    #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 
    260213    private void ExpandSlaveGroupNodes() {
    261214      foreach (TreeNode n in nodeStore.Where(x => x.Tag is SlaveGroup)) {
     
    267220
    268221    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();
    326279    }
    327280    #endregion
  • branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.Designer.cs

    r14185 r15401  
    4545    /// </summary>
    4646    private void InitializeComponent() {
    47       System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HiveResourceSelectorDialog));
    4847      this.okButton = new System.Windows.Forms.Button();
    4948      this.cancelButton = new System.Windows.Forms.Button();
    5049      this.refreshButton = new System.Windows.Forms.Button();
    51       this.hiveResourceSelector = new HeuristicLab.Clients.Hive.JobManager.Views.HiveResourceSelector();
     50      this.hiveResourceSelector = new HeuristicLab.Clients.Hive.JobManager.Views.HiveProjectSelector();
    5251      this.SuspendLayout();
    5352      //
     
    8786      // hiveResourceSelector
    8887      //
    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) 
    9190            | System.Windows.Forms.AnchorStyles.Right)));
    9291      this.hiveResourceSelector.Caption = "View";
     
    101100      //
    102101      this.AcceptButton = this.okButton;
    103       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    104102      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    105103      this.CancelButton = this.cancelButton;
     
    115113      this.ShowInTaskbar = false;
    116114      this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
    117       this.Text = "Select Resources";
     115      this.Text = "Select Project";
    118116      this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.HiveResourceSelectorDialog_FormClosing);
    119117      this.Load += new System.EventHandler(this.HiveResourceSelectorDialog_Load);
     
    126124    protected System.Windows.Forms.Button okButton;
    127125    protected System.Windows.Forms.Button cancelButton;
    128     protected HiveResourceSelector hiveResourceSelector;
     126    protected HiveProjectSelector hiveResourceSelector;
    129127    protected System.Windows.Forms.Button refreshButton;
    130128  }
  • branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.cs

    r14185 r15401  
    3131    }
    3232
    33     public ISet<Resource> GetSelectedResources() { return hiveResourceSelector.SelectedResources; }
     33    public ISet<Project> GetSelectedResources() { return hiveResourceSelector.SelectedResources; }
     34    public Project SelectedProject { get { return hiveResourceSelector.SelectedProject; } }
    3435
    3536    private void HiveResourceSelectorDialog_Load(object sender, System.EventArgs e) {
     
    4344
    4445    void Instance_Refreshed(object sender, System.EventArgs e) {
    45       hiveResourceSelector.Content = HiveAdminClient.Instance.Resources;
     46      hiveResourceSelector.Content = HiveAdminClient.Instance.Projects;
    4647    }
    4748
  • branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs

    r14901 r15401  
    130130          nameTextBox.Text = Content.Job.Name;
    131131          executionTimeTextBox.Text = Content.ExecutionTime.ToString();
    132           resourceNamesTextBox.Text = Content.Job.ResourceNames;
     132          //resourceNamesTextBox.Text = Content.Job.ResourceNames;
    133133          refreshAutomaticallyCheckBox.Checked = Content.RefreshAutomatically;
    134134          logView.Content = Content.Log;
     
    337337      if (hiveResourceSelectorDialog.ShowDialog(this) == DialogResult.OK) {
    338338        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;
    346350      }
    347351    }
     
    404408
    405409    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;
    408412    }
    409413
Note: See TracChangeset for help on using the changeset viewer.