mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-28 17:23:28 +00:00
minor: improve csv parsing for custom properties (#18293)
(cherry picked from commit dab1e31dc8eb319908da91f23eb4c35ebaae7bd9)
This commit is contained in:
parent
5e08c103a7
commit
6a4c685849
@ -10,6 +10,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { ExtensionDataProps } from '../../components/Modals/ModalWithCustomProperty/ModalWithMarkdownEditor.interface';
|
||||
import { EntityType } from '../../enums/entity.enum';
|
||||
import {
|
||||
MOCK_GLOSSARY_TERM_CUSTOM_PROPERTIES,
|
||||
@ -163,5 +164,14 @@ describe('CSVUtils', () => {
|
||||
MOCK_GLOSSARY_TERM_CUSTOM_PROPERTIES_CONVERTED_EXTENSION_CSV_STRING
|
||||
);
|
||||
});
|
||||
|
||||
it('should return string correctly which contains undefined as value for property', () => {
|
||||
const convertedCSVEntities = convertEntityExtensionToCustomPropertyString(
|
||||
{ dateCp: undefined } as unknown as ExtensionDataProps,
|
||||
MOCK_GLOSSARY_TERM_CUSTOM_PROPERTIES
|
||||
);
|
||||
|
||||
expect(convertedCSVEntities).toStrictEqual(`dateCp:undefined`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -11,7 +11,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { TypeColumn } from '@inovua/reactdatagrid-community/types';
|
||||
import { compact, get, isEmpty, isUndefined, startCase } from 'lodash';
|
||||
import {
|
||||
compact,
|
||||
get,
|
||||
isEmpty,
|
||||
isString,
|
||||
isUndefined,
|
||||
startCase,
|
||||
} from 'lodash';
|
||||
import React from 'react';
|
||||
import { ReactComponent as SuccessBadgeIcon } from '../..//assets/svg/success-badge.svg';
|
||||
import { ReactComponent as FailBadgeIcon } from '../../assets/svg/fail-badge.svg';
|
||||
@ -392,12 +399,13 @@ export const convertEntityExtensionToCustomPropertyString = (
|
||||
convertCustomPropertyValueExtensionToStringBasedOnType(
|
||||
value,
|
||||
customPropertiesMapByName[key]
|
||||
) as string;
|
||||
);
|
||||
|
||||
const endValue = isLastElement ? '' : ';';
|
||||
|
||||
const hasSeparator =
|
||||
stringValue.includes(',') || stringValue.includes(';');
|
||||
isString(stringValue) &&
|
||||
(stringValue.includes(',') || stringValue.includes(';'));
|
||||
|
||||
// Check if the property type is markdown or sqlQuery or string and add quotes around the value
|
||||
if (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user