Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/16/11 16:01:39 (13 years ago)
Author:
ascheibe
Message:

#1233
Admin UI:

  • some bugfixes
  • removed dummy stuff
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Administration/3.4/Views/ResourcesView.cs

    r6373 r6437  
    2424using System.Linq;
    2525using System.Windows.Forms;
     26using HeuristicLab.Clients.Hive.Views;
    2627using HeuristicLab.Core;
    2728using HeuristicLab.Core.Views;
    2829using HeuristicLab.MainForm;
    29 using HeuristicLab.Clients.Hive.Views;
    3030
    3131namespace HeuristicLab.Clients.Hive.Administration.Views {
     
    122122      if (e.Node.Tag.GetType() == typeof(Slave)) {
    123123        scheduleView.ResourceId = ((Slave)e.Node.Tag).Id;
     124        if (tabSlaveGroup.SelectedIndex == 1) {
     125          UpdateSchedule();
     126        }
    124127      } else if (e.Node.Tag is SlaveGroup) {
    125128        slaveView.Content.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(SlaveViewContent_PropertyChanged);
     
    149152      if (treeSlaveGroup.SelectedNode != null && treeSlaveGroup.SelectedNode.Tag != null) {
    150153        Resource res = (Resource)treeSlaveGroup.SelectedNode.Tag;
    151         Content.Remove(res);
    152154
    153155        if (res is Slave) {
     156          Content.Remove(res);
    154157          ServiceLocator.Instance.CallHiveService(service => service.DeleteSlave(res.Id));
    155158        } else if (res is SlaveGroup) {
    156159          //only delete empty groups
    157           if (Content.Where(s => s.ParentResourceId == res.Id).Count() < 0) {
     160          if (Content.Where(s => s.ParentResourceId == res.Id).Count() < 1) {
     161            Content.Remove(res);
    158162            ServiceLocator.Instance.CallHiveService(service => service.DeleteSlaveGroup(res.Id));
    159163          } else {
    160             MessageBox.Show("Only empty groups can be deleted.");
     164            MessageBox.Show("Only empty groups can be deleted.", "HeuristicLab Hive Administration", MessageBoxButtons.OK, MessageBoxIcon.Error);
    161165          }
    162166        }
     
    168172        if (res is SlaveGroup && res.Id == Guid.Empty) {
    169173          SlaveGroup slaveGroup = (SlaveGroup)res;
    170           ServiceLocator.Instance.CallHiveService(service => service.AddSlaveGroup(slaveGroup));
     174          ServiceLocator.Instance.CallHiveService(service => slaveGroup.Id = service.AddSlaveGroup(slaveGroup));
    171175        }
    172176        if (res.Id != Guid.Empty && res.Modified) {
     
    198202            if (newNode.Tag != null && newNode.Tag is Slave) {
    199203              Slave slave = (Slave)newNode.Tag;
    200               if (slave.ParentResourceId != sgrp.Id) {
     204
     205              if (sgrp.Id == Guid.Empty) {
     206                ServiceLocator.Instance.CallHiveService(service => sgrp.Id = service.AddSlaveGroup(sgrp));
     207              }
     208
     209              if (slave.ParentResourceId == null || (slave.ParentResourceId != null && slave.ParentResourceId != sgrp.Id)) {
    201210                slave.ParentResourceId = sgrp.Id;
    202211                OnContentChanged();
     
    257266      }
    258267    }
     268
     269    private void tabSlaveGroup_SelectedIndexChanged(object sender, EventArgs e) {
     270      if (tabSlaveGroup.SelectedIndex == 1) {
     271        UpdateSchedule();
     272      }
     273    }
    259274  }
    260275}
Note: See TracChangeset for help on using the changeset viewer.