From 4101d5dacf62b71d04b07d34a5759ce922888c8a Mon Sep 17 00:00:00 2001 From: Aravindh-Raju Date: Wed, 25 Sep 2024 18:27:32 +0530 Subject: [PATCH 1/4] add copy to clipboard --- .../dnsChanges/dnsChangeDetail.scala.html | 4 +++ .../app/views/groups/groupDetail.scala.html | 8 ++++- .../app/views/zones/zoneDetail.scala.html | 4 +++ modules/portal/public/app.js | 2 +- modules/portal/public/css/vinyldns.css | 9 +++++ .../lib/controllers/controller.membership.js | 13 +++++++ .../lib/controllers/controller.records.js | 13 +++++++ .../dns-change-detail.controller.js | 13 +++++++ .../dns-change/dns-change-new.controller.js | 5 +++ .../lib/recordset/recordsets.controller.js | 5 +++ .../lib/services/utility/service.utility.js | 36 ++++++++++++++++--- 11 files changed, 105 insertions(+), 7 deletions(-) diff --git a/modules/portal/app/views/dnsChanges/dnsChangeDetail.scala.html b/modules/portal/app/views/dnsChanges/dnsChangeDetail.scala.html index 956fa95f7..5954ae134 100644 --- a/modules/portal/app/views/dnsChanges/dnsChangeDetail.scala.html +++ b/modules/portal/app/views/dnsChanges/dnsChangeDetail.scala.html @@ -24,6 +24,10 @@ {{batch.status}} {{batch.status}} {{batch.status}} + + 📋 + diff --git a/modules/portal/app/views/groups/groupDetail.scala.html b/modules/portal/app/views/groups/groupDetail.scala.html index 273be9fb7..819a0b2ff 100644 --- a/modules/portal/app/views/groups/groupDetail.scala.html +++ b/modules/portal/app/views/groups/groupDetail.scala.html @@ -16,7 +16,13 @@
-

Group {{membership.group.name}}

+

+ Group: {{membership.group.name}} + + 📋 + +

diff --git a/modules/portal/app/views/zones/zoneDetail.scala.html b/modules/portal/app/views/zones/zoneDetail.scala.html index e35699ba2..c37d073dc 100644 --- a/modules/portal/app/views/zones/zoneDetail.scala.html +++ b/modules/portal/app/views/zones/zoneDetail.scala.html @@ -23,6 +23,10 @@

{{ zoneInfo.name }} {{ zoneInfo.status }} + + 📋 +

