diff --git a/ui/package.json b/ui/package.json
index 68b20428d..0e4e626b2 100644
--- a/ui/package.json
+++ b/ui/package.json
@@ -11,6 +11,7 @@
"@testing-library/user-event": "^12.1.10",
"bootstrap": "^4.6.0",
"date-fns": "^2.21.1",
+ "file-saver": "^2.0.5",
"http-proxy-middleware": "^1.2.0",
"lodash": "^4.17.21",
"prop-types": "^15.7.2",
diff --git a/ui/src/app/App.js b/ui/src/app/App.js
index 85bae3dc5..2e53c4e3d 100644
--- a/ui/src/app/App.js
+++ b/ui/src/app/App.js
@@ -25,6 +25,7 @@ function App() {
interceptors: {
request: async ({options, url, path, route}) => {
options.headers['X-XSRF-TOKEN'] = get_cookie('XSRF-TOKEN');
+
return options;
}
}
diff --git a/ui/src/app/core/utility/download_as_xml.js b/ui/src/app/core/utility/download_as_xml.js
new file mode 100644
index 000000000..0ce61cca3
--- /dev/null
+++ b/ui/src/app/core/utility/download_as_xml.js
@@ -0,0 +1,7 @@
+import * as FileSaver from 'file-saver';
+
+export const downloadAsXml = (entity, xml) => {
+ const name = entity.name ? entity.name : entity.serviceProviderName;
+ const blob = new Blob([xml], { type: 'text/xml;charset=utf-8' });
+ FileSaver.saveAs(blob, `${name}.xml`);
+}
\ No newline at end of file
diff --git a/ui/src/app/metadata/Metadata.js b/ui/src/app/metadata/Metadata.js
index 7564416c3..dcb32e2c2 100644
--- a/ui/src/app/metadata/Metadata.js
+++ b/ui/src/app/metadata/Metadata.js
@@ -6,6 +6,8 @@ import { MetadataHistory } from './component/MetadataHistory';
import { MetadataEditor } from './editor/MetadataEditor';
import { MetadataSelector } from './hoc/MetadataSelector';
import { MetadataSchema } from './hoc/MetadataSchema';
+import { MetadataXmlLoader } from './hoc/MetadataXmlLoader';
+import { MetadataXml } from './component/MetadataXml';
export function Metadata () {
@@ -13,21 +15,28 @@ export function Metadata () {
return (
-
-
-
-
-
-
- } />
-
-
-
-
- } />
-
-
-
+
+
+
+
+
+
+
+ } />
+
+
+
+
+ } />
+
+
+
+
+ } />
+
+
+
+
);
}
\ No newline at end of file
diff --git a/ui/src/app/metadata/component/MetadataHistory.js b/ui/src/app/metadata/component/MetadataHistory.js
index a372179cc..42c882407 100644
--- a/ui/src/app/metadata/component/MetadataHistory.js
+++ b/ui/src/app/metadata/component/MetadataHistory.js
@@ -1,13 +1,85 @@
import React from 'react';
+import { useParams } from 'react-router';
+import { Link } from 'react-router-dom';
+import FormattedDate from '../../core/components/FormattedDate';
import Translate from '../../i18n/components/translate';
+import { useMetadataHistory } from '../hooks/api';
export function MetadataHistory () {
+ const { type, id } = useParams();
+
+ const { data, loading } = useMetadataHistory(type, id, {}, []);
+
+ const toggleVersionSelected = () => {};
+ const restore = () => {};
+ const compare = () => {};
+
+ const selected = [];
+
return (
<>
- version history
+ version history
+ {data && !loading &&
+ <>
+
+
+ >
+
}
+ {loading &&
+
+ Loading...
+
}
>
);
}
\ No newline at end of file
diff --git a/ui/src/app/metadata/component/MetadataOptions.js b/ui/src/app/metadata/component/MetadataOptions.js
index e59b1f8d1..374713f12 100644
--- a/ui/src/app/metadata/component/MetadataOptions.js
+++ b/ui/src/app/metadata/component/MetadataOptions.js
@@ -11,6 +11,7 @@ import { MetadataConfiguration } from './MetadataConfiguration';
import { useMetadataConfiguration } from '../hooks/configuration';
+import { MetadataViewToggle } from './MetadataViewToggle';
export function MetadataOptions () {
@@ -43,18 +44,7 @@ export function MetadataOptions () {
}
- {/**/}
+
diff --git a/ui/src/app/metadata/component/MetadataViewToggle.js b/ui/src/app/metadata/component/MetadataViewToggle.js
new file mode 100644
index 000000000..59975b9fb
--- /dev/null
+++ b/ui/src/app/metadata/component/MetadataViewToggle.js
@@ -0,0 +1,26 @@
+import React from 'react';
+import { NavLink } from 'react-router-dom';
+
+import {Translate} from '../../i18n/components/translate';
+import { MetadataXmlContext } from '../hoc/MetadataXmlLoader';
+
+export function MetadataViewToggle () {
+ const xml = React.useContext(MetadataXmlContext);
+
+ return (
+ <>
+ {xml ?
+
+
+ Toggle view:
+ Options
+
+
+ Toggle view:
+ XML
+
+
+ : ''}
+ >
+ );
+}
\ No newline at end of file
diff --git a/ui/src/app/metadata/component/MetadataXml.js b/ui/src/app/metadata/component/MetadataXml.js
new file mode 100644
index 000000000..10c740d8e
--- /dev/null
+++ b/ui/src/app/metadata/component/MetadataXml.js
@@ -0,0 +1,45 @@
+import { faSave } from '@fortawesome/free-solid-svg-icons';
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
+import React from 'react';
+
+import { useParams } from 'react-router';
+import Translate from '../../i18n/components/translate';
+import { MetadataObjectContext } from '../hoc/MetadataSelector';
+
+import { MetadataXmlContext } from '../hoc/MetadataXmlLoader';
+import { MetadataViewToggle } from './MetadataViewToggle';
+import { downloadAsXml } from '../../core/utility/download_as_xml';
+
+export function MetadataXml () {
+ const xml = React.useContext(MetadataXmlContext);
+ const entity = React.useContext(MetadataObjectContext);
+ const { type } = useParams();
+
+ const download = () => downloadAsXml(entity, xml);
+
+ return (
+ <>
+
+ Source Configuration
+
+
+
+
+
+
+
+ {xml}
+
+ { xml }
+
+
+
+
+
+
+ >
+ );
+}
\ No newline at end of file
diff --git a/ui/src/app/metadata/component/properties/PropertyValue.js b/ui/src/app/metadata/component/properties/PropertyValue.js
index 14779b3e4..91b51d5cd 100644
--- a/ui/src/app/metadata/component/properties/PropertyValue.js
+++ b/ui/src/app/metadata/component/properties/PropertyValue.js
@@ -10,8 +10,6 @@ export function PropertyValue ({ name, value, columns }) {
const id = useGuid();
- console.log(value)
-
return (
<>
{ name && value && value !== false ?
diff --git a/ui/src/app/metadata/domain/index.js b/ui/src/app/metadata/domain/index.js
index 01d2429aa..5cd284162 100644
--- a/ui/src/app/metadata/domain/index.js
+++ b/ui/src/app/metadata/domain/index.js
@@ -1,10 +1,13 @@
+import { MetadataProviderEditorTypes } from './provider';
import { SourceEditor } from "./source/SourceDefinition";
export const editors = {
source: SourceEditor
};
-export const ProviderEditorTypes = [];
+export const ProviderEditorTypes = [
+ ...MetadataProviderEditorTypes
+];
export const FilterEditorTypes = [];
diff --git a/ui/src/app/metadata/domain/provider/BaseProviderDefinition.js b/ui/src/app/metadata/domain/provider/BaseProviderDefinition.js
new file mode 100644
index 000000000..082ab3203
--- /dev/null
+++ b/ui/src/app/metadata/domain/provider/BaseProviderDefinition.js
@@ -0,0 +1,26 @@
+import { metadataFilterProcessor } from './utility/providerFilterProcessor';
+
+export const BaseProviderDefinition = {
+ schemaPreprocessor: metadataFilterProcessor,
+ parser: (changes) => (changes.metadataFilters ? ({
+ ...changes,
+ metadataFilters: [
+ ...Object.keys(changes.metadataFilters).reduce((collection, filterName) => ([
+ ...collection,
+ {
+ ...changes.metadataFilters[filterName],
+ '@type': filterName
+ }
+ ]), [])
+ ]
+ }) : changes),
+ formatter: (changes) => (changes.metadataFilters ? ({
+ ...changes,
+ metadataFilters: {
+ ...(changes.metadataFilters || []).reduce((collection, filter) => ({
+ ...collection,
+ [filter['@type']]: filter
+ }), {})
+ }
+ }) : changes),
+}
\ No newline at end of file
diff --git a/ui/src/app/metadata/domain/provider/DynamicHttpMetadataProviderDefinition.js b/ui/src/app/metadata/domain/provider/DynamicHttpMetadataProviderDefinition.js
new file mode 100644
index 000000000..e1f04b0a1
--- /dev/null
+++ b/ui/src/app/metadata/domain/provider/DynamicHttpMetadataProviderDefinition.js
@@ -0,0 +1,131 @@
+// import { metadataFilterProcessor } from './utility/providerFilterProcessor';
+
+import { BaseProviderDefinition } from './BaseProviderDefinition';
+import API_BASE_PATH from "../../../App.constant";
+
+export const DynamicHttpMetadataProviderWizard = {
+ ...BaseProviderDefinition,
+ label: 'DynamicHttpMetadataProvider',
+ type: 'DynamicHttpMetadataResolver',
+ schema: `${API_BASE_PATH}/ui/MetadataResolver/DynamicHttpMetadataResolver`,
+ steps: [
+ {
+ id: 'common',
+ label: 'label.common-attributes',
+ index: 2,
+ initialValues: [],
+ fields: [
+ 'xmlId',
+ 'requireValidMetadata',
+ 'failFastInitialization',
+ 'metadataRequestURLConstructionScheme'
+ ]
+ },
+ {
+ id: 'dynamic',
+ label: 'label.dynamic-attributes',
+ index: 3,
+ initialValues: [],
+ fields: [
+ 'dynamicMetadataResolverAttributes'
+ ]
+ },
+ {
+ id: 'plugins',
+ label: 'label.metadata-filter-plugins',
+ index: 4,
+ initialValues: [],
+ fields: [
+ 'metadataFilters'
+ ]
+ },
+ {
+ id: 'summary',
+ label: 'label.finished',
+ index: 5,
+ initialValues: [],
+ fields: [
+ 'enabled'
+ ]
+ }
+ ]
+};
+
+
+export const DynamicHttpMetadataProviderEditor = {
+ ...DynamicHttpMetadataProviderWizard,
+ steps: [
+ {
+ id: 'common',
+ label: 'label.common-attributes',
+ index: 1,
+ initialValues: [],
+ fields: [
+ 'name',
+ '@type',
+ 'xmlId',
+ 'metadataRequestURLConstructionScheme',
+ 'enabled',
+ 'requireValidMetadata',
+ 'failFastInitialization'
+ ],
+ fieldsets: [
+ {
+ type: 'section',
+ class: ['mb-3'],
+ fields: [
+ 'name',
+ '@type'
+ ]
+ },
+ {
+ type: 'group-lg',
+ class: ['col-12'],
+ fields: [
+ 'xmlId',
+ 'metadataRequestURLConstructionScheme',
+ 'enabled',
+ 'requireValidMetadata',
+ 'failFastInitialization'
+ ]
+ }
+ ],
+ override: {
+ '@type': {
+ type: 'string',
+ readOnly: true,
+ widget: 'string',
+ oneOf: [{ enum: ['DynamicHttpMetadataResolver'], description: 'value.dynamic-http-metadata-provider' }]
+ }
+ }
+ },
+ {
+ id: 'dynamic',
+ label: 'label.dynamic-attributes',
+ index: 3,
+ initialValues: [],
+ fields: [
+ 'dynamicMetadataResolverAttributes'
+ ]
+ },
+ {
+ id: 'plugins',
+ label: 'label.metadata-filter-plugins',
+ index: 4,
+ initialValues: [],
+ fields: [
+ 'metadataFilters'
+ ]
+ },
+ {
+ id: 'advanced',
+ label: 'label.http-settings-advanced',
+ index: 4,
+ initialValues: [],
+ locked: true,
+ fields: [
+ 'httpMetadataResolverAttributes'
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/ui/src/app/metadata/domain/provider/FileBackedHttpMetadataProviderDefinition.js b/ui/src/app/metadata/domain/provider/FileBackedHttpMetadataProviderDefinition.js
new file mode 100644
index 000000000..37e4216b2
--- /dev/null
+++ b/ui/src/app/metadata/domain/provider/FileBackedHttpMetadataProviderDefinition.js
@@ -0,0 +1,114 @@
+import { BaseProviderDefinition } from "./BaseProviderDefinition";
+
+export const FileBackedHttpMetadataProviderWizard = {
+ ...BaseProviderDefinition,
+ label: 'FileBackedHttpMetadataProvider',
+ type: 'FileBackedHttpMetadataResolver',
+ schema: '/assets/schema/provider/filebacked-http.schema.json',
+ steps: [
+ {
+ id: 'common',
+ label: 'label.common-attributes',
+ index: 2,
+ initialValues: [],
+ fields: [
+ 'xmlId',
+ 'metadataURL',
+ 'initializeFromBackupFile',
+ 'backingFile',
+ 'backupFileInitNextRefreshDelay',
+ 'requireValidMetadata',
+ 'failFastInitialization',
+ 'useDefaultPredicateRegistry',
+ 'satisfyAnyPredicates'
+ ]
+ },
+ {
+ id: 'reloading',
+ label: 'label.reloading-attributes',
+ index: 3,
+ initialValues: [],
+ fields: [
+ 'reloadableMetadataResolverAttributes'
+ ]
+ },
+ {
+ id: 'plugins',
+ label: 'label.metadata-filter-plugins',
+ index: 4,
+ initialValues: [
+ { key: 'metadataFilters', value: [] }
+ ],
+ fields: [
+ 'metadataFilters'
+ ]
+ },
+ {
+ id: 'summary',
+ label: 'label.finished',
+ index: 5,
+ initialValues: [],
+ fields: [
+ 'enabled'
+ ]
+ }
+ ]
+};
+
+
+export const FileBackedHttpMetadataProviderEditor = {
+ ...FileBackedHttpMetadataProviderWizard,
+ schema: 'assets/schema/provider/filebacked-http.schema.json',
+ steps: [
+ {
+ id: 'common',
+ label: 'label.common-attributes',
+ index: 1,
+ initialValues: [],
+ fields: [
+ 'name',
+ '@type',
+ 'enabled',
+ 'xmlId',
+ 'metadataURL',
+ 'initializeFromBackupFile',
+ 'backingFile',
+ 'backupFileInitNextRefreshDelay',
+ 'requireValidMetadata',
+ 'failFastInitialization',
+ 'useDefaultPredicateRegistry',
+ 'satisfyAnyPredicates'
+ ]
+ },
+ {
+ id: 'reloading',
+ label: 'label.reloading-attributes',
+ index: 2,
+ initialValues: [],
+ fields: [
+ 'reloadableMetadataResolverAttributes'
+ ]
+ },
+ {
+ id: 'plugins',
+ label: 'label.metadata-filter-plugins',
+ index: 3,
+ initialValues: [
+ { key: 'metadataFilters', value: [] }
+ ],
+ fields: [
+ 'metadataFilters'
+ ]
+ },
+ {
+ id: 'advanced',
+ label: 'label.advanced-settings',
+ index: 4,
+ initialValues: [],
+ locked: true,
+ fields: [
+ 'httpMetadataResolverAttributes'
+ ]
+ }
+ ]
+};
diff --git a/ui/src/app/metadata/domain/provider/FileSystemMetadataProviderDefinition.js b/ui/src/app/metadata/domain/provider/FileSystemMetadataProviderDefinition.js
new file mode 100644
index 000000000..6a06e1d51
--- /dev/null
+++ b/ui/src/app/metadata/domain/provider/FileSystemMetadataProviderDefinition.js
@@ -0,0 +1,137 @@
+import API_BASE_PATH from "../../../App.constant";
+import { BaseProviderDefinition } from "./BaseProviderDefinition";
+
+export const FileSystemMetadataProviderWizard = {
+ ...BaseProviderDefinition,
+ label: 'FilesystemMetadataProvider',
+ type: 'FilesystemMetadataResolver',
+ schema: `${API_BASE_PATH}/ui/MetadataResolver/FilesystemMetadataResolver`,
+ steps: [
+ {
+ id: 'common',
+ label: 'label.common-attributes',
+ index: 2,
+ initialValues: [],
+ fields: [
+ 'xmlId',
+ 'metadataFile',
+ 'doInitialization'
+ ],
+ fieldsets: [
+ {
+ type: 'group-lg',
+ class: ['col-12'],
+ fields: [
+ 'xmlId',
+ 'metadataFile',
+ 'doInitialization'
+ ]
+ }
+ ]
+ },
+ {
+ id: 'dynamic',
+ label: 'label.dynamic-attributes',
+ index: 3,
+ initialValues: [],
+ fields: [
+ 'reloadableMetadataResolverAttributes'
+ ],
+ fieldsets: [
+ {
+ type: 'group-lg',
+ class: ['col-12'],
+ fields: [
+ 'reloadableMetadataResolverAttributes'
+ ]
+ }
+ ]
+ },
+ {
+ id: 'summary',
+ label: 'label.finished',
+ index: 4,
+ initialValues: [],
+ fields: [
+ 'enabled'
+ ],
+ fieldsets: [
+ {
+ type: 'group-lg',
+ class: ['col-12'],
+ fields: [
+ 'enabled'
+ ]
+ }
+ ]
+ }
+ ]
+};
+
+
+export const FileSystemMetadataProviderEditor = {
+ ...FileSystemMetadataProviderWizard,
+ steps: [
+ {
+ id: 'common',
+ label: 'label.common-attributes',
+ index: 1,
+ initialValues: [],
+ fields: [
+ 'name',
+ 'xmlId',
+ '@type',
+ 'metadataFile',
+ 'enabled',
+ 'doInitialization'
+ ],
+ override: {
+ '@type': {
+ type: 'string',
+ readOnly: true,
+ widget: 'string',
+ oneOf: [{ enum: ['FilesystemMetadataResolver'],
+ description: 'value.file-system-metadata-provider' }]
+ }
+ },
+ fieldsets: [
+ {
+ type: 'section',
+ class: ['mb-3'],
+ fields: [
+ 'name',
+ '@type'
+ ]
+ },
+ {
+ type: 'group-lg',
+ class: ['col-12'],
+ fields: [
+ 'enabled',
+ 'xmlId',
+ 'metadataFile',
+ 'doInitialization'
+ ]
+ }
+ ]
+ },
+ {
+ id: 'dynamic',
+ label: 'label.dynamic-attributes',
+ index: 2,
+ initialValues: [],
+ fields: [
+ 'reloadableMetadataResolverAttributes'
+ ],
+ fieldsets: [
+ {
+ type: 'group-lg',
+ class: ['col-12'],
+ fields: [
+ 'reloadableMetadataResolverAttributes'
+ ]
+ }
+ ]
+ }
+ ]
+};
diff --git a/ui/src/app/metadata/domain/provider/LocalDynamicMetadataProviderDefinition.js b/ui/src/app/metadata/domain/provider/LocalDynamicMetadataProviderDefinition.js
new file mode 100644
index 000000000..0595d0bad
--- /dev/null
+++ b/ui/src/app/metadata/domain/provider/LocalDynamicMetadataProviderDefinition.js
@@ -0,0 +1,123 @@
+import API_BASE_PATH from "../../../App.constant";
+import { BaseProviderDefinition } from "./BaseProviderDefinition";
+
+export const LocalDynamicMetadataProviderWizard = {
+ ...BaseProviderDefinition,
+ label: 'LocalDynamicMetadataProvider',
+ type: 'LocalDynamicMetadataResolver',
+ schema: `${API_BASE_PATH}/ui/MetadataResolver/LocalDynamicMetadataResolver`,
+ steps: [
+ {
+ id: 'common',
+ label: 'label.common-attributes',
+ index: 2,
+ initialValues: [],
+ fields: [
+ 'xmlId',
+ 'sourceDirectory'
+ ],
+ fieldsets: [
+ {
+ type: 'group-lg',
+ class: ['col-12'],
+ fields: [
+ 'xmlId',
+ 'sourceDirectory'
+ ]
+ }
+ ]
+ },
+ {
+ id: 'dynamic',
+ label: 'label.dynamic-attributes',
+ index: 3,
+ initialValues: [],
+ fields: [
+ 'dynamicMetadataResolverAttributes'
+ ],
+ fieldsets: [
+ {
+ type: 'group-lg',
+ class: ['col-12'],
+ fields: [
+ 'dynamicMetadataResolverAttributes'
+ ]
+ }
+ ]
+ },
+ {
+ id: 'summary',
+ label: 'label.finished',
+ index: 4,
+ initialValues: [],
+ fields: [
+ 'enabled'
+ ],
+ fieldsets: [
+ {
+ type: 'group-lg',
+ class: ['col-12'],
+ fields: [
+ 'enabled'
+ ]
+ }
+ ]
+ }
+ ]
+};
+
+
+export const LocalDynamicMetadataProviderEditor = {
+ ...LocalDynamicMetadataProviderWizard,
+ steps: [
+ {
+ id: 'common',
+ label: 'label.common-attributes',
+ index: 1,
+ initialValues: [],
+ fields: [
+ 'name',
+ '@type',
+ 'enabled',
+ 'xmlId',
+ 'sourceDirectory',
+ ],
+ override: {
+ '@type': {
+ type: 'string',
+ readOnly: true,
+ widget: 'string',
+ oneOf: [{ enum: ['LocalDynamicMetadataResolver'], description: 'value.local-dynamic-metadata-provider' }]
+ }
+ },
+ fieldsets: [
+ {
+ type: 'section',
+ class: ['mb-3'],
+ fields: [
+ 'name',
+ '@type'
+ ]
+ },
+ {
+ type: 'group-lg',
+ class: ['col-12'],
+ fields: [
+ 'enabled',
+ 'xmlId',
+ 'sourceDirectory',
+ ]
+ }
+ ]
+ },
+ {
+ id: 'dynamic',
+ label: 'label.dynamic-attributes',
+ index: 2,
+ initialValues: [],
+ fields: [
+ 'dynamicMetadataResolverAttributes'
+ ]
+ }
+ ]
+};
diff --git a/ui/src/app/metadata/domain/provider/index.js b/ui/src/app/metadata/domain/provider/index.js
new file mode 100644
index 000000000..bc36234e5
--- /dev/null
+++ b/ui/src/app/metadata/domain/provider/index.js
@@ -0,0 +1,24 @@
+import { FileBackedHttpMetadataProviderWizard, FileBackedHttpMetadataProviderEditor } from './FileBackedHttpMetadataProviderDefinition';
+import { DynamicHttpMetadataProviderWizard, DynamicHttpMetadataProviderEditor } from './DynamicHttpMetadataProviderDefinition';
+import { LocalDynamicMetadataProviderWizard, LocalDynamicMetadataProviderEditor } from './LocalDynamicMetadataProviderDefinition';
+import { FileSystemMetadataProviderWizard, FileSystemMetadataProviderEditor } from './FileSystemMetadataProviderDefinition';
+
+export const MetadataProviderWizardTypes = [
+ FileBackedHttpMetadataProviderWizard,
+ DynamicHttpMetadataProviderWizard,
+ FileSystemMetadataProviderWizard,
+ LocalDynamicMetadataProviderWizard
+];
+
+export const MetadataProviderEditorTypes = [
+ FileBackedHttpMetadataProviderEditor,
+ DynamicHttpMetadataProviderEditor,
+ LocalDynamicMetadataProviderEditor,
+ FileSystemMetadataProviderEditor
+];
+
+export const FilterableProviders = [
+ FileBackedHttpMetadataProviderEditor.type,
+ DynamicHttpMetadataProviderEditor.type,
+ LocalDynamicMetadataProviderEditor.type
+];
diff --git a/ui/src/app/metadata/domain/provider/utility/providerFilterProcessor.js b/ui/src/app/metadata/domain/provider/utility/providerFilterProcessor.js
new file mode 100644
index 000000000..dc415bae1
--- /dev/null
+++ b/ui/src/app/metadata/domain/provider/utility/providerFilterProcessor.js
@@ -0,0 +1,23 @@
+export const metadataFilterProcessor = (schema) => {
+ if (!schema) {
+ return null;
+ }
+ if (!schema.properties || !schema.properties.metadataFilters) {
+ return schema;
+ }
+ const filters = schema.properties.metadataFilters;
+ const processed = ({
+ ...schema,
+ properties: {
+ ...schema.properties,
+ metadataFilters: {
+ type: 'object',
+ properties: filters.items.reduce((collection, filterType) => ({
+ ...collection,
+ [filterType.$id]: filterType
+ }), {})
+ }
+ }
+ });
+ return processed;
+};
diff --git a/ui/src/app/metadata/domain/source/SourceDefinition.js b/ui/src/app/metadata/domain/source/SourceDefinition.js
index bbf38b740..39d5ed28d 100644
--- a/ui/src/app/metadata/domain/source/SourceDefinition.js
+++ b/ui/src/app/metadata/domain/source/SourceDefinition.js
@@ -1,8 +1,10 @@
+import API_BASE_PATH from "../../../App.constant";
+
export const SourceBase = {
label: 'Metadata Source',
type: '@MetadataProvider',
steps: [],
- schema: '',
+ schema: `${API_BASE_PATH}/ui/MetadataSources`,
validatorParams: [/*getAllOtherIds*/],
bindings: {
@@ -119,7 +121,7 @@ export const SourceBase = {
export const SourceEditor = {
...SourceBase,
- schema: `/MetadataSources`,
+ schema: `${API_BASE_PATH}/ui/MetadataSources`,
steps: [
{
index: 1,
diff --git a/ui/src/app/metadata/hoc/MetadataSchema.js b/ui/src/app/metadata/hoc/MetadataSchema.js
index ad6574bfe..54b29c681 100644
--- a/ui/src/app/metadata/hoc/MetadataSchema.js
+++ b/ui/src/app/metadata/hoc/MetadataSchema.js
@@ -2,22 +2,27 @@ import React from 'react';
import { useParams } from 'react-router';
import { useMetadataSchema } from '../hooks/api';
import { getDefinition } from '../domain/index';
+import { MetadataObjectContext } from './MetadataSelector';
export const MetadataSchemaContext = React.createContext();
export const MetadataDefinitionContext = React.createContext();
export function MetadataSchema({ children }) {
- let { type } = useParams();
+ const metadata = React.useContext(MetadataObjectContext);
- const definition = React.useMemo(() => getDefinition(type), [type]);
+ const { type } = useParams();
+
+ const definition = React.useMemo(() => getDefinition(
+ type === 'source' ? type : metadata['@type']
+ ), [type, metadata]);
const { get, response } = useMetadataSchema();
const [schema, setSchema] = React.useState();
async function loadSchema(d) {
- const source = await get(`/${definition.schema}`)
+ const source = await get(`/${d.schema}`)
if (response.ok) {
setSchema(source);
}
diff --git a/ui/src/app/metadata/hoc/MetadataXmlLoader.js b/ui/src/app/metadata/hoc/MetadataXmlLoader.js
new file mode 100644
index 000000000..5b5d1e4ab
--- /dev/null
+++ b/ui/src/app/metadata/hoc/MetadataXmlLoader.js
@@ -0,0 +1,32 @@
+import React from 'react';
+import { useParams } from 'react-router';
+import { useMetadataEntityXml } from '../hooks/api';
+
+export const MetadataXmlContext = React.createContext();
+
+export function MetadataXmlLoader({ children }) {
+
+ let { type, id } = useParams();
+
+ const { get, response } = useMetadataEntityXml(type);
+
+ const [xml, setXml] = React.useState([]);
+
+ async function loadMetadataXml(id) {
+ const data = await get(`/${id}`)
+ if (response.ok) {
+ setXml(data);
+ }
+ }
+
+ /*eslint-disable react-hooks/exhaustive-deps*/
+ React.useEffect(() => { loadMetadataXml(id) }, [id]);
+
+ return (
+
+ {children}
+
+ );
+}
+
+export default MetadataXmlLoader;
\ No newline at end of file
diff --git a/ui/src/app/metadata/hooks/api.js b/ui/src/app/metadata/hooks/api.js
index 8b76c5233..ac2f66355 100644
--- a/ui/src/app/metadata/hooks/api.js
+++ b/ui/src/app/metadata/hooks/api.js
@@ -32,14 +32,35 @@ export function useMetadataEntities(type = 'source', opts = {}) {
return useFetch(`${API_BASE_PATH}${getMetadataListPath(type)}`, opts);
}
-export function useMetadataEntity(type = 'source', opts = {}) {
+export function useMetadataEntity(type = 'source', opts = {
+ cachePolicy: 'no-cache'
+}) {
+ return useFetch(`${API_BASE_PATH}${getMetadataPath(type)}`, opts);
+}
+
+export function useMetadataEntityXml(type = 'source', opts = {
+ interceptors: {
+ request: ({options}) => {
+ options.headers['Accept'] = 'application/xml';
+ return options;
+ }
+ }
+}) {
return useFetch(`${API_BASE_PATH}${getMetadataPath(type)}`, opts);
}
export function useMetadataProviderOrder() {
- return useFetch(`${API_BASE_PATH}/MetadataResolversPositionOrder`)
+ return useFetch(`${API_BASE_PATH}/MetadataResolversPositionOrder`);
}
export function useMetadataSchema() {
- return useFetch(`${API_BASE_PATH}/ui`);
+ return useFetch(``);
}
+
+export function useMetadataHistory(type, id, opts = {}, i) {
+
+ return useFetch(`${API_BASE_PATH}${getMetadataPath(type)}/${id}/Versions`, opts, i);
+
+ // EntityDescriptor/d07d6122-0dd2-433e-baec-b76413b4c842/Versions
+ // MetadataResolvers/4161d661-2be7-4110-9e91-539669a691e3/Versions
+}
\ No newline at end of file
diff --git a/ui/src/app/metadata/hooks/configuration.js b/ui/src/app/metadata/hooks/configuration.js
index e1eb41d93..d7a16edd4 100644
--- a/ui/src/app/metadata/hooks/configuration.js
+++ b/ui/src/app/metadata/hooks/configuration.js
@@ -7,7 +7,5 @@ export function useMetadataConfiguration(models) {
const definition = React.useContext(MetadataDefinitionContext);
const schema = React.useContext(MetadataSchemaContext);
- console.log(definition, schema);
-
return getConfigurationSections(models, definition, schema);
}
\ No newline at end of file
diff --git a/ui/yarn.lock b/ui/yarn.lock
index 5f9867d98..bc509ce9c 100644
--- a/ui/yarn.lock
+++ b/ui/yarn.lock
@@ -4950,6 +4950,11 @@ file-loader@6.1.1:
loader-utils "^2.0.0"
schema-utils "^3.0.0"
+file-saver@^2.0.5:
+ version "2.0.5"
+ resolved "https://registry.yarnpkg.com/file-saver/-/file-saver-2.0.5.tgz#d61cfe2ce059f414d899e9dd6d4107ee25670c38"
+ integrity sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==
+
file-uri-to-path@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd"