2
0
mirror of https://github.com/VinylDNS/vinyldns synced 2025-08-22 18:17:07 +00:00

Merge pull request #1396 from Aravindh-Raju/aravindhr/copy-ids-to-clipboard

Copy group, batch and zone id to clipboard
This commit is contained in:
Nicholas Spadaccino 2024-10-09 11:30:02 -04:00 committed by GitHub
commit 52ab3d999a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 176 additions and 17 deletions

View File

@ -42,6 +42,10 @@
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<p><strong>ID:</strong> {{batch.id}} <p><strong>ID:</strong> {{batch.id}}
<span class="copy-button" ng-click="copyToClipboard()"
data-toggle="tooltip" data-placement="top" title="Copy batch id to clipboard">
<i class="fa fa-clone"></i> Copy
</span>
<button class="btn-right-corner" ng-click="exportToCSV(batch.id)">Export CSV</button> <button class="btn-right-corner" ng-click="exportToCSV(batch.id)">Export CSV</button>
</p> </p>
<p><strong>Submitted:</strong> {{batch.createdTimestamp}}</p> <p><strong>Submitted:</strong> {{batch.createdTimestamp}}</p>

View File

@ -111,7 +111,13 @@
<tr ng-repeat="batchChange in batchChanges|filter:query"> <tr ng-repeat="batchChange in batchChanges|filter:query">
<td ng-bind="batchChange.createdTimestamp"></td> <td ng-bind="batchChange.createdTimestamp"></td>
<td ng-if="ignoreAccess" ng-bind="batchChange.userName"></td> <td ng-if="ignoreAccess" ng-bind="batchChange.userName"></td>
<td><a href="/dnschanges/{{batchChange.id}}">{{batchChange.id}}</a></td> <td>
<a href="/dnschanges/{{batchChange.id}}">{{batchChange.id}}</a>
<span class="small-copy-button" ng-click="copyToClipboard(batchChange.id)"
data-toggle="tooltip" data-placement="top" title="Copy batch id to clipboard">
<i class="fa fa-clone"></i> Copy
</span>
</td>
<td ng-bind="batchChange.totalChanges"></td> <td ng-bind="batchChange.totalChanges"></td>
<td> <td>
<span ng-if="batchChange.status == 'Complete'" class="label label-success">{{batchChange.status}}</span> <span ng-if="batchChange.status == 'Complete'" class="label label-success">{{batchChange.status}}</span>

View File

@ -16,13 +16,33 @@
<!-- PAGE TITLE --> <!-- PAGE TITLE -->
<div class="page-title"> <div class="page-title">
<h3><span class="fa fa-group"></span> Group {{membership.group.name}}</h3> <h3>
<span class="fa fa-group"></span> Group: {{membership.group.name}}
</h3>
</div> </div>
<!-- END PAGE TITLE --> <!-- END PAGE TITLE -->
<!-- PAGE CONTENT WRAPPER --> <!-- PAGE CONTENT WRAPPER -->
<div class="page-content-wrap"> <div class="page-content-wrap">
<div class="row">
<div class="col-md-12">
<h3 class="batch-change-error-help">
<i class="fa fa-info-circle" style="font-size:18px;color:red">
Updates to group require a valid email. If group email is invalid please enter a valid email.
</i>
</h3>
<p><strong>Group ID:</strong> {{membership.group.id}}
<span class="copy-button" ng-click="copyToClipboard()"
data-toggle="tooltip" data-placement="top" title="Copy group id to clipboard">
<i class="fa fa-clone"></i> Copy
</span>
</p>
<p><strong>Group Email:</strong> {{membership.group.email}}</p>
<p ng-if="membership.group.description"><strong>Description:</strong> {{membership.group.description}}</p>
</div>
</div>
<div class="alert-wrapper"> <div class="alert-wrapper">
<div ng-repeat="alert in alerts"> <div ng-repeat="alert in alerts">
<notification ng-model="alert"></notification> <notification ng-model="alert"></notification>
@ -36,19 +56,9 @@
<li ng-if="canViewGroup"><a href="#tab2" data-toggle="tab">Change History</a></li> <li ng-if="canViewGroup"><a href="#tab2" data-toggle="tab">Change History</a></li>
</ul> </ul>
<div class="panel-body tab-content"> <div class="panel-body tab-content">
<div class="tab-pane active" id="tab1"> <div class="tab-pane active" id="tab1">
<h3 class="batch-change-error-help">
<i class="fa fa-info-circle" style="font-size:18px;color:red">
Updates to group require a valid email. If group email is invalid please enter a valid email.
</i>
</h3>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<p ng-if="membership.group.description"><strong>Description:</strong> {{membership.group.description}}</p>
<p><strong>Group Email:</strong> {{membership.group.email}}</p>
<!-- START SIMPLE DATATABLE --> <!-- START SIMPLE DATATABLE -->
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">

View File

@ -30,6 +30,17 @@
<!-- PAGE CONTENT WRAPPER --> <!-- PAGE CONTENT WRAPPER -->
<div class="page-content-wrap"> <div class="page-content-wrap">
<div class="row">
<div class="col-md-12">
<p><strong>Zone ID:</strong> {{zoneInfo.id}}
<span class="copy-button" ng-click="copyToClipboard()"
data-toggle="tooltip" data-placement="top" title="Copy zone id to clipboard">
<i class="fa fa-clone"></i> Copy
</span>
</p>
</div>
</div>
<div class="alert-wrapper"> <div class="alert-wrapper">
<div ng-repeat="alert in alerts"> <div ng-repeat="alert in alerts">
<notification ng-model="alert"></notification> <notification ng-model="alert"></notification>

View File

