From 0cd83bcd3acac8031ccf952ba6abdd5e528c26ea Mon Sep 17 00:00:00 2001 From: Ryan Mathis Date: Thu, 7 Jul 2022 10:39:32 -0700 Subject: [PATCH 1/4] Fixed caching of source xml --- ui/src/app/metadata/hoc/MetadataXmlLoader.js | 10 +++++++--- ui/src/app/metadata/view/MetadataXml.js | 7 ++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ui/src/app/metadata/hoc/MetadataXmlLoader.js b/ui/src/app/metadata/hoc/MetadataXmlLoader.js index ffc1c8bcf..e5453a519 100644 --- a/ui/src/app/metadata/hoc/MetadataXmlLoader.js +++ b/ui/src/app/metadata/hoc/MetadataXmlLoader.js @@ -13,7 +13,7 @@ export function MetadataXmlLoader({ children }) { const [xml, setXml] = React.useState(); async function loadMetadataXml(id) { - const data = await get(`/${id}`) + const data = await get(`/${id}`); if (response.ok) { setXml(data); } @@ -22,12 +22,16 @@ export function MetadataXmlLoader({ children }) { /*eslint-disable react-hooks/exhaustive-deps*/ React.useEffect(() => { if (type === 'source') { - loadMetadataXml(id) + reload() } }, [id]); + function reload() { + loadMetadataXml(id); + } + return ( - + {children} ); diff --git a/ui/src/app/metadata/view/MetadataXml.js b/ui/src/app/metadata/view/MetadataXml.js index 5144b14af..17e79d26a 100644 --- a/ui/src/app/metadata/view/MetadataXml.js +++ b/ui/src/app/metadata/view/MetadataXml.js @@ -12,12 +12,17 @@ import { MetadataViewToggle } from '../component/MetadataViewToggle'; import { downloadAsXml } from '../../core/utility/download_as_xml'; export function MetadataXml () { - const xml = React.useContext(MetadataXmlContext); + const { xml, reload } = React.useContext(MetadataXmlContext); const entity = React.useContext(MetadataObjectContext); const { type } = useParams(); const download = () => downloadAsXml(entity.name ? entity.name : entity.serviceProviderName, xml); + /*eslint-disable react-hooks/exhaustive-deps*/ + React.useEffect(() => { + reload(); + }, []); + return ( <>

From 7684867a3cf49cf7fb473a504e02eed8f280b9a8 Mon Sep 17 00:00:00 2001 From: Ryan Mathis Date: Thu, 7 Jul 2022 12:27:36 -0700 Subject: [PATCH 2/4] Added success alert for custom entity attributes --- ui/public/assets/schema/attribute/attribute.schema.json | 2 +- ui/src/app/metadata/new/NewAttribute.js | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ui/public/assets/schema/attribute/attribute.schema.json b/ui/public/assets/schema/attribute/attribute.schema.json index 0514703f0..84590e08e 100644 --- a/ui/public/assets/schema/attribute/attribute.schema.json +++ b/ui/public/assets/schema/attribute/attribute.schema.json @@ -64,7 +64,7 @@ "title": "label.entity-attribute-help", "description": "tooltip.entity-attribute-help", "type": "string", - "minLength": 1, + "minLength": 0, "maxLength": 255 } }, diff --git a/ui/src/app/metadata/new/NewAttribute.js b/ui/src/app/metadata/new/NewAttribute.js index 3648942bb..0db6847cb 100644 --- a/ui/src/app/metadata/new/NewAttribute.js +++ b/ui/src/app/metadata/new/NewAttribute.js @@ -11,7 +11,7 @@ import { useMetadataAttribute } from '../hooks/api'; import {CustomAttributeDefinition} from '../domain/attribute/CustomAttributeDefinition'; import MetadataSchema from '../hoc/MetadataSchema'; import { MetadataForm } from '../hoc/MetadataFormContext'; -import { createNotificationAction, useNotificationDispatcher } from '../../notifications/hoc/Notifications'; +import { createNotificationAction, NotificationTypes, useNotificationDispatcher } from '../../notifications/hoc/Notifications'; export function NewAttribute() { const history = useHistory(); @@ -25,11 +25,16 @@ export function NewAttribute() { const [blocking, setBlocking] = React.useState(false); async function save(metadata) { + let toast; const resp = await post(``, definition.parser(metadata)); if (response.ok) { + toast = createNotificationAction(`Added attribute successfully.`, NotificationTypes.SUCCESS); gotoDetail({ refresh: true }); } else { - dispatch(createNotificationAction(`${resp.errorCode}: Unable to create attribute ... ${resp.errorMessage}`, 'danger', 5000)); + toast = createNotificationAction(`${resp.errorCode}: Unable to create attribute ... ${resp.errorMessage}`, 'danger', 5000); + } + if (toast) { + dispatch(toast); } }; From be660ed0c48a542fe61796f8f5e2704f5ea84fee Mon Sep 17 00:00:00 2001 From: Ryan Mathis Date: Thu, 7 Jul 2022 12:34:44 -0700 Subject: [PATCH 3/4] Added success notifcation for editing/deleting attributes --- ui/src/app/metadata/hoc/MetadataAttributes.js | 4 ++++ ui/src/app/metadata/view/MetadataAttributeEdit.js | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ui/src/app/metadata/hoc/MetadataAttributes.js b/ui/src/app/metadata/hoc/MetadataAttributes.js index c4c59d3c0..e4cf57a2d 100644 --- a/ui/src/app/metadata/hoc/MetadataAttributes.js +++ b/ui/src/app/metadata/hoc/MetadataAttributes.js @@ -1,8 +1,11 @@ import React from 'react'; +import { createNotificationAction, NotificationTypes, useNotificationDispatcher } from '../../notifications/hoc/Notifications'; import { useMetadataAttribute, useMetadataAttributes } from '../hooks/api'; export function MetadataAttributes ({children}) { + const dispatch = useNotificationDispatcher(); + const { get, response } = useMetadataAttributes({ cachePolicy: 'no-cache' }); @@ -24,6 +27,7 @@ export function MetadataAttributes ({children}) { await del(`/${id}`); if (attrApi.response.ok) { loadAttributes(); + dispatch(createNotificationAction(`Attribute deleted successfully`, NotificationTypes.SUCCESS, 5000)); } } diff --git a/ui/src/app/metadata/view/MetadataAttributeEdit.js b/ui/src/app/metadata/view/MetadataAttributeEdit.js index b45dfeaa5..84670d467 100644 --- a/ui/src/app/metadata/view/MetadataAttributeEdit.js +++ b/ui/src/app/metadata/view/MetadataAttributeEdit.js @@ -11,7 +11,7 @@ import { useMetadataAttribute } from '../hooks/api'; import { CustomAttributeDefinition, CustomAttributeEditor } from '../domain/attribute/CustomAttributeDefinition'; import MetadataSchema from '../hoc/MetadataSchema'; import { MetadataForm } from '../hoc/MetadataFormContext'; -import { createNotificationAction, useNotificationDispatcher } from '../../notifications/hoc/Notifications'; +import { createNotificationAction, NotificationTypes, useNotificationDispatcher } from '../../notifications/hoc/Notifications'; export function MetadataAttributeEdit() { const { id } = useParams(); @@ -35,11 +35,16 @@ export function MetadataAttributeEdit() { } async function save(metadata) { + let toast; const resp = await put(``, definition.parser(metadata)); if (response.ok) { + toast = createNotificationAction(`Updated attribute successfully.`, NotificationTypes.SUCCESS); gotoDetail({ refresh: true }); } else { - dispatch(createNotificationAction(`${resp.errorCode}: Unable to edit attribute ... ${resp.errorMessage}`, 'danger', 5000)); + toast = createNotificationAction(`${resp.errorCode}: Unable to edit attribute ... ${resp.errorMessage}`, 'danger', 5000); + } + if (toast) { + dispatch(toast); } }; From 012c3a037fbc2b3812ea13576269dce2c4f3f8f0 Mon Sep 17 00:00:00 2001 From: Charles Hasegawa Date: Fri, 12 Aug 2022 15:11:07 +0000 Subject: [PATCH 4/4] README.md edited online with Bitbucket Former-commit-id: 70601bc297312358b65819db33d3193f9fe2cb26 --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index c34cf18bc..3afd1b078 100644 --- a/README.md +++ b/README.md @@ -91,10 +91,6 @@ spring.h2.console.enabled=true #spring.datasource.tomcat.initialSize=50 #spring.datasource.tomcat.validationQuery=select 1 -# Liquibase properties -liquibase.enabled=false -#liquibase.change-log=classpath:edu/internet2/tier/shibboleth/admin/ui/database/masterchangelog.xml - # Hibernate properties # for production never ever use create, create-drop. It's BEST to use validate spring.jpa.hibernate.ddl-auto=create