foreman_pipeline 0.0.11 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/Rakefile +2 -1
  4. data/app/assets/javascripts/foreman_pipeline/jenkins-instances/details/jenkins-instance-details-info.controller.js +23 -2
  5. data/app/assets/javascripts/foreman_pipeline/jenkins-instances/details/jenkins-instance-details.controller.js +1 -23
  6. data/app/assets/javascripts/foreman_pipeline/jenkins-instances/details/views/jenkins-instance-details-info.html +31 -0
  7. data/app/assets/javascripts/foreman_pipeline/jenkins-instances/details/views/jenkins-instance-details-users.html +17 -14
  8. data/app/assets/javascripts/foreman_pipeline/jenkins-instances/details/views/jenkins-instance-details.html +3 -10
  9. data/app/assets/javascripts/foreman_pipeline/jenkins-instances/jenkins-instances.module.js +4 -1
  10. data/app/assets/javascripts/foreman_pipeline/jenkins-instances/new/new-jenkins-instance.controller.js +4 -7
  11. data/app/assets/javascripts/foreman_pipeline/jenkins-instances/new/views/new-jenkins-instance-form.html +18 -3
  12. data/app/assets/javascripts/foreman_pipeline/jenkins-users/new/new-jenkins-user.controller.js +5 -5
  13. data/app/assets/javascripts/foreman_pipeline/jobs/details/job-details-content-views.controller.js +3 -3
  14. data/app/assets/javascripts/foreman_pipeline/jobs/details/job-details-hostgroups.controller.js +3 -5
  15. data/app/assets/javascripts/foreman_pipeline/jobs/details/job-details-jenkins-projects.controller.js +2 -2
  16. data/app/assets/javascripts/foreman_pipeline/jobs/details/project-discovery/job-projects-discovery.controller.js +10 -1
  17. data/app/assets/javascripts/foreman_pipeline/jobs/details/project-discovery/views/job-projects-discovery.html +20 -12
  18. data/app/assets/javascripts/foreman_pipeline/jobs/details/views/job-details-content-views.html +12 -8
  19. data/app/assets/javascripts/foreman_pipeline/jobs/details/views/job-details-environments.html +10 -6
  20. data/app/assets/javascripts/foreman_pipeline/jobs/details/views/job-details-hostgroups.html +6 -2
  21. data/app/assets/javascripts/foreman_pipeline/jobs/details/views/job-details-jenkins-projects.html +7 -6
  22. data/app/assets/javascripts/foreman_pipeline/jobs/details/views/job-details-jenkins.html +15 -11
  23. data/app/assets/javascripts/foreman_pipeline/jobs/details/views/job-details-resources.html +16 -12
  24. data/app/assets/javascripts/foreman_pipeline/jobs/details/views/job-details-to-environments.html +11 -7
  25. data/app/assets/javascripts/foreman_pipeline/jobs/jobs.module.js +4 -1
  26. data/app/assets/stylesheets/foreman_pipeline/foreman_pipeline.css +4 -0
  27. data/app/controllers/foreman_pipeline/api/jenkins_instances_controller.rb +10 -3
  28. data/app/controllers/foreman_pipeline/api/jenkins_projects_controller.rb +1 -1
  29. data/app/controllers/foreman_pipeline/api/jenkins_users_controller.rb +1 -1
  30. data/app/controllers/foreman_pipeline/api/jobs_controller.rb +44 -48
  31. data/app/lib/actions/foreman_pipeline/jenkins/build.rb +9 -3
  32. data/app/lib/actions/foreman_pipeline/jenkins/build_project.rb +2 -0
  33. data/app/lib/actions/foreman_pipeline/jenkins/bulk_build.rb +4 -0
  34. data/app/lib/actions/foreman_pipeline/jenkins/list.rb +4 -0
  35. data/app/lib/actions/foreman_pipeline/jenkins_instance/create_jenkins_instance_keys.rb +1 -1
  36. data/app/lib/actions/foreman_pipeline/job/create_host.rb +2 -2
  37. data/app/lib/actions/foreman_pipeline/job/cv_promote_job_hook.rb +1 -3
  38. data/app/lib/actions/foreman_pipeline/job/cv_publish_job_hook.rb +1 -3
  39. data/app/lib/actions/foreman_pipeline/job/job_hook.rb +4 -3
  40. data/app/lib/actions/foreman_pipeline/job/repo_sync_job_hook.rb +4 -17
  41. data/app/lib/actions/foreman_pipeline/job/run_job_manually.rb +2 -11
  42. data/app/lib/actions/foreman_pipeline/job/wait_until_provisioned.rb +4 -1
  43. data/app/lib/actions/foreman_pipeline/mixins/uri_extension.rb +1 -1
  44. data/app/models/foreman_pipeline/jenkins_instance.rb +8 -6
  45. data/app/models/foreman_pipeline/jenkins_project.rb +2 -4
  46. data/app/models/foreman_pipeline/jenkins_project_param.rb +0 -1
  47. data/app/models/foreman_pipeline/jenkins_user.rb +0 -2
  48. data/app/models/foreman_pipeline/job.rb +24 -8
  49. data/app/models/foreman_pipeline/job_to_environment.rb +0 -2
  50. data/app/services/foreman_pipeline/job_filter.rb +34 -0
  51. data/app/views/foreman/unattended/snippets/_jenkins_instance_pubkey.erb +3 -3
  52. data/app/views/foreman_pipeline/api/jenkins_instances/show.json.rabl +1 -1
  53. data/config/routes.rb +2 -7
  54. data/db/migrate/20150209160604_add_jenkins_home_to_jenkins_instance_table.rb +1 -1
  55. data/db/migrate/20150213095447_add_cert_path_to_jenkins_instances.rb +1 -1
  56. data/db/migrate/20150223142315_change_jenkins_instance_cert_path_column.rb +1 -1
  57. data/db/migrate/20150224090100_create_jenkins_projects_table.rb +4 -4
  58. data/db/migrate/20160404102405_update_projects_table.rb +9 -0
  59. data/db/migrate/20160404133012_drop_job_jenkins_project.rb +30 -0
  60. data/db/migrate/20160629085119_add_timeout_to_jenkins_instance.rb +9 -0
  61. data/db/seeds.d/location.rb +9 -0
  62. data/db/seeds.d/snippets.rb +11 -0
  63. data/lib/foreman_pipeline/engine.rb +1 -2
  64. data/lib/foreman_pipeline/plugin.rb +1 -1
  65. data/lib/foreman_pipeline/roles.rb +3 -3
  66. data/lib/foreman_pipeline/skip_tests.rb +22 -6
  67. data/lib/foreman_pipeline/tasks/{foreman_pipeline_test.rake → test.rake} +3 -2
  68. data/lib/foreman_pipeline/version.rb +1 -1
  69. data/test/fixtures/jenkins_instances.yml +8 -0
  70. data/test/fixtures/jenkins_projects.yml +9 -0
  71. data/test/fixtures/jenkins_users.yml +4 -0
  72. data/test/fixtures/jobs.yml +47 -0
  73. data/test/fixtures/pipeline_compute_attributes.yml +20 -0
  74. data/test/fixtures/pipeline_compute_profiles.yml +5 -0
  75. data/test/fixtures/pipeline_hostgroups.yml +25 -0
  76. data/test/fixtures_support.rb +17 -0
  77. data/test/{foreman_pipeline_plugin_test_helper.rb → foreman_pipeline_test_helper.rb} +17 -8
  78. data/test/functional/foreman_pipeline/api/jenkins_users_controller_test.rb +47 -0
  79. data/test/functional/foreman_pipeline/api/jobs_controller_test.rb +186 -0
  80. data/test/{unit → models}/jenkins_instance_test.rb +1 -1
  81. data/test/{unit → models}/job_test.rb +111 -55
  82. data/test/services/job_filter_test.rb +59 -0
  83. metadata +37 -16
  84. data/app/models/foreman_pipeline/job_jenkins_project.rb +0 -27
  85. data/lib/foreman_pipeline/tasks/foreman_pipeline_seed.rake +0 -28
  86. data/test/factories/hostgroup_factory.rb +0 -5
  87. data/test/unit/sanity_test.rb +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db36a9120f9be356a6975a250d240dcf9f760783
