Skip to content

Commit 5e39bd9

Browse files
committed
RE from file: added RE of datacenters, fixed re of replication_factor
1 parent a23cddf commit 5e39bd9

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

properties_pane/container_level/containerLevelConfig.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,7 @@ making sure that you maintain a proper JSON format.
157157
"shouldValidate": true,
158158
"propertyTooltip": "description",
159159
"propertyType": "numeric",
160-
"valueType": "number",
161-
"dependency": {
162-
"key": "replStrategy",
163-
"value": "SimpleStrategy"
164-
}
160+
"valueType": "number"
165161
},
166162
{
167163
"propertyName": "Data Centers",

reverse_engineering/cqlToCollectionsVisitor.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,28 @@ class Visitor extends CqlParserVisitor {
477477
visitReplicationList(ctx) {
478478
const items = this.visit(ctx.replicationListItem());
479479

480-
return items.reduce((replicationProperties, item) => ({
481-
...replicationProperties,
482-
...item
483-
}), {});
480+
const definedKeys = ['replStrategy', 'replFactor']
481+
482+
return items.reduce(
483+
(replicationProperties, item) => {
484+
const key = Object.keys(item)[0];
485+
486+
if (!definedKeys.includes(key)) {
487+
const dataCenter = { dataCenterName: key, replFactorValue: Number(item[key]) || 0 };
488+
489+
return {
490+
...replicationProperties,
491+
dataCenters: [...replicationProperties.dataCenters, dataCenter],
492+
};
493+
}
494+
495+
return {
496+
...replicationProperties,
497+
...item,
498+
};
499+
},
500+
{ dataCenters: [] }
501+
);
484502
}
485503

486504
visitReplicationListItem(ctx) {

0 commit comments

Comments
 (0)