parent
d9bafa478b
commit
dcf8922799
5 changed files with 100 additions and 0 deletions
52
static/css/directives/ui/feedback-bar.css
Normal file
52
static/css/directives/ui/feedback-bar.css
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
.feedback-bar {
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
|
right: 0px;
|
||||||
|
z-index: 50;
|
||||||
|
overflow: hidden;
|
||||||
|
text-align: center;
|
||||||
|
height: 42px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes flow-down-up {
|
||||||
|
0% {
|
||||||
|
top: -40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
25% {
|
||||||
|
top: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
75% {
|
||||||
|
top: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
top: -40px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.feedback-bar-element {
|
||||||
|
position: relative;
|
||||||
|
top: -40px;
|
||||||
|
|
||||||
|
text-align: center;
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
|
background: #eee;
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid #eee;
|
||||||
|
border-top: 0px;
|
||||||
|
|
||||||
|
animation-name: flow-down-up;
|
||||||
|
animation-duration: 5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feedback-bar .feedback-bar-element.info {
|
||||||
|
background-color: #F0FAFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feedback-bar .feedback-bar-element.warning {
|
||||||
|
background-color: #FFFBF0;
|
||||||
|
}
|
3
static/directives/feedback-bar.html
Normal file
3
static/directives/feedback-bar.html
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<div class="feedback-bar-element" ng-class="feedback.kind" ng-show="viewCounter">
|
||||||
|
{{ feedback.message }}
|
||||||
|
</div>
|
|
@ -1,4 +1,5 @@
|
||||||
<div class="robots-manager-element">
|
<div class="robots-manager-element">
|
||||||
|
<div class="feedback-bar" feedback="feedback"></div>
|
||||||
<div class="cor-loader" ng-show="loading"></div>
|
<div class="cor-loader" ng-show="loading"></div>
|
||||||
|
|
||||||
<div ng-show="!loading">
|
<div ng-show="!loading">
|
||||||
|
|
35
static/js/directives/ui/feedback-bar.js
Normal file
35
static/js/directives/ui/feedback-bar.js
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/**
|
||||||
|
* An element which displays a feedback bar when an action has been taken.
|
||||||
|
*/
|
||||||
|
angular.module('quay').directive('feedbackBar', function () {
|
||||||
|
var directiveDefinitionObject = {
|
||||||
|
priority: 0,
|
||||||
|
templateUrl: '/static/directives/feedback-bar.html',
|
||||||
|
replace: false,
|
||||||
|
transclude: true,
|
||||||
|
restrict: 'C',
|
||||||
|
scope: {
|
||||||
|
'feedback': '=feedback'
|
||||||
|
},
|
||||||
|
controller: function($scope, $element, AvatarService, Config, UIService, $timeout) {
|
||||||
|
$scope.viewCounter = 0;
|
||||||
|
|
||||||
|
$scope.$watch('feedback', function(feedback) {
|
||||||
|
if (feedback) {
|
||||||
|
$scope.viewCounter++;
|
||||||
|
} else {
|
||||||
|
$scope.viewCounter = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$($element).find('.feedback-bar-element')
|
||||||
|
.on('webkitAnimationEnd oanimationend oAnimationEnd msAnimationEnd animationend',
|
||||||
|
function(e) {
|
||||||
|
$scope.$apply(function() {
|
||||||
|
$scope.viewCounter = 0;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return directiveDefinitionObject;
|
||||||
|
});
|
|
@ -22,6 +22,7 @@ angular.module('quay').directive('robotsManager', function () {
|
||||||
$scope.shownRobot = null;
|
$scope.shownRobot = null;
|
||||||
$scope.showRobotCounter = 0;
|
$scope.showRobotCounter = 0;
|
||||||
$scope.Config = Config;
|
$scope.Config = Config;
|
||||||
|
$scope.feedback = null;
|
||||||
|
|
||||||
// Listen for route changes and update the tabs accordingly.
|
// Listen for route changes and update the tabs accordingly.
|
||||||
var locationListener = $rootScope.$on('$routeUpdate', function(){
|
var locationListener = $rootScope.$on('$routeUpdate', function(){
|
||||||
|
@ -117,6 +118,10 @@ angular.module('quay').directive('robotsManager', function () {
|
||||||
created.teams = [];
|
created.teams = [];
|
||||||
created.repositories = [];
|
created.repositories = [];
|
||||||
$scope.robots.push(created);
|
$scope.robots.push(created);
|
||||||
|
$scope.feedback = {
|
||||||
|
'kind': 'info',
|
||||||
|
'message': 'Robot account ' + name + ' was created'
|
||||||
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -126,6 +131,10 @@ angular.module('quay').directive('robotsManager', function () {
|
||||||
var index = $scope.findRobotIndexByName(info.name);
|
var index = $scope.findRobotIndexByName(info.name);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
$scope.robots.splice(index, 1);
|
$scope.robots.splice(index, 1);
|
||||||
|
$scope.feedback = {
|
||||||
|
'kind': 'info',
|
||||||
|
'message': 'Robot account ' + info.name + ' was deleted'
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}, ApiService.errorDisplay('Cannot delete robot account'));
|
}, ApiService.errorDisplay('Cannot delete robot account'));
|
||||||
};
|
};
|
||||||
|
|
Reference in a new issue