Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/03/18 15:06:21 (6 years ago)
Author:
jzenisek
Message:

#2839:

  • adapted job execution implementation at ProjectJobsView
  • prohibited resource checking for non-admins
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs

    r16117 r16209  
    139139          }
    140140
     141          // project look up
    141142          if (Content.Job != null && Content.Job.ProjectId == Guid.Empty) {
    142143            if (HiveClient.Instance != null && HiveClient.Instance.Projects != null && HiveClient.Instance.Projects.Count == 1) {
     
    150151              }               
    151152            }
    152           }
    153 
    154 
    155           nameTextBox.Text = Content.Job.Name;
    156           descriptionTextBox.Text = Content.Job.Description;
    157           executionTimeTextBox.Text = Content.ExecutionTime.ToString();
    158           refreshAutomaticallyCheckBox.Checked = Content.RefreshAutomatically;
    159 
    160           // project look up
    161           if(Content.Job.ProjectId != null && Content.Job.ProjectId != Guid.Empty) {
    162             if(selectedProject == null || selectedProject.Id != Content.Job.ProjectId) {
     153          } else if (Content.Job != null && Content.Job.ProjectId != Guid.Empty) {
     154            if (selectedProject == null || selectedProject.Id != Content.Job.ProjectId) {
    163155              selectedProject = GetProject(Content.Job.ProjectId);
     156              hiveResourceSelectorDialog = null;
    164157              if (selectedProject != null) {
    165158                projectNameTextBox.Text = selectedProject.Name;
     
    168161              }
    169162            }
     163
     164            if(hiveResourceSelectorDialog == null)
     165              hiveResourceSelectorDialog = new HiveResourceSelectorDialog(Content.Job.Id, Content.Job.ProjectId);
     166
     167            if (Content.Job.ResourceIds == null) {
     168              Content.Job.ResourceIds = HiveClient.Instance.GetAssignedResourcesForJob(Content.Job.Id)
     169                .Select(x => x.Id)
     170                .ToList();
     171              hiveResourceSelectorDialog.SelectedResourceIds = Content.Job.ResourceIds;
     172            }
     173
    170174          } else {
    171175            selectedProject = null;
     
    173177            Content.Job.ResourceIds = null;
    174178          }
     179
     180
     181          nameTextBox.Text = Content.Job.Name;
     182          descriptionTextBox.Text = Content.Job.Description;
     183          executionTimeTextBox.Text = Content.ExecutionTime.ToString();
     184          refreshAutomaticallyCheckBox.Checked = Content.RefreshAutomatically;
    175185         
    176186          logView.Content = Content.Log;
     
    501511    }
    502512
    503     private void updateButton_Click2(object sender, EventArgs e) {
    504       if (Content.ExecutionState == ExecutionState.Stopped) {
    505         MessageBox.Show("Job cannot be updated once it stopped.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);
    506         return;
    507       }
    508 
    509       HiveClient.UpdateJob(
    510         (Exception ex) => ErrorHandling.ShowErrorDialog(this, "Update failed.", ex),
    511         Content,
    512         new CancellationToken());
    513       UpdateSelectorDialog();
    514     }
    515 
    516513    private void updateButton_Click(object sender, EventArgs e) {
    517514      if (Content.ExecutionState == ExecutionState.Stopped) {
     
    556553      } else {
    557554        startButton.Enabled = Content.IsControllable && Content.HiveTasks != null && Content.HiveTasks.Count > 0
    558           && Content.Job.ProjectId != null && Content.Job.ProjectId != Guid.Empty && Content.Job.ResourceIds != null  && Content.Job.ResourceIds.Any()
     555          && Content.Job.ProjectId != Guid.Empty && Content.Job.ResourceIds != null  && Content.Job.ResourceIds.Any()
    559556          && (Content.ExecutionState == ExecutionState.Prepared || Content.ExecutionState == ExecutionState.Paused) && !Content.IsProgressing;
    560557        pauseButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started && !Content.IsProgressing;
Note: See TracChangeset for help on using the changeset viewer.