Skip to content

Commit

Permalink
fix(add-dataset): attributes for GeoJSON and ShapeFile appear in exte…
Browse files Browse the repository at this point in the history
…nded grid
  • Loading branch information
james-rae committed Mar 23, 2015
1 parent dcfab83 commit 7930fce
Showing 1 changed file with 10 additions and 24 deletions.
34 changes: 10 additions & 24 deletions src/js/RAMP/Modules/dataLoaderGui.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ define([

// make a guess if it's a feature or wms server only if the user hasn't already selected the type
if (!serviceTypeBrick.isUserSelected()) {

if (value.match(/ArcGIS\/rest\/services/ig)) {
guess = "featureServiceAttrStep";
} else if (value.match(/wms/ig)) {
Expand Down Expand Up @@ -99,12 +98,11 @@ define([

/**
* Create choice tree structure. This function is executed as part of the module initialization so that i18n strings can be properly loaded
*
*
* @method prepareChoiceTreeStructure
* @private
*/
function prepareChoiceTreeStructure() {

choiceTreeErrors = {
base: {
type: "error",
Expand Down Expand Up @@ -276,7 +274,6 @@ define([
})
});
} else {

choiceTreeCallbacks.simpleAdvance(step, bricksData.serviceType, {
stepData: data,
bricksData: {
Expand All @@ -286,7 +283,6 @@ define([
}
});
}

}, function (event) {
console.error(event);
handleFailure(step, handle, {
Expand All @@ -296,7 +292,6 @@ define([
})
});
});

}, function (event) {
// error connection to service
console.error(event);
Expand Down Expand Up @@ -330,7 +325,6 @@ define([
})
});
} else {

choiceTreeCallbacks.simpleAdvance(step, bricksData.serviceType, {
stepData: {
wmsData: data,
Expand All @@ -343,7 +337,6 @@ define([
}
});
}

}, function (event) {
console.error(event);
handleFailure(step, handle, {
Expand Down Expand Up @@ -615,7 +608,6 @@ define([
})
});
} else {

choiceTreeCallbacks.simpleAdvance(step, bricksData.fileType, {
stepData: featureLayer,
bricksData: {
Expand All @@ -628,7 +620,6 @@ define([
}
});
}

}, function (event) {
//error building geojson
console.error(event);
Expand Down Expand Up @@ -680,7 +671,6 @@ define([
})
});
} else {

guess = guessLatLong(rows);

// preselect primary attribute so it's not one of the lat or long guesses;
Expand Down Expand Up @@ -738,7 +728,6 @@ define([
})
});
} else {

choiceTreeCallbacks.simpleAdvance(step, bricksData.fileType, {
stepData: featureLayer,
bricksData: {
Expand All @@ -751,7 +740,6 @@ define([
}
});
}

}, function (event) {
// error to build shapefiles
console.error(event);
Expand All @@ -765,7 +753,6 @@ define([

break;
}

}, function (event) {
//error loading file
console.error(event);
Expand Down Expand Up @@ -827,7 +814,7 @@ define([
on: [
{
eventName: Bricks.ButtonBrick.event.CLICK,
// add wms service layer to the map
// add geojson layer to the map
callback: function (step /*,data*/) {
var data = step.getData(),
bricksData = data.bricksData,
Expand All @@ -845,7 +832,8 @@ define([
],
nameField: bricksData.primaryAttribute.dropDownValue,
icon: iconTemplate,
datasetName: bricksData.datasetName.inputValue
datasetName: bricksData.datasetName.inputValue,
fields: featureLayer.fields.map(function (field) { return field.name; })
});

LayerLoader.loadLayer(featureLayer);
Expand Down Expand Up @@ -962,7 +950,6 @@ define([
//TODO: set symbology and colour on feature layer (obj.data)
LayerLoader.loadLayer(featureLayer);
addDatasetPopup.close();

}, function () {
// can't construct csv
handleFailure(step, null, {
Expand Down Expand Up @@ -1034,7 +1021,8 @@ define([
],
nameField: bricksData.primaryAttribute.dropDownValue,
icon: iconTemplate,
datasetName: bricksData.datasetName.inputValue
datasetName: bricksData.datasetName.inputValue,
fields: featureLayer.fields.map(function (field) { return field.name; })
});

LayerLoader.loadLayer(featureLayer);
Expand All @@ -1049,11 +1037,9 @@ define([
}
]
};

}

function createChoiceTree() {

// clear steps
t.dfs(choiceTree, function (node) {
node.stepItem = null;
Expand Down Expand Up @@ -1090,7 +1076,7 @@ define([
// set the first step as active
stepLookup.sourceTypeStep.currentStep(1);

// It's IE9.
// It's IE9.
if (!window.FileReader) {
var fileOrFileURL = stepLookup.fileTypeStep.contentBricks.fileOrFileURL;

Expand Down Expand Up @@ -1175,7 +1161,7 @@ define([
}

/**
*
*
* @method makeIconTemplate
* @param {String} templateName a name of the template to use for an icon
* @param {String} hex color value in hex
Expand All @@ -1192,8 +1178,8 @@ define([
}

/**
* Delay setting loading state to the step for a specified time in case it happens really fast and
*
* Delay setting loading state to the step for a specified time in case it happens really fast and
*
* @method delayLoadingState
* @param {StepItem} step step to delay setting loading state on
* @param {Number} time a delay in ms
Expand Down

0 comments on commit 7930fce

Please sign in to comment.