Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/03/09 14:35:21 (15 years ago)
Author:
aleitner
Message:

Modified design of Management-Console(#569)

File:
1 edited

Legend:

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

    r1509 r1512  
    7979    }
    8080
     81
     82    private int CapacityRam(int noCores, int freeCores) {
     83      return (((noCores - freeCores) / noCores) * 100);
     84    }
     85
    8186    /// <summary>
    8287    /// Adds clients to ListView and TreeView
     
    9196        clients = clientManager.GetAllClientGroups();
    9297        lvClientControl.Items.Clear();
    93         int count = 0;
    9498        List<Guid> inGroup = new List<Guid>();
    9599        foreach (ClientGroup cg in clients.List) {
     
    100104              item = new ListViewItem(ci.Name, 3, lvg);
    101105            } else {
    102               item = new ListViewItem(ci.Name, count, lvg);
     106                            int percentageUsage = CapacityRam(ci.NrOfCores, ci.NrOfFreeCores);
     107              int usage = 0;
     108              if ((percentageUsage >= 0) && (percentageUsage <= 25)) {
     109                usage = 0;
     110              } else if ((percentageUsage > 25) && (percentageUsage <= 75)) {
     111                usage = 1;
     112              } else if ((percentageUsage > 75) && (percentageUsage <= 100)) {
     113                usage = 2;
     114              }
     115
     116              item = new ListViewItem(ci.Name, usage, lvg);
    103117            }
    104118            item.Tag = ci.Id;
    105119            lvClientControl.Items.Add(item);
    106120            clientInfoObjects.Add(ci.Id, item);
    107             count = (count + 1) % 3;
    108121            inGroup.Add(ci.Id);
    109122
     
    130143              item = new ListViewItem(ci.Name, 3, lvunsorted);
    131144            } else {
    132               item = new ListViewItem(ci.Name, count, lvunsorted);
     145              int percentageUsage = CapacityRam(ci.NrOfCores, ci.NrOfFreeCores);
     146              int usage = 0;
     147              if ((percentageUsage >= 0) && (percentageUsage <= 25)) {
     148                usage = 0;
     149              } else if ((percentageUsage > 25) && (percentageUsage <= 75)) {
     150                usage = 1;
     151              } else if ((percentageUsage > 75) && (percentageUsage <= 100)) {
     152                usage = 2;
     153              }
     154              item = new ListViewItem(ci.Name, usage, lvunsorted);
    133155            }
    134156            item.Tag = ci.Id;
    135157            lvClientControl.Items.Add(item);
    136             count = (count + 1) % 3;
    137158          }
    138159        }
     
    213234    /// </summary>
    214235    private void ClientClicked() {
     236      plClientDetails.Visible = true;
    215237      int i = 0;
    216238      while (clientInfo.List[i].Id.ToString() != nameCurrentClient) {
     
    218240      }
    219241      currentClient = clientInfo.List[i];
    220       pbClientControl.Image = ilClientControl.Images[0];
     242      int percentageUsage = CapacityRam(currentClient.NrOfCores, currentClient.NrOfFreeCores);
     243      int usage = 3;
     244      if ((currentClient.State != State.offline) && (currentClient.State != State.nullState)) {
     245        if ((percentageUsage >= 0) && (percentageUsage <= 25)) {
     246          usage = 0;
     247        } else if ((percentageUsage > 25) && (percentageUsage <= 75)) {
     248          usage = 1;
     249        } else if ((percentageUsage > 75) && (percentageUsage <= 100)) {
     250          usage = 2;
     251        }
     252      }
     253      pbClientControl.Image = ilClientControl.Images[usage];
    221254      lblClientName.Text = currentClient.Name;
    222255      lblLogin.Text = currentClient.Login.ToString();
     
    228261    /// </summary>
    229262    private void JobClicked() {
     263      plJobDetails.Visible = true;
    230264      int i = 0;
    231265      while (jobs.List[i].Id.ToString() != nameCurrentJob) {
    232266        i++;
    233267      }
    234       lvSnapshots.Enabled = false;
     268      lvSnapshots.Enabled = true;
    235269      currentJob = jobs.List[i];
    236270      pbJobControl.Image = ilJobControl.Images[0];
     
    262296      }
    263297      if (currentJob.State != State.offline) {
    264         lvSnapshots.Enabled = true;
     298        lvSnapshots.Visible = true;
    265299      } else {
    266         lvSnapshots.Enabled = false;
     300        lvSnapshots.Visible = false;
    267301      }
    268302    }
     
    329363            State state = clientInfo.List[change.Position].State;
    330364            System.Diagnostics.Debug.WriteLine(lvClientControl.Items[i].Text.ToString());
     365            int percentageUsage = CapacityRam(currentClient.NrOfCores, currentClient.NrOfFreeCores);
    331366            if ((state == State.offline) || (state == State.nullState)) {
    332367              lvClientControl.Items[i].ImageIndex = 3;
    333368            } else {
    334               lvClientControl.Items[i].ImageIndex = 1;
     369              if ((percentageUsage >= 0) && (percentageUsage <= 25)) {
     370                lvClientControl.Items[i].ImageIndex = 0;
     371              } else if ((percentageUsage > 25) && (percentageUsage <= 75)) {
     372                lvClientControl.Items[i].ImageIndex = 1;
     373              } else if ((percentageUsage > 75) && (percentageUsage <= 100)) {
     374                lvClientControl.Items[i].ImageIndex = 2;
     375              }
     376
    335377            }
    336378            lvClientControl.Refresh();
     
    497539          if (ci.Id.Equals(cio.Id)) {
    498540            found = true;
    499             if (ci.State != cio.State) {
     541            if ((ci.State != cio.State) || (ci.NrOfFreeCores != ci.NrOfFreeCores)) {
    500542              changes.Add(new Changes { Types = Type.Client, ID = ci.Id, ChangeType = Change.Update, Position = i });
    501543            }
     
    573615            found = true;
    574616            if (job.State != State.offline) {
    575               if (!IsEqual(job.Client, jobold.Client)) {
    576                 changes.Add(new Changes { Types = Type.Job, ID = job.Id, ChangeType = Change.Update, Position = i });
    577               } else if (job.State != jobold.State) {
     617              if ((!IsEqual(job.Client, jobold.Client)) || (job.State != jobold.State)
     618                   || (job.Percentage != jobold.Percentage)) {
    578619                changes.Add(new Changes { Types = Type.Job, ID = job.Id, ChangeType = Change.Update, Position = i });
    579620              }
Note: See TracChangeset for help on using the changeset viewer.