From dbc7f45679010142fc0f4b4b31e05a3b64cc4c30 Mon Sep 17 00:00:00 2001 From: William Welling <144841721+wwelling@users.noreply.github.com> Date: Mon, 8 Apr 2024 14:18:00 -0500 Subject: [PATCH 01/15] 1.5.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc8b849..7a44c7b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "library-webservices-status", "private": true, - "version": "1.5.2-rc2", + "version": "1.5.2", "description": "Library Webservices Status System UI", "repository": "https://github.com/TAMULib/LibraryServiceStatusSystemUI.git", "license": "MIT", From edb9ac387f9f2e3178ef0414eabc937f50fa6037 Mon Sep 17 00:00:00 2001 From: William Welling <144841721+wwelling@users.noreply.github.com> Date: Mon, 8 Apr 2024 14:19:35 -0500 Subject: [PATCH 02/15] Increment patch version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7a44c7b..b5d364b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "library-webservices-status", "private": true, - "version": "1.5.2", + "version": "1.5.3", "description": "Library Webservices Status System UI", "repository": "https://github.com/TAMULib/LibraryServiceStatusSystemUI.git", "license": "MIT", From e9ff4e403600d1f0216fec332e7aff0a88740797 Mon Sep 17 00:00:00 2001 From: William Welling Date: Mon, 8 Apr 2024 14:38:31 -0500 Subject: [PATCH 03/15] Fade in using opacity and update body and main styles --- app/config/runTime.js | 2 +- app/resources/styles/sass/app.scss | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/config/runTime.js b/app/config/runTime.js index ab13b2c..683ca91 100644 --- a/app/config/runTime.js +++ b/app/config/runTime.js @@ -1,6 +1,6 @@ app.run(function ($location) { - angular.element("body").fadeIn(300); + angular.element("body").css('opacity', 0).animate({ opacity: 1 }, 1000); // Add runtime tasks here // Allow the passing of an additional parameter which diff --git a/app/resources/styles/sass/app.scss b/app/resources/styles/sass/app.scss index 9670515..28c38b4 100644 --- a/app/resources/styles/sass/app.scss +++ b/app/resources/styles/sass/app.scss @@ -20,16 +20,14 @@ html { body { font-family: "Lato", sans-serif; - margin-right: 0 !important; - padding-right: 0 !important; - height: 100%; + opacity: 0; + min-height: 100%; + display: grid; + grid-template-rows: 1fr auto; } main { display: block; - height: auto; - min-height: 94%; - margin-bottom: -50px; } main footer { From d0bca313a6dd9c0501938d2ed7329318d8c4d7b0 Mon Sep 17 00:00:00 2001 From: Jason Savell Date: Mon, 10 Jun 2024 10:38:15 -0500 Subject: [PATCH 04/15] downgrade tinymce to latest version compatible with angular-ui-tinymce --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc8b849..c58d71a 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "angular-ui-tinymce": "0.0.19", "ng-csv": "0.3.6", "ng-table": "3.0.1", - "tinymce": "7.0.0" + "tinymce": "^4.9" }, "devDependencies": { }, From e401973ae1f1178287c7bf81fd3a66cc84bda7b7 Mon Sep 17 00:00:00 2001 From: Rincy Mathew Date: Wed, 3 Jul 2024 08:17:29 -0500 Subject: [PATCH 05/15] WIP - added tl-wysiwyg in the add notification modal --- app/controllers/notificationController.js | 22 ++++++++++++---------- app/views/modals/addNotificationModal.html | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/controllers/notificationController.js b/app/controllers/notificationController.js index a1a8220..e8dc950 100644 --- a/app/controllers/notificationController.js +++ b/app/controllers/notificationController.js @@ -111,17 +111,19 @@ app.controller('NotificationController', function ($controller, $scope, Notifica NotificationRepo.ready().then(function () { buildTable(); + + document.addEventListener("contentSave", function (e) { + $scope.notificationData.body = e.detail.data; + $scope.save(); + }); + + $scope.save = function () { + $scope.notificationData.body = encodeURIComponent($scope.notificationData.body); + $scope.notificationData.update($scope.notificationData); + $scope.notificationData.body = decodeURIComponent($scope.notificationData.body); + }; + $scope.tableParams.reload(); }); - $scope.tinymceOptions = { - selector: 'textarea', - theme: "modern", - plugins: "link lists", - toolbar: "undo redo | formatselect bold italic separator | alignleft aligncenter alignright | numlist bullist | forecolor backcolor", - relative_urls: false, - remove_script_host : false, - convert_urls : true - }; - }); diff --git a/app/views/modals/addNotificationModal.html b/app/views/modals/addNotificationModal.html index 512b14e..312feed 100644 --- a/app/views/modals/addNotificationModal.html +++ b/app/views/modals/addNotificationModal.html @@ -14,7 +14,7 @@
{{ notificationRepo.getValidationResults().messages.body.minlength }}
- +
From cd63b1cdab71c83660c12e3fcf78c0911abb1ba4 Mon Sep 17 00:00:00 2001 From: William Welling Date: Wed, 3 Jul 2024 11:50:22 -0500 Subject: [PATCH 06/15] Use tl-wysiwyg for edit notification Required manually adding body to tinymce iframe document --- app/controllers/notificationController.js | 2 ++ app/views/modals/editNotificationModal.html | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/notificationController.js b/app/controllers/notificationController.js index e8dc950..8d50e87 100644 --- a/app/controllers/notificationController.js +++ b/app/controllers/notificationController.js @@ -61,6 +61,8 @@ app.controller('NotificationController', function ($controller, $scope, Notifica $scope.editNotification = function (notification) { $scope.notificationData = notification; $scope.openModal('#editNotificationModal'); + const iframe = angular.element('#editNotificationModal').find("iframe")[0]; + iframe.contentDocument.body.innerHTML = notification.body; }; $scope.updateNotification = function () { diff --git a/app/views/modals/editNotificationModal.html b/app/views/modals/editNotificationModal.html index d04018a..f85df02 100644 --- a/app/views/modals/editNotificationModal.html +++ b/app/views/modals/editNotificationModal.html @@ -13,7 +13,8 @@ - + +
From ae60e79c47f570b5f8607dbb80e7a842af5eb8da Mon Sep 17 00:00:00 2001 From: William Welling Date: Wed, 3 Jul 2024 11:58:02 -0500 Subject: [PATCH 07/15] Add checks for iframe --- app/controllers/notificationController.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/controllers/notificationController.js b/app/controllers/notificationController.js index 8d50e87..2e929da 100644 --- a/app/controllers/notificationController.js +++ b/app/controllers/notificationController.js @@ -61,8 +61,13 @@ app.controller('NotificationController', function ($controller, $scope, Notifica $scope.editNotification = function (notification) { $scope.notificationData = notification; $scope.openModal('#editNotificationModal'); - const iframe = angular.element('#editNotificationModal').find("iframe")[0]; - iframe.contentDocument.body.innerHTML = notification.body; + const modal = angular.element('#editNotificationModal'); + if (modal) { + const iframe = modal.find("iframe"); + if (iframe && iframe.length >= 1) { + iframe[0].contentDocument.body.innerHTML = notification.body; + } + } }; $scope.updateNotification = function () { From 0b2d36005043a9ebfb80d4e4c044f4d0e9d9bd84 Mon Sep 17 00:00:00 2001 From: William Welling Date: Wed, 3 Jul 2024 11:59:36 -0500 Subject: [PATCH 08/15] Remove unnecessary build config --- .wvr/build-config.js | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/.wvr/build-config.js b/.wvr/build-config.js index b882595..e76e65d 100644 --- a/.wvr/build-config.js +++ b/.wvr/build-config.js @@ -70,24 +70,6 @@ const config = { from: './node_modules/bootstrap/dist/css/bootstrap.min.css.map', to: './resources/styles/bootstrap/dist/css/bootstrap.min.css.map', }, - { - from: './node_modules/tinymce/plugins/**/plugin.js', - to({ context, absoluteFilename }) { - return `${absoluteFilename.replace(/^.*\/node_modules\/tinymce\/plugins\//, "plugins/")}`; - }, - }, - { - from: './node_modules/tinymce/themes/**/theme.js', - to({ context, absoluteFilename }) { - return `${absoluteFilename.replace(/^.*\/node_modules\/tinymce\/themes\//, "themes/")}`; - }, - }, - { - from: './node_modules/tinymce/skins/**/*.css', - to({ context, absoluteFilename }) { - return `${absoluteFilename.replace(/^.*\/node_modules\/tinymce\/skins\//, "skins/")}`; - }, - }, ], entry: { app: [ From 132a7fe0a87b3d2bdf825ba123e008cbba08786e Mon Sep 17 00:00:00 2001 From: William Welling Date: Fri, 5 Jul 2024 09:09:53 -0500 Subject: [PATCH 09/15] Add some digest cycles and preserve notification data binding --- app/controllers/notificationController.js | 43 ++++++++++++++--------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/app/controllers/notificationController.js b/app/controllers/notificationController.js index 2e929da..b37948f 100644 --- a/app/controllers/notificationController.js +++ b/app/controllers/notificationController.js @@ -1,4 +1,4 @@ -app.controller('NotificationController', function ($controller, $scope, Notification, NotificationRepo, NgTableParams) { +app.controller('NotificationController', function ($controller, $scope, $timeout, Notification, NotificationRepo, NgTableParams) { angular.extend(this, $controller('AbstractScheduleController', { $scope: $scope @@ -29,17 +29,24 @@ app.controller('NotificationController', function ($controller, $scope, Notifica $scope.notificationToDelete = {}; + $scope.notificationData = new Notification({ + name: '', + body: '', + active: false, + locations: [] + }); + $scope.resetNotifications = function () { - if ($scope.notificationData) { - $scope.notificationData.refresh(); - $scope.notificationData.clearValidationResults(); - } + $scope.notificationData.refresh(); + $scope.notificationData.clearValidationResults(); + for (var key in $scope.forms) { if (!$scope.forms[key].$pristine) { $scope.forms[key].$setPristine(); } } - $scope.notificationData = new Notification({ + Object.assign($scope.notificationData, { + id: undefined, name: '', body: '', active: false, @@ -59,15 +66,17 @@ app.controller('NotificationController', function ($controller, $scope, Notifica }; $scope.editNotification = function (notification) { - $scope.notificationData = notification; - $scope.openModal('#editNotificationModal'); - const modal = angular.element('#editNotificationModal'); - if (modal) { - const iframe = modal.find("iframe"); - if (iframe && iframe.length >= 1) { - iframe[0].contentDocument.body.innerHTML = notification.body; + Object.assign($scope.notificationData, notification); + $timeout(function () { + $scope.openModal('#editNotificationModal'); + const modal = angular.element('#editNotificationModal'); + if (modal) { + const iframe = modal.find("iframe"); + if (iframe && iframe.length >= 1) { + iframe[0].contentDocument.body.innerHTML = notification.body; + } } - } + }); }; $scope.updateNotification = function () { @@ -80,8 +89,10 @@ app.controller('NotificationController', function ($controller, $scope, Notifica }; $scope.confirmDelete = function (notification) { - $scope.openModal('#deleteNotificationModal'); - $scope.notificationToDelete = notification; + Object.assign($scope.notificationToDelete, notification); + $timeout(function() { + $scope.openModal('#deleteNotificationModal'); + }); }; $scope.deleteNotification = function () { From e6ac5d12d4f486a7ca0b19b8e455ebecbf35c91e Mon Sep 17 00:00:00 2001 From: William Welling Date: Fri, 5 Jul 2024 09:25:17 -0500 Subject: [PATCH 10/15] Fix delete notification --- app/controllers/notificationController.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/app/controllers/notificationController.js b/app/controllers/notificationController.js index b37948f..cdc81f3 100644 --- a/app/controllers/notificationController.js +++ b/app/controllers/notificationController.js @@ -27,14 +27,16 @@ app.controller('NotificationController', function ($controller, $scope, $timeout $scope.forms = {}; - $scope.notificationToDelete = {}; - - $scope.notificationData = new Notification({ + var emptyNotification = { name: '', body: '', active: false, locations: [] - }); + }; + + $scope.notificationToDelete = new Notification(emptyNotification); + + $scope.notificationData = new Notification(emptyNotification); $scope.resetNotifications = function () { $scope.notificationData.refresh(); @@ -45,13 +47,7 @@ app.controller('NotificationController', function ($controller, $scope, $timeout $scope.forms[key].$setPristine(); } } - Object.assign($scope.notificationData, { - id: undefined, - name: '', - body: '', - active: false, - locations: [] - }); + Object.assign($scope.notificationData, emptyNotification); $scope.closeModal(); }; @@ -101,7 +97,7 @@ app.controller('NotificationController', function ($controller, $scope, $timeout if (angular.fromJson(res.body).meta.status === 'SUCCESS') { $scope.closeModal(); $scope.deleting = false; - $scope.notificationToDelete = {}; + Object.assign($scope.notificationToDelete, emptyNotification); $scope.tableParams.reload(); } }); From 364b613e8fcfca39bbc5ea2cbb3505a2b47cc56d Mon Sep 17 00:00:00 2001 From: William Welling Date: Fri, 5 Jul 2024 09:43:22 -0500 Subject: [PATCH 11/15] Fix notification controller tests --- .../controllers/notificationControllerTest.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/unit/controllers/notificationControllerTest.js b/tests/unit/controllers/notificationControllerTest.js index 697d754..6ba18da 100644 --- a/tests/unit/controllers/notificationControllerTest.js +++ b/tests/unit/controllers/notificationControllerTest.js @@ -9,10 +9,11 @@ describe('controller: NotificationController', function () { module('mock.notification'); module('mock.notificationRepo'); - inject(function ($controller, $q, $rootScope, _NgTableParams_, _Notification_, _NotificationRepo_) { + inject(function ($controller, $q, $rootScope, $timeout, _NgTableParams_, _Notification_, _NotificationRepo_) { installPromiseMatchers(); q = $q; scope = $rootScope.$new(); + timeout = $timeout; controller = $controller('NotificationController', { $scope: scope, @@ -72,13 +73,14 @@ describe('controller: NotificationController', function () { describe('Are the scope methods working as expected', function () { it('resetNotifications should reset notifications', function () { - var notification; - scope.notificationData = null; + var notification = new Notification(); + scope.notificationData = notification; scope.closeModal = function() {}; spyOn(scope, 'closeModal'); scope.resetNotifications(); + scope.$digest(); expect(scope.closeModal).toHaveBeenCalled(); expect(scope.ideaData).not.toEqual(null); @@ -109,14 +111,14 @@ describe('controller: NotificationController', function () { expect(notification.clearValidationResults).toHaveBeenCalled(); }); it('editNotification should open a modal', function () { - scope.notificationData = null; scope.openModal = function(name) { }; spyOn(scope, 'openModal'); scope.editNotification(mockNotification1); + timeout.flush(); + scope.$digest(); - expect(scope.notificationData).toEqual(mockNotification1); expect(scope.openModal).toHaveBeenCalled(); }); @@ -133,14 +135,14 @@ describe('controller: NotificationController', function () { expect(scope.notificationRepo.update).toHaveBeenCalled(); }); it('confirmDelete should should open a modal', function () { - scope.notificationToDelete = null; scope.openModal = function(name) { }; spyOn(scope, 'openModal'); scope.confirmDelete(mockNotification1); + timeout.flush(); + scope.$digest(); - expect(scope.notificationToDelete).toEqual(mockNotification1); expect(scope.openModal).toHaveBeenCalled(); }); it('deleteNotification should delete a notification', function () { From 2809f72219d3f014cd6b543b9cff4718d0563172 Mon Sep 17 00:00:00 2001 From: William Welling Date: Mon, 8 Jul 2024 09:43:43 -0500 Subject: [PATCH 12/15] Remove tinymce tamu-library-components brings in tinymce --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index c58d71a..f151898 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,7 @@ "@wvr/core": "2.2.6", "angular-ui-tinymce": "0.0.19", "ng-csv": "0.3.6", - "ng-table": "3.0.1", - "tinymce": "^4.9" + "ng-table": "3.0.1" }, "devDependencies": { }, From dcc2928d9f71f71e411e4727a2e640da4bedf295 Mon Sep 17 00:00:00 2001 From: William Welling Date: Mon, 8 Jul 2024 10:14:39 -0500 Subject: [PATCH 13/15] Use var to be consistent with AngularJS code --- app/controllers/notificationController.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/notificationController.js b/app/controllers/notificationController.js index cdc81f3..9e4346d 100644 --- a/app/controllers/notificationController.js +++ b/app/controllers/notificationController.js @@ -65,9 +65,9 @@ app.controller('NotificationController', function ($controller, $scope, $timeout Object.assign($scope.notificationData, notification); $timeout(function () { $scope.openModal('#editNotificationModal'); - const modal = angular.element('#editNotificationModal'); + var modal = angular.element('#editNotificationModal'); if (modal) { - const iframe = modal.find("iframe"); + var iframe = modal.find("iframe"); if (iframe && iframe.length >= 1) { iframe[0].contentDocument.body.innerHTML = notification.body; } From 7de765ac578ab6f0faa997164ac9483b57bfa8cd Mon Sep 17 00:00:00 2001 From: William Welling Date: Tue, 9 Jul 2024 10:03:23 -0500 Subject: [PATCH 14/15] Completely remove angular-ui-tinymce --- .wvr/build-config.js | 2 - app/app.js | 2 +- app/controllers/ideaController.js | 7 - app/controllers/noteController.js | 53 ++--- app/controllers/notificationController.js | 31 ++- app/controllers/serviceController.js | 187 +++++++++--------- app/views/modals/addNoteModal.html | 2 +- app/views/modals/addServiceModal.html | 2 +- app/views/modals/editNoteModal.html | 2 +- app/views/modals/editNotificationModal.html | 2 +- app/views/modals/editServiceModal.html | 2 +- karma.conf.js | 2 - package.json | 1 - tests/unit/controllers/noteControllerTest.js | 8 +- .../controllers/notificationControllerTest.js | 5 +- .../unit/controllers/serviceControllerTest.js | 8 +- 16 files changed, 152 insertions(+), 164 deletions(-) diff --git a/.wvr/build-config.js b/.wvr/build-config.js index e76e65d..ca4558d 100644 --- a/.wvr/build-config.js +++ b/.wvr/build-config.js @@ -86,8 +86,6 @@ const config = { './node_modules/ng-file-upload/dist/ng-file-upload-shim.js', './node_modules/ng-file-upload/dist/ng-file-upload.js', './node_modules/ng-table/bundles/ng-table.js', - './node_modules/tinymce/tinymce.js', - './node_modules/angular-ui-tinymce/dist/tinymce.min.js', './node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js', './node_modules/@wvr/core/app/config/coreConfig.js', './node_modules/@wvr/core/app/components/version/version.js', diff --git a/app/app.js b/app/app.js index fa8508c..3507997 100644 --- a/app/app.js +++ b/app/app.js @@ -35,7 +35,7 @@ setUpApp(function (connected) { try { //If the app is already bootstrapped then an error will be thrown - angular.bootstrap(document, ['app', 'core', 'ngMessages', 'ngFileUpload', 'ui.tinymce', 'ui.bootstrap']); + angular.bootstrap(document, ['app', 'core', 'ngMessages', 'ngFileUpload', 'ui.bootstrap']); if (!window.stompClient.connected) { unreachableAlert(injector); diff --git a/app/controllers/ideaController.js b/app/controllers/ideaController.js index 6971b65..c091b9b 100644 --- a/app/controllers/ideaController.js +++ b/app/controllers/ideaController.js @@ -144,11 +144,4 @@ app.controller('IdeaController', function ($controller, $scope, FeatureProposalR $scope.selectedFp = fp; }; - $scope.tinymceOptions = { - selector: 'textarea', - theme: "modern", - plugins: "link lists", - toolbar: "undo redo | formatselect bold italic separator | alignleft aligncenter alignright | numlist bullist | forecolor backcolor" - }; - }); diff --git a/app/controllers/noteController.js b/app/controllers/noteController.js index b6a465c..a6683a6 100644 --- a/app/controllers/noteController.js +++ b/app/controllers/noteController.js @@ -15,7 +15,17 @@ app.controller('NoteController', function ($controller, $scope, Note, NoteRepo, $scope.forms = {}; - $scope.noteToDelete = {}; + var emptyNote = { + title: '', + active: false, + pinned: false, + service: $scope.services[0], + noteType: 'ENHANCEMENT' + }; + + $scope.noteToDelete = new Note(emptyNote); + + $scope.noteData = new Note(emptyNote); $scope.noteTypes = [{ value: "ENHANCEMENT", @@ -108,23 +118,16 @@ app.controller('NoteController', function ($controller, $scope, Note, NoteRepo, ServiceRepo.ready().then(function () { $scope.resetNotes = function () { - if ($scope.noteData) { - $scope.noteData.refresh(); - $scope.noteData.clearValidationResults(); - } + $scope.noteData.refresh(); + $scope.noteData.clearValidationResults(); + for (var key in $scope.forms) { if (!$scope.forms[key].$pristine) { $scope.forms[key].$setPristine(); $scope.forms[key].$setUntouched(); } } - $scope.noteData = new Note({ - title: '', - active: false, - pinned: false, - service: $scope.services[0], - noteType: 'ENHANCEMENT' - }); + Object.assign($scope.noteData, emptyNote); $scope.closeModal(); }; @@ -139,8 +142,15 @@ app.controller('NoteController', function ($controller, $scope, Note, NoteRepo, }; $scope.editNote = function (note) { - $scope.noteData = note; + Object.assign($scope.noteData, note); $scope.openModal('#editNoteModal'); + var modal = angular.element('#editNoteModal'); + if (modal) { + var iframe = modal.find("iframe"); + if (iframe && iframe.length >= 1) { + iframe[0].contentDocument.body.innerHTML = note.body; + } + } }; $scope.updateNote = function () { @@ -162,8 +172,8 @@ app.controller('NoteController', function ($controller, $scope, Note, NoteRepo, }; $scope.confirmDelete = function (note) { + Object.assign($scope.noteToDelete, note); $scope.openModal('#deleteNoteModal'); - $scope.noteToDelete = note; }; $scope.deleteNote = function () { @@ -172,18 +182,17 @@ app.controller('NoteController', function ($controller, $scope, Note, NoteRepo, if (angular.fromJson(res.body).meta.status === 'SUCCESS') { $scope.closeModal(); $scope.deleting = false; - $scope.noteToDelete = {}; + Object.assign($scope.noteToDelete, emptyNote); } }); }; - }); + document.addEventListener("contentSave", function (e) { + $scope.noteData.body = encodeURIComponent(e.detail.data); + $scope.noteData.update($scope.noteData); + $scope.noteData.body = decodeURIComponent($scope.noteData.body); + }); - $scope.tinymceOptions = { - selector: 'textarea', - theme: "modern", - plugins: "link lists", - toolbar: "undo redo | formatselect bold italic separator | alignleft aligncenter alignright | numlist bullist | forecolor backcolor" - }; + }); }); diff --git a/app/controllers/notificationController.js b/app/controllers/notificationController.js index 9e4346d..307d591 100644 --- a/app/controllers/notificationController.js +++ b/app/controllers/notificationController.js @@ -1,4 +1,4 @@ -app.controller('NotificationController', function ($controller, $scope, $timeout, Notification, NotificationRepo, NgTableParams) { +app.controller('NotificationController', function ($controller, $scope, Notification, NotificationRepo, NgTableParams) { angular.extend(this, $controller('AbstractScheduleController', { $scope: $scope @@ -63,16 +63,14 @@ app.controller('NotificationController', function ($controller, $scope, $timeout $scope.editNotification = function (notification) { Object.assign($scope.notificationData, notification); - $timeout(function () { - $scope.openModal('#editNotificationModal'); - var modal = angular.element('#editNotificationModal'); - if (modal) { - var iframe = modal.find("iframe"); - if (iframe && iframe.length >= 1) { - iframe[0].contentDocument.body.innerHTML = notification.body; - } + $scope.openModal('#editNotificationModal'); + var modal = angular.element('#editNotificationModal'); + if (modal) { + var iframe = modal.find("iframe"); + if (iframe && iframe.length >= 1) { + iframe[0].contentDocument.body.innerHTML = notification.body; } - }); + } }; $scope.updateNotification = function () { @@ -86,9 +84,7 @@ app.controller('NotificationController', function ($controller, $scope, $timeout $scope.confirmDelete = function (notification) { Object.assign($scope.notificationToDelete, notification); - $timeout(function() { - $scope.openModal('#deleteNotificationModal'); - }); + $scope.openModal('#deleteNotificationModal'); }; $scope.deleteNotification = function () { @@ -127,15 +123,10 @@ app.controller('NotificationController', function ($controller, $scope, $timeout buildTable(); document.addEventListener("contentSave", function (e) { - $scope.notificationData.body = e.detail.data; - $scope.save(); - }); - - $scope.save = function () { - $scope.notificationData.body = encodeURIComponent($scope.notificationData.body); + $scope.notificationData.body = encodeURIComponent(e.detail.data); $scope.notificationData.update($scope.notificationData); $scope.notificationData.body = decodeURIComponent($scope.notificationData.body); - }; + }); $scope.tableParams.reload(); }); diff --git a/app/controllers/serviceController.js b/app/controllers/serviceController.js index 0349d0d..4b3e54c 100644 --- a/app/controllers/serviceController.js +++ b/app/controllers/serviceController.js @@ -16,96 +16,28 @@ app.controller('ServiceController', function ($controller, $scope, ProductServic $scope.forms = {}; - $scope.serviceToDelete = {}; - - ServiceRepo.ready().then(function () { - $scope.weaverTable = { - pageSettings: $scope.serviceRepo.getPageSettings(), - tableParams: $scope.serviceRepo.getTableParams(), - columns: [{ - gloss: 'Service', - property: 'name', - filterable: true, - sortable: true - }, - { - gloss: 'Status', - property: 'status', - filterable: true, - sortable: true - }, - { - gloss: 'Auto Updating URL', - property: 'serviceUrl', - filterable: true, - sortable: true - }, - { - gloss: 'Visible to Anonymous Users', - property: 'isPublic', - filterable: true, - sortable: true - }, - { - gloss: 'Prominent Display', - property: 'onShortList', - filterable: true, - sortable: true - }, - { - gloss: 'Product', - filterable: false, - sortable: false - }, - { - gloss: 'Actions', - filterable: false, - sortable: false - } - ], - activeSort: [{ - property: 'name', - direction: 'ASC' - }] - }; - }); - - ProductService.getAll().then(function (products) { - $scope.products = products; + var emptyService = { + name: '', + description: '', + isPublic: false, + onShortList: false, + isAuto: false, + status: 'UP' + }; - $scope.getProduct = function (service) { - if (service.productId && !service.product) { - service.product = {}; - ProductService.getById(service.productId).then(function (product) { - angular.extend(service, { - product: product - }); - }); - return service.product; - } - return service.product; - }; + $scope.serviceData = new Service(emptyService); - }); + $scope.serviceToDelete = new Service(emptyService); $scope.resetServices = function () { - if ($scope.serviceData) { - $scope.serviceData.refresh(); - $scope.serviceData.clearValidationResults(); - } + $scope.serviceData.refresh(); + $scope.serviceData.clearValidationResults(); for (var key in $scope.forms) { if (!$scope.forms[key].$pristine) { $scope.forms[key].$setPristine(); } } - $scope.serviceData = new Service({ - name: '', - description: '', - isPublic: false, - onShortList: false, - isAuto: false, - status: 'UP' - }); + Object.assign($scope.serviceData, emptyService); $scope.closeModal(); }; @@ -125,8 +57,15 @@ app.controller('ServiceController', function ($controller, $scope, ProductServic }; $scope.editService = function (service) { - $scope.serviceData = service; + Object.assign($scope.serviceData, service); $scope.openModal('#editServiceModal'); + var modal = angular.element('#editServiceModal'); + if (modal) { + var iframe = modal.find("iframe"); + if (iframe && iframe.length >= 1) { + iframe[0].contentDocument.body.innerHTML = service.description; + } + } }; $scope.updateService = function () { @@ -153,8 +92,8 @@ app.controller('ServiceController', function ($controller, $scope, ProductServic }); $scope.confirmDelete = function (service) { + Object.assign($scope.serviceToDelete, service); $scope.openModal('#deleteServiceModal'); - $scope.serviceToDelete = service; }; $scope.deleteService = function () { @@ -164,17 +103,85 @@ app.controller('ServiceController', function ($controller, $scope, ProductServic $scope.closeModal(); $scope.deleting = false; ServiceRepo.remove($scope.serviceToDelete); - $scope.serviceToDelete = {}; + Object.assign($scope.serviceToDelete, emptyService); $scope.tableParams.reload(); } }); }; - $scope.tinymceOptions = { - selector: 'textarea', - theme: "modern", - plugins: "link lists", - toolbar: "undo redo | formatselect bold italic separator | alignleft aligncenter alignright | bullist numlist | forecolor backcolor" - }; + ServiceRepo.ready().then(function () { + $scope.weaverTable = { + pageSettings: $scope.serviceRepo.getPageSettings(), + tableParams: $scope.serviceRepo.getTableParams(), + columns: [{ + gloss: 'Service', + property: 'name', + filterable: true, + sortable: true + }, + { + gloss: 'Status', + property: 'status', + filterable: true, + sortable: true + }, + { + gloss: 'Auto Updating URL', + property: 'serviceUrl', + filterable: true, + sortable: true + }, + { + gloss: 'Visible to Anonymous Users', + property: 'isPublic', + filterable: true, + sortable: true + }, + { + gloss: 'Prominent Display', + property: 'onShortList', + filterable: true, + sortable: true + }, + { + gloss: 'Product', + filterable: false, + sortable: false + }, + { + gloss: 'Actions', + filterable: false, + sortable: false + } + ], + activeSort: [{ + property: 'name', + direction: 'ASC' + }] + }; + + document.addEventListener("contentSave", function (e) { + $scope.serviceData.description = encodeURIComponent(e.detail.data); + $scope.serviceData.update($scope.serviceData); + $scope.serviceData.description = decodeURIComponent($scope.serviceData.description); + }); + }); + + ProductService.getAll().then(function (products) { + $scope.products = products; + + $scope.getProduct = function (service) { + if (service.productId && !service.product) { + service.product = {}; + ProductService.getById(service.productId).then(function (product) { + angular.extend(service, { + product: product + }); + }); + return service.product; + } + return service.product; + }; + }); }); diff --git a/app/views/modals/addNoteModal.html b/app/views/modals/addNoteModal.html index 1911533..54f52da 100644 --- a/app/views/modals/addNoteModal.html +++ b/app/views/modals/addNoteModal.html @@ -18,7 +18,7 @@ - +
diff --git a/app/views/modals/addServiceModal.html b/app/views/modals/addServiceModal.html index 193307a..7c582b9 100644 --- a/app/views/modals/addServiceModal.html +++ b/app/views/modals/addServiceModal.html @@ -14,7 +14,7 @@ - +
diff --git a/app/views/modals/editNoteModal.html b/app/views/modals/editNoteModal.html index 0b7a15e..6f2d45f 100644 --- a/app/views/modals/editNoteModal.html +++ b/app/views/modals/editNoteModal.html @@ -18,7 +18,7 @@ - +
diff --git a/app/views/modals/editNotificationModal.html b/app/views/modals/editNotificationModal.html index f85df02..52a76d7 100644 --- a/app/views/modals/editNotificationModal.html +++ b/app/views/modals/editNotificationModal.html @@ -13,7 +13,7 @@ - +
diff --git a/app/views/modals/editServiceModal.html b/app/views/modals/editServiceModal.html index 5e26a2e..539f4c4 100644 --- a/app/views/modals/editServiceModal.html +++ b/app/views/modals/editServiceModal.html @@ -13,7 +13,7 @@ - +
diff --git a/karma.conf.js b/karma.conf.js index 9e54fde..db8aed5 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -27,8 +27,6 @@ module.exports = function (config) { 'node_modules/ng-file-upload/dist/ng-file-upload-shim.js', 'node_modules/ng-file-upload/dist/ng-file-upload.js', 'node_modules/ng-table/bundles/ng-table.js', - 'node_modules/tinymce/tinymce.js', - 'node_modules/angular-ui-tinymce/dist/tinymce.js', 'node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js', 'node_modules/jasmine-promise-matchers/dist/jasmine-promise-matchers.js', diff --git a/package.json b/package.json index f151898..4941f7d 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ }, "dependencies": { "@wvr/core": "2.2.6", - "angular-ui-tinymce": "0.0.19", "ng-csv": "0.3.6", "ng-table": "3.0.1" }, diff --git a/tests/unit/controllers/noteControllerTest.js b/tests/unit/controllers/noteControllerTest.js index cf76ace..bcb4a14 100644 --- a/tests/unit/controllers/noteControllerTest.js +++ b/tests/unit/controllers/noteControllerTest.js @@ -76,7 +76,7 @@ describe('controller: NoteController', function () { var service = new Service(); service.mock(mockService1); scope.service = service; - scope.noteData = null; + scope.noteData = new Note(); scope.closeModal = function() {}; spyOn(scope, 'closeModal'); @@ -112,14 +112,13 @@ describe('controller: NoteController', function () { expect(note.clearValidationResults).toHaveBeenCalled(); }); it('editNote should open a modal', function () { - scope.noteData = null; + scope.noteData = new Note(); scope.openModal = function(name) { }; spyOn(scope, 'openModal'); scope.editNote(mockNote1); - expect(scope.noteData).toEqual(mockNote1); expect(scope.openModal).toHaveBeenCalled(); }); it('updateNote should update a note', function () { @@ -153,14 +152,13 @@ describe('controller: NoteController', function () { expect(scope.resetNotes).toHaveBeenCalled(); }); it('confirmDelete should open a modal', function () { - scope.noteToDelete = null; + scope.noteToDelete = new Note(); scope.openModal = function(name) { }; spyOn(scope, 'openModal'); scope.confirmDelete(mockNote1); - expect(scope.noteToDelete).toEqual(mockNote1); expect(scope.openModal).toHaveBeenCalled(); }); it('deleteNote should delete a note', function () { diff --git a/tests/unit/controllers/notificationControllerTest.js b/tests/unit/controllers/notificationControllerTest.js index 6ba18da..18f1568 100644 --- a/tests/unit/controllers/notificationControllerTest.js +++ b/tests/unit/controllers/notificationControllerTest.js @@ -9,11 +9,10 @@ describe('controller: NotificationController', function () { module('mock.notification'); module('mock.notificationRepo'); - inject(function ($controller, $q, $rootScope, $timeout, _NgTableParams_, _Notification_, _NotificationRepo_) { + inject(function ($controller, $q, $rootScope, _NgTableParams_, _Notification_, _NotificationRepo_) { installPromiseMatchers(); q = $q; scope = $rootScope.$new(); - timeout = $timeout; controller = $controller('NotificationController', { $scope: scope, @@ -116,7 +115,6 @@ describe('controller: NotificationController', function () { spyOn(scope, 'openModal'); scope.editNotification(mockNotification1); - timeout.flush(); scope.$digest(); expect(scope.openModal).toHaveBeenCalled(); @@ -140,7 +138,6 @@ describe('controller: NotificationController', function () { spyOn(scope, 'openModal'); scope.confirmDelete(mockNotification1); - timeout.flush(); scope.$digest(); expect(scope.openModal).toHaveBeenCalled(); diff --git a/tests/unit/controllers/serviceControllerTest.js b/tests/unit/controllers/serviceControllerTest.js index 22c63a7..9e1a514 100644 --- a/tests/unit/controllers/serviceControllerTest.js +++ b/tests/unit/controllers/serviceControllerTest.js @@ -81,7 +81,7 @@ describe('controller: ServiceController', function () { describe('Do the scope methods work as expected', function () { it('resetServices should reset services', function () { var service; - scope.serviceData = null; + scope.serviceData = new Service(); scope.closeModal = function() {}; spyOn(scope, 'closeModal'); @@ -115,14 +115,13 @@ describe('controller: ServiceController', function () { expect(ServiceRepo.findById(id)).toEqual(newService); }); it('editService should open a modal', function () { - scope.serviceData = null; + scope.serviceData = new Service(); scope.openModal = function(name) { }; spyOn(scope, 'openModal'); scope.editService(mockService1); - expect(scope.serviceData).toEqual(mockService1); expect(scope.openModal).toHaveBeenCalled(); }); it('updateService should update a service', function () { @@ -135,14 +134,13 @@ describe('controller: ServiceController', function () { expect(ServiceRepo.findById(id)).toEqual(updatedService); }); it('confirmDelete should should open a modal', function () { - scope.serviceToDelete = null; + scope.serviceToDelete = new Service(); scope.openModal = function(name) { }; spyOn(scope, 'openModal'); scope.confirmDelete(mockService1); - expect(scope.serviceToDelete).toEqual(mockService1); expect(scope.openModal).toHaveBeenCalled(); }); it('deleteService should delete a service', function () { From 4396686c1857f10a34c30365e25108e46c8f07f2 Mon Sep 17 00:00:00 2001 From: Rincy Mathew Date: Wed, 10 Jul 2024 16:22:47 -0500 Subject: [PATCH 15/15] Upgraded to 1.5.3-rc1 and added initial draft for Changelog file --- CHANGELOG.md | 28 ++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..cb57ad9 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,28 @@ +# Changelog + +## [1.5.3] - 07-10-24 +### Resolves + +- Unable to update the body of a notification in the Status application.. (#245) + +## [1.5.2] - 04-08-24 +### Resolves + +- Github Actions for LibraryServiceStatusSystem UI. (#185) +- WYSIWYG forces relative links. (#216) +- Upgrade Weaver-UI-Core (2.2.2-rc.8). (#212) +- Tech debt tasks. (#219) +- Tech debt tasks. (#221) +- Weaver upgrade. (#223) +- Source maps fail to load. (#226) +- Coverage report not being sent to coveralls. (#224) +- Footer not sticky on bottom. (#225) +- Upgrade to latest tl_components. (#6) +- Added Lato font and rem rule. (#231) +- Update Dockerfile. (#232) +- Update Dockerfile using node 16 in #233 +- Allow anonymous viewing of Status app. (#240) +- Security fixes for: minimatch and qs. (#234) +- Improve handling of local Weaver-UI-Core repo, adding support for det… in #237 +- Enforce line-feed/new-line character as the only EOL for certain line-ending sensitive script files. (#239) + diff --git a/package.json b/package.json index f48d20e..7ca498e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "library-webservices-status", "private": true, - "version": "1.5.3", + "version": "1.5.3-rc1", "description": "Library Webservices Status System UI", "repository": "https://github.com/TAMULib/LibraryServiceStatusSystemUI.git", "license": "MIT",