LT-67; OHIF-78: Merging server configuration and CINE dialog changes from downstream (Ascend)

This commit is contained in:
Bruno Alves de Faria committed 2016-09-29 12:25:04 -03:00
1 parent da7202de0f
commit 8d5d1ee360
47 files changed
+516 -333

No files matched your search

@@ -46,10 +46,6 @@ Meteor.publish('reviewers', function() {
return Reviewers.find();
});
Meteor.publish('servers', () => {
return Servers.find();
});
// Temporary fix to drop all Collections on server restart
// http://stackoverflow.com/questions/23891631/meteor-how-can-i-drop-all-mongo-collections-and-clear-all-data-on-startup
Meteor.startup(function() {
-72
View File
@@ -1,72 +0,0 @@
import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';
Meteor.startup(function() {
_.each(Meteor.settings.servers, function(endpoints, serverType) {
_.each(endpoints, function(endpoint) {
var server = _.clone(endpoint);
server.origin = 'json';
server.type = serverType;
Servers.insert(server);
});
});
});
class ServersControl {
static validateUser() {
if (!Meteor.userId()) {
throw new Meteor.Error('not-authorized');
}
}
static writeCallback(error, affected) {
if (error) {
throw new Meteor.Error('data-write', error);
}
}
static save(serverSettings) {
this.validateUser();
var query = {
_id: serverSettings._id
};
var options = {
upsert: true
};
if (!serverSettings._id) {
delete serverSettings._id;
}
return Servers.update(query, serverSettings, options, this.writeCallback);
}
static setActive(serverId) {
this.validateUser();
var query = {
_id: Meteor.userId()
};
var data = {
$set: {
'profile.activeServer': serverId
}
};
Accounts.users.update(query, data, this.writeCallback);
}
static remove(serverId) {
this.validateUser();
var query = {
_id: serverId
};
return Servers.remove(query, this.writeCallback);
}
}
Meteor.methods({
serverSave: serverSettings => ServersControl.save(serverSettings),
serverSetActive: serverId => ServersControl.setActive(serverId),
serverRemove: serverId => ServersControl.remove(serverId)
});