diff --git a/app/assets/javascripts/lib/data_manager.coffee b/app/assets/javascripts/lib/data_manager.coffee index 3b547fbd..3586ae56 100755 --- a/app/assets/javascripts/lib/data_manager.coffee +++ b/app/assets/javascripts/lib/data_manager.coffee @@ -360,6 +360,23 @@ data_manager.factory( delete model.suggested_topic model.$update_topic({topic_id: if Number.isInteger(topic_id) then topic_id else null }) + DataManager.addSources = (model, new_sources, x, y)-> + console.log(model) + model.$add_mapping { + sources: + id: new_sources + x: x + y: y + } + + DataManager.addVariables = (model, variables)-> + console.log(model) + model.$add_mapping { + variable_names: variables + x: null + y: null + } + DataManager.getInstrumentStats = (id, cb)-> DataManager.Data.InstrumentStats[id] = {$resolved: false} DataManager.Data.InstrumentStats[id].$promise = InstrumentStats(id) diff --git a/app/assets/javascripts/lib/data_manager/constructs/questions.coffee b/app/assets/javascripts/lib/data_manager/constructs/questions.coffee index d0dfd5ed..d7737704 100755 --- a/app/assets/javascripts/lib/data_manager/constructs/questions.coffee +++ b/app/assets/javascripts/lib/data_manager/constructs/questions.coffee @@ -39,4 +39,4 @@ questions.factory( grid.clearCache() if grid? } ] -) \ No newline at end of file +) diff --git a/app/assets/javascripts/lib/resource.coffee b/app/assets/javascripts/lib/resource.coffee index 23c5c5fd..c5867f2c 100755 --- a/app/assets/javascripts/lib/resource.coffee +++ b/app/assets/javascripts/lib/resource.coffee @@ -82,4 +82,4 @@ resource.factory('GetResource', [ ) sub_promise.then(cb) if typeof cb is 'function' rsrc -]) \ No newline at end of file +]) diff --git a/app/assets/javascripts/sections/datasets/modules/show/index.coffee b/app/assets/javascripts/sections/datasets/modules/show/index.coffee index 5f6d6694..11fa2915 100755 --- a/app/assets/javascripts/sections/datasets/modules/show/index.coffee +++ b/app/assets/javascripts/sections/datasets/modules/show/index.coffee @@ -73,12 +73,11 @@ show.controller( $scope.detectKey = (event, variable, x = null, y = null)-> if event.keyCode == 13 new_sources = event.target.value.split ',' - variable.$add_mapping { - sources: - id: new_sources - x: x - y: y - } + DataManager.addSources(variable, new_sources, x, y).then(-> + $scope.model.orig_topic = $scope.model.topic + , (reason)-> + variable.errors = reason.data.message + ) console.log variable console.log $scope diff --git a/app/assets/javascripts/sections/mapping/index.coffee b/app/assets/javascripts/sections/mapping/index.coffee index d0a34628..d0f343b7 100755 --- a/app/assets/javascripts/sections/mapping/index.coffee +++ b/app/assets/javascripts/sections/mapping/index.coffee @@ -52,13 +52,11 @@ mapping.controller( $scope.detectKey = (event, question, x = null, y = null)-> if event.keyCode == 13 variables = event.target.value.split ',' - question.$add_mapping { - variable_names: variables - x: null - y: null - } - , -> - DataManager.resolveQuestions() + DataManager.addVariables(question, variables).then(-> + $scope.model.orig_topic = $scope.model.topic + , (reason)-> + question.errors = reason.data.message + ) console.log question # $scope.detectKey = (event,question_id)-> @@ -137,7 +135,7 @@ mapping.directive( $scope.model.orig_topic = $scope.model.topic , (reason)-> $scope.model.topic = $scope.model.orig_topic - Flash.add('danger', reason.data.message) + $scope.model.errors = reason.data.message ).finally(-> bsLoadingOverlayService.stop() ) diff --git a/app/assets/javascripts/templates/partials/datasets/show.html b/app/assets/javascripts/templates/partials/datasets/show.html index a8719966..f5dedea9 100755 --- a/app/assets/javascripts/templates/partials/datasets/show.html +++ b/app/assets/javascripts/templates/partials/datasets/show.html @@ -34,8 +34,13 @@