Skip to content

Commit

Permalink
Added 'no projects and cant create' empty state to process-template, …
Browse files Browse the repository at this point in the history
…deploy-image, and from-file
  • Loading branch information
dtaylor113 committed Oct 20, 2017
1 parent f127c70 commit 4e0154a
Show file tree
Hide file tree
Showing 10 changed files with 688 additions and 605 deletions.
12 changes: 11 additions & 1 deletion app/scripts/directives/deployImage.js
Expand Up @@ -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 = {
Expand All @@ -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');

Expand Down Expand Up @@ -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();
});
}
};
});
8 changes: 8 additions & 0 deletions app/scripts/directives/deployImageDialog.js
Expand Up @@ -19,6 +19,7 @@

function DeployImageDialog($scope, $routeParams, DataService) {
var ctrl = this;
var noProjectsCantCreateWatch;

ctrl.$onInit = function() {
ctrl.loginBaseUrl = DataService.openshiftAPIBaseUrl();
Expand All @@ -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() {
Expand All @@ -40,6 +44,10 @@
ctrl.currentStep = "Results";
});

ctrl.$onDestroy = function() {
noProjectsCantCreateWatch();
};

ctrl.close = function() {
var cb = ctrl.onDialogClosed();
if (_.isFunction(cb)) {
Expand Down
12 changes: 11 additions & 1 deletion app/scripts/directives/fromFile.js
Expand Up @@ -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
};
Expand Down Expand Up @@ -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();
});
}
};
});
8 changes: 8 additions & 0 deletions app/scripts/directives/fromFileDialog.js
Expand Up @@ -21,6 +21,7 @@

function FromFileDialog($scope, $timeout, $routeParams, $filter, DataService) {
var ctrl = this;
var noProjectsCantCreateWatch;
var annotation = $filter('annotation');
var imageForIconClass = $filter('imageForIconClass');

Expand All @@ -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() {
Expand Down Expand Up @@ -109,5 +113,9 @@
}
return true;
};

ctrl.$onDestroy = function() {
noProjectsCantCreateWatch();
};
}
})();
13 changes: 12 additions & 1 deletion app/scripts/directives/processTemplate.js
Expand Up @@ -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$/;
Expand Down Expand Up @@ -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();
};

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4e0154a

Please sign in to comment.