Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6465


Ignore:
Timestamp:
06/21/11 17:54:32 (13 years ago)
Author:
cneumuel
Message:

#1233

  • show owner of experimens in listview
Location:
branches/HeuristicLab.Hive-3.4/sources
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/Views/HiveExperimentPermissionView.cs

    r6463 r6465  
    3434    public HiveExperimentPermissionView() {
    3535      InitializeComponent();
    36       permissionComboBox.Items.Add(Permission.ReadOnly);
     36      permissionComboBox.Items.Add(Permission.Read);
    3737      permissionComboBox.Items.Add(Permission.Full);
    38       permissionComboBox.SelectedItem = Permission.ReadOnly;
     38      permissionComboBox.SelectedItem = Permission.Read;
    3939    }
    4040
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/Views/RefreshableHiveExperimentListView.cs

    r6381 r6465  
    3333    public RefreshableHiveExperimentListView() {
    3434      InitializeComponent();
     35      this.itemsListView.View = View.Details;
     36      this.itemsListView.Columns.Clear();
     37      this.itemsListView.Columns.Add(new ColumnHeader("Date") { Text = "Date" });
     38      this.itemsListView.Columns.Add(new ColumnHeader("Name") { Text = "Name" });
     39      this.itemsListView.HeaderStyle = ColumnHeaderStyle.Clickable;
     40      this.itemsListView.FullRowSelect = true;
    3541    }
    3642
     
    4551      }
    4652    }
     53
     54    protected override ListViewItem CreateListViewItem(RefreshableHiveExperiment item) {
     55      ListViewItem listViewItem = base.CreateListViewItem(item);
     56      listViewItem.SubItems.Clear();
     57      listViewItem.SubItems.Insert(0, new ListViewItem.ListViewSubItem(listViewItem, item.HiveExperiment.DateCreated.ToString("dd.MM.yyyy HH:mm")));
     58      listViewItem.SubItems.Insert(1, new ListViewItem.ListViewSubItem(listViewItem, item.HiveExperiment.Name));
     59      listViewItem.Group = GetListViewGroup(item.HiveExperiment.OwnerUsername);
     60      return listViewItem;
     61    }
     62
     63    private ListViewGroup GetListViewGroup(string groupName) {
     64      foreach (ListViewGroup group in itemsListView.Groups) {
     65        if (group.Name == groupName)
     66          return group;
     67      }
     68      var newGroup = new ListViewGroup(string.Format("Owner ({0})", groupName), HorizontalAlignment.Left) { Name = groupName };
     69      itemsListView.Groups.Add(newGroup);
     70      return newGroup;
     71    }
    4772  }
    4873}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/HiveExperimentPermission.cs

    r6463 r6465  
    2828    private string grantedUserName;
    2929    public string GrantedUserName {
    30       get { return grantedUserName; }
    31       set { grantedUserName = value; OnPropertyChanged(new PropertyChangedEventArgs("GrantedUserName")); }
     30      get { return this.grantedUserName; }
     31      set {
     32        this.grantedUserName = value;
     33        this.OnPropertyChanged(new PropertyChangedEventArgs("GrantedUserName"));
     34      }
    3235    }
    3336
    3437    #region Constructors and Cloning
    3538    public HiveExperimentPermission() {
    36       this.Permission = Hive.Permission.ReadOnly;
     39      this.Permission = Hive.Permission.Read;
    3740      this.PropertyChanged += new PropertyChangedEventHandler(HiveExperimentPermission_PropertyChanged);
    3841    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/HiveServiceClient.cs

    r6463 r6465  
    607607       
    608608        [System.Runtime.Serialization.OptionalFieldAttribute()]
     609        private string OwnerUsernameField;
     610       
     611        [System.Runtime.Serialization.OptionalFieldAttribute()]
    609612        private HeuristicLab.Clients.Hive.Permission PermissionField;
    610613       
     
    710713                    this.OwnerUserIdField = value;
    711714                    this.RaisePropertyChanged("OwnerUserId");
     715                }
     716            }
     717        }
     718       
     719        [System.Runtime.Serialization.DataMemberAttribute()]
     720        public string OwnerUsername
     721        {
     722            get
     723            {
     724                return this.OwnerUsernameField;
     725            }
     726            set
     727            {
     728                if ((object.ReferenceEquals(this.OwnerUsernameField, value) != true))
     729                {
     730                    this.OwnerUsernameField = value;
     731                    this.RaisePropertyChanged("OwnerUsername");
    712732                }
    713733            }
     
    14521472       
    14531473        [System.Runtime.Serialization.EnumMemberAttribute()]
    1454         ReadOnly = 1,
     1474        Read = 1,
    14551475       
    14561476        [System.Runtime.Serialization.EnumMemberAttribute()]
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/HiveExperiment.cs

    r6457 r6465  
    3737    [DataMember]
    3838    public Permission Permission { get; set; } // the permission for the currently logged in user
     39    [DataMember]
     40    public string OwnerUsername { get; set; }
    3941
    4042    /* ==== some computed statistics ==== */
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs

    r6463 r6465  
    244244            && (x.OwnerUserId == userManager.CurrentUserId || x.HiveExperimentPermissions.Count(hep => hep.Permission != Permission.NotAllowed && hep.GrantedUserId == userManager.CurrentUserId) > 0)
    245245          ).FirstOrDefault();
    246       if (hiveExperiment != null) hiveExperiment.Permission = dao.GetPermissionForExperiment(hiveExperiment.Id, userManager.CurrentUserId);
     246      if (hiveExperiment != null) {
     247        hiveExperiment.Permission = dao.GetPermissionForExperiment(hiveExperiment.Id, userManager.CurrentUserId);
     248        hiveExperiment.OwnerUsername = userManager.GetUserById(hiveExperiment.OwnerUserId).UserName;
     249      }
    247250      return hiveExperiment;
    248251    }
     
    254257        author.AuthorizeForExperiment(he.Id, Permission.Read);
    255258        he.Permission = dao.GetPermissionForExperiment(he.Id, userManager.CurrentUserId);
     259        he.OwnerUsername = userManager.GetUserById(he.OwnerUserId).UserName;
    256260      }
    257261      return hiveExperiments;
     
    261265      authen.AuthenticateForAnyRole(HiveRoles.Administrator);
    262266      var hiveExperiments = dao.GetHiveExperiments(x => true);
    263       foreach (var he in hiveExperiments) // no authorization here, since this method is admin-only! (admin is allowed to read all jobs)
     267      foreach (var he in hiveExperiments) { // no authorization here, since this method is admin-only! (admin is allowed to read all jobs)
    264268        he.Permission = dao.GetPermissionForExperiment(he.Id, userManager.CurrentUserId);
     269        he.OwnerUsername = userManager.GetUserById(he.OwnerUserId).UserName;
     270      }
    265271      return hiveExperiments;
    266272    }
     
    287293      author.AuthorizeForExperiment(hiveExperimentId, Permission.Full);
    288294      trans.UseTransaction(() => {
    289         HiveExperiment he = dao.GetHiveExperiment(hiveExperimentId);
    290295        dao.DeleteHiveExperiment(hiveExperimentId); // child jobs will be deleted by db-trigger
    291296      });
Note: See TracChangeset for help on using the changeset viewer.