Skip to content

Commit

Permalink
Merged develop into bugfix/shibui-2333
Browse files Browse the repository at this point in the history
Former-commit-id: 480517637d60f3ac48594e7aef61c9aad3615aca
  • Loading branch information
chasegawa committed Aug 15, 2022
2 parents 136f35b + cccd529 commit 3f15969
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 13 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ui/public/assets/schema/attribute/attribute.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"title": "label.entity-attribute-help",
"description": "tooltip.entity-attribute-help",
"type": "string",
"minLength": 1,
"minLength": 0,
"maxLength": 255
}
},
Expand Down
4 changes: 4 additions & 0 deletions ui/src/app/metadata/hoc/MetadataAttributes.js
Original file line number Diff line number Diff line change
@@ -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'
});
Expand All @@ -24,6 +27,7 @@ export function MetadataAttributes ({children}) {
await del(`/${id}`);
if (attrApi.response.ok) {
loadAttributes();
dispatch(createNotificationAction(`Attribute deleted successfully`, NotificationTypes.SUCCESS, 5000));
}
}

Expand Down
10 changes: 7 additions & 3 deletions ui/src/app/metadata/hoc/MetadataXmlLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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 (
<MetadataXmlContext.Provider value={xml}>
<MetadataXmlContext.Provider value={{reload, xml}}>
{children}
</MetadataXmlContext.Provider>
);
Expand Down
9 changes: 7 additions & 2 deletions ui/src/app/metadata/new/NewAttribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
}
};

Expand Down
9 changes: 7 additions & 2 deletions ui/src/app/metadata/view/MetadataAttributeEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
}
};

Expand Down
7 changes: 6 additions & 1 deletion ui/src/app/metadata/view/MetadataXml.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<>
<h2 className="mb-4">
Expand Down

0 comments on commit 3f15969

Please sign in to comment.