diff --git a/modules/portal/public/app.js b/modules/portal/public/app.js index 8879d4af0..d201ef7cc 100644 --- a/modules/portal/public/app.js +++ b/modules/portal/public/app.js @@ -14,7 +14,7 @@ angular.module('vinyldns', [ $animateProvider .classNameFilter(/toshow/); // turning off $log. Change to true for local development and testing - $logProvider.debugEnabled(false); + $logProvider.debugEnabled(true); }) .controller('AppController', function ($scope, $timeout, profileService, utilityService) { document.body.style.cursor = 'default'; diff --git a/modules/portal/public/css/vinyldns.css b/modules/portal/public/css/vinyldns.css index 4beac8b20..10ee98b72 100644 --- a/modules/portal/public/css/vinyldns.css +++ b/modules/portal/public/css/vinyldns.css @@ -627,3 +627,12 @@ input[type="file"] { display: flex; flex-direction: column; } + +/* Style for the copy icon */ +.copy-icon { + cursor: pointer; + font-size: 16px; + position: relative; + display: inline-block; + margin-left: 5px; +} diff --git a/modules/portal/public/lib/controllers/controller.membership.js b/modules/portal/public/lib/controllers/controller.membership.js index 9c71adbda..d974ca4ad 100644 --- a/modules/portal/public/lib/controllers/controller.membership.js +++ b/modules/portal/public/lib/controllers/controller.membership.js @@ -41,6 +41,19 @@ angular.module('controller.membership', []).controller('MembershipController', f 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 var changePaging = pagingService.getNewPagingParams(100); diff --git a/modules/portal/public/lib/controllers/controller.records.js b/modules/portal/public/lib/controllers/controller.records.js index ec9959024..e0939e123 100644 --- a/modules/portal/public/lib/controllers/controller.records.js +++ b/modules/portal/public/lib/controllers/controller.records.js @@ -90,6 +90,19 @@ angular.module('controller.records', []) // paging status for record changes 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 */ diff --git a/modules/portal/public/lib/dns-change/dns-change-detail.controller.js b/modules/portal/public/lib/dns-change/dns-change-detail.controller.js index 024177d5c..d28081bf2 100644 --- a/modules/portal/public/lib/dns-change/dns-change-detail.controller.js +++ b/modules/portal/public/lib/dns-change/dns-change-detail.controller.js @@ -26,6 +26,19 @@ $scope.reviewConfirmationMsg; $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) { function success(response) { $scope.batch = response.data; diff --git a/modules/portal/public/lib/dns-change/dns-change-new.controller.js b/modules/portal/public/lib/dns-change/dns-change-new.controller.js index 931426f9a..8642953c2 100644 --- a/modules/portal/public/lib/dns-change/dns-change-new.controller.js +++ b/modules/portal/public/lib/dns-change/dns-change-new.controller.js @@ -44,6 +44,11 @@ $scope.manualReviewEnabled; $scope.naptrFlags = ["U", "S", "A", "P"]; + // Initialize Bootstrap tooltips + $(document).ready(function() { + $('[data-toggle="tooltip"]').tooltip(); + }); + $scope.addSingleChange = function() { $scope.newBatch.changes.push({changeType: "Add", type: "A+PTR"}); diff --git a/modules/portal/public/lib/recordset/recordsets.controller.js b/modules/portal/public/lib/recordset/recordsets.controller.js index 2fac5cd5a..d1071ebee 100644 --- a/modules/portal/public/lib/recordset/recordsets.controller.js +++ b/modules/portal/public/lib/recordset/recordsets.controller.js @@ -80,6 +80,11 @@ var recordType = []; var recordName = []; + // Initialize Bootstrap tooltips + $(document).ready(function() { + $('[data-toggle="tooltip"]').tooltip(); + }); + $( "#record-search-text" ).autocomplete({ source: function( request, response ) { $.ajax({ diff --git a/modules/portal/public/lib/services/utility/service.utility.js b/modules/portal/public/lib/services/utility/service.utility.js index 5fb97ebaa..0bd6d23ef 100644 --- a/modules/portal/public/lib/services/utility/service.utility.js +++ b/modules/portal/public/lib/services/utility/service.utility.js @@ -46,13 +46,39 @@ angular.module('service.utility', []) }; this.success = function(message, response, type) { - var msg = "HTTP " + response.status + " (" + response.statusText + "): " + message; - $log.debug(type, response); - return { - type: "success", content: msg - }; + if (response && type) { + var msg = "HTTP " + response.status + " (" + response.statusText + "): " + message; + $log.debug(type, response); + return { + 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) { var result = []; for (var property in obj) { From ed564cf54ac7fc142f229e3a57e8968a11200a5a Mon Sep 17 00:00:00 2001 From: Aravindh-Raju Date: Wed, 25 Sep 2024 18:34:57 +0530 Subject: [PATCH 2/4] turn off debug --- modules/portal/public/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/portal/public/app.js b/modules/portal/public/app.js index d201ef7cc..8879d4af0 100644 --- a/modules/portal/public/app.js +++ b/modules/portal/public/app.js @@ -14,7 +14,7 @@ angular.module('vinyldns', [ $animateProvider .classNameFilter(/toshow/); // turning off $log. Change to true for local development and testing - $logProvider.debugEnabled(true); + $logProvider.debugEnabled(false); }) .controller('AppController', function ($scope, $timeout, profileService, utilityService) { document.body.style.cursor = 'default'; From af60d73b3c35c972d381d767119aaaaf2d59d853 Mon Sep 17 00:00:00 2001 From: Aravindh-Raju Date: Tue, 1 Oct 2024 15:21:23 +0530 Subject: [PATCH 3/4] add-copy-button --- .../dnsChanges/dnsChangeDetail.scala.html | 11 ++++--- .../app/views/groups/groupDetail.scala.html | 32 +++++++++++-------- .../app/views/zones/zoneDetail.scala.html | 15 ++++++--- modules/portal/public/css/vinyldns.css | 27 ++++++++++++---- 4 files changed, 56 insertions(+), 29 deletions(-) diff --git a/modules/portal/app/views/dnsChanges/dnsChangeDetail.scala.html b/modules/portal/app/views/dnsChanges/dnsChangeDetail.scala.html index 5954ae134..afc747dd9 100644 --- a/modules/portal/app/views/dnsChanges/dnsChangeDetail.scala.html +++ b/modules/portal/app/views/dnsChanges/dnsChangeDetail.scala.html @@ -24,10 +24,6 @@ {{batch.status}} {{batch.status}} {{batch.status}} - - 📋 - @@ -45,7 +41,12 @@
-

ID: {{batch.id}}

+

ID: {{batch.id}} + + Copy + +

Submitted: {{batch.createdTimestamp}}

Submitter: {{batch.userName}}

Description: {{batch.comments}}

diff --git a/modules/portal/app/views/groups/groupDetail.scala.html b/modules/portal/app/views/groups/groupDetail.scala.html index 819a0b2ff..2c42fe465 100644 --- a/modules/portal/app/views/groups/groupDetail.scala.html +++ b/modules/portal/app/views/groups/groupDetail.scala.html @@ -18,10 +18,6 @@

Group: {{membership.group.name}} - - 📋 -

@@ -29,6 +25,24 @@
+
+
+

+ + Updates to group require a valid email. If group email is invalid please enter a valid email. + +

+

Group ID: {{membership.group.id}} + + Copy + +

+

Group Email: {{membership.group.email}}

+

Description: {{membership.group.description}}

+
+
+
@@ -42,19 +56,9 @@
  • Change History
  • -
    - -

    - - Updates to group require a valid email. If group email is invalid please enter a valid email. - -

    -
    -

    Description: {{membership.group.description}}

    -

    Group Email: {{membership.group.email}}

    diff --git a/modules/portal/app/views/zones/zoneDetail.scala.html b/modules/portal/app/views/zones/zoneDetail.scala.html index c37d073dc..5683651cc 100644 --- a/modules/portal/app/views/zones/zoneDetail.scala.html +++ b/modules/portal/app/views/zones/zoneDetail.scala.html @@ -23,10 +23,6 @@

    {{ zoneInfo.name }} {{ zoneInfo.status }} - - 📋 -

    @@ -34,6 +30,17 @@
    +
    +
    +

    Zone ID: {{zoneInfo.id}} + + Copy + +

    +
    +
    +
    diff --git a/modules/portal/public/css/vinyldns.css b/modules/portal/public/css/vinyldns.css index 10ee98b72..a3b863bb8 100644 --- a/modules/portal/public/css/vinyldns.css +++ b/modules/portal/public/css/vinyldns.css @@ -283,6 +283,7 @@ body { .page-title { padding: 10px 20px 0; + height: 100%; } .page-content-wrap { @@ -628,11 +629,25 @@ input[type="file"] { flex-direction: column; } -/* Style for the copy icon */ -.copy-icon { +.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: 16px; - position: relative; - display: inline-block; - margin-left: 5px; + 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; } From 618f2cd089c68561f7f7089ccc46727299d46099 Mon Sep 17 00:00:00 2001 From: Aravindh-Raju Date: Wed, 9 Oct 2024 12:20:41 +0530 Subject: [PATCH 4/4] add copy button in batches page --- .../app/views/dnsChanges/dnsChanges.scala.html | 8 +++++++- modules/portal/public/css/vinyldns.css | 16 ++++++++++++++++ .../lib/dns-change/dns-changes.controller.js | 13 +++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/modules/portal/app/views/dnsChanges/dnsChanges.scala.html b/modules/portal/app/views/dnsChanges/dnsChanges.scala.html index 56059399d..a90e4ba3a 100644 --- a/modules/portal/app/views/dnsChanges/dnsChanges.scala.html +++ b/modules/portal/app/views/dnsChanges/dnsChanges.scala.html @@ -111,7 +111,13 @@ - {{batchChange.id}} + + {{batchChange.id}} + + Copy + + {{batchChange.status}} diff --git a/modules/portal/public/css/vinyldns.css b/modules/portal/public/css/vinyldns.css index 110f0c99b..65797bc38 100644 --- a/modules/portal/public/css/vinyldns.css +++ b/modules/portal/public/css/vinyldns.css @@ -656,3 +656,19 @@ input[type="file"] { 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; +} diff --git a/modules/portal/public/lib/dns-change/dns-changes.controller.js b/modules/portal/public/lib/dns-change/dns-changes.controller.js index b9e046fa2..af121ac58 100644 --- a/modules/portal/public/lib/dns-change/dns-changes.controller.js +++ b/modules/portal/public/lib/dns-change/dns-changes.controller.js @@ -50,6 +50,19 @@ $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() { batchChangePaging = pagingService.resetPaging(batchChangePaging);