Ignore:
Timestamp:
01/26/18 08:51:30 (3 years ago)
Author:
jzenisek
Message:

#2839

  • worked on (restricted) accessibility of hive's administration area for non-admin roles
  • adapted HiveClient & HiveAdminClient entity loading (client- & service-side)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveProjectManagement/HeuristicLab.Clients.Hive/3.3/HiveClient.cs

    r15642 r15658  
    5757    }
    5858
     59    private IItemList<Project> projects;
     60    public IItemList<Project> Projects {
     61      get { return projects; }
     62    }
     63
     64    private IItemList<Resource> resources;
     65    public IItemList<Resource> Resources {
     66      get { return resources; }
     67    }
     68
     69
    5970    private List<Plugin> onlinePlugins;
    6071    public List<Plugin> OnlinePlugins {
     
    93104
    94105      try {
     106        projects = new ItemList<Project>();
     107        resources = new ItemList<Resource>();
    95108        jobs = new HiveItemCollection<RefreshableJob>();
    96         var jobsLoaded = HiveServiceLocator.Instance.CallHiveService<IEnumerable<Job>>(s => s.GetJobs());
    97 
    98         foreach (var j in jobsLoaded) {
    99           jobs.Add(new RefreshableJob(j));
    100         }
     109
     110        HiveServiceLocator.Instance.CallHiveService(service => {
     111          service.GetProjects().ForEach(p => projects.Add(p));
     112          service.GetSlaveGroups().ForEach(g => resources.Add(g));
     113          service.GetSlaves().ForEach(s => resources.Add(s));
     114          service.GetJobs().ForEach(p => jobs.Add(new RefreshableJob(p)));
     115        });
    101116      }
    102117      catch {
    103118        jobs = null;
     119        projects = null;
     120        resources = null;
    104121        throw;
    105122      }
    106123      finally {
     124        OnRefreshed();
     125      }
     126    }
     127
     128    public void RefreshProjectsAndResources() {
     129      OnRefreshing();
     130
     131      try {
     132        projects = new ItemList<Project>();
     133        resources = new ItemList<Resource>();
     134
     135        HiveServiceLocator.Instance.CallHiveService(service => {
     136          service.GetProjects().ForEach(p => projects.Add(p));
     137          service.GetSlaveGroups().ForEach(g => resources.Add(g));
     138          service.GetSlaves().ForEach(s => resources.Add(s));
     139        });
     140      } catch {
     141        projects = null;
     142        resources = null;
     143        throw;
     144      } finally {
    107145        OnRefreshed();
    108146      }
     
    124162      }, null);
    125163    }
     164   
    126165    #endregion
    127166
Note: See TracChangeset for help on using the changeset viewer.