@ -288,6 +288,7 @@ body {
.page-title { .page-title {
padding: 10px 20px 0; padding: 10px 20px 0;
height: 100%;
} }
.page-content-wrap { .page-content-wrap {
@ -632,3 +633,42 @@ input[type="file"] {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.copy-button {
display: inline-flex;
align-items: center;
padding: 2px 6px;
border: 1px solid #d1d5da;
background-color: #f6f8fa;
border-radius: 4px;
cursor: pointer;
font-size: 12px;
color: #24292e;
margin-left: 8px;
transition: background-color 0.3s ease;
}
.copy-button:hover {
background-color: #e1e4e8;
}
.copy-button i {
margin-right: 4px;
font-size: 12px;
}
.small-copy-button {
font-size: 12px;
padding: 2px 6px;
display: inline-block;
cursor: pointer;
}
.small-copy-button i {
font-size: 12px;
}
.small-copy-button:hover {
background-color: #f0f0f0;
border-radius: 4px;
}

View File

@ -41,6 +41,19 @@ angular.module('controller.membership', []).controller('MembershipController', f
return $sce.trustAsHtml(message); return $sce.trustAsHtml(message);
}; };
// Initialize Bootstrap tooltips
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();
});
// Function to copy the ID to clipboard
$scope.copyToClipboard = function() {
utilityService.copyToClipboard($scope.membership.group.id);
// Trigger success alert using utilityService
var alert = utilityService.success('Successfully copied group id to clipboard');
$scope.alerts.push(alert);
};
// paging status for group changes // paging status for group changes
var changePaging = pagingService.getNewPagingParams(100); var changePaging = pagingService.getNewPagingParams(100);

View File

@ -99,6 +99,19 @@ angular.module('controller.records', [])
// paging status for record changes // paging status for record changes
var changePaging = pagingService.getNewPagingParams(100); var changePaging = pagingService.getNewPagingParams(100);
// Initialize Bootstrap tooltips
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();
});
// Function to copy the ID to clipboard
$scope.copyToClipboard = function() {
utilityService.copyToClipboard($scope.zoneInfo.id);
// Trigger success alert using utilityService
var alert = utilityService.success('Successfully copied zone id to clipboard');
$scope.alerts.push(alert);
};
/** /**
* Modal control functions * Modal control functions
*/ */

View File

@ -26,6 +26,19 @@
$scope.reviewConfirmationMsg; $scope.reviewConfirmationMsg;
$scope.reviewType; $scope.reviewType;
// Initialize Bootstrap tooltips
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();
});
// Function to copy the ID to clipboard
$scope.copyToClipboard = function() {
utilityService.copyToClipboard($scope.batch.id);
// Trigger success alert using utilityService
var alert = utilityService.success('Successfully copied batch id to clipboard');
$scope.alerts.push(alert);
};
$scope.getBatchChange = function(batchChangeId) { $scope.getBatchChange = function(batchChangeId) {
function success(response) { function success(response) {
$scope.batch = response.data; $scope.batch = response.data;

View File

@ -44,6 +44,11 @@
$scope.manualReviewEnabled; $scope.manualReviewEnabled;
$scope.naptrFlags = ["U", "S", "A", "P"]; $scope.naptrFlags = ["U", "S", "A", "P"];
// Initialize Bootstrap tooltips
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();
});
$scope.addSingleChange = function() { $scope.addSingleChange = function() {
$scope.newBatch.changes.push({changeType: "Add", type: "A+PTR"}); $scope.newBatch.changes.push({changeType: "Add", type: "A+PTR"});

View File

@ -50,6 +50,19 @@
$scope.alerts.push(alert); $scope.alerts.push(alert);
} }
// Initialize tooltips after the view has rendered
$timeout(function() {
$('[data-toggle="tooltip"]').tooltip();
}, 0);
// Function to copy the ID to clipboard
$scope.copyToClipboard = function(copyText) {
utilityService.copyToClipboard(copyText);
// Trigger success alert using utilityService
var alert = utilityService.success('Successfully copied batch id to clipboard');
$scope.alerts.push(alert);
};
$scope.refreshBatchChanges = function() { $scope.refreshBatchChanges = function() {
batchChangePaging = pagingService.resetPaging(batchChangePaging); batchChangePaging = pagingService.resetPaging(batchChangePaging);

View File

@ -80,6 +80,11 @@
var recordType = []; var recordType = [];
var recordName = []; var recordName = [];
// Initialize Bootstrap tooltips
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();
});
$( "#record-search-text" ).autocomplete({ $( "#record-search-text" ).autocomplete({
source: function( request, response ) { source: function( request, response ) {
$.ajax({ $.ajax({

View File

@ -46,12 +46,38 @@ angular.module('service.utility', [])
}; };
this.success = function(message, response, type) { this.success = function(message, response, type) {
if (response && type) {
var msg = "HTTP " + response.status + " (" + response.statusText + "): " + message; var msg = "HTTP " + response.status + " (" + response.statusText + "): " + message;
$log.debug(type, response); $log.debug(type, response);
return { return {
type: "success", content: msg type: "success",
content: msg
}; };
} else {
return {
type: "success",
content: message
}; };
}
};
// Function to copy the ID to clipboard
this.copyToClipboard = function(id) {
// Create a temporary input element to hold the ID
var tempInput = document.createElement("input");
tempInput.style.position = "absolute";
tempInput.style.left = "-9999px";
tempInput.value = id;
document.body.appendChild(tempInput);
// Select the input value and copy it
tempInput.select();
document.execCommand("copy");
// Remove the temporary input
document.body.removeChild(tempInput);
};
this.urlBuilder = function (url, obj) { this.urlBuilder = function (url, obj) {
var result = []; var result = [];