Skip to content

Commit

Permalink
Fix message of gcs-configure-from-sdf
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Dec 10, 2012
1 parent a7e533a commit d91dc09
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions bin/gcs-configure-from-sdf
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@ function listExistingFields(callback) {
if (error)
client.raiseFatalError(error);

var existingFieldNames = [];
indexFields.forEach(function(indexField) {
existingFieldNames.push(indexField.Options.IndexFieldName);
console.log(client.summarizeIndexFieldStatus(indexField));
});

callback(null, existingFieldNames);
callback(null, indexFields);
});
}

Expand Down Expand Up @@ -115,11 +113,21 @@ function listDetectedFields(fields) {
});
}

function listProposedFields(fields) {
function listProposedFields(fields, existingFields) {
console.log('New proposed field configuration for the domain - %s :', client.domainName);
var allFields = [];
var listedFieldNames = {};
fields.forEach(function(field) {
var status = field.existing ? '[UPDATE]' : '[NEW]';
console.log(client.summarizeIndexFieldStatus(field) + ' ' + status);
allFields.push(client.summarizeIndexFieldStatus(field) + ' ' + status);
listedFieldNames[field.Options.IndexFieldName] = true;
});
existingFields.forEach(function(field) {
if (!(field.Options.IndexFieldName in listedFieldNames))
allFields.push(client.summarizeIndexFieldStatus(field) + ' [NO CHANGE]');
});
allFields.sort().forEach(function(summary) {
console.log(summary);
});
}

Expand Down Expand Up @@ -178,7 +186,10 @@ client.getDomainStatus(function(error, domain) {
var separator = '-----------------------------------------------------------------------------------';
console.log(separator);

listExistingFields(function(error, existingFieldNames) {
listExistingFields(function(error, indexFields) {
var existingFieldNames = indexFields.map(function(indexField) {
return indexField.Options.IndexFieldName;
});
try {
console.log(separator);
var fields = collectFieldConfigurations(sourceFile, existingFieldNames);
Expand Down Expand Up @@ -207,7 +218,7 @@ client.getDomainStatus(function(error, domain) {
process.exit(1);
}

listProposedFields(fields);
listProposedFields(fields, indexField);

console.log(separator);

Expand Down

0 comments on commit d91dc09

Please sign in to comment.