diff --git a/applications/Unity.GrantManager/modules/Unity.AI/src/Unity.AI.Web/Pages/AIReporting/Index.js b/applications/Unity.GrantManager/modules/Unity.AI/src/Unity.AI.Web/Pages/AIReporting/Index.js index a8b364e85b..eeb4712ccf 100644 --- a/applications/Unity.GrantManager/modules/Unity.AI/src/Unity.AI.Web/Pages/AIReporting/Index.js +++ b/applications/Unity.GrantManager/modules/Unity.AI/src/Unity.AI.Web/Pages/AIReporting/Index.js @@ -5,32 +5,7 @@ const showInitializationError = (container, message, error) => { const reportingAiUrl = globalThis.reportingAiUrl; const container = document.getElementById('container'); -const initializeAIReporting = async () => { - if (!container) { - return; - } - - if (!reportingAiUrl) { - showInitializationError(container, 'AI Reporting is not configured.'); - return; - } - - let reportingUrl; - try { - reportingUrl = new URL(reportingAiUrl); - } catch (error) { - showInitializationError(container, 'AI Reporting is not configured correctly.', error); - return; - } - - let token; - try { - token = await unity.grantManager.identity.jwtToken.generateJWTToken(); - } catch (error) { - showInitializationError(container, 'Failed to initialize AI Reporting. Please refresh the page and try again.', error); - return; - } - +const buildReportingIframe = (reportingUrl, token) => { const iframe = document.createElement('iframe'); iframe.style.width = '100%'; @@ -66,7 +41,32 @@ const initializeAIReporting = async () => { }; iframe.src = reportingUrl.href; - container.appendChild(iframe); + return iframe; }; -initializeAIReporting(); +if (container) { + if (!reportingAiUrl) { + showInitializationError(container, 'AI Reporting is not configured.'); + } else { + let reportingUrl; + try { + reportingUrl = new URL(reportingAiUrl); + } catch (error) { + reportingUrl = null; + showInitializationError(container, 'AI Reporting is not configured correctly.', error); + } + + if (reportingUrl) { + const initializeReporting = async () => { + try { + const token = await unity.grantManager.identity.jwtToken.generateJWTToken(); + container.appendChild(buildReportingIframe(reportingUrl, token)); + } catch (error) { + showInitializationError(container, 'Failed to initialize AI Reporting. Please refresh the page and try again.', error); + } + }; + + initializeReporting(); + } + } +} diff --git a/applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Views/Shared/Components/Scoresheet/Scoresheet.js b/applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Views/Shared/Components/Scoresheet/Scoresheet.js index c670b00b18..1b6d712a05 100644 --- a/applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Views/Shared/Components/Scoresheet/Scoresheet.js +++ b/applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Views/Shared/Components/Scoresheet/Scoresheet.js @@ -360,9 +360,12 @@ $(function () { return hash; } for (let i = 0; i < str.length; i++) { - const char = str.charCodeAt(i); + const char = str.codePointAt(i); hash = ((hash << 5) - hash) + char; hash |= 0; + if (char > 0xFFFF) { + i++; + } } return hash; } diff --git a/applications/Unity.GrantManager/modules/Unity.Notifications/src/Unity.Notifications.Web/Views/Settings/NotificationsSettingGroup/InternalEmailGroups.js b/applications/Unity.GrantManager/modules/Unity.Notifications/src/Unity.Notifications.Web/Views/Settings/NotificationsSettingGroup/InternalEmailGroups.js index 8092c7b82c..fa9e79cad3 100644 --- a/applications/Unity.GrantManager/modules/Unity.Notifications/src/Unity.Notifications.Web/Views/Settings/NotificationsSettingGroup/InternalEmailGroups.js +++ b/applications/Unity.GrantManager/modules/Unity.Notifications/src/Unity.Notifications.Web/Views/Settings/NotificationsSettingGroup/InternalEmailGroups.js @@ -444,7 +444,7 @@ const emailGroupsManager = { 'createAddUserBtn', function(selectedUser) { // Add to selected users if not already there - if (!selectedUsers.find(u => u.userId === selectedUser.userId)) { + if (!selectedUsers.some(u => u.userId === selectedUser.userId)) { const newUser = { userId: selectedUser.userId, userName: selectedUser.userName, diff --git a/applications/Unity.GrantManager/modules/Unity.Notifications/src/Unity.Notifications.Web/wwwroot/js/notifications-realtime-client.js b/applications/Unity.GrantManager/modules/Unity.Notifications/src/Unity.Notifications.Web/wwwroot/js/notifications-realtime-client.js index 83f407ee61..7346769111 100644 --- a/applications/Unity.GrantManager/modules/Unity.Notifications/src/Unity.Notifications.Web/wwwroot/js/notifications-realtime-client.js +++ b/applications/Unity.GrantManager/modules/Unity.Notifications/src/Unity.Notifications.Web/wwwroot/js/notifications-realtime-client.js @@ -407,7 +407,7 @@ toast: true, position: 'top-end', icon: 'info', - title: sender, + titleText: String(sender || ''), text: message, showConfirmButton: false, timer: 5000, @@ -970,7 +970,7 @@ toast: true, position: 'top-end', icon: 'info', - title: sender, + titleText: String(sender || ''), text: message, showConfirmButton: false, timer: 5000, diff --git a/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Pages/PaymentRequests/Index.js b/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Pages/PaymentRequests/Index.js index 532a7e48d4..3bffd103a3 100644 --- a/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Pages/PaymentRequests/Index.js +++ b/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Pages/PaymentRequests/Index.js @@ -1042,7 +1042,7 @@ $(function () { } function formatName(userData) { - return typeof userData !== 'undefined' && userData !== null ? `${userData?.name} ${userData?.surname}` : ""; + return userData !== undefined && userData !== null ? `${userData?.name} ${userData?.surname}` : ""; } function getApprovalDateColumn(columnIndex, level) { diff --git a/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Views/Shared/Components/PaymentInfo/Default.js b/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Views/Shared/Components/PaymentInfo/Default.js index 7e70f1d011..6de50c7259 100644 --- a/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Views/Shared/Components/PaymentInfo/Default.js +++ b/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Views/Shared/Components/PaymentInfo/Default.js @@ -1,4 +1,4 @@ -$(function () { +$(function () { const l = abp.localization.getResource('Payments'); $('.unity-currency-input').maskMoney({}); $('.unity-currency-input').each(function () { @@ -61,10 +61,8 @@ inputElement.hasClass('unity-currency-input') || inputElement.hasClass('numeric-mask') ) { - paymentInfoObj[input.name.split('.')[1]] = input.value.replace( - /,/g, - '' - ); + const fieldName = input.name.split('.')[1]; + paymentInfoObj[fieldName] = input.value.replaceAll(',', ''); } else { paymentInfoObj[input.name.split('.')[1]] = input.value; } diff --git a/applications/Unity.GrantManager/modules/Unity.TenantManagement/src/Unity.TenantManagement.Web/Pages/TenantManagement/Reconciliation/Index.js b/applications/Unity.GrantManager/modules/Unity.TenantManagement/src/Unity.TenantManagement.Web/Pages/TenantManagement/Reconciliation/Index.js index e38cc30cb5..2018e6539e 100644 --- a/applications/Unity.GrantManager/modules/Unity.TenantManagement/src/Unity.TenantManagement.Web/Pages/TenantManagement/Reconciliation/Index.js +++ b/applications/Unity.GrantManager/modules/Unity.TenantManagement/src/Unity.TenantManagement.Web/Pages/TenantManagement/Reconciliation/Index.js @@ -146,12 +146,12 @@ $(function () { setExternalSearchFilter(iDt); if ($('#btn-toggle-filter').length) { - if ($.fn.dataTable !== 'undefined' && typeof $.fn.dataTable.FilterRow !== 'undefined') { + if ($.fn.dataTable !== undefined && $.fn.dataTable.FilterRow !== undefined) { const filterRow = new $.fn.dataTable.FilterRow(iDt.settings()[0], { buttonId: 'btn-toggle-filter', buttonText: FilterDesc.Default, buttonTextActive: FilterDesc.With_Filter, - enablePopover: $.fn.popover !== 'undefined' + enablePopover: $.fn.popover !== undefined }); iDt.settings()[0]._filterRow = filterRow; diff --git a/applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/Themes/UX2/Components/Topbar/Default.cshtml b/applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/Themes/UX2/Components/Topbar/Default.cshtml index 45283ea594..f572a7c905 100644 --- a/applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/Themes/UX2/Components/Topbar/Default.cshtml +++ b/applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/Themes/UX2/Components/Topbar/Default.cshtml @@ -56,7 +56,10 @@ @if (CurrentUser.IsInRole("ITOperations")) { Unity Admin - Unity Messaging + @if (await FeatureChecker.IsEnabledAsync("Unity.Notifications.DirectMessaging")) + { + Unity Messaging + } Exception Logs } diff --git a/applications/Unity.GrantManager/scripts/Get-SonarIssues.ps1 b/applications/Unity.GrantManager/scripts/Get-SonarIssues.ps1 index 994a1ece4a..f773f33560 100644 --- a/applications/Unity.GrantManager/scripts/Get-SonarIssues.ps1 +++ b/applications/Unity.GrantManager/scripts/Get-SonarIssues.ps1 @@ -8,11 +8,10 @@ or attaching to a PR instead of screen-scraping the SonarQube UI. .PARAMETER ServerUrl - SonarQube server URL. Default: https://sonarqube.econ.gov.bc.ca/sonar. Set this to - https://sonarcloud.io when querying SonarCloud. + SonarQube server URL. Default: https://sonarcloud.io, matching sonar-project.properties. .PARAMETER ProjectKey - SonarQube project (component) key. Default: UnityScanKey. + SonarQube project (component) key. Default: bcgov_Unity. .PARAMETER Branch Branch name to query. If omitted, you'll be prompted to pick the current git branch, one of @@ -70,9 +69,9 @@ .\Get-SonarIssues.ps1 -Branch main -FixLevel Quick #> param( - [string]$ServerUrl = "https://sonarqube.econ.gov.bc.ca/sonar", + [string]$ServerUrl = "https://sonarcloud.io", - [string]$ProjectKey = "UnityScanKey", + [string]$ProjectKey = "bcgov_Unity", [string]$Branch = "", @@ -281,9 +280,9 @@ function Get-SonarIssuePage { if (-not $response.IsSuccessStatusCode) { $status = [int]$response.StatusCode if ($status -eq 401 -or $status -eq 403) { - throw "SonarCloud returned $status - pass -Token (or set `$env:SONAR_TOKEN) with access to '$ProjectKey'." + throw "Sonar server returned $status for '$ProjectKey' at '$ServerUrl'. Pass -Token (or set `$env:SONAR_TOKEN) with browse access to this project." } - throw "SonarCloud returned $status`: $text" + throw "Sonar server returned $status`: $text" } return $text | ConvertFrom-Json diff --git a/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Pages/ApplicationLinks/ApplicationLinks.js b/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Pages/ApplicationLinks/ApplicationLinks.js index 1ecdc59e1d..7425fdd0d3 100644 --- a/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Pages/ApplicationLinks/ApplicationLinks.js +++ b/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Pages/ApplicationLinks/ApplicationLinks.js @@ -88,7 +88,7 @@ $(function () { // Make sure input string have no error with the plugin LinksInput.prototype.anyErrors = function (string) { - if (!this.options.duplicate && this.arr.indexOf(string) != -1) { + if (!this.options.duplicate && this.arr.includes(string)) { console.log('duplicate found " ' + string + ' " ') return true; } diff --git a/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Pages/GrantApplications/ai-generation-button-state.js b/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Pages/GrantApplications/ai-generation-button-state.js index c8bb1d95bf..3867265346 100644 --- a/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Pages/GrantApplications/ai-generation-button-state.js +++ b/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Pages/GrantApplications/ai-generation-button-state.js @@ -21,7 +21,7 @@ || error?.responseText || ''; - const match = String(message).match(/try again in\s+(\d+)\s+second/i); + const match = /try again in\s+(\d+)\s+second/i.exec(String(message)); return match ? Number(match[1]) : 0; } diff --git a/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Settings/TagManagement/TagManagement.js b/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Settings/TagManagement/TagManagement.js index 46df2d8efc..5d313d3add 100644 --- a/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Settings/TagManagement/TagManagement.js +++ b/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Settings/TagManagement/TagManagement.js @@ -44,9 +44,7 @@ function defineTagSummaryColumnDefs() { title: "Count", name: 'totalCount', data: 'totalCount' - }); - - columnDefs.push({ + }, { title: "Actions", name: 'actions', data: 'tag.name', diff --git a/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/ActionBar/Default.js b/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/ActionBar/Default.js index 5d44c2d7e6..271af63eb1 100644 --- a/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/ActionBar/Default.js +++ b/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/ActionBar/Default.js @@ -73,9 +73,9 @@ $(function () { let groupedValues = Object.values(groupedTags); if (groupedValues.length === 0) return []; - return groupedValues.reduce(function (prev, next) { + return groupedValues.slice(1).reduce(function (prev, next) { return prev.filter(p => hasMatchingTagId(p, next)); - }); + }, groupedValues[0]); } function filterUncommonTags(tagList, commonTags) { diff --git a/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/ChefsAttachments/ChefsAttachments.js b/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/ChefsAttachments/ChefsAttachments.js index 1a935464ae..804bac1579 100644 --- a/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/ChefsAttachments/ChefsAttachments.js +++ b/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/ChefsAttachments/ChefsAttachments.js @@ -525,7 +525,7 @@ function downloadChefsFile(event) { link.style.display = 'none'; document.body.appendChild(link); link.click(); - document.body.removeChild(link); + link.remove(); abp.notify.success('', 'The file has been downloaded successfully.'); }, error: function (error) { diff --git a/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/CommentsWidget/Default.js b/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/CommentsWidget/Default.js index 84252eb367..dd5d81eaed 100644 --- a/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/CommentsWidget/Default.js +++ b/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/CommentsWidget/Default.js @@ -203,7 +203,7 @@ function initTribute(mentionData) { let tribute = new Tribute({ values: mentionData, selectTemplate: function (item) { - if (typeof item === 'undefined') return null; + if (item === undefined) return null; if (this.range.isContentEditable(this.current.element)) { return (`${item.original.value}`); }