Skip to content

Commit

Permalink
Connection to Apollo on Constellation
Browse files Browse the repository at this point in the history
  • Loading branch information
pdesmarets committed Jan 3, 2020
1 parent caae140 commit 1ffca30
Show file tree
Hide file tree
Showing 1,364 changed files with 28,440 additions and 59,800 deletions.
48 changes: 48 additions & 0 deletions adapter/0.1.36.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* 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": [<names of new property>],
* "container": [<names of new property>],
* "model": [<names of new property>],
* "view": [<names of new property>],
* "field": {
* "<type>": [<names of new property>]
* }
* },
* "remove": {
* "entity": [<names of new property>],
* "container": [<names of new property>],
* "model": [<names of new property>],
* "view": [<names of new property>],
* "field": {
* "<type>": [<names of new property>]
* }
* },
* "modify": {
* "entity": [
* {
* "from": { <properties that identify record> },
* "to": { <properties that need to be changed> }
* }
* ],
* "container": [],
* "model": [],
* "view": [],
* "field": []
* },
* }
*/

{
"add": {
"container": ["addToCqlScript"]
}
}

Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
const applyToInstance = (cassandra) => (connectionInfo, logger, app) => {
const applyToInstance = (cassandraHelper) => (connectionInfo, logger, app) => {
const script = connectionInfo.script;

if (!Array.isArray(connectionInfo.hosts)) {
return Promise.reject({ message: 'Hosts were not defined' });
}
const cassandra = cassandraHelper(app.require('lodash'));

return cassandra.connect(app)(connectionInfo)
.then(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module.exports = (cassandra) => (connectionInfo, app) => {
if (!Array.isArray(connectionInfo.hosts)) {
return Promise.reject({ message: 'Hosts were not defined' });
}
module.exports = (cassandraHelper) => (connectionInfo, app) => {
const cassandra = cassandraHelper(app.require('lodash'));

return cassandra.connect(app)(connectionInfo)
.then(() => {
Expand Down
4 changes: 3 additions & 1 deletion forward_engineering/helpers/keyspaceHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ const getKeyspaceStatement = (keyspaceData) => {
const dataCenters = retrivePropertyFromConfig(keyspaceData, 0, "dataCenters", []);
const durableWrites = retrivePropertyFromConfig(keyspaceData, 0, "durableWrites", false);

if (keyspaceName === "") {
if (!keyspaceData[0].addToCqlScript) {
return "";
} else if (keyspaceName === "") {
return "";
} else {
return getCreateStatement(
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Cassandra",
"version": "0.1.35",
"versionDate": "2019-12-20",
"version": "0.1.36",
"versionDate": "2020-01-03",
"author": "hackolade",
"engines": {
"hackolade": "3.4.12",
Expand Down
7 changes: 6 additions & 1 deletion properties_pane/container_level/containerLevelConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ making sure that you maintain a proper JSON format.
"propertyName": "Replication Strategy",
"propertyKeyword": "replStrategy",
"shouldValidate": false,
"propertyTooltip": "description",
"propertyTooltip": "Select from list of options",
"propertyType": "select",
"options": [
Expand Down Expand Up @@ -197,6 +196,12 @@ making sure that you maintain a proper JSON format.
"propertyTooltip": "comments",
"propertyType": "details",
"template": "textarea"
},
{
"propertyName": "Add to CQL Script",
"propertyKeyword": "addToCqlScript",
"propertyTooltip": "the flag to add \"create keyspace\" statement into CQL script",
"propertyType": "checkbox"
}
],
"containerLevelKeys": []
Expand Down
3 changes: 2 additions & 1 deletion properties_pane/defaultData.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"container": {
"name": "New keyspace",
"indexes": [],
"replStrategy": "SimpleStrategy"
"replStrategy": "SimpleStrategy",
"addToCqlScript": true
},
"collection": {
"collectionName": "New table",
Expand Down
24 changes: 12 additions & 12 deletions reverse_engineering/api.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
'use strict';

const async = require('async');
const cassandra = require('./cassandraHelper');
const cassandraHelper = require('./cassandraHelper');
const systemKeyspaces = require('./package').systemKeyspaces;
const logHelper = require('./logHelper');

module.exports = {
connect: function(connectionInfo, logger, cb, app){
if (!Array.isArray(connectionInfo.hosts)) {
return cb({ message: 'Hosts were not defined' });
}

cassandra.connect(app)(connectionInfo)
cassandraHelper(app.require('lodash')).connect(app)(connectionInfo)
.then(cb, (error) => {
logger.log('error', error, 'Connection error');
cb(error);
});
},

disconnect: function(connectionInfo, cb){
cassandra.close();
disconnect: function(connectionInfo, cb, app){
cassandraHelper(app.require('lodash')).close();
cb();
},

Expand All @@ -33,15 +28,18 @@ module.exports = {
logger.log('info', 'Connection successful', 'Test connection');
}

this.disconnect(connectionInfo, () => {});
this.disconnect(connectionInfo, () => {}, app);

return cb(cassandra.prepareError(error));
return cb(cassandraHelper(app.require('lodash')).prepareError(error));
}, app);
},

getDbCollectionsNames: function(connectionInfo, logger, cb, app) {
const async = app.require('async');

logInfo('Retrieving keyspaces and tables information', connectionInfo, logger);
const { includeSystemCollection } = connectionInfo;
const cassandra = cassandraHelper(app.require('lodash'));

cassandra.connect(app)(connectionInfo).then(() => {
let keyspaces = cassandra.getKeyspacesNames();
Expand All @@ -66,7 +64,9 @@ module.exports = {
});
},

getDbCollectionsData: function(data, logger, cb){
getDbCollectionsData: function(data, logger, cb, app){
const async = app.require('async');
const cassandra = cassandraHelper(app.require('lodash'));
logger.log('info', data, 'Retrieving schema', data.hiddenKeys);

const tables = data.collectionData.collections;
Expand Down
Loading

0 comments on commit 1ffca30

Please sign in to comment.