Skip to content

Instantly share code, notes, and snippets.

@tbruno
Created January 7, 2016 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbruno/687895a24ee44fec3bd4 to your computer and use it in GitHub Desktop.
Save tbruno/687895a24ee44fec3bd4 to your computer and use it in GitHub Desktop.
My snippet
function refreshPolicyTemplates(policyTemplates) {
$scope.policyTemplates = policyTemplates;
$scope.characteristics = {};
initFakeData ();
initCharacteristicsMap();
initVisualizationMode();
updateSortablePoliciesMap();
// TODO remove. Fake data for tests
function initFakeData() {
var CORS_ORDER = 100;
var RL_ORDER = 101;
policies.forEach(function (policy, index) {
policy.order = index;
});
policyTemplates.forEach(function (policyTemplate) {
if (policyTemplate.id === 'cors') {
policyTemplate.fixedOrder = CORS_ORDER;
} else if (policyTemplate.id === 'rate-limiting') {
policyTemplate.fixedOrder = RL_ORDER;
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment