Skip to content

Commit

Permalink
Merge branch 'release/2.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerome Bonini committed Feb 2, 2018
2 parents 631518a + 368ed36 commit d6be9d8
Show file tree
Hide file tree
Showing 774 changed files with 39,840 additions and 28,368 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ nbbuild/
dist/
nbdist/
.nb-gradle/
sql/import
sql/import
structure/template/public/themes/
661 changes: 0 additions & 661 deletions AGPL.txt

This file was deleted.

677 changes: 668 additions & 9 deletions LICENSE.txt

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Command line :<br>
or<br>
<pre>./start_newmips.sh</pre><br>

Open your browser on http://127.0.0.1:1337 (don't use localhost) and log as "admin/admin" by default.
Open your browser on http://127.0.0.1:1337 and log as "admin/admin" by default.

Notice : to create your first application, ports 9000 and 9001 must be available on your computer.

Expand Down Expand Up @@ -67,6 +67,8 @@ Newmips Software documentation is available at http://docs.newmips.com.
## License #
################################

Newmips is released under the GNU/AGPLv3 license.
Newmips is released under the GNU GPL v3.0 license.
It contains several open source components distributed under the MIT, BSD or GNU GPL V3.0 licenses.


<br>
15 changes: 15 additions & 0 deletions config/gitlab.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var globalConf = require('./global');

var config = {
develop: {
"doGit": false,
"protocol": "http",
"url": "cloud.newmips.com:1400",
"sshUrl": "git@cloud.newmips.com",
"useSSH": true,
"adminUser": "",
"privateToken": ""
}
}

module.exports = config[globalConf.env];
9 changes: 0 additions & 9 deletions config/gitlab.json

This file was deleted.

24 changes: 24 additions & 0 deletions database/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,27 @@ exports.deleteComponentOnEntity = function(codeNameComponent, idModule, idEntity
callback(err, null);
});
}

// Get a component codeName and the has many entity and check if the given ID entity is in
exports.deleteComponentOnModule = function(codeNameComponent, idModule, callback) {

models.Component.findOne({
where: {
codeName: codeNameComponent,
id_module: idModule
}
}).then(function(foundComponent){
if(foundComponent){
foundComponent.destroy().then(function(){
callback(null, true);
});
} else{
var err = new Error();
err.message = "database.component.delete.error";
return callback(err, null);
}
}).catch(function(err) {
console.log(err);
callback(err, null);
});
}
42 changes: 22 additions & 20 deletions database/data_entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ function capitalizeFirstLetter(word) {
}

// DataEntity
exports.selectDataEntity = function(attr, callback) {
exports.selectEntity = function(attr, callback) {

var options = attr.options;
var type_option;
var optionType;

// Check if only space
if (!options.value.replace(/\s/g, '').length) {
Expand All @@ -36,7 +36,7 @@ exports.selectDataEntity = function(attr, callback) {
}]
}]
};
type_option = "ID";
optionType = "ID";
}
else {
where = {
Expand All @@ -53,37 +53,38 @@ exports.selectDataEntity = function(attr, callback) {
}]
}]
};
type_option = "Name";
optionType = "Name";
}

