From 6bd76785639424881969b4e5f9aea434a90548ee Mon Sep 17 00:00:00 2001 From: Lench Volodymyr Date: Fri, 6 Aug 2021 11:46:03 +0300 Subject: [PATCH] add deactivation indexes, filter them out from indexing policy and adapt previousely created models --- adapter/0.1.27.json | 63 +++++++++++++++++++ .../helpers/getIndexPolicyScript.js | 14 +++-- package.json | 2 +- .../container_level/containerLevelConfig.json | 28 +++++++++ 4 files changed, 102 insertions(+), 5 deletions(-) create mode 100644 adapter/0.1.27.json diff --git a/adapter/0.1.27.json b/adapter/0.1.27.json new file mode 100644 index 0000000..e349505 --- /dev/null +++ b/adapter/0.1.27.json @@ -0,0 +1,63 @@ +/** + * Copyright © 2016-2018 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": { + * "": [] + * } + * }, + * "remove": { + * "entity": [], + * "container": [], + * "model": [], + * "view": [], + * "field": { + * "": [] + * } + * }, + * "modify": { + * "entity": [ + * { + * "from": { }, + * "to": { } + * } + * ], + * "container": [], + * "model": [], + * "view": [], + * "field": [] + * }, + * } + */ + { + "add": { + "container": [ + { + "path": ["includedPaths", "isActivated"], + "value": true + }, + { + "path": ["excludedPaths", "isActivated"], + "value": true + }, + { + "path": ["spatialIndexes", "isActivated"], + "value": true + }, + { + "path": ["compositeIndexes", "isActivated"], + "value": true + } + ] + } +} \ No newline at end of file diff --git a/forward_engineering/helpers/getIndexPolicyScript.js b/forward_engineering/helpers/getIndexPolicyScript.js index ce2ea4b..50481a0 100644 --- a/forward_engineering/helpers/getIndexPolicyScript.js +++ b/forward_engineering/helpers/getIndexPolicyScript.js @@ -57,6 +57,12 @@ const getPath = (paths = []) => { }).concat(items[items.length - 1]).join('/'); }; +const filterDeactivated = (items) => { + return (items || []).filter(item => { + return item.isActivated !== false; + }); +}; + const getIndex = (_) => (item) => { const precision = Number(item.indexPrecision); return _.flow( @@ -67,7 +73,7 @@ const getIndex = (_) => (item) => { }; const getIncludedPath = (_) => (includedPaths = []) => { - return includedPaths.map(item => { + return filterDeactivated(includedPaths).map(item => { return _.flow( add('path', getPath(item.indexIncludedPath)), )({}); @@ -75,7 +81,7 @@ const getIncludedPath = (_) => (includedPaths = []) => { }; const getExcludedPath = (_) => (excludedPaths = []) => { - return excludedPaths.map(item => { + return filterDeactivated(excludedPaths).map(item => { return _.flow( add('path', getPath(item.indexExcludedPath)), )({}); @@ -83,7 +89,7 @@ const getExcludedPath = (_) => (excludedPaths = []) => { }; const getCompositeIndexes = (_) => (compositeIndexes = []) => { - return compositeIndexes.map(item => { + return filterDeactivated(compositeIndexes).map(item => { if (!Array.isArray(item.compositeFieldPath)) { return; } @@ -100,7 +106,7 @@ const getCompositeIndexes = (_) => (compositeIndexes = []) => { }; const getSpatialIndexes = (_) => (spatialIndexes = []) => { - return spatialIndexes.map(item => { + return filterDeactivated(spatialIndexes).map(item => { return _.flow( add('path', getPath(item.indexIncludedPath)), add('types', (item.dataTypes || []).map(dataType => dataType.spatialType).filter(Boolean)), diff --git a/package.json b/package.json index 07072ae..a0fcf15 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "versionDate": "2021-05-17", "author": "hackolade", "engines": { - "hackolade": "4.3.9", + "hackolade": "5.1.3", "hackoladePlugin": "1.0.1" }, "contributes": { diff --git a/properties_pane/container_level/containerLevelConfig.json b/properties_pane/container_level/containerLevelConfig.json index 4bf877c..1c282f1 100644 --- a/properties_pane/container_level/containerLevelConfig.json +++ b/properties_pane/container_level/containerLevelConfig.json @@ -292,6 +292,13 @@ making sure that you maintain a proper JSON format. "propertyTooltip": "", "propertyType": "text" }, + { + "propertyName": "Activated", + "propertyKeyword": "isActivated", + "propertyTooltip": "Deactivated item will be not included in FE script", + "propertyType": "checkbox", + "defaultValue": true + }, { "propertyName": "Path", "propertyKeyword": "indexIncludedPath", @@ -344,6 +351,13 @@ making sure that you maintain a proper JSON format. "propertyTooltip": "", "propertyType": "text" }, + { + "propertyName": "Activated", + "propertyKeyword": "isActivated", + "propertyTooltip": "Deactivated item will be not included in FE script", + "propertyType": "checkbox", + "defaultValue": true + }, { "propertyName": "Path", "propertyKeyword": "indexExcludedPath", @@ -397,6 +411,13 @@ making sure that you maintain a proper JSON format. "propertyTooltip": "", "propertyType": "text" }, + { + "propertyName": "Activated", + "propertyKeyword": "isActivated", + "propertyTooltip": "Deactivated item will be not included in FE script", + "propertyType": "checkbox", + "defaultValue": true + }, { "propertyName": "Path", "propertyKeyword": "indexIncludedPath", @@ -468,6 +489,13 @@ making sure that you maintain a proper JSON format. "propertyTooltip": "", "propertyType": "text" }, + { + "propertyName": "Activated", + "propertyKeyword": "isActivated", + "propertyTooltip": "Deactivated item will be not included in FE script", + "propertyType": "checkbox", + "defaultValue": true + }, { "propertyName": "Path", "propertyKeyword": "compositeFieldPath",