updates for pull-command and popover-details of UI.

This commit is contained in:
kunw 2016-05-24 13:50:09 +08:00
parent ce2454472b
commit c0f16a620b
8 changed files with 19 additions and 2645 deletions

View File

@ -58,7 +58,7 @@
if($routeParams.project_id){ if($routeParams.project_id){
angular.forEach(vm.projects, function(value, index) { angular.forEach(vm.projects, function(value, index) {
if(value['ProjectId'] === $routeParams.project_id) { if(value['ProjectId'] === Number($routeParams.project_id)) {
vm.selectedProject = value; vm.selectedProject = value;
} }
}); });
@ -123,13 +123,12 @@
function link(scope, element, attrs, ctrl) { function link(scope, element, attrs, ctrl) {
$(document).on('click', clickHandler); $(document).on('click', clickHandler);
function clickHandler(e) { function clickHandler(e) {
var target = $(e.target).parent(); $('[data-toggle="popover"]').each(function () {
$('[data-toggle="popover"]').each(function () {
//the 'is' for buttons that trigger popups //the 'is' for buttons that trigger popups
//the 'has' for icons within a button that triggers a popup //the 'has' for icons within a button that triggers a popup
if (!$(this).is(target) && $(this).has(target).length === 0 && $('.popover').has(target).length === 0) { if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
$(this).parent().popover('hide'); $(this).parent().popover('hide');
} }
}); });

View File

@ -1,4 +1,4 @@
<a href="javascript:void(0)" role="button" data-trigger="click" data-toggle="popover" data-placement="right" disabled> <a href="javascript:void(0)" >
<span class="glyphicon glyphicon-info-sign" > <span class="glyphicon glyphicon-info-sign" role="button" data-trigger="click" data-toggle="popover" data-placement="right">
</span> </span>
</a> </a>

View File

@ -39,6 +39,7 @@
'tag': '@', 'tag': '@',
'index': '@' 'index': '@'
}, },
'replace': true,
'link': link, 'link': link,
'controller': PopupDetailsController, 'controller': PopupDetailsController,
'controllerAs': 'vm', 'controllerAs': 'vm',
@ -48,9 +49,9 @@
function link(scope, element, attrs, ctrl) { function link(scope, element, attrs, ctrl) {
ctrl.retrieve(); ctrl.retrieve();
scope.$watch('vm.manifest', function(current) { scope.$watch('vm.manifest', function(current) {
if(current) { if(current) {
element element
.popover({ .popover({
'template': '<div class="popover" role="tooltip"><div class="arrow"></div><div class="popover-title"></div><div class="popover-content"></div></div>', 'template': '<div class="popover" role="tooltip"><div class="arrow"></div><div class="popover-title"></div><div class="popover-content"></div></div>',
@ -58,15 +59,16 @@
'content': generateContent, 'content': generateContent,
'html': true 'html': true
}) })
.on('shown.bs.popover', function(e){ .on('shown.bs.popover', function(e){
$('[type="text"]:input', element.parent()) var self = jQuery(this);
$('[type="text"]:input', self.parent())
.select() .select()
.end() .end()
.on('click', function() { .on('click', function() {
$(this).select(); $(this).select();
}); });
element.parent().find('.glyphicon.glyphicon-remove-circle').on('click', function() { self.parent().find('.glyphicon.glyphicon-remove-circle').on('click', function() {
element.trigger('click'); element.trigger('click');
}); });
}); });
} }

View File

@ -1,9 +1,9 @@
<form class="form-inline"> <form class="form-inline">
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
<input type="text" class="form-control" id="//vm.repoName//-//vm.tag//" value="docker pull //vm.harborRegUrl////vm.repoName//://vm.tag//" readonly="readonly" size="60"> <input type="text" class="form-control" value="docker pull //vm.harborRegUrl////vm.repoName//://vm.tag//" readonly="readonly" size="60">
<div class="input-group-addon"> <div class="input-group-addon">
<a href="javascript:void(0);" data-clipboard-target="//vm.repoName//-//vm.tag//"><span class="glyphicon glyphicon-duplicate" data-toggle="tooltip" data-placement="right" title="Copied!"></span></a> <a href="javascript:void(0);"><span class="glyphicon glyphicon-duplicate"></span></a>
</div> </div>
</div> </div>
</div> </div>

View File

@ -29,26 +29,10 @@
ctrl.harborRegUrl = $('#HarborRegUrl').val() + '/'; ctrl.harborRegUrl = $('#HarborRegUrl').val() + '/';
ZeroClipboard.config( { swfPath: "/static/ng/vendors/zc/v2.2.0/ZeroClipboard.swf" } ); element.find('a').on('click', clickHandler);
var clip = new ZeroClipboard(element.find('a')); function clickHandler(e) {
element.find('span').tooltip({'trigger': 'click'}); element.find('input[type="text"]').select();
}
clip.on("ready", function() {
console.log("Flash movie loaded and ready.");
this.on("aftercopy", function(event) {
console.log("Copied text to clipboard: " + event.data["text/plain"]);
element.find('span').tooltip('show');
setTimeout(function(){
element.find('span').tooltip('hide');
}, 1000);
});
});
clip.on("error", function(event) {
console.log('error[name="' + event.name + '"]: ' + event.message);
ZeroClipboard.destroy();
element.find('span').tooltip('destroy');
});
} }

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -10,7 +10,6 @@
<link rel="stylesheet" href="/static/ng/vendors/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css" /> <link rel="stylesheet" href="/static/ng/vendors/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css" />
<script src="/static/ng/vendors/spinner/spinner.min.js"></script> <script src="/static/ng/vendors/spinner/spinner.min.js"></script>
<script src="/static/ng/vendors/zc/v2.2.0/ZeroClipboard.js"></script>
<!-- Latest compiled and minified CSS --> <!-- Latest compiled and minified CSS -->
<!--link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"--> <!--link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"-->