From d6e9d3e1f28de309632e096a6d188ac1dd2d5dd2 Mon Sep 17 00:00:00 2001 From: Ryan Mathis Date: Tue, 2 Nov 2021 09:49:25 -0700 Subject: [PATCH 1/4] Fixed saving providers issue --- ui/src/app/metadata/editor/MetadataEditor.js | 4 ++-- ui/src/app/metadata/hooks/api.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/src/app/metadata/editor/MetadataEditor.js b/ui/src/app/metadata/editor/MetadataEditor.js index fac1c1fa7..2adc5b273 100644 --- a/ui/src/app/metadata/editor/MetadataEditor.js +++ b/ui/src/app/metadata/editor/MetadataEditor.js @@ -51,8 +51,8 @@ export function MetadataEditor ({ restore, current, reload }) { .then(() => { gotoDetail({ refresh: true }); }) - .catch((err) => { - notificationDispatch(createNotificationAction(`Updated data with latest changes`, NotificationTypes.INFO)) + .catch((err, notification) => { + notificationDispatch(notification || createNotificationAction(`${err.errorCode} - ${translator(err.errorMessage)}`, NotificationTypes.ERROR)); }); }; diff --git a/ui/src/app/metadata/hooks/api.js b/ui/src/app/metadata/hooks/api.js index 9c2d2f90c..d5add90a1 100644 --- a/ui/src/app/metadata/hooks/api.js +++ b/ui/src/app/metadata/hooks/api.js @@ -1,6 +1,7 @@ import useFetch from 'use-http'; import API_BASE_PATH from '../../App.constant'; +import { createNotificationAction, NotificationTypes } from '../../notifications/hoc/Notifications'; import { useContentionDispatcher, openContentionModalAction } from '../contention/ContentionContext'; import {MetadataFilterTypes} from '../domain/filter'; @@ -113,7 +114,7 @@ export function useMetadataUpdater (path, current, cancel) { resolve(await update(p, resolution)); }, (err) => { cancel && cancel(); - reject(err); + reject(err, createNotificationAction(`Updated data with latest changes`, NotificationTypes.INFO)); })); }); } From 31b3f724ab13e1b6ca10f2d606429b3cc0060eb6 Mon Sep 17 00:00:00 2001 From: Ryan Mathis Date: Tue, 2 Nov 2021 13:27:27 -0700 Subject: [PATCH 2/4] Fixed issue with contention and reloading data --- .../provider/definition/BaseProviderDefinition.js | 1 - ui/src/app/metadata/editor/MetadataEditor.js | 15 +++++++++------ ui/src/app/metadata/hooks/api.js | 3 +-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ui/src/app/metadata/domain/provider/definition/BaseProviderDefinition.js b/ui/src/app/metadata/domain/provider/definition/BaseProviderDefinition.js index 55a2f671c..a411f5e89 100644 --- a/ui/src/app/metadata/domain/provider/definition/BaseProviderDefinition.js +++ b/ui/src/app/metadata/domain/provider/definition/BaseProviderDefinition.js @@ -30,7 +30,6 @@ export const BaseProviderDefinition = { ...changes, metadataFilters: [ ...changes.metadataFilters.filter((filter, filterName) => { - if (filter['@type'] === 'RequiredValidUntil') { if (!filter.maxValidityInterval || filter.maxValidityInterval === "") { return false; diff --git a/ui/src/app/metadata/editor/MetadataEditor.js b/ui/src/app/metadata/editor/MetadataEditor.js index 2adc5b273..2a06e2502 100644 --- a/ui/src/app/metadata/editor/MetadataEditor.js +++ b/ui/src/app/metadata/editor/MetadataEditor.js @@ -51,8 +51,15 @@ export function MetadataEditor ({ restore, current, reload }) { .then(() => { gotoDetail({ refresh: true }); }) - .catch((err, notification) => { - notificationDispatch(notification || createNotificationAction(`${err.errorCode} - ${translator(err.errorMessage)}`, NotificationTypes.ERROR)); + .catch((err) => { + notificationDispatch( + createNotificationAction(`${err.errorCode > 1 ? `${err.errorCode} - ` : ''} ${translator(err.errorMessage)}`, err.errorCode === 1 ? NotificationTypes.INFO : NotificationTypes.ERROR) + ); + if (err.errorCode === 1) { + setTimeout(() => { + window.location.reload(); + }, 500); + } }); }; @@ -83,10 +90,6 @@ export function MetadataEditor ({ restore, current, reload }) { const canFilter = restore ? false : FilterableProviders.indexOf(definition.type) > -1; - React.useEffect(() => { - dispatch(setFormDataAction(current)); - }, [current, dispatch]) - return (
{ cancel && cancel(); - reject(err, createNotificationAction(`Updated data with latest changes`, NotificationTypes.INFO)); + reject({ errorCode: 1, errorMessage: 'Updated data with latest changes - Reloading' }); })); }); } From e825880c9bee6cdc18a91445c3a8ba9fe40fd42a Mon Sep 17 00:00:00 2001 From: Bill Smith Date: Tue, 2 Nov 2021 14:31:12 -0700 Subject: [PATCH 3/4] 2251 Added simple fix for one related test. --- backend/src/integration/resources/SHIBUI-1364-1.side | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/src/integration/resources/SHIBUI-1364-1.side b/backend/src/integration/resources/SHIBUI-1364-1.side index 7920af4c1..56b611aa2 100644 --- a/backend/src/integration/resources/SHIBUI-1364-1.side +++ b/backend/src/integration/resources/SHIBUI-1364-1.side @@ -2034,11 +2034,11 @@ "id": "63e1b12d-a50a-4877-9588-21209a08b364", "comment": "", "command": "assertText", - "target": "css=div:nth-child(7) .d-block:nth-child(2)", + "target": "css=div:nth-child(8) > .bg-diff > .d-block:nth-child(2)", "targets": [ - ["css=div:nth-child(7) .d-block:nth-child(2)", "css:finder"], - ["xpath=//div[@id='root']/div/main/div/section/div/div/section/div/div[2]/div[2]/div[7]/div/span[2]", "xpath:idRelative"], - ["xpath=//div[7]/div/span[2]", "xpath:position"], + ["css=div:nth-child(8) > .bg-diff > .d-block:nth-child(2)", "css:finder"], + ["xpath=//div[@id='root']/div/main/div/section/div/div/section/div/div[2]/div[2]/div[8]/div/span[2]", "xpath:idRelative"], + ["xpath=//div[8]/div/span[2]", "xpath:position"], ["xpath=//span[contains(.,'PT1M')]", "xpath:innerText"] ], "value": "PT1M" From cc2fdc30d8e012c250045d8928a30682961739e0 Mon Sep 17 00:00:00 2001 From: Bill Smith Date: Wed, 3 Nov 2021 10:59:37 -0700 Subject: [PATCH 4/4] 2251 Various test fixes and updates. --- .../admin/ui/SeleniumSIDETest.groovy | 16 ++++++------ .../integration/resources/SHIBUI-1361.side | 4 +-- .../integration/resources/SHIBUI-1364-1.side | 4 +-- .../integration/resources/SHIBUI-1385-2.side | 26 +++++++++---------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/backend/src/integration/groovy/edu/internet2/tier/shibboleth/admin/ui/SeleniumSIDETest.groovy b/backend/src/integration/groovy/edu/internet2/tier/shibboleth/admin/ui/SeleniumSIDETest.groovy index ee843bca7..f60242089 100644 --- a/backend/src/integration/groovy/edu/internet2/tier/shibboleth/admin/ui/SeleniumSIDETest.groovy +++ b/backend/src/integration/groovy/edu/internet2/tier/shibboleth/admin/ui/SeleniumSIDETest.groovy @@ -101,10 +101,10 @@ class SeleniumSIDETest extends Specification { where: name | file -// 'SHIBUI-1364: Compare FBHTTPMP with filters' | '/SHIBUI-1364-1.side' // bug here for ryan + 'SHIBUI-1364: Compare FBHTTPMP with filters' | '/SHIBUI-1364-1.side' 'SHIBUI-1364: Compare FSMP' | '/SHIBUI-1364-2.side' 'SHIBUI-1364: Compare LDMP' | '/SHIBUI-1364-3.side' -// 'SHIBUI-1364: Compare DHTTPMP with filters' | '/SHIBUI-1364-4.side' // bug here for ryan + 'SHIBUI-1364: Compare DHTTPMP with filters' | '/SHIBUI-1364-4.side' 'SHIBUI-1281: Metadata Source Dashboard' | '/SHIBUI-1281.side' 'SHIBUI-1311: Metadata Provider Dashboard' | '/SHIBUI-1311.side' 'SHIBUI-950: Metadata Source from XML w/ digest' | '/SHIBUI-950.side' @@ -112,14 +112,14 @@ class SeleniumSIDETest extends Specification { 'SHIBUI-1352: Create FileSystem provider' | '/SHIBUI-1352-2.side' 'SHIBUI-1333: Verify metadata source configuration' | '/SHIBUI-1333.side' 'SHIBUI-1334: Verify metadata source versioning' | '/SHIBUI-1334-1.side' -// 'SHIBUI-1334: Verify metadata provider versioning' | '/SHIBUI-1334-2.side' // there's a bug here for ryan + 'SHIBUI-1334: Verify metadata provider versioning' | '/SHIBUI-1334-2.side' 'SHIBUI-1335: Verify File Backed HTTP Metadata Provider Filters' | '/SHIBUI-1335-1.side' - 'SHIBUI-1335: Verify Filesystem Metadata Provider Filters' | '/SHIBUI-1335-2.side' // adding filters to this resolver type was removed in the react update - 'SHIBUI-1335: Verify Local Dynamic Metadata Provider Filters' | '/SHIBUI-1335-3.side' // adding filters to this resolver type was removed in the react update + 'SHIBUI-1335: Verify Filesystem Metadata Provider' | '/SHIBUI-1335-2.side' + 'SHIBUI-1335: Verify Local Dynamic Metadata Provider' | '/SHIBUI-1335-3.side' 'SHIBUI-1335: Verify Dynamic HTTP Metadata Provider Filters' | '/SHIBUI-1335-4.side' -// 'SHIBUI-1361: Verify dates display in proper format' | '/SHIBUI-1361.side' // Note that this script WILL NOT PASS in the Selenium IDE. There is a bug in the IDE where it thinks there is a missing ')'. there's a bug here for Ryan + 'SHIBUI-1361: Verify dates display in proper format' | '/SHIBUI-1361.side' 'SHIBUI-1385: Restore a metadata source version' | '/SHIBUI-1385-1.side' -// 'SHIBUI-1385: Restore a metadata provider version' | '/SHIBUI-1385-2.side' // there's a bug here for ryan + 'SHIBUI-1385: Restore a metadata provider version' | '/SHIBUI-1385-2.side' 'SHIBUI-1391: Regex Validation' | '/SHIBUI-1391.side' 'SHIBUI-1407: Metadata source comparison highlights' | '/SHIBUI-1407-1.side' 'SHIBUI-1407: Metadata provider comparison highlights' | '/SHIBUI-1407-2.side' @@ -141,7 +141,7 @@ class SeleniumSIDETest extends Specification { 'SHIBUI-2116: Verify entity attribute bundle highlights' | '/SHIBUI-2116.side' // Note that this script WILL NOT PASS in the Selenium IDE due to ${driver} not being set (it is provided by this groovy script). 'SHIBUI-1732: Create, use, and delete CEA String' | '/SHIBUI-1732-1.side' 'SHIBUI-1732: Create, use, and delete CEA Boolean' | '/SHIBUI-1732-2.side' -// 'SHIBUI-1732: Create, use, and delete CEA List' | '/SHIBUI-1732-3.side' // bug here for ryan + 'SHIBUI-1732: Create, use, and delete CEA List' | '/SHIBUI-1732-3.side' 'SHIBUI-1732: Create, use, and delete CEA Long' | '/SHIBUI-1732-4.side' 'SHIBUI-1732: Create, use, and delete CEA Double' | '/SHIBUI-1732-5.side' 'SHIBUI-1732: Create, use, and delete CEA Duration' | '/SHIBUI-1732-6.side' diff --git a/backend/src/integration/resources/SHIBUI-1361.side b/backend/src/integration/resources/SHIBUI-1361.side index 97ecfe51f..ee3ed5e8f 100644 --- a/backend/src/integration/resources/SHIBUI-1361.side +++ b/backend/src/integration/resources/SHIBUI-1361.side @@ -1341,9 +1341,9 @@ "id": "0687fe3f-c1af-4a5a-9708-09b7b92734bc", "comment": "", "command": "assertText", - "target": "css=div:nth-child(4) > .bg-diff > .d-block:nth-child(2)", + "target": "css=div:nth-child(1) > div:nth-child(4) > .d-flex > .d-block:nth-child(2)", "targets": [ - ["css=div:nth-child(4) > .bg-diff > .d-block:nth-child(2)", "css:finder"], + ["css=div:nth-child(1) > div:nth-child(4) > .d-flex > .d-block:nth-child(2)", "css:finder"], ["xpath=//div[@id='root']/div/main/div/section/div/div/section[4]/div/div[2]/div[2]/div/div[4]/div/span[2]", "xpath:idRelative"], ["xpath=//div[2]/div[2]/div/div[4]/div/span[2]", "xpath:position"], ["xpath=//span[contains(.,'PT1M')]", "xpath:innerText"] diff --git a/backend/src/integration/resources/SHIBUI-1364-1.side b/backend/src/integration/resources/SHIBUI-1364-1.side index 56b611aa2..2ad78b831 100644 --- a/backend/src/integration/resources/SHIBUI-1364-1.side +++ b/backend/src/integration/resources/SHIBUI-1364-1.side @@ -2034,7 +2034,7 @@ "id": "63e1b12d-a50a-4877-9588-21209a08b364", "comment": "", "command": "assertText", - "target": "css=div:nth-child(8) > .bg-diff > .d-block:nth-child(2)", + "target": "css=section > div > div > section:nth-child(2) > div > div.p-2 > div:nth-child(2) > div:nth-child(8) > div > span:nth-child(2)", "targets": [ ["css=div:nth-child(8) > .bg-diff > .d-block:nth-child(2)", "css:finder"], ["xpath=//div[@id='root']/div/main/div/section/div/div/section/div/div[2]/div[2]/div[8]/div/span[2]", "xpath:idRelative"], @@ -2078,7 +2078,7 @@ "id": "75f45cb6-9c38-44e7-82dc-a473fa7fab62", "comment": "", "command": "assertText", - "target": "css=div:nth-child(2) > .d-flex > .d-block:nth-child(2)", + "target": "css=section > div > div > section:nth-child(2) > div > div.p-2 > div:nth-child(2) > div:nth-child(2) > div > span:nth-child(2)", "targets": [ ["css=div:nth-child(2) > .d-flex > .d-block:nth-child(2)", "css:finder"], ["xpath=//div[@id='root']/div/main/div/section/div/div/section/div/div[2]/div[2]/div[2]/div/span[2]", "xpath:idRelative"], diff --git a/backend/src/integration/resources/SHIBUI-1385-2.side b/backend/src/integration/resources/SHIBUI-1385-2.side index 1e7ecfc66..57e73890b 100644 --- a/backend/src/integration/resources/SHIBUI-1385-2.side +++ b/backend/src/integration/resources/SHIBUI-1385-2.side @@ -1351,11 +1351,11 @@ "id": "30aae338-393c-4312-8ccc-f3fd8acb3aad", "comment": "", "command": "assertText", - "target": "css=div:nth-child(2) > div:nth-child(3) .text-truncate", + "target": "css=div:nth-child(2) > div:nth-child(4) .text-truncate", "targets": [ - ["css=div:nth-child(2) > div:nth-child(3) .text-truncate", "css:finder"], - ["xpath=//div[@id='root']/div/main/div/section/div/div/section/div/div[2]/div[2]/div[3]/div/span[2]", "xpath:idRelative"], - ["xpath=//div[3]/div/span[2]", "xpath:position"], + ["css=div:nth-child(2) > div:nth-child(4) .text-truncate", "css:finder"], + ["xpath=//div[@id='root']/div/main/div/section/div/div/section/div/div[2]/div[2]/div[4]/div/span[2]", "xpath:idRelative"], + ["xpath=//div[4]/div/span[2]", "xpath:position"], ["xpath=//span[contains(.,'123 version 2')]", "xpath:innerText"] ], "value": "123 version 2" @@ -1416,7 +1416,7 @@ "id": "20bfdc06-e12b-4287-ad14-3ca578d84de1", "comment": "", "command": "waitForElementVisible", - "target": "css=div:nth-child(2) > div:nth-child(3) .d-block:nth-child(2)", + "target": "css=div:nth-child(2) > div:nth-child(4) .d-block:nth-child(2)", "targets": [ ["css=div:nth-child(2) > div:nth-child(3) .d-block:nth-child(2)", "css:finder"], ["xpath=//div[@id='root']/div/main/div/section/div/div/section/div/div[2]/div[2]/div[3]/div/span[2]", "xpath:idRelative"], @@ -1428,11 +1428,11 @@ "id": "a6c78ab6-5584-490f-9bfd-b1eda70b864b", "comment": "", "command": "assertText", - "target": "css=div:nth-child(2) > div:nth-child(3) .d-block:nth-child(2)", + "target": "css=div:nth-child(2) > div:nth-child(4) .d-block:nth-child(2)", "targets": [ - ["css=div:nth-child(2) > div:nth-child(3) .d-block:nth-child(2)", "css:finder"], - ["xpath=//div[@id='root']/div/main/div/section/div/div/section/div/div[2]/div[2]/div[3]/div/span[2]", "xpath:idRelative"], - ["xpath=//div[3]/div/span[2]", "xpath:position"], + ["css=div:nth-child(2) > div:nth-child(4) .d-block:nth-child(2)", "css:finder"], + ["xpath=//div[@id='root']/div/main/div/section/div/div/section/div/div[2]/div[2]/div[4]/div/span[2]", "xpath:idRelative"], + ["xpath=//div[4]/div/span[2]", "xpath:position"], ["xpath=//span[contains(.,'123 version 2')]", "xpath:innerText"] ], "value": "123 version 2" @@ -1451,11 +1451,11 @@ "id": "17832263-6fd7-4df8-86ba-f3e2fdc5d8ce", "comment": "", "command": "assertText", - "target": "css=div:nth-child(2) > div:nth-child(3) .d-block:nth-child(3)", + "target": "css=div:nth-child(2) > div:nth-child(4) .d-block:nth-child(3)", "targets": [ - ["css=div:nth-child(2) > div:nth-child(3) .d-block:nth-child(3)", "css:finder"], - ["xpath=//div[@id='root']/div/main/div/section/div/div/section/div/div[2]/div[2]/div[3]/div/span[3]", "xpath:idRelative"], - ["xpath=//div[3]/div/span[3]", "xpath:position"] + ["css=div:nth-child(2) > div:nth-child(4) .d-block:nth-child(3)", "css:finder"], + ["xpath=//div[@id='root']/div/main/div/section/div/div/section/div/div[2]/div[2]/div[4]/div/span[3]", "xpath:idRelative"], + ["xpath=//div[4]/div/span[3]", "xpath:position"] ], "value": "123 version 2" }, {