From 4e0154a724a3a050f966b5291d5d5f72ec3cd3ca Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 20 Oct 2017 08:50:20 -0400 Subject: [PATCH] Added 'no projects and cant create' empty state to process-template, deploy-image, and from-file --- app/scripts/directives/deployImage.js | 12 +- app/scripts/directives/deployImageDialog.js | 8 + app/scripts/directives/fromFile.js | 12 +- app/scripts/directives/fromFileDialog.js | 8 + app/scripts/directives/processTemplate.js | 13 +- app/views/directives/deploy-image.html | 374 +++++----- app/views/directives/from-file.html | 54 +- app/views/directives/process-template.html | 28 +- dist/scripts/scripts.js | 774 ++++++++++---------- dist/scripts/templates.js | 10 +- 10 files changed, 688 insertions(+), 605 deletions(-) diff --git a/app/scripts/directives/deployImage.js b/app/scripts/directives/deployImage.js index 07a6349a48..f09a93ab8e 100644 --- a/app/scripts/directives/deployImage.js +++ b/app/scripts/directives/deployImage.js @@ -25,6 +25,7 @@ angular.module("openshiftConsole") controller: function($scope) { // Must be initialized the controller. The link function is too late. $scope.forms = {}; + $scope.noProjectsCantCreate = false; }, link: function($scope) { $scope.input = { @@ -44,6 +45,12 @@ angular.module("openshiftConsole") value: '' }]; + var noProjectsCantCreateWatch; + + noProjectsCantCreateWatch = $scope.$on('no-projects-cannot-create', function() { + $scope.noProjectsCantCreate = true; + }); + var orderByDisplayName = $filter('orderByDisplayName'); var getErrorDetails = $filter('getErrorDetails'); @@ -387,7 +394,10 @@ angular.module("openshiftConsole") // button is outside the component since it is in the wizard footer. Listen // for an event for when the button is clicked. $scope.$on('newAppFromDeployImage', $scope.create); - $scope.$on('$destroy', hideErrorNotifications); + $scope.$on('$destroy', function() { + hideErrorNotifications(); + noProjectsCantCreateWatch(); + }); } }; }); diff --git a/app/scripts/directives/deployImageDialog.js b/app/scripts/directives/deployImageDialog.js index be5ea8eee0..08835440f5 100644 --- a/app/scripts/directives/deployImageDialog.js +++ b/app/scripts/directives/deployImageDialog.js @@ -19,6 +19,7 @@ function DeployImageDialog($scope, $routeParams, DataService) { var ctrl = this; + var noProjectsCantCreateWatch; ctrl.$onInit = function() { ctrl.loginBaseUrl = DataService.openshiftAPIBaseUrl(); @@ -27,6 +28,9 @@ if (!$routeParams.project) { ctrl.showProjectName = true; } + noProjectsCantCreateWatch = $scope.$on('no-projects-cannot-create', function() { + ctrl.deployForm.$setValidity('required', false); + }); }; ctrl.deployImage = function() { @@ -40,6 +44,10 @@ ctrl.currentStep = "Results"; }); + ctrl.$onDestroy = function() { + noProjectsCantCreateWatch(); + }; + ctrl.close = function() { var cb = ctrl.onDialogClosed(); if (_.isFunction(cb)) { diff --git a/app/scripts/directives/fromFile.js b/app/scripts/directives/fromFile.js index 7ea9982e66..a55d99f49e 100644 --- a/app/scripts/directives/fromFile.js +++ b/app/scripts/directives/fromFile.js @@ -23,10 +23,17 @@ angular.module("openshiftConsole") templateUrl: "views/directives/from-file.html", controller: function($scope) { var aceEditorSession; + var noProjectsCantCreateWatch; + $scope.noProjectsCantCreate = false; + var humanizeKind = $filter('humanizeKind'); var getErrorDetails = $filter('getErrorDetails'); TaskList.clear(); + noProjectsCantCreateWatch = $scope.$on('no-projects-cannot-create', function() { + $scope.noProjectsCantCreate = true; + }); + $scope.input = { selectedProject: $scope.project }; @@ -511,7 +518,10 @@ angular.module("openshiftConsole") // button is outside the component since it is in the wizard footer. Listen // for an event for when the button is clicked. $scope.$on('importFileFromYAMLOrJSON', $scope.create); - $scope.$on('$destroy', hideErrorNotifications); + $scope.$on('$destroy', function() { + hideErrorNotifications(); + noProjectsCantCreateWatch(); + }); } }; }); diff --git a/app/scripts/directives/fromFileDialog.js b/app/scripts/directives/fromFileDialog.js index c1b39a947b..fa3ed58524 100644 --- a/app/scripts/directives/fromFileDialog.js +++ b/app/scripts/directives/fromFileDialog.js @@ -21,6 +21,7 @@ function FromFileDialog($scope, $timeout, $routeParams, $filter, DataService) { var ctrl = this; + var noProjectsCantCreateWatch; var annotation = $filter('annotation'); var imageForIconClass = $filter('imageForIconClass'); @@ -31,6 +32,9 @@ if (!$routeParams.project) { ctrl.showProjectName = true; } + noProjectsCantCreateWatch = $scope.$on('no-projects-cannot-create', function() { + ctrl.importForm.$setValidity('required', false); + }); }; function getIconClass() { @@ -109,5 +113,9 @@ } return true; }; + + ctrl.$onDestroy = function() { + noProjectsCantCreateWatch(); + }; } })(); diff --git a/app/scripts/directives/processTemplate.js b/app/scripts/directives/processTemplate.js index dc50216206..07f507b6c9 100644 --- a/app/scripts/directives/processTemplate.js +++ b/app/scripts/directives/processTemplate.js @@ -50,6 +50,9 @@ var displayName = $filter('displayName'); var humanize = $filter('humanize'); + var noProjectsCantCreateWatch; + ctrl.noProjectsCantCreate = false; + function getHelpLinks(template) { var helpLinkName = /^helplink\.(.*)\.title$/; var helpLinkURL = /^helplink\.(.*)\.url$/; @@ -80,6 +83,11 @@ ctrl.template = angular.copy(ctrl.template); ctrl.templateDisplayName = displayName(ctrl.template); ctrl.selectedProject = ctrl.project; + + noProjectsCantCreateWatch = $scope.$on('no-projects-cannot-create', function() { + ctrl.noProjectsCantCreate = true; + }); + setTemplateParams(); }; @@ -261,7 +269,10 @@ // button is outside the component since it is in the wizard footer. Listen // for an event for when the button is clicked. $scope.$on('instantiateTemplate', ctrl.createFromTemplate); - $scope.$on('$destroy', hideNotificationErrors); + $scope.$on('$destroy', function() { + hideNotificationErrors(); + noProjectsCantCreateWatch(); + }); var shouldAddAppLabel = function() { // If the template defines its own app label, we don't need to add one at all diff --git a/app/views/directives/deploy-image.html b/app/views/directives/deploy-image.html index 222840429f..e61d7d39ac 100644 --- a/app/views/directives/deploy-image.html +++ b/app/views/directives/deploy-image.html @@ -1,206 +1,208 @@
-

- Deploy an existing image from an image stream tag or docker pull spec. -

- -
-
- -
-
- -
- - Service account default will need image pull authority to deploy images - from {{istag.namespace}}. You can grant authority with the command: - -

- oc policy add-role-to-user system:image-puller system:serviceaccount:{{input.selectedProject.metadata.name}}:default -n {{istag.namespace}} -

+ +

+ Deploy an existing image from an image stream tag or docker pull spec. +

+ +
+
+
-
- -
- -
-
-
- -
- - - - -
-
- Image search is only available for existing projects. +
+ +
+ + Service account default will need image pull authority to deploy images + from {{istag.namespace}}. You can grant authority with the command: + +

+ oc policy add-role-to-user system:image-puller system:serviceaccount:{{input.selectedProject.metadata.name}}:default -n {{istag.namespace}} +

+
+ +
+
+
+
+ +
+ + + + +
+
+ Image search is only available for existing projects. +
+
+
-
- -
-
-
-
-

Select an image stream tag or enter an image name.

-

Loading image metadata for {{imageName | stripSHA}}...

-
-
-
" );