Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
origin-web-common
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Java-于龙
origin-web-common
Commits
1a256eb3
Commit
1a256eb3
authored
Jun 30, 2017
by
Jessica Forrester
Committed by
GitHub
Jun 30, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #108 from spadgett/create-project-toasts
Don't show both a toast and in-page alert for create project
parents
672591da
65721be3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
27 deletions
+39
-27
origin-web-common-ui.js
dist/origin-web-common-ui.js
+11
-7
origin-web-common.js
dist/origin-web-common.js
+11
-7
origin-web-common.min.js
dist/origin-web-common.min.js
+6
-6
createProject.js
src/components/create-project/createProject.js
+11
-7
No files found.
dist/origin-web-common-ui.js
View file @
1a256eb3
...
...
@@ -542,7 +542,6 @@ angular.module("openshiftCommonUI")
return
{
restrict
:
'E'
,
scope
:
{
alerts
:
'='
,
redirectAction
:
'&'
,
onCancel
:
'&?'
,
isDialog
:
'@'
...
...
@@ -555,9 +554,8 @@ angular.module("openshiftCommonUI")
$scope
.
isDialog
=
$scope
.
isDialog
===
'true'
;
var
showAlert
=
function
(
name
,
alert
)
{
$scope
.
alerts
[
name
]
=
alert
;
NotificationsService
.
addNotification
(
alert
);
var
hideErrorNotifications
=
function
()
{
NotificationsService
.
hideNotification
(
'create-project-error'
);
};
$scope
.
createProject
=
function
()
{
...
...
@@ -581,9 +579,9 @@ angular.module("openshiftCommonUI")
}
else
{
$location
.
path
(
"project/"
+
encodeURIComponent
(
data
.
metadata
.
name
)
+
"/create"
);
}
showAlert
(
'created-project'
,
{
NotificationsService
.
addNotification
(
{
type
:
"success"
,
message
:
"Project
\
'"
+
displayNameFilter
(
data
)
+
"
\
' was successfully created."
message
:
"Project
\
'"
+
displayNameFilter
(
data
)
+
"
\
' was successfully created."
});
},
function
(
result
)
{
$scope
.
disableInputs
=
false
;
...
...
@@ -592,7 +590,11 @@ angular.module("openshiftCommonUI")
$scope
.
nameTaken
=
true
;
}
else
{
var
msg
=
data
.
message
||
'An error occurred creating the project.'
;
showAlert
(
'error-creating-project'
,
{
type
:
'error'
,
message
:
msg
});
NotificationsService
.
addNotification
({
id
:
'create-project-error'
,
type
:
'error'
,
message
:
msg
});
}
});
}
...
...
@@ -608,6 +610,8 @@ angular.module("openshiftCommonUI")
$window
.
history
.
back
();
}
};
$scope
.
$on
(
"$destroy"
,
hideErrorNotifications
);
},
};
});
...
...
dist/origin-web-common.js
View file @
1a256eb3
...
...
@@ -713,7 +713,6 @@ angular.module("openshiftCommonUI")
return
{
restrict
:
'E'
,
scope
:
{
alerts
:
'='
,
redirectAction
:
'&'
,
onCancel
:
'&?'
,
isDialog
:
'@'
...
...
@@ -726,9 +725,8 @@ angular.module("openshiftCommonUI")
$scope
.
isDialog
=
$scope
.
isDialog
===
'true'
;
var
showAlert
=
function
(
name
,
alert
)
{
$scope
.
alerts
[
name
]
=
alert
;
NotificationsService
.
addNotification
(
alert
);
var
hideErrorNotifications
=
function
()
{
NotificationsService
.
hideNotification
(
'create-project-error'
);
};
$scope
.
createProject
=
function
()
{
...
...
@@ -752,9 +750,9 @@ angular.module("openshiftCommonUI")
}
else
{
$location
.
path
(
"project/"
+
encodeURIComponent
(
data
.
metadata
.
name
)
+
"/create"
);
}
showAlert
(
'created-project'
,
{
NotificationsService
.
addNotification
(
{
type
:
"success"
,
message
:
"Project
\
'"
+
displayNameFilter
(
data
)
+
"
\
' was successfully created."
message
:
"Project
\
'"
+
displayNameFilter
(
data
)
+
"
\
' was successfully created."
});
},
function
(
result
)
{
$scope
.
disableInputs
=
false
;
...
...
@@ -763,7 +761,11 @@ angular.module("openshiftCommonUI")
$scope
.
nameTaken
=
true
;
}
else
{
var
msg
=
data
.
message
||
'An error occurred creating the project.'
;
showAlert
(
'error-creating-project'
,
{
type
:
'error'
,
message
:
msg
});
NotificationsService
.
addNotification
({
id
:
'create-project-error'
,
type
:
'error'
,
message
:
msg
});
}
});
}
...
...
@@ -779,6 +781,8 @@ angular.module("openshiftCommonUI")
$window
.
history
.
back
();
}
};
$scope
.
$on
(
"$destroy"
,
hideErrorNotifications
);
}],
};
}]);
...
...
dist/origin-web-common.min.js
View file @
1a256eb3
...
...
@@ -158,7 +158,6 @@ return humanizeKind(object.kind);
return
{
restrict
:
"E"
,
scope
:{
alerts
:
"="
,
redirectAction
:
"&"
,
onCancel
:
"&?"
,
isDialog
:
"@"
...
...
@@ -166,8 +165,8 @@ isDialog:"@"
templateUrl
:
"src/components/create-project/createProject.html"
,
controller
:[
"$scope"
,
"$filter"
,
"$location"
,
"DataService"
,
"NotificationsService"
,
"displayNameFilter"
,
function
(
$scope
,
$filter
,
$location
,
DataService
,
NotificationsService
,
displayNameFilter
)
{
$scope
.
submitButtonLabel
||
(
$scope
.
submitButtonLabel
=
"Create"
),
$scope
.
isDialog
=
"true"
===
$scope
.
isDialog
;
var
showAlert
=
function
(
name
,
alert
)
{
$scope
.
alerts
[
name
]
=
alert
,
NotificationsService
.
addNotification
(
alert
);
var
hideErrorNotifications
=
function
(
)
{
NotificationsService
.
hideNotification
(
"create-project-error"
);
};
$scope
.
createProject
=
function
()
{
$scope
.
disableInputs
=
!
0
,
$scope
.
createProjectForm
.
$valid
&&
DataService
.
create
(
"projectrequests"
,
null
,
{
...
...
@@ -180,7 +179,7 @@ displayName:$scope.displayName,
description
:
$scope
.
description
},
$scope
).
then
(
function
(
data
)
{
var
cb
=
$scope
.
redirectAction
();
cb
?
cb
(
encodeURIComponent
(
data
.
metadata
.
name
))
:
$location
.
path
(
"project/"
+
encodeURIComponent
(
data
.
metadata
.
name
)
+
"/create"
),
showAlert
(
"created-project"
,
{
cb
?
cb
(
encodeURIComponent
(
data
.
metadata
.
name
))
:
$location
.
path
(
"project/"
+
encodeURIComponent
(
data
.
metadata
.
name
)
+
"/create"
),
NotificationsService
.
addNotification
(
{
type
:
"success"
,
message
:
"Project '"
+
displayNameFilter
(
data
)
+
"' was successfully created."
});
...
...
@@ -189,7 +188,8 @@ $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."
;
showAlert
(
"error-creating-project"
,
{
NotificationsService
.
addNotification
({
id
:
"create-project-error"
,
type
:
"error"
,
message
:
msg
});
...
...
@@ -200,7 +200,7 @@ if ($scope.onCancel) {
var
cb
=
$scope
.
onCancel
();
cb
&&
cb
();
}
else
$window
.
history
.
back
();
};
}
,
$scope
.
$on
(
"$destroy"
,
hideErrorNotifications
)
;
}
]
};
}
]),
angular
.
module
(
"openshiftCommonUI"
).
directive
(
"deleteProject"
,
[
"$uibModal"
,
"$location"
,
"$filter"
,
"$q"
,
"hashSizeFilter"
,
"APIService"
,
"DataService"
,
"NotificationsService"
,
"Logger"
,
function
(
$uibModal
,
$location
,
$filter
,
$q
,
hashSizeFilter
,
APIService
,
DataService
,
NotificationsService
,
Logger
)
{
...
...
src/components/create-project/createProject.js
View file @
1a256eb3
...
...
@@ -6,7 +6,6 @@ angular.module("openshiftCommonUI")
return
{
restrict
:
'E'
,
scope
:
{
alerts
:
'='
,
redirectAction
:
'&'
,
onCancel
:
'&?'
,
isDialog
:
'@'
...
...
@@ -19,9 +18,8 @@ angular.module("openshiftCommonUI")
$scope
.
isDialog
=
$scope
.
isDialog
===
'true'
;
var
showAlert
=
function
(
name
,
alert
)
{
$scope
.
alerts
[
name
]
=
alert
;
NotificationsService
.
addNotification
(
alert
);
var
hideErrorNotifications
=
function
()
{
NotificationsService
.
hideNotification
(
'create-project-error'
);
};
$scope
.
createProject
=
function
()
{
...
...
@@ -45,9 +43,9 @@ angular.module("openshiftCommonUI")
}
else
{
$location
.
path
(
"project/"
+
encodeURIComponent
(
data
.
metadata
.
name
)
+
"/create"
);
}
showAlert
(
'created-project'
,
{
NotificationsService
.
addNotification
(
{
type
:
"success"
,
message
:
"Project
\
'"
+
displayNameFilter
(
data
)
+
"
\
' was successfully created."
message
:
"Project
\
'"
+
displayNameFilter
(
data
)
+
"
\
' was successfully created."
});
},
function
(
result
)
{
$scope
.
disableInputs
=
false
;
...
...
@@ -56,7 +54,11 @@ angular.module("openshiftCommonUI")
$scope
.
nameTaken
=
true
;
}
else
{
var
msg
=
data
.
message
||
'An error occurred creating the project.'
;
showAlert
(
'error-creating-project'
,
{
type
:
'error'
,
message
:
msg
});
NotificationsService
.
addNotification
({
id
:
'create-project-error'
,
type
:
'error'
,
message
:
msg
});
}
});
}
...
...
@@ -72,6 +74,8 @@ angular.module("openshiftCommonUI")
$window
.
history
.
back
();
}
};
$scope
.
$on
(
"$destroy"
,
hideErrorNotifications
);
},
};
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment