Skip to content

Commit

Permalink
#123 make it easy to configure the layout of the endpoint forms
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrachan committed Jun 5, 2013
1 parent bb33ca0 commit 0770e03
Showing 1 changed file with 45 additions and 10 deletions.
55 changes: 45 additions & 10 deletions hawtio-web/src/main/webapp/app/camel/js/endpointChooser.ts
Expand Up @@ -59,17 +59,40 @@ module Camel {
* specify custom label & icon properties for endpoint names
*/
export var endpointConfigurations = {
drools: {
icon: "/app/camel/img/endpointQueue24.png"
},
quartz: {
icon: "/app/camel/img/endpointTimer24.png"
},
timer: {
icon: "/app/camel/img/endpointTimer24.png"
}
drools: {
icon: "/app/camel/img/endpointQueue24.png"
},
quartz: {
icon: "/app/camel/img/endpointTimer24.png"
},
timer: {
icon: "/app/camel/img/endpointTimer24.png"
}
};

/**
* Define the default form configurations
*/
export var endpointForms = {
file: {
tabs: {
//'Core': ['key', 'value'],
'Options': ['*']
}
},
activemq: {
tabs: {
'Connection': ['clientId', 'transacted', 'transactedInOut', 'transactionName', 'transactionTimeout' ],
'Producer': ['timeToLive', 'priority', 'allowNullBody', 'pubSubNoLocal', 'preserveMessageQos'],
'Consumer': ['concurrentConsumers', 'acknowledgementModeName', 'selector', 'receiveTimeout'],
'Reply': ['replyToDestination', 'replyToDeliveryPersistent', 'replyToCacheLevelName', 'replyToDestinationSelectorName'],
'Options': ['*']
}
}
};

endpointForms["jms"] = endpointForms.activemq;

angular.forEach(endpointCategories, (category, catKey) => {
category.id = catKey;
angular.forEach(category.endpoints, (endpoint) => {
Expand Down Expand Up @@ -169,14 +192,26 @@ module Camel {
try {
//console.log("got JSON: " + response);
var json = JSON.parse(response);
var endpointName = $scope.selectedComponentName;
configureEndpointSchema(endpointName, json);
$scope.endpointSchema = json;
$scope.schema.definitions[$scope.selectedComponentName] = json;
$scope.schema.definitions[endpointName] = json;
Core.$apply($scope);
} catch (e) {
console.log("Failed to parse JSON " + e);
console.log("JSON: " + response);
}
}
}

function configureEndpointSchema(endpointName, json) {
console.log("======== configuring schema for " + endpointName);
var config = Camel.endpointForms[endpointName];
if (config && json) {
if (config.tabs) {
json.tabs = config.tabs;
}
}
}
}
}

0 comments on commit 0770e03

Please sign in to comment.