4
- data.tar.gz: 1e196c6c561bb04b0b93c398da85c39f5cc8d210
3
+ metadata.gz: 0b5e733c9c9f034cd0bbed19b68c86c23dbbfd26
4
+ data.tar.gz: 5d3a9ddb1230b8ef422d983a6766f7139a5a94f3
5
5
  SHA512:
6
- metadata.gz: c7a335446f9e0f18b5878d7a803eaf8cc8f091a63b4644ef2f2d23905686e2007bc99888f9bca001ab308ebd0a23fb89b83680f030e5a236f1d215b2cf430ef9
7
- data.tar.gz: 6db00d39beb3146330b9e6f375b8243e642a6b50e60589e9aeb71fc35663f1b301d9aa3b5edfa626aadb76b1f696385ddf42c52e17cbff46def05bfae63133a8
6
+ metadata.gz: 20fb2373df9501c043d8af9522fbc51f0eb043b5e11384f8c915fd57a759f2162bd8f558fd168c00a81a887e3097af8d89c0b553a8a56993234c81996f7ac5e8
7
+ data.tar.gz: 068cf7ef56a1060c2038ce4c807c8552db613861963bc74c381464456226e3bf52727250314a8b828e3aaebeeecd3bc74a0d298a84e688e33adf239ecfbad1e9
data/README.md CHANGED
@@ -26,7 +26,7 @@ Then execute from Foreman's root
26
26
  ```
27
27
  bundle install
28
28
  rake db:migrate
29
- rake foreman_pipeline:seed
29
+ rake db:seed
30
30
  ```
