diff --git a/dist/origin-web-common-ui.js b/dist/origin-web-common-ui.js index 89b1bd0..001d5bc 100644 --- a/dist/origin-web-common-ui.js +++ b/dist/origin-web-common-ui.js @@ -206,7 +206,7 @@ hawtioPluginLoader.addModule('openshiftCommonUI'); "
\n" + " \n" + " \n" + - " \n" + " \n" + - " \n" + " \n" + - " \n
\n\n
\n \n \n Cancel\n \n
\n \n\n'), +$templateCache.put("src/components/create-project/createProject.html", '
\n
\n
\n \n \n \n \n
\n A unique name for the project.\n
\n
\n \n Name is required.\n \n
\n
\n \n Name must have at least two characters.\n \n
\n
\n \n Project names may only contain lower-case letters, numbers, and dashes.\n They may not start or end with a dash.\n \n
\n
\n \n This name is already in use. Please choose a different name.\n \n
\n
\n\n
\n \n \n
\n\n
\n \n \n
\n\n
\n \n \n Cancel\n \n
\n
\n
\n'), $templateCache.put("src/components/delete-project/delete-project-button.html", '
\n \n Delete Project {{projectName}}\n
\n'), $templateCache.put("src/components/delete-project/delete-project-modal.html", '
\n \n
\n \n \n
\n
\n'), -$templateCache.put("src/components/delete-project/delete-project.html", '{{label || \'Delete\'}}\n'), $templateCache.put("src/components/edit-project/editProject.html", '
\n
\n
\n \n \n
\n\n
\n \n \n
\n\n
\n \n \n Cancel\n \n
\n
\n
\n'), +$templateCache.put("src/components/delete-project/delete-project.html", '{{label || \'Delete\'}}\n'), $templateCache.put("src/components/edit-project/editProject.html", '
\n
\n
\n \n \n
\n\n
\n \n \n
\n\n
\n \n \n Cancel\n \n
\n
\n
\n'), $templateCache.put("src/components/origin-modal-popup/origin-modal-popup.html", '
\n

\n {{$ctrl.modalTitle}}\n

\n
\n \n \n \n
\n'), $templateCache.put("src/components/toast-notifications/toast-notifications.html", '
\n
\n
\n \n \n {{notification.type}}\n {{notification.message}}\n
\n \n \n
\n \n {{link.label}}\n {{link.label}}\n |\n \n
\n
\n
\n'), $templateCache.put("src/components/truncate-long-text/truncateLongText.html", '\n\n\n \n \n …\n \n See All\n \n \n
\n Collapse\n \n
\n \n Collapse\n \n \n
\n
\n'); } ]), angular.module("openshiftCommonUI").component("bindApplicationForm", { @@ -163,13 +163,15 @@ onCancel:"&?", isDialog:"@" }, templateUrl:"src/components/create-project/createProject.html", -controller:[ "$scope", "$location", "ProjectsService", "NotificationsService", "displayNameFilter", function($scope, $location, ProjectsService, NotificationsService, displayNameFilter) { +controller:[ "$scope", "$location", "ProjectsService", "NotificationsService", "displayNameFilter", "Logger", function($scope, $location, ProjectsService, NotificationsService, displayNameFilter, Logger) { $scope.submitButtonLabel || ($scope.submitButtonLabel = "Create"), $scope.isDialog = "true" === $scope.isDialog; var hideErrorNotifications = function() { NotificationsService.hideNotification("create-project-error"); }; $scope.createProject = function() { -$scope.disableInputs = !0, $scope.createProjectForm.$valid && ProjectsService.create($scope.name, $scope.displayName, $scope.description).then(function(project) { +if ($scope.disableInputs = !0, $scope.createProjectForm.$valid) { +var displayName = $scope.displayName || $scope.name; +ProjectsService.create($scope.name, $scope.displayName, $scope.description).then(function(project) { var cb = $scope.redirectAction(); cb ? cb(encodeURIComponent(project.metadata.name)) :$location.path("project/" + encodeURIComponent(project.metadata.name) + "/create"), NotificationsService.addNotification({ type:"success", @@ -179,14 +181,14 @@ message:"Project '" + displayNameFilter(project) + "' was successfully created." $scope.disableInputs = !1; var data = result.data || {}; if ("AlreadyExists" === data.reason) $scope.nameTaken = !0; else { -var msg = data.message || "An error occurred creating the project."; +var msg = data.message || "An error occurred creating project '" + displayName + "'."; NotificationsService.addNotification({ -id:"create-project-error", type:"error", message:msg -}); +}), Logger.error("Project '" + displayName + "' could not be created.", result); } }); +} }, $scope.cancelCreateProject = function() { if ($scope.onCancel) { var cb = $scope.onCancel(); @@ -214,9 +216,7 @@ return angular.isDefined(attr.buttonOnly) ? "src/components/delete-project/delet }, replace:!0, link:function(scope, element, attrs) { -var showAlert = function(alert) { -NotificationsService.addNotification(alert.data); -}, navigateToList = function() { +var navigateToList = function() { if (!scope.stayOnCurrentPage) { if (scope.redirectUrl) return void $location.url(scope.redirectUrl); if ("/" === $location.path()) return void scope.$emit("deleteProject"); @@ -233,24 +233,20 @@ controller:"DeleteProjectModalController", scope:scope }); modalInstance.result.then(function() { -var projectName = scope.projectName, formattedResource = "Project '" + scope.displayName + "'", context = {}; +var projectName = scope.projectName, formattedResource = "Project '" + (scope.displayName || projectName) + "'", context = {}; DataService["delete"]({ resource:APIService.kindToResource("Project") }, projectName, context).then(function() { -showAlert({ -name:projectName, -data:{ +NotificationsService.addNotification({ type:"success", message:formattedResource + " was marked for deletion." -} }), scope.success && scope.success(), navigateToList(); })["catch"](function(err) { -var alert = { +NotificationsService.addNotification({ type:"error", message:formattedResource + " could not be deleted.", details:$filter("getErrorDetails")(err) -}; -NotificationsService.addNotification(alert), Logger.error(formattedResource + " could not be deleted.", err); +}), Logger.error(formattedResource + " could not be deleted.", err); }); }); } @@ -268,14 +264,13 @@ return { restrict:"E", scope:{ project:"=", -alerts:"=", submitButtonLabel:"@", redirectAction:"&", onCancel:"&", isDialog:"@" }, templateUrl:"src/components/edit-project/editProject.html", -controller:[ "$scope", "$filter", "$location", "DataService", "NotificationsService", "annotationNameFilter", "displayNameFilter", function($scope, $filter, $location, DataService, NotificationsService, annotationNameFilter, displayNameFilter) { +controller:[ "$scope", "$filter", "$location", "DataService", "NotificationsService", "annotationNameFilter", "displayNameFilter", "Logger", function($scope, $filter, $location, DataService, NotificationsService, annotationNameFilter, displayNameFilter, Logger) { $scope.submitButtonLabel || ($scope.submitButtonLabel = "Save"), $scope.isDialog = "true" === $scope.isDialog; var annotation = $filter("annotation"), annotationName = $filter("annotationName"), editableFields = function(resource) { return { @@ -290,8 +285,6 @@ var paths = [ annotationNameFilter("description"), annotationNameFilter("display return _.each(paths, function(path) { resource.metadata.annotations[path] || delete resource.metadata.annotations[path]; }), resource; -}, showAlert = function(alert) { -$scope.alerts.update = alert, NotificationsService.addNotification(alert); }; $scope.editableFields = editableFields($scope.project), $scope.update = function() { $scope.disableInputs = !0, $scope.editProjectForm.$valid && DataService.update("projects", $scope.project.metadata.name, cleanEditableAnnotations(mergeEditable($scope.project, $scope.editableFields)), { @@ -300,16 +293,16 @@ projectName:$scope.project.name errorNotification:!1 }).then(function(project) { var cb = $scope.redirectAction(); -cb && cb(encodeURIComponent($scope.project.metadata.name)), showAlert({ +cb && cb(encodeURIComponent($scope.project.metadata.name)), NotificationsService.addNotification({ type:"success", message:"Project '" + displayNameFilter(project) + "' was successfully updated." }); }, function(result) { -$scope.disableInputs = !1, $scope.editableFields = editableFields($scope.project), showAlert({ +$scope.disableInputs = !1, $scope.editableFields = editableFields($scope.project), NotificationsService.addNotification({ type:"error", -message:"An error occurred while updating the project", +message:"An error occurred while updating project '" + displayNameFilter($scope.project) + "'.", details:$filter("getErrorDetails")(result) -}); +}), Logger.error("Project '" + displayNameFilter($scope.project) + "' could not be updated.", result); }); }, $scope.cancelEditProject = function() { var cb = $scope.onCancel(); diff --git a/dist/scripts/templates.js b/dist/scripts/templates.js index 308276c..995e9f8 100644 --- a/dist/scripts/templates.js +++ b/dist/scripts/templates.js @@ -177,7 +177,7 @@ angular.module('openshiftCommonUI').run(['$templateCache', function($templateCac "
\n" + " \n" + " \n" + - " \n" + " \n" + - " \n" + " \n" + - "