Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/21/12 12:46:54 (13 years ago)
Author:
ascheibe
Message:

#1859 some improvements for the resource permission management ui

Location:
trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/HiveRoles.cs

    r8051 r8075  
    3131
    3232    public static bool CheckAdminUserPermissions() {
    33       UserInformation.Instance.Refresh();
    3433      return UserInformation.Instance.UserExists && UserInformation.Instance.User.Roles.Any(x => x.Name == HiveRoles.Administrator);
    3534    }
  • trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.Designer.cs

    r8074 r8075  
    4040      HiveAdminClient.Instance.Refreshed -= new EventHandler(Instance_Refreshed);
    4141
    42       Access.AccessClient.Instance.Refreshing -= new EventHandler(Content_Refreshing);
    43       Access.AccessClient.Instance.Refreshed -= new EventHandler(Content_Refreshed);
     42      Access.AccessClient.Instance.Refreshing -= new EventHandler(AccessClient_Refreshing);
     43      Access.AccessClient.Instance.Refreshed -= new EventHandler(AccessClient_Refreshed);
    4444      base.Dispose(disposing);
    4545    }
  • trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs

    r8074 r8075  
    6161      HiveAdminClient.Instance.Refreshed += new EventHandler(Instance_Refreshed);
    6262
    63       Access.AccessClient.Instance.Refreshing += new EventHandler(Content_Refreshing);
    64       Access.AccessClient.Instance.Refreshed += new EventHandler(Content_Refreshed);
     63      Access.AccessClient.Instance.Refreshing += new EventHandler(AccessClient_Refreshing);
     64      Access.AccessClient.Instance.Refreshed += new EventHandler(AccessClient_Refreshed);
    6565    }
    6666
     
    8989      progressTask = new TS.Task(UpdateProgress);
    9090      progressTask.Start();
    91       SetEnabledStateOfControls(false);
     91      SetEnabledStateOfControls();
    9292    }
    9393
    9494    void Instance_Refreshed(object sender, EventArgs e) {
    9595      stopProgressTask = true;
    96       SetEnabledStateOfControls(true);
    97     }
    98 
    99     void Content_Refreshing(object sender, EventArgs e) {
     96      SetEnabledStateOfControls();
     97    }
     98
     99    void AccessClient_Refreshing(object sender, EventArgs e) {
    100100      stopProgressTask = false;
    101101      progressTask = new TS.Task(UpdateProgress);
    102102      progressTask.Start();
    103       SetEnabledStateOfControls(false);
    104     }
    105 
    106     void Content_Refreshed(object sender, EventArgs e) {
     103      SetEnabledStateOfControls();
     104    }
     105
     106    void AccessClient_Refreshed(object sender, EventArgs e) {
    107107      stopProgressTask = true;
    108       SetEnabledStateOfControls(true);
     108      SetEnabledStateOfControls();
    109109    }
    110110
     
    199199        btnPermissionsSave.Enabled = false;
    200200        permissionView.Enabled = false;
     201        scheduleView.SetEnabledStateOfSchedule(false);
     202        btnPermissionsSave.Enabled = false;
     203        permissionView.Enabled = false;
    201204      } else {
    202205        btnAddGroup.Enabled = true;
    203206        btnRemoveGroup.Enabled = true;
    204207        btnSave.Enabled = true;
    205       }
    206     }
    207 
    208     public virtual void SetEnabledStateOfControls(bool state) {
    209       if (InvokeRequired) {
    210         Invoke(new Action(() => SetEnabledStateOfControls(state)));
    211       } else {
    212         if (Content == null) state = false;
    213         btnAddGroup.Enabled = state;
    214         btnRemoveGroup.Enabled = state;
    215         btnSave.Enabled = state;
    216         scheduleView.SetEnabledStateOfControls(state && IsAuthorized(slaveView.Content));
    217         btnPermissionsSave.Enabled = state && permissionView.FetchSelectedUsers != null && Content != null;
    218         permissionView.Enabled = state && permissionView.FetchSelectedUsers != null && Content != null;
     208        scheduleView.SetEnabledStateOfSchedule(IsAuthorized(slaveView.Content));
     209        btnPermissionsSave.Enabled = permissionView.FetchSelectedUsers != null;
     210        permissionView.Enabled = permissionView.FetchSelectedUsers != null;
    219211      }
    220212    }
     
    483475      scheduleView.Invoke(new Action(() => {
    484476        scheduleView.Content = HiveAdminClient.Instance.Downtimes;
    485         SetEnabledStateOfControls(currentlyAuthorized);
     477        SetEnabledStateOfControls();
    486478      }));
    487479    }
     
    526518
    527519    private void btnPermissionsSave_Click(object sender, EventArgs e) {
    528       SetEnabledStateOfControls(false);
     520      SetEnabledStateOfControls();
    529521      HiveServiceLocator.Instance.CallHiveService(service => {
    530522        service.GrantResourcePermissions(((Resource)treeSlaveGroup.SelectedNode.Tag).Id, permissionView.GetAddedUsers().Select(x => x.Id).ToList());
    531523        service.RevokeResourcePermissions(((Resource)treeSlaveGroup.SelectedNode.Tag).Id, permissionView.GetDeletedUsers().Select(x => x.Id).ToList());
    532524      });
    533       SetEnabledStateOfControls(true);
     525      SetEnabledStateOfControls();
    534526    }
    535527  }
  • trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.cs

    r8051 r8075  
    230230    }
    231231
    232     public virtual void SetEnabledStateOfControls(bool state) {
     232    public virtual void SetEnabledStateOfSchedule(bool state) {
    233233      if (InvokeRequired) {
    234         Invoke(new Action(() => SetEnabledStateOfControls(state)));
     234        Invoke(new Action(() => SetEnabledStateOfSchedule(state)));
    235235      } else {
    236236        if (Content == null) state = false;
Note: See TracChangeset for help on using the changeset viewer.