Merge pull request #213 from jerrybai2009/master

fix the issue that action getSchema did not fired
This commit is contained in:
jerrybai2009 2016-09-02 11:13:22 -07:00 committed by GitHub
commit 9bbbf1a68e
5 changed files with 40 additions and 6 deletions

View File

@ -321,7 +321,7 @@
</td> </td>
<td class="commentsArea"> <td class="commentsArea">
<div class="commentsArea"> <div class="commentsArea">
{{#schema-comment schema=schema datasetId=this.model.id fieldId=schema.id getSchema="getSchema"}}{{/schema-comment}} {{#schema-comment schema=schema datasetId=dataset.id fieldId=schema.id}}{{/schema-comment}}
{{schema.commentHtml}} {{schema.commentHtml}}
</div> </div>
</td> </td>

View File

@ -102,6 +102,36 @@ App.DatasetSchemaComponent = Ember.Component.extend({
}, 500); }, 500);
}, },
actions: { actions: {
getSchema: function(){
var _this = this
var id = _this.get('dataset.id')
var columnUrl = 'api/v1/datasets/' + id + "/columns";
_this.set("isTable", true);
_this.set("isJSON", false);
$.get(columnUrl, function(data) {
if (data && data.status == "ok")
{
if (data.columns && (data.columns.length > 0))
{
_this.set("hasSchemas", true);
data.columns = data.columns.map(function(item, idx){
item.commentHtml = marked(item.comment).htmlSafe()
return item
})
_this.set("schemas", data.columns);
setTimeout(initializeColumnTreeGrid, 500);
}
else
{
_this.set("hasSchemas", false);
}
}
else
{
_this.set("hasSchemas", false);
}
});
},
setView: function (view) { setView: function (view) {
switch (view) { switch (view) {
case "tabular": case "tabular":

View File

@ -497,7 +497,10 @@ App.SchemaCommentComponent = Ember.Component.extend({
}) })
.on('hidden.bs.modal', function(){ .on('hidden.bs.modal', function(){
_this.set('propModal', false) _this.set('propModal', false)
_this.sendAction('getSchema') if (_this.parentView && _this.parentView.controller)
{
_this.parentView.controller.send('getSchema')
}
$("#datasetSchemaColumnCommentModal").modal('hide'); $("#datasetSchemaColumnCommentModal").modal('hide');
}) })
}, 300) }, 300)

View File

@ -339,3 +339,8 @@ function filterListView(category, filter)
} }
} }
function initializeColumnTreeGrid()
{
$('#json-table').treegrid();
}

View File

@ -1,7 +1,3 @@
function initializeColumnTreeGrid()
{
$('#json-table').treegrid();
}
function initializeDependsTreeGrid() function initializeDependsTreeGrid()
{ {