Skip to content

Commit

Permalink
Merge pull request #2609 from caskdata/bugfix/schema-ui
Browse files Browse the repository at this point in the history
Bugfix/schema ui
  • Loading branch information
elfenheart committed May 5, 2015
2 parents dca3fea + 5638e5e commit 726d8d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ angular.module(PKG.name + '.commons')

// Format model
function initialize() {
var obj = {};
var schema = {};

if ($scope.model) {
try {
obj = JSON.parse($scope.model);
schema = JSON.parse($scope.model);
} catch (e) {
$scope.error = 'Invalid JSON string';
}
}

var schema = myHelpers.objectQuery(obj, 'schema', 'fields');
var schema = myHelpers.objectQuery(schema, 'fields');
$scope.properties = [];
angular.forEach(schema, function(p) {
if (angular.isArray(p.type)) {
Expand Down Expand Up @@ -61,10 +61,6 @@ angular.module(PKG.name + '.commons')


function formatSchema() {
var obj = {
name: $scope.format
};

// Format Schema
var properties = [];
angular.forEach($scope.properties, function(p) {
Expand All @@ -78,13 +74,13 @@ angular.module(PKG.name + '.commons')

// do not include properties on the request when schema field is empty
if (properties.length !== 0) {
obj.schema = {
var schema = {
type: 'record',
name: 'etlSchemaBody',
fields: properties
};
// turn obj into JSON string
var json = JSON.stringify(obj);
// turn schema into JSON string
var json = JSON.stringify(schema);

$scope.model = json;
} else {
Expand Down
2 changes: 1 addition & 1 deletion cdap-ui/templates/common/Database.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
}
},
"group3": {
"display" : "Import Query",
"display" : "Table Properties",
"position" : [ "importQuery", "countQuery"],
"fields" : {
"importQuery" : {
Expand Down

0 comments on commit 726d8d6

Please sign in to comment.