mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 03:40:42 -03:30
Dynamically update Tooltip content based on click
This commit is contained in:
parent
7fda3c0658
commit
73ea0b348a
@ -74,6 +74,7 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert',
|
||||
project.scm_update_tooltip = i18n._("Start an SCM update");
|
||||
project.scm_schedule_tooltip = i18n._("Schedule future SCM updates");
|
||||
project.scm_type_class = "";
|
||||
project.tooltipContent = 'Copy full revision to clipboard.';
|
||||
|
||||
if (project.status === 'failed' && project.summary_fields.last_update && project.summary_fields.last_update.status === 'canceled') {
|
||||
project.statusTip = i18n._('Canceled. Click for details');
|
||||
@ -92,6 +93,17 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert',
|
||||
}
|
||||
}
|
||||
|
||||
$scope.$on('copied', function(e) {
|
||||
$scope.projects.map( (project) => {
|
||||
if (project.id === e.targetScope.project.id) {
|
||||
project.tooltipContent = 'Copied to clipboard.';
|
||||
}
|
||||
else {
|
||||
project.tooltipContent = "Copy full revision to clipboard.";
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$scope.reloadList = function(){
|
||||
let path = GetBasePath(list.basePath) || GetBasePath(list.name);
|
||||
qs.search(path, $state.params[`${list.iterator}_search`])
|
||||
|
||||
@ -6,7 +6,6 @@ export default
|
||||
function(templateUrl, Rest, $q, $filter) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: false,
|
||||
templateUrl: templateUrl('projects/revisions/revisions'),
|
||||
link: function(scope) {
|
||||
let full_revision = scope.project.scm_revision;
|
||||
@ -14,6 +13,8 @@ export default
|
||||
scope.count = scope.project.scm_revision.length;
|
||||
|
||||
scope.copyRevisionHash = function() {
|
||||
scope.$emit('copied');
|
||||
|
||||
let textArea = document.createElement("textarea");
|
||||
|
||||
// Place in top-left corner of screen regardless of scroll position.
|
||||
@ -40,7 +41,7 @@ export default
|
||||
textArea.value = full_revision;
|
||||
document.body.appendChild(textArea);
|
||||
textArea.select();
|
||||
|
||||
|
||||
document.execCommand('copy');
|
||||
|
||||
document.body.removeChild(textArea);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<div class="RevisionHash-tag">
|
||||
<span class="RevisionHash-name">{{revisionHash}}</span>
|
||||
</div>
|
||||
<div class="RevisionHash-copy" ng-if="count > 7" aw-tool-tip="Copy full revision to clipboard" data-placement="top" ng-click="copyRevisionHash()">
|
||||
Copy
|
||||
<div class="RevisionHash-copy" ng-if="count > 7" aw-tool-tip="{{project.tooltipContent}}" data-tip-watch="project.tooltipContent"
|
||||
data-placement="top" ng-click="copyRevisionHash()">
|
||||
<i class="fa fa-clone"></i>
|
||||
</div>
|
||||
Loading…
x
Reference in New Issue
Block a user