diff --git a/.github/workflows/fake-pr-tests.yml b/.github/workflows/fake-pr-tests.yml deleted file mode 100644 index f2dd9fbb..00000000 --- a/.github/workflows/fake-pr-tests.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: PR tests -on: - pull_request: - types: [auto_merge_enabled] - workflow_dispatch: - -jobs: - skip: - name: Report fake success for PR tests - runs-on: ubuntu-latest - permissions: - checks: write - steps: - - uses: LouisBrunner/checks-action@v2.0.0 - with: - name: Run PR tests (Plugins) (Plugins) - conclusion: success - token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/trigger-pr-tests-plugins.yml b/.github/workflows/trigger-pr-tests-plugins.yml new file mode 100644 index 00000000..b618ae11 --- /dev/null +++ b/.github/workflows/trigger-pr-tests-plugins.yml @@ -0,0 +1,19 @@ +name: Trigger PR tests (Plugins) + +on: + pull_request: + types: [auto_merge_enabled] + +jobs: + trigger-pr-tests-plugins: + name: Trigger PR tests (Plugins) + runs-on: ubuntu-latest + steps: + - name: Call TeamCity API endpoint + run: | + curl \ + -X POST \ + -H 'Authorization: Bearer ${{ secrets.TEAMCITY_TRIGGER_TESTS_TOKEN }}' \ + -H 'Content-Type: application/json' \ + -d '{"branchName": "pull/${{ github.event.number }}", "buildType": {"id": "${{ vars.TEAMCITY_BUILD_ID_FOR_TESTING_PLUGIN_PR }}"}}' \ + ${{ vars.TEAMCITY_API_URL }}/buildQueue \ No newline at end of file diff --git a/adapter/0.2.7.json b/adapter/0.2.7.json new file mode 100644 index 00000000..05860993 --- /dev/null +++ b/adapter/0.2.7.json @@ -0,0 +1,59 @@ +/** + * Copyright © 2016-2024 by IntegrIT S.A. dba Hackolade. All rights reserved. + * + * The copyright to the computer software herein is the property of IntegrIT S.A. + * The software may be used and/or copied only with the written permission of + * IntegrIT S.A. or in accordance with the terms and conditions stipulated in + * the agreement/contract under which the software has been supplied. + * + * { + * "add": { + * "entity": [], + * "container": [], + * "model": [], + * "view": [], + * "field": { + * "": [] + * } + * }, + * "delete": { + * "entity": [], + * "container": [], + * "model": [], + * "view": [], + * "field": { + * "": [] + * } + * }, + * "modify": { + * "entity": [ + * { + * "from": { }, + * "to": { } + * } + * ], + * "container": [], + * "model": [], + * "view": [], + * "field": [] + * }, + * } + */ + +{ + "modify": { + "model": [ + [ + "populateByPropertySource", + { + "modify": { + "container": [["getNameFromDottedIdentifier", "tagName", "schemaTags"]], + "entity": [["getNameFromDottedIdentifier", "tagName", "tableTags"]], + "view": [["getNameFromDottedIdentifier", "tagName", "viewTags"]], + "field": [["getNameFromDottedIdentifier", "tagName", "columnTags"]] + } + } + ] + ] + } +} diff --git a/forward_engineering/ddlProvider.js b/forward_engineering/ddlProvider.js index 1d8e9c11..f5191ae7 100644 --- a/forward_engineering/ddlProvider.js +++ b/forward_engineering/ddlProvider.js @@ -71,7 +71,7 @@ module.exports = (baseProvider, options, app) => { tab, }); - const { getTagStatement, getTagAllowedValues, getTagKeyValues, prepareObjectTagsData } = + const { getTagStatement, getTagAllowedValues, getTagKeyValues, prepareObjectTagsData, isEmptyTags } = require('./helpers/tagHelper')({ getName, toString, @@ -233,7 +233,7 @@ module.exports = (baseProvider, options, app) => { this.createTag({ tag, schemaName: currentSchemaName, isCaseSensitive }), ); - if (!_.isEmpty(schemaTags)) { + if (!isEmptyTags({ tags: schemaTags })) { const schemaTagStatement = assignTemplates(templates.alterSchema, { name: fullName, operation: 'SET TAG', diff --git a/forward_engineering/helpers/tagHelper.js b/forward_engineering/helpers/tagHelper.js index 64e48b1d..be970fcd 100644 --- a/forward_engineering/helpers/tagHelper.js +++ b/forward_engineering/helpers/tagHelper.js @@ -10,12 +10,16 @@ module.exports = ({ getName, toString }) => { * @returns {string} */ const getTagStatement = ({ tags, isCaseSensitive, indent = ' ' }) => { - if (isEmpty(tags)) { + if (isEmptyTags({ tags })) { return ''; } const keyValues = getTagKeyValues({ tags, isCaseSensitive }); + if (isEmpty(keyValues)) { + return ''; + } + return `${indent}WITH TAG ( ${keyValues} )`; }; @@ -23,14 +27,13 @@ module.exports = ({ getName, toString }) => { * @param {{ allowedValues: string[] }} * @returns {string} */ - const getTagAllowedValues = ({ allowedValues }) => { - if (isEmpty(allowedValues)) { - return ''; - } - - const values = allowedValues.map(({ value }) => toString(value)).join(', '); + const getTagAllowedValues = ({ allowedValues = [] }) => { + const values = allowedValues + .filter(({ value }) => value) + .map(({ value }) => toString(value)) + .join(', '); - return ` ALLOWED_VALUES ${values}`; + return isEmpty(values) ? '' : ` ALLOWED_VALUES ${values}`; }; /** @@ -39,7 +42,7 @@ module.exports = ({ getName, toString }) => { */ const getTagKeyValues = ({ tags, isCaseSensitive }) => { return tags - .filter(tag => tag.tagName) + .filter(tag => tag.tagName && tag.tagValue) .map(tag => `${getTagName({ tagName: tag.tagName, isCaseSensitive })} = ${toString(tag.tagValue)}`) .join(', '); }; @@ -83,7 +86,7 @@ module.exports = ({ getName, toString }) => { return ''; } - const tagNames = droppedTags.map(({ tagName }) => tagName).join(', '); + const tagNames = droppedTags.map(({ tagName }) => getTagName({ tagName, isCaseSensitive })).join(', '); return `TAG ${tagNames}`; }; @@ -114,6 +117,14 @@ module.exports = ({ getName, toString }) => { }; }; + /** + * @param {{ tags: ObjectTag[] }} + * @returns {boolean} + */ + const isEmptyTags = ({ tags }) => { + return isEmpty(tags) || tags.every(tag => !tag.tagName); + }; + return { getTagStatement, getTagAllowedValues, @@ -121,5 +132,6 @@ module.exports = ({ getName, toString }) => { prepareObjectTagsData, getSetTagValue, getUnsetTagValue, + isEmptyTags, }; }; diff --git a/package.json b/package.json index c581c57d..08c7e4b3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Snowflake", - "version": "0.2.8", + "version": "0.2.10", "author": "hackolade", "engines": { "hackolade": "6.1.2", diff --git a/properties_pane/container_level/containerLevelConfig.json b/properties_pane/container_level/containerLevelConfig.json index 290c1533..0716a89e 100644 --- a/properties_pane/container_level/containerLevelConfig.json +++ b/properties_pane/container_level/containerLevelConfig.json @@ -162,22 +162,116 @@ making sure that you maintain a proper JSON format. "propertyTooltip": "", "propertyType": "group", "groupItemLimit": 50, + "helpUrl": "https://hackolade.com/help/Snowflake.html#Tags", "structure": [ { "propertyName": "Tag name", "propertyKeyword": "tagName", "propertyTooltip": "", - "propertyType": "text" + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "source": "tags.*.name" + } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "source": "tags.${tagName}.allowedValues.*.value" + }, + "shouldValidate": true, + "validation": { + "required": true + }, + "dependency": { + "type": "and", + "values": [ + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + } + ] + }, + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + } }, { "propertyName": "Value", "propertyKeyword": "tagValue", "propertyTooltip": "", "propertyType": "text", + "propertySource": { + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "key": "tagName", + "pattern": "^.+$" + }, + { + "type": "or", + "values": [ + { + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + }, + { + "type": "not", + "values": [ + { + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + } + ] + } + ] + }, "shouldValidate": true, "validation": { + "required": true, "regex": "^.{0,256}$" } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "select", + "disabled": true, + "dependency": { + "type": "or", + "values": [ + { + "key": "tagName", + "exist": false + }, + { + "key": "tagName", + "pattern": "^$" + } + ] + } } ] }, @@ -951,6 +1045,7 @@ making sure that you maintain a proper JSON format. "propertyType": "group", "propertyKeyword": "tags", "propertyTooltip": "Creates a new stored tag or replaces an existing tag for the current database.", + "helpUrl": "https://hackolade.com/help/Snowflake.html#Tags", "structure": [ { "propertyName": "Name", diff --git a/properties_pane/defaultData.json b/properties_pane/defaultData.json index 6ebadb96..f57e2cd4 100644 --- a/properties_pane/defaultData.json +++ b/properties_pane/defaultData.json @@ -10,10 +10,7 @@ }, "collection": { "collectionName": "New table", - "external": false, - "formatTypeOptions": { - "NULL_IF": [{ "NULL_IF_item": "\\N" }] - } + "external": false }, "field": { "name": "New column", diff --git a/properties_pane/entity_level/entityLevelConfig.json b/properties_pane/entity_level/entityLevelConfig.json index c1e0d09d..574349fc 100644 --- a/properties_pane/entity_level/entityLevelConfig.json +++ b/properties_pane/entity_level/entityLevelConfig.json @@ -675,6 +675,9 @@ making sure that you maintain a proper JSON format. } ] }, + "defaultValue": { + "NULL_IF": [{ "NULL_IF_item": "\\N" }] + }, "structure": [ { "propertyName": "Trim space", @@ -1044,22 +1047,121 @@ making sure that you maintain a proper JSON format. "propertyTooltip": "", "propertyType": "group", "groupItemLimit": 50, + "helpUrl": "https://hackolade.com/help/Snowflake.html#Tags", "structure": [ { "propertyName": "Tag name", "propertyKeyword": "tagName", "propertyTooltip": "", - "propertyType": "text" + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.*.name" + } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + } + ] + }, + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + }, + "shouldValidate": true, + "validation": { + "required": true + } }, { "propertyName": "Value", "propertyKeyword": "tagValue", "propertyTooltip": "", "propertyType": "text", + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "key": "tagName", + "pattern": "^.+$" + }, + { + "type": "or", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + }, + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + } + ] + } + ] + }, "shouldValidate": true, "validation": { + "required": true, "regex": "^.{0,256}$" } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "select", + "disabled": true, + "dependency": { + "type": "or", + "values": [ + { + "key": "tagName", + "exist": false + }, + { + "key": "tagName", + "pattern": "^$" + } + ] + } } ] }, diff --git a/properties_pane/field_level/fieldLevelConfig.json b/properties_pane/field_level/fieldLevelConfig.json index 0cd5df88..672e6633 100644 --- a/properties_pane/field_level/fieldLevelConfig.json +++ b/properties_pane/field_level/fieldLevelConfig.json @@ -505,22 +505,121 @@ making sure that you maintain a proper JSON format. "propertyTooltip": "", "propertyType": "group", "groupItemLimit": 50, + "helpUrl": "https://hackolade.com/help/Snowflake.html#Tags", "structure": [ { "propertyName": "Tag name", "propertyKeyword": "tagName", "propertyTooltip": "", - "propertyType": "text" + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.*.name" + } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + } + ] + }, + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + }, + "shouldValidate": true, + "validation": { + "required": true + } }, { "propertyName": "Value", "propertyKeyword": "tagValue", "propertyTooltip": "", "propertyType": "text", + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "key": "tagName", + "pattern": "^.+$" + }, + { + "type": "or", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + }, + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + } + ] + } + ] + }, "shouldValidate": true, "validation": { + "required": true, "regex": "^.{0,256}$" } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "select", + "disabled": true, + "dependency": { + "type": "or", + "values": [ + { + "key": "tagName", + "exist": false + }, + { + "key": "tagName", + "pattern": "^$" + } + ] + } } ] }, @@ -940,17 +1039,115 @@ making sure that you maintain a proper JSON format. "propertyName": "Tag name", "propertyKeyword": "tagName", "propertyTooltip": "", - "propertyType": "text" + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.*.name" + } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + } + ] + }, + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + }, + "shouldValidate": true, + "validation": { + "required": true + } }, { "propertyName": "Value", "propertyKeyword": "tagValue", "propertyTooltip": "", "propertyType": "text", + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "key": "tagName", + "pattern": "^.+$" + }, + { + "type": "or", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + }, + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + } + ] + } + ] + }, "shouldValidate": true, "validation": { + "required": true, "regex": "^.{0,256}$" } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "select", + "disabled": true, + "dependency": { + "type": "or", + "values": [ + { + "key": "tagName", + "exist": false + }, + { + "key": "tagName", + "pattern": "^$" + } + ] + } } ] }, @@ -1352,17 +1549,115 @@ making sure that you maintain a proper JSON format. "propertyName": "Tag name", "propertyKeyword": "tagName", "propertyTooltip": "", - "propertyType": "text" + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.*.name" + } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + } + ] + }, + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + }, + "shouldValidate": true, + "validation": { + "required": true + } }, { "propertyName": "Value", "propertyKeyword": "tagValue", "propertyTooltip": "", "propertyType": "text", + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "key": "tagName", + "pattern": "^.+$" + }, + { + "type": "or", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + }, + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + } + ] + } + ] + }, "shouldValidate": true, "validation": { + "required": true, "regex": "^.{0,256}$" } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "select", + "disabled": true, + "dependency": { + "type": "or", + "values": [ + { + "key": "tagName", + "exist": false + }, + { + "key": "tagName", + "pattern": "^$" + } + ] + } } ] }, @@ -1764,17 +2059,115 @@ making sure that you maintain a proper JSON format. "propertyName": "Tag name", "propertyKeyword": "tagName", "propertyTooltip": "", - "propertyType": "text" + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.*.name" + } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + } + ] + }, + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + }, + "shouldValidate": true, + "validation": { + "required": true + } }, { "propertyName": "Value", "propertyKeyword": "tagValue", "propertyTooltip": "", "propertyType": "text", + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "key": "tagName", + "pattern": "^.+$" + }, + { + "type": "or", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + }, + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + } + ] + } + ] + }, "shouldValidate": true, "validation": { + "required": true, "regex": "^.{0,256}$" } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "select", + "disabled": true, + "dependency": { + "type": "or", + "values": [ + { + "key": "tagName", + "exist": false + }, + { + "key": "tagName", + "pattern": "^$" + } + ] + } } ] }, @@ -2176,22 +2569,120 @@ making sure that you maintain a proper JSON format. "propertyName": "Tag name", "propertyKeyword": "tagName", "propertyTooltip": "", - "propertyType": "text" + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.*.name" + } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + } + ] + }, + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + }, + "shouldValidate": true, + "validation": { + "required": true + } }, { "propertyName": "Value", "propertyKeyword": "tagValue", "propertyTooltip": "", "propertyType": "text", + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "key": "tagName", + "pattern": "^.+$" + }, + { + "type": "or", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + }, + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + } + ] + } + ] + }, "shouldValidate": true, "validation": { + "required": true, "regex": "^.{0,256}$" } - } - ] - }, - { - "propertyName": "Remarks", + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "select", + "disabled": true, + "dependency": { + "type": "or", + "values": [ + { + "key": "tagName", + "exist": false + }, + { + "key": "tagName", + "pattern": "^$" + } + ] + } + } + ] + }, + { + "propertyName": "Remarks", "propertyKeyword": "comments", "propertyTooltip": "remarks", "addTimestampButton": true, @@ -2493,17 +2984,115 @@ making sure that you maintain a proper JSON format. "propertyName": "Tag name", "propertyKeyword": "tagName", "propertyTooltip": "", - "propertyType": "text" + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.*.name" + } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + } + ] + }, + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + }, + "shouldValidate": true, + "validation": { + "required": true + } }, { "propertyName": "Value", "propertyKeyword": "tagValue", "propertyTooltip": "", "propertyType": "text", + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "key": "tagName", + "pattern": "^.+$" + }, + { + "type": "or", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + }, + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + } + ] + } + ] + }, "shouldValidate": true, "validation": { + "required": true, "regex": "^.{0,256}$" } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "select", + "disabled": true, + "dependency": { + "type": "or", + "values": [ + { + "key": "tagName", + "exist": false + }, + { + "key": "tagName", + "pattern": "^$" + } + ] + } } ] }, @@ -2823,17 +3412,115 @@ making sure that you maintain a proper JSON format. "propertyName": "Tag name", "propertyKeyword": "tagName", "propertyTooltip": "", - "propertyType": "text" + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.*.name" + } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + } + ] + }, + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + }, + "shouldValidate": true, + "validation": { + "required": true + } }, { "propertyName": "Value", "propertyKeyword": "tagValue", "propertyTooltip": "", "propertyType": "text", + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "key": "tagName", + "pattern": "^.+$" + }, + { + "type": "or", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + }, + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + } + ] + } + ] + }, "shouldValidate": true, "validation": { + "required": true, "regex": "^.{0,256}$" } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "select", + "disabled": true, + "dependency": { + "type": "or", + "values": [ + { + "key": "tagName", + "exist": false + }, + { + "key": "tagName", + "pattern": "^$" + } + ] + } } ] }, @@ -3145,17 +3832,115 @@ making sure that you maintain a proper JSON format. "propertyName": "Tag name", "propertyKeyword": "tagName", "propertyTooltip": "", - "propertyType": "text" + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.*.name" + } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + } + ] + }, + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + }, + "shouldValidate": true, + "validation": { + "required": true + } }, { "propertyName": "Value", "propertyKeyword": "tagValue", "propertyTooltip": "", "propertyType": "text", + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "key": "tagName", + "pattern": "^.+$" + }, + { + "type": "or", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + }, + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + } + ] + } + ] + }, "shouldValidate": true, "validation": { + "required": true, "regex": "^.{0,256}$" } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "select", + "disabled": true, + "dependency": { + "type": "or", + "values": [ + { + "key": "tagName", + "exist": false + }, + { + "key": "tagName", + "pattern": "^$" + } + ] + } } ] }, @@ -3476,17 +4261,115 @@ making sure that you maintain a proper JSON format. "propertyName": "Tag name", "propertyKeyword": "tagName", "propertyTooltip": "", - "propertyType": "text" + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.*.name" + } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + } + ] + }, + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + }, + "shouldValidate": true, + "validation": { + "required": true + } }, { "propertyName": "Value", "propertyKeyword": "tagValue", "propertyTooltip": "", "propertyType": "text", + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "key": "tagName", + "pattern": "^.+$" + }, + { + "type": "or", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + }, + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + } + ] + } + ] + }, "shouldValidate": true, "validation": { + "required": true, "regex": "^.{0,256}$" } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "select", + "disabled": true, + "dependency": { + "type": "or", + "values": [ + { + "key": "tagName", + "exist": false + }, + { + "key": "tagName", + "pattern": "^$" + } + ] + } } ] }, @@ -3815,25 +4698,123 @@ making sure that you maintain a proper JSON format. "propertyName": "Tag name", "propertyKeyword": "tagName", "propertyTooltip": "", - "propertyType": "text" + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.*.name" + } }, { "propertyName": "Value", "propertyKeyword": "tagValue", "propertyTooltip": "", - "propertyType": "text", + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + } + ] + }, + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + }, "shouldValidate": true, "validation": { - "regex": "^.{0,256}$" + "required": true } - } - ] - }, - { - "propertyName": "Remarks", - "propertyKeyword": "comments", - "propertyTooltip": "remarks", - "addTimestampButton": true, + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "text", + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "key": "tagName", + "pattern": "^.+$" + }, + { + "type": "or", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + }, + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + } + ] + } + ] + }, + "shouldValidate": true, + "validation": { + "required": true, + "regex": "^.{0,256}$" + } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "select", + "disabled": true, + "dependency": { + "type": "or", + "values": [ + { + "key": "tagName", + "exist": false + }, + { + "key": "tagName", + "pattern": "^$" + } + ] + } + } + ] + }, + { + "propertyName": "Remarks", + "propertyKeyword": "comments", + "propertyTooltip": "remarks", + "addTimestampButton": true, "propertyType": "details", "template": "textarea" } @@ -4154,17 +5135,115 @@ making sure that you maintain a proper JSON format. "propertyName": "Tag name", "propertyKeyword": "tagName", "propertyTooltip": "", - "propertyType": "text" + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.*.name" + } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + } + ] + }, + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + }, + "shouldValidate": true, + "validation": { + "required": true + } }, { "propertyName": "Value", "propertyKeyword": "tagValue", "propertyTooltip": "", "propertyType": "text", + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "key": "tagName", + "pattern": "^.+$" + }, + { + "type": "or", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + }, + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + } + ] + } + ] + }, "shouldValidate": true, "validation": { + "required": true, "regex": "^.{0,256}$" } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "select", + "disabled": true, + "dependency": { + "type": "or", + "values": [ + { + "key": "tagName", + "exist": false + }, + { + "key": "tagName", + "pattern": "^$" + } + ] + } } ] }, @@ -4493,17 +5572,115 @@ making sure that you maintain a proper JSON format. "propertyName": "Tag name", "propertyKeyword": "tagName", "propertyTooltip": "", - "propertyType": "text" + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.*.name" + } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + } + ] + }, + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + }, + "shouldValidate": true, + "validation": { + "required": true + } }, { "propertyName": "Value", "propertyKeyword": "tagValue", "propertyTooltip": "", "propertyType": "text", + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "key": "tagName", + "pattern": "^.+$" + }, + { + "type": "or", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + }, + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + } + ] + } + ] + }, "shouldValidate": true, "validation": { + "required": true, "regex": "^.{0,256}$" } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "select", + "disabled": true, + "dependency": { + "type": "or", + "values": [ + { + "key": "tagName", + "exist": false + }, + { + "key": "tagName", + "pattern": "^$" + } + ] + } } ] }, @@ -4914,17 +6091,115 @@ making sure that you maintain a proper JSON format. "propertyName": "Tag name", "propertyKeyword": "tagName", "propertyTooltip": "", - "propertyType": "text" + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.*.name" + } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + } + ] + }, + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + }, + "shouldValidate": true, + "validation": { + "required": true + } }, { "propertyName": "Value", "propertyKeyword": "tagValue", "propertyTooltip": "", "propertyType": "text", + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "key": "tagName", + "pattern": "^.+$" + }, + { + "type": "or", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + }, + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + } + ] + } + ] + }, "shouldValidate": true, "validation": { + "required": true, "regex": "^.{0,256}$" } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "select", + "disabled": true, + "dependency": { + "type": "or", + "values": [ + { + "key": "tagName", + "exist": false + }, + { + "key": "tagName", + "pattern": "^$" + } + ] + } } ] }, @@ -5247,17 +6522,115 @@ making sure that you maintain a proper JSON format. "propertyName": "Tag name", "propertyKeyword": "tagName", "propertyTooltip": "", - "propertyType": "text" + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.*.name" + } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + } + ] + }, + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + }, + "shouldValidate": true, + "validation": { + "required": true + } }, { "propertyName": "Value", "propertyKeyword": "tagValue", "propertyTooltip": "", "propertyType": "text", + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "key": "tagName", + "pattern": "^.+$" + }, + { + "type": "or", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + }, + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + } + ] + } + ] + }, "shouldValidate": true, "validation": { + "required": true, "regex": "^.{0,256}$" } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "select", + "disabled": true, + "dependency": { + "type": "or", + "values": [ + { + "key": "tagName", + "exist": false + }, + { + "key": "tagName", + "pattern": "^$" + } + ] + } } ] }, @@ -5336,17 +6709,115 @@ making sure that you maintain a proper JSON format. "propertyName": "Tag name", "propertyKeyword": "tagName", "propertyTooltip": "", - "propertyType": "text" + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.*.name" + } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + } + ] + }, + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + }, + "shouldValidate": true, + "validation": { + "required": true + } }, { "propertyName": "Value", "propertyKeyword": "tagValue", "propertyTooltip": "", "propertyType": "text", + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "key": "tagName", + "pattern": "^.+$" + }, + { + "type": "or", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + }, + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + } + ] + } + ] + }, "shouldValidate": true, "validation": { + "required": true, "regex": "^.{0,256}$" } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "select", + "disabled": true, + "dependency": { + "type": "or", + "values": [ + { + "key": "tagName", + "exist": false + }, + { + "key": "tagName", + "pattern": "^$" + } + ] + } } ] } diff --git a/properties_pane/view_level/viewLevelConfig.json b/properties_pane/view_level/viewLevelConfig.json index dfdab135..a457d40f 100644 --- a/properties_pane/view_level/viewLevelConfig.json +++ b/properties_pane/view_level/viewLevelConfig.json @@ -91,22 +91,121 @@ "propertyTooltip": "", "propertyType": "group", "groupItemLimit": 50, + "helpUrl": "https://hackolade.com/help/Snowflake.html#Tags", "structure": [ { "propertyName": "Tag name", "propertyKeyword": "tagName", "propertyTooltip": "", - "propertyType": "text" + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.*.name" + } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "selecthashed", + "withEmptyOption": true, + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + } + ] + }, + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + }, + "shouldValidate": true, + "validation": { + "required": true + } }, { "propertyName": "Value", "propertyKeyword": "tagValue", "propertyTooltip": "", "propertyType": "text", + "propertySource": { + "level": "container", + "source": "tags.${tagName}.allowedValues.*.value" + }, + "dependency": { + "type": "and", + "values": [ + { + "key": "tagName", + "pattern": "^.+$" + }, + { + "type": "or", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "isEmpty": true + }, + { + "type": "not", + "values": [ + { + "level": "container", + "source": "tags.${tagName}", + "key": "allowedValues", + "exist": true + } + ] + } + ] + } + ] + }, "shouldValidate": true, "validation": { + "required": true, "regex": "^.{0,256}$" } + }, + { + "propertyName": "Value", + "propertyKeyword": "tagValue", + "propertyTooltip": "", + "propertyType": "select", + "disabled": true, + "dependency": { + "type": "or", + "values": [ + { + "key": "tagName", + "exist": false + }, + { + "key": "tagName", + "pattern": "^$" + } + ] + } } ] } diff --git a/reverse_engineering/helpers/snowflakeHelper.js b/reverse_engineering/helpers/snowflakeHelper.js index 2cdce18a..b8143ae6 100644 --- a/reverse_engineering/helpers/snowflakeHelper.js +++ b/reverse_engineering/helpers/snowflakeHelper.js @@ -1514,7 +1514,7 @@ const getSchemaTags = async ({ dbName, schemaName, logger }) => { ); return rows.map(row => ({ - tagName: [row['TAG_DATABASE'], row['TAG_SCHEMA'], row['TAG_NAME']].join('.'), + tagName: row['TAG_NAME'], tagValue: row['TAG_VALUE'], })); } catch (error) {