models.DataEntity.findOne(where).then(function(model) {
if (!model) {
models.DataEntity.findOne(where).then(function(entity) {
if (!entity) {
var err = new Error();
err.message = "database.entity.notFound.withThis" + type_option;
err.message = "database.entity.notFound.withThis" + optionType;
err.messageParams = [options.value];
return callback(err,null);
}

var info = {
insertId: model.id,
insertId: entity.id,
moduleId: entity.Module.id,
urlEntity: entity.codeName.substring(2),
message: "database.entity.select.selected",
messageParams: [model.name, model.id]
messageParams: [entity.name, entity.id]
};

callback(null,info);
callback(null, info);
}).catch(function(err) {
callback(err, null);
});
}
else {
} else {
var err = new Error();
err.message = "database.entity.select.valid";
callback(err, null);
}
}

// DataEntity with just a name
exports.selectDataEntityTarget = function(attr, callback) {
exports.selectEntityTarget = function(attr, callback) {

models.DataEntity.findOne({
where: {
Expand Down Expand Up @@ -111,7 +112,7 @@ exports.selectDataEntityTarget = function(attr, callback) {
});
}

exports.createNewDataEntity = function(attr, callback) {
exports.createNewEntity = function(attr, callback) {

// Set id_information_system of future data_entity according to session value transmitted in attributes
var id_module = attr.id_module;
Expand Down Expand Up @@ -151,11 +152,13 @@ exports.createNewDataEntity = function(attr, callback) {
id_module: id_module,
version: 1
}).then(function(newEntity) {
var info = {};
info.insertId = newEntity.id;
info.message = "database.entity.create.success";
models.Module.findById(id_module).then(function(module){
info.messageParams = [newEntity.name, newEntity.id, module.name, newEntity.name];
var info = {
insertId: newEntity.id,
urlEntity: newEntity.codeName.substring(2),
message: "database.entity.create.success",
messageParams: [newEntity.name, newEntity.id, module.name, newEntity.name]
};
callback(null,info);
});
});
Expand All @@ -164,7 +167,7 @@ exports.createNewDataEntity = function(attr, callback) {
});
}

exports.createNewDataEntityTarget = function(attr, callback) {
exports.createNewEntityTarget = function(attr, callback) {
models.DataEntity.findOne({
where: {
$or: [{name: attr.options.showTarget}, {codeName: attr.options.target}]
Expand Down Expand Up @@ -373,7 +376,6 @@ exports.getDataEntityByCodeName = function(idApplication, nameEntity, callback)

// Get a DataEntity with a given name
exports.getDataEntityByName = function(nameEntity, idModule, callback) {

models.DataEntity.findOne({
where: {
name: nameEntity,
Expand Down
32 changes: 26 additions & 6 deletions database/data_field.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,18 @@ exports.deleteDataField = function (attr, callback) {
return callback(err, null);
}

var id_data_entity = attr.id_data_entity;
var options = attr.options;
var name_data_field = options.value;
var idEntity = attr.id_data_entity;
var nameField = attr.options.value;

models.DataField.destroy({
where: {
codeName: name_data_field,
id_data_entity: id_data_entity
codeName: nameField,
id_data_entity: idEntity
}
}).then(function () {
var info = {};
info.message = "database.field.delete.deleted";
info.messageParams = [options.showValue];
info.messageParams = [attr.options.showValue];
callback(null, info);
}).catch(function (err) {
callback(err, null);
Expand Down Expand Up @@ -220,3 +219,24 @@ exports.getCodeNameByNameArray = function(names, id_entity, callback) {
callback(err);
});
}

exports.getFieldByCodeName = function (attr, callback) {

models.DataField.findOne({
where: {
codeName: attr.fieldToDrop,
id_data_entity: attr.id_data_entity
}
}).then(function (field) {
if (!field) {
var err = new Error();
err.message = "database.field.notFound.withThisName";
err.messageParams = [attr.options.showValue, attr.show_name_data_entity];
return callback(err, null);
}

callback(null, field);
}).catch(function (err) {
callback(err, null);
});
}
7 changes: 6 additions & 1 deletion database/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ function pushToSyncQuery(id_application, query) {
if (!toSync.queries)
toSync.queries = [];
toSync.queries.push(query);
console.log(query);
fs.writeFileSync('workspace/'+id_application+'/models/toSync.json', JSON.stringify(toSync, null, 4), 'utf8');
} catch(e){
console.log(e);
Expand Down Expand Up @@ -47,6 +46,9 @@ exports.dropFKDataField = function(attr, callback) {
var query = "SELECT constraint_name FROM `information_schema`.`KEY_COLUMN_USAGE` where `COLUMN_NAME` = '"+attr.fieldToDrop+"' && `TABLE_NAME` = '"+table_name+"'";

sequelize.query(query).then(function(constraintName) {
if(typeof constraintName[0][0] === "undefined"){
return callback();
}
query = "ALTER TABLE "+table_name+" DROP FOREIGN KEY "+constraintName[0][0].constraint_name+"; ALTER TABLE "+table_name+" DROP "+attr.fieldToDrop.toLowerCase();
if (!pushToSyncQuery(attr.id_application, query))
return callback("ERROR: Can't delete in database");
Expand All @@ -64,6 +66,9 @@ exports.dropFKMultipleDataField = function(attr, callback) {

var query = "SELECT constraint_name FROM `information_schema`.`KEY_COLUMN_USAGE` where `COLUMN_NAME` = '"+attr.fieldToDrop+"' && `TABLE_NAME` = '"+table_name+"'";
sequelize.query(query).then(function(constraintName) {
if(typeof constraintName[0][0] === "undefined"){
return callback();
}
query = "ALTER TABLE "+table_name+" DROP FOREIGN KEY "+constraintName[0][0].constraint_name+"; ALTER TABLE "+table_name+" DROP "+attr.fieldToDrop.toLowerCase();
if (!pushToSyncQuery(attr.id_application, query))
return callback("ERROR: Can't delete in database");
Expand Down

0 comments on commit d6be9d8

Please sign in to comment.