31
31
 
32
32
  ##Dependencies##
data/Rakefile CHANGED
@@ -1,2 +1,3 @@
1
1
  #!/usr/bin/env rake
2
- # useful tasks to be found in lib/foreman_pipeline/tasks
2
+ # useful tasks to be found in lib/foreman_pipeline/tasks
3
+ Bundler::GemHelper.install_tasks
@@ -1,4 +1,4 @@
1
- angular.module('ForemanPipeline.jenkins-instances').controller('JenkinsInstanceDetailsInfoController',
1
+ angular.module('ForemanPipeline.jenkins-instances').controller('JenkinsInstanceDetailsInfoController',
2
2
  ['$scope', '$q', 'translate', 'JenkinsInstance',
3
3
  function ($scope, $q, translate, JenkinsInstance) {
4
4
 
@@ -41,6 +41,27 @@ angular.module('ForemanPipeline.jenkins-instances').controller('JenkinsInstanceD
41
41
  $scope.$on('errorMessages', function (event, data) {
42
42
  $scope.errorMessages = data;
43
43
  });
44
-
44
+
45
+ $scope.checkJenkins = function () {
46
+ var deferred = $q.defer();
47
+ $scope.working = true;
48
+ JenkinsInstance.checkJenkins({id: $scope.jenkinsInstance.id}, function (response) {
49
+ deferred.resolve(response);
50
+ $scope.successMessages.push(translate('Jenkins is reachable, server ver. %s').replace('%s', response.server_version));
51
+ $scope.$broadcast('successMessages', $scope.successMessages)
52
+ $scope.working = false;
53
+ }, function (response) {
54
+ deferred.reject(response);
55
+ angular.forEach(response.data.errors, function (errorMessage, key) {
56
+ if (angular.isString(key)) {
57
+ errorMessage = [key, errorMessage].join(' ');
58
+ }
59
+ $scope.errorMessages.push(translate("Could not reach Jenkins server: ") + errorMessage);
60
+ $scope.$broadcast('errorMessages', $scope.errorMessages);
61
+ });
62
+ $scope.working = false;
63
+ })
64
+ return deferred.promise;
65
+ };
45
66
  }]
46
67
  );
@@ -1,4 +1,4 @@
1
- angular.module('ForemanPipeline.jenkins-instances').controller('JenkinsInstanceDetailsController',
1
+ angular.module('ForemanPipeline.jenkins-instances').controller('JenkinsInstanceDetailsController',
2
2
  ['$scope', '$state', 'JenkinsInstance', '$q', 'translate',
3
3
  function ($scope, $state, JenkinsInstance, $q, translate) {
4
4
 
@@ -14,27 +14,5 @@ angular.module('ForemanPipeline.jenkins-instances').controller('JenkinsInstanceD
14
14
  $scope.jenkinsInstance = JenkinsInstance.get({id: $scope.$stateParams.jenkinsInstanceId}, function () {
15
15
  $scope.panel.loading = false;
16
16
  });
17
-
18
- $scope.checkJenkins = function () {
19
- var deferred = $q.defer();
20
- $scope.working = true;
21
- JenkinsInstance.checkJenkins({id: $scope.jenkinsInstance.id}, function (response) {
22
- deferred.resolve(response);
23
- $scope.successMessages.push(translate('Jenkins is reachable, server ver. %s').replace('%s', response.server_version));
24
- $scope.$broadcast('successMessages', $scope.successMessages)
25
- $scope.working = false;
26
- }, function (response) {
27
- deferred.reject(response);
28
- angular.forEach(response.data.errors, function (errorMessage, key) {
29
- if (angular.isString(key)) {
30
- errorMessage = [key, errorMessage].join(' ');
31
- }
32
- $scope.errorMessages.push(translate("Could not reach Jenkins server: ") + errorMessage);
33
- $scope.broadcast('errorMessages', $scope.errorMessages);
34
- });
35
- $scope.working = false;
36
- })
37
- return deferred.promise;
38
- };
39
17
  }]
40
18
  );
@@ -32,5 +32,36 @@
32
32
  </span>
33
33
  </div>
34
34
 
35
+ <div class="detail">
36
+ <span class="info-label" translate>Timeout&nbsp;
37
+ <i class="fa fa-question-circle"
38
+ tooltip="{{ 'Time in minutes we are willing to wait before build on Jenkins starts' | translate }}"
39
+ tooltip-animation="false"
40
+ tooltip-append-to-body="true">
41
+ </i>
42
+ </span>
43
+ <span class="info-value"
44
+ bst-edit-custom="jenkinsInstance.timeout"
45
+ on-save="save(jenkinsInstance)">
46
+ <div class="form input">
47
+ <input ng-model="jenkinsInstance.timeout"
48
+ name="timeout"
49
+ type="number"
50
+ min="1"/>
51
+ </div>
52
+ </span>
53
+ </div>
54
+
35
55
  </section>
56
+ </div>
57
+ <div class="fr">
58
+ <button class="btn btn-default" ng-click="checkJenkins()" ng-disabled="working">
59
+ <span ng-hide="working">
60
+ <i class="fa fa-wrench"></i>
61
+ </span>
62
+ <span ng-show="working">
63
+ <i class="fa fa-spinner fa-spin"></i>
64
+ </span>
65
+ <span translate>Jenkins reachable?</span>
66
+ </button>
36
67
  </div>
@@ -2,25 +2,25 @@
2
2
 
3
3
  <div class="details details-full">
4
4
  <div bst-alerts success-messages="successMessages" error-messages="errorMessages"></div>
5
-
5
+
6
6
  <h4>
7
7
  <span translate>Current Jenkins User: </span>
8
8
  <a ui-sref="jenkins-instances.details.users.info({
9
9
  jenkinsInstanceId: jenkinsInstance.id, jenkinsUserId: jenkinsInstance.jenkins_user.id})">
10
10
  <span class="no-capitalize" ng-show="jenkinsInstance.jenkins_user.name" ng-bind="jenkinsInstance.jenkins_user.name">
11
11
  </span>
12
- </a>
12
+ </a>
13
13
  <span class="no-capitalize" ng-show="!jenkinsInstance.jenkins_user.name" translate>none</span>
14
14
  </h4>
15
15
 
16
- <br/>
16
+ <br/>
17
17
 
18
18
  <section>
19
19
  <div class="details-header row">
20
-
20
+
21
21
  <div class="col-sm-3" ng-show="jUserTable.rows.length > 0">
22
22
  <input type="text"
23
- class="form-control"
23
+ class="form-control"
24
24
  placeholder="{{ 'Filter' | translate }}"
25
25
  ng-model="userFilter" />
26
26
  </div>
@@ -29,12 +29,15 @@
29
29
 
30
30
  <span ng-show="jUserTable.rows.length > 0">
31
31
  <button class="btn btn-default"
32
-
33
32
  ng-hide="denied('edit_jobs')"
34
- ng-disabled="!jUserTable.chosenRow || jUserTable.working"
33
+ ng-disabled="!jUserTable.chosenRow || jUserTable.working"
35
34
  ng-click="setJenkinsUser()">
36
- <i class="fa fa-pencil" ng-hide="jUserTable.working"></i>
37
- <i class="fa fa-spinner fa-spin" ng-show="jUserTable.working"></i>
35
+ <span ng-hide="jUserTable.working">
36
+ <i class="fa fa-pencil"></i>
37
+ </span>
38
+ <span ng-show="jUserTable.working">
39
+ <i class="fa fa-spinner fa-spin"></i>
40
+ </span>
38
41
  {{ 'Set Jenkins User' | translate }}
39
42
  </button>
40
43
  </span>
@@ -43,7 +46,7 @@
43
46
  ng-hide="denied('edit_jobs')"
44
47
  ui-sref="jenkins-instances.details.users.new(
45
48
  {jenkinsInstanceId: jenkinsInstance.id})">
46
- <i class="fa fa-file"></i>
49
+ <i class="fa fa-file"></i>
47
50
  {{ 'New Jenkins User' | translate }}
48
51
  </button>
49
52
  </div>
@@ -51,7 +54,7 @@
51
54
 
52
55
  <div bst-table="jUserTable" class="nutupane" ng-show="jUserTable.rows.length > 0">
53
56
  <div bst-container-scroll bst-infinite-scroll="jUserTable.nextPage()">
54
-
57
+
55
58
  <table ng-class="{'table-mask': jUserTable.working}"
56
59
  class="table table-full table-striped">
57
60
 
@@ -64,7 +67,7 @@
64
67
 
65
68
  <tbody>
66
69
  <tr bst-table-row ng-repeat="jenkinsUser in jUserTable.rows | filter:userFilter" row-choice="jenkinsUser">
67
-
70
+
68
71
  <td bst-table-cell>
69
72
  <a ui-sref="jenkins-instances.details.users.info({ jenkinsUserId: jenkinsUser.id, jenkinsInstanceId: jenkinsInstance.id })">
70
73
  {{ jenkinsUser.name }}
@@ -75,7 +78,7 @@
75
78
  <button class="btn btn-default"
76
79
  ng-hide="denied('edit_jenkins_instance')"
77
80
  ng-click="openModal()">
78
- <i class="fa fa-trash-o"></i>
81
+ <i class="fa fa-trash-o"></i>
79
82
  {{ 'Delete' | translate }}
80
83
  </button>
81
84
  <div bst-modal="deleteJenkinsUser(jenkinsUser)">
@@ -95,7 +98,7 @@
95
98
  <div ng-show="jUserTable.rows.length === 0">
96
99
  <div class="loading-mask loading-mask-panel" ng-show="jUserTable.working">
97
100
  <i class="fa fa-spinner fa-spin"></i>
98
- {{ "Loading..." | translate }}
101
+ {{ "Loading..." | translate }}
99
102
  </div>
100
103
 
101
104
  <p class="alert alert-info"
@@ -9,18 +9,11 @@
9
9
  <header class="details-header">
10
10
  <h2 class="fl" translate>Jenkins Instance {{ jenkinsInstance.name }}</h2>
11
11
  <div class="fr">
12
- <div bst-modal="deleteJenkinsInstance(jenkinsInstance)"
12
+ <div bst-modal="deleteJenkinsInstance(jenkinsInstance)"
13
13
  model="jenkinsInstance"
14
14
  modal-header='Remove JenkinsInstance "{{ jenkinsInstance.name }}"?'
15
15
  modal-body='Are you sure you want to remove Jenkins Instance "{{ jenkinsInstance.name }}"?'>
16
16
  </div>
17
-
18
- <button class="btn btn-default" ng-click="checkJenkins()" ng-disabled="working">
19
- <i class="fa fa-wrench" ng-hide="working"></i>
20
- <i class="fa fa-spinner fa-spin" ng-show="working"></i>
21
- <span translate>Jenkins reachable?</span>
22
- </button>
23
-
24
17
  <button class="btn btn-default" ng-click="openModal()" ng-hide="denied('destroy_jenkins_instance', jenkinsInstance)">
25
18
  <i class="fa fa-trash-o"></i>
26
19
  {{ 'Remove Jenkins Instance' | translate }}
@@ -32,7 +25,7 @@
32
25
  </button>
33
26
  </div>
34
27
  </header>
35
-
28
+
36
29
  <nav>
37
30
  <ul class="nav nav-tabs">
38
31
  <li ng-class="{active: stateIncludes('jenkins-instances.details.info')}">
@@ -46,7 +39,7 @@
46
39
  <span translate>Jenkins Users</span>
47
40
  </a>
48
41
  </li>
49
-
42
+
50
43
  </ul>
51
44
  </nav>
52
45
  <section class="nutupane-sub-section" ui-view></section>
@@ -3,7 +3,10 @@ angular.module('ForemanPipeline.jenkins-instances', [
3
3
  'Bastion.components',
4
4
  'ui.router',
5
5
  'Bastion'
6
- ]);
6
+ ])
7
+ .run(["FencedPages", function (FencedPages) {
8
+ FencedPages.addPages("jenkins_instances");
9
+ }]);
7
10
 
8
11
  angular.module('ForemanPipeline.jenkins-instances').config(['$stateProvider', function ($stateProvider) {
9
12
  $stateProvider.state('jenkins-instances', {
@@ -1,5 +1,5 @@
1
1
  angular.module('ForemanPipeline.jenkins-instances').controller('NewJenkinsInstanceController',
2
- ['$scope', 'translate', 'JenkinsInstance',
2
+ ['$scope', 'translate', 'JenkinsInstance',
3
3
  function ($scope, translate, JenkinsInstance) {
4
4
 
5
5
  $scope.successMessages = [];
@@ -21,20 +21,17 @@ angular.module('ForemanPipeline.jenkins-instances').controller('NewJenkinsInstan
21
21
  angular.forEach(response.data.errors, function (errors, field) {
22
22
  try {
23
23
  $scope.jenkinsInstanceForm[field].$setValidity('server', false);
24
- $scope.jenkinsInstanceForm[field].$error.messages = errors;
25
- }
24
+ $scope.jenkinsInstanceForm[field].$error.messages = errors;
25
+ }
26
26
  catch (err) {
27
27
  $scope.errorMessages.push(errors);
28
28
  }
29
-
29
+
30
30
  });
31
31
  };
32
32
 
33
33
  $scope.createJenkinsInstance = function (jenkinsInstance) {
34
34
  jenkinsInstance.$save(success, error);
35
35
  };
36
-
37
-
38
-
39
36
  }]
40
37
  );
@@ -15,13 +15,13 @@
15
15
  name="url"
16
16
  ng-model="jenkinsInstance.url"
17
17
  type="text"
18
- tabindex="2"
18
+ tabindex="2"
19
19
  required/>
20
20
  </div>
21
- <div bst-form-group>
21
+ <div bst-form-group>
22
22
  <p class="alert alert-info" translate>
23
23
  Make sure to specify the port Jenkins master is running on. Example: http://jenkins.example.com:8080
24
- </p>
24
+ </p>
25
25
  </div>
26
26
 
27
27
  <div bst-form-group label="{{ 'Jenkins Home' | translate }}">
@@ -42,6 +42,21 @@
42
42
  required/>
43
43
  </div>
44
44
 
45
+ <div bst-form-group label="{{ 'Timeout' | translate }}">
46
+ <input id="timeout"
47
+ name="timeout"
48
+ ng-model="jenkinsInstance.timeout"
49
+ type="number"
50
+ min="1"
51
+ tabindex="5" />
52
+ </div>
53
+
54
+ <div bst-form-group>
55
+ <p class="alert alert-info" translate>
56
+ Time in minutes we are willing to wait before build on Jenkins starts.
57
+ </p>
58
+ </div>
59
+
45
60
  <div bst-form-buttons
46
61
  on-cancel="transitionBack()"
47
62
  on-save="createJenkinsInstance(jenkinsInstance)"
@@ -1,4 +1,4 @@
1
- angular.module('ForemanPipeline.jenkins-users').controller('NewJenkinsUserController',
1
+ angular.module('ForemanPipeline.jenkins-users').controller('NewJenkinsUserController',
2
2
  ['$scope', '$q', 'translate', 'JenkinsUser', 'JenkinsInstance',
3
3
  function ($scope, $q, translate, JenkinsUser, JenkinsInstance) {
4
4
 
@@ -14,7 +14,7 @@ angular.module('ForemanPipeline.jenkins-users').controller('NewJenkinsUserContro
14
14
 
15
15
  success = function (response) {
16
16
  $scope.working = false;
17
- $scope.transitionBack();
17
+ $scope.transitionBack();
18
18
  };
19
19
 
20
20
  error = function (response) {
@@ -22,12 +22,12 @@ angular.module('ForemanPipeline.jenkins-users').controller('NewJenkinsUserContro
22
22
  angular.forEach(response.data.errors, function (errors, field) {
23
23
  try {
24
24
  $scope.jenkinsUsereForm[field].$setValidity('server', false);
25
- $scope.jenkinsUserForm[field].$error.messages = errors;
26
- }
25
+ $scope.jenkinsUserForm[field].$error.messages = errors;
26
+ }
27
27
  catch (err) {
28
28
  $scope.errorMessages.push(errors);
29
29
  }
30
-
30
+
31
31
  });
32
32
  };
33
33
 
@@ -1,5 +1,5 @@
1
1
  angular.module('ForemanPipeline.jobs').controller('JobDetailsContentViewsController',
2
- ['$scope', '$q', '$location','translate', 'Job', 'ContentView', 'Nutupane',
2
+ ['$scope', '$q', '$location','translate', 'Job', 'ContentView', 'Nutupane',
3
3
  function ($scope, $q, $location, translate, Job, ContentView, Nutupane) {
4
4
 
5
5
  $scope.successMessages = [];
@@ -37,7 +37,7 @@ angular.module('ForemanPipeline.jobs').controller('JobDetailsContentViewsControl
37
37
  cvNutupane.refresh();
38
38
  $scope.job.content_view = $scope.chosen;
39
39
  $scope.cvTable.chosenRow = null;
40
- };
40
+ };
41
41
 
42
42
  error = function (response) {
43
43
  deferred.reject(response);
@@ -50,6 +50,6 @@ angular.module('ForemanPipeline.jobs').controller('JobDetailsContentViewsControl
50
50
  $scope.cvTable.working = true;
51
51
  Job.setContentView({id: $scope.job.id}, data, success, error);
52
52
  return deferred.promise;
53
- };
53
+ };
54
54
  }
55
55
  ]);
@@ -1,5 +1,5 @@
1
1
  angular.module('ForemanPipeline.jobs').controller('JobDetailsHostgroupsController',
2
- ['$scope', '$q', '$location', 'translate', 'Job', 'Hostgroup', 'Nutupane',
2
+ ['$scope', '$q', '$location', 'translate', 'Job', 'Hostgroup', 'Nutupane',
3
3
  function ($scope, $q, $location, translate, Job, Hostgroup, Nutupane) {
4
4
 
5
5
  $scope.successMessages = [];
@@ -8,7 +8,7 @@ angular.module('ForemanPipeline.jobs').controller('JobDetailsHostgroupsControlle
8
8
  params = {
9
9
  'search': $location.search().search || "",
10
10
  'sort_by': 'name',
11
- 'order': 'ASC'
11
+ 'order': 'ASC'
12
12
  }
13
13
 
14
14
  $scope.job = $scope.job || Job.get({id: $scope.$stateParams.jobId}, function () {
@@ -53,7 +53,5 @@ angular.module('ForemanPipeline.jobs').controller('JobDetailsHostgroupsControlle
53
53
  Job.setHostgroup({id: $scope.job.id}, data, success, error);
54
54
  return deferred.promise;
55
55
  };
56
-
57
-
58
56
  }
59
- ]);
57
+ ]);
@@ -1,5 +1,5 @@
1
1
  angular.module('ForemanPipeline.jobs').controller('JobDetailsJenkinsProjectsController',
2
- ['$scope', '$q', 'translate', 'Nutupane', 'Job',
2
+ ['$scope', '$q', 'translate', 'Nutupane', 'Job',
3
3
  function ($scope, $q, translate, Nutupane, Job) {
4
4
 
5
5
  $scope.errorMessages = [];
@@ -9,7 +9,7 @@ angular.module('ForemanPipeline.jobs').controller('JobDetailsJenkinsProjectsCont
9
9
  'sort_by': 'name',
10
10
  'sort_order': 'ASC',
11
11
  'id': $scope.$stateParams.jobId
12
- }
12
+ }
13
13
 
14
14
  nutupane = new Nutupane(Job, params, 'projects');
15
15
  $scope.projectsTable = nutupane.table;
@@ -14,6 +14,15 @@ angular.module('ForemanPipeline.jobs').controller('JobProjectsDiscoveryControlle
14
14
  setDetails(task);
15
15
  if (!task.pending) {
16
16
  Task.unregisterSearch($scope.taskSearchId);
17
+ if (task.result !== "success") {
18
+ if (task.humanized && task.humanized.errors && task.humanized.errors.length > 0) {
19
+ task.humanized.errors.forEach( function (err) {
20
+ $scope.errorMessages.push(err);
21
+ });
22
+ } else {
23
+ $scope.errorMessages.push("Unknown error occured when listing projects on Jenkins server");
24
+ }
25
+ }
17
26
  }
18
27
  }
19
28
 
@@ -30,7 +39,7 @@ angular.module('ForemanPipeline.jobs').controller('JobProjectsDiscoveryControlle
30
39
  projects = _.map(project_names, function (item) {
31
40
  return {'name': item}
32
41
  });
33
-
42
+
34
43
  sorted = _.sortBy(projects, function (item) {
35
44
  return item.name;
36
45
  });