aggregation-platform/plugins/configs/ts/configPlugin.ts

56 lines
2.3 KiB
TypeScript

/// <reference path="../../includes.ts"/>
module Configs {
export var pluginName = "Configs";
export var context = "/config";
export var pluginPath = 'plugins/configs/';
export var templatePath = pluginPath + 'html/';
export var _module = angular.module(pluginName, ['hawtio-core', 'hawtio-ui', 'ui.codemirror', 'nvd3', 'ngTable', 'ngDialog']);
export var route = PluginHelpers.createRoutingFunction(templatePath);
export var controller = PluginHelpers.createControllerFunction(_module, pluginName);
_module.config(['$provide', '$routeProvider', ($provide, $routeProvider) =>{
$routeProvider.when(UrlHelpers.join(context, 'gluster-fs/setting'), route('glusterfsSetting.html', false))
.when(UrlHelpers.join(context, 'kube-cluster/setting'), route('kubeClusterSetting.html', false))
.when(context, {redirectTo: UrlHelpers.join(context, '/kube-cluster/setting')});
}]);
_module.run(['viewRegistry', '$templateCache', 'HawtioExtension', '$compile', (viewRegistry, $templateCache:ng.ITemplateCacheService, ext, $compile:ng.ICompileService) => {
ext.add('config-setting', ($scope) => {
var template = $templateCache.get<string>(UrlHelpers.join(templatePath, "configMenuItem.html"));
return $compile(template)($scope);
});
viewRegistry['config'] = templatePath + "shareLayout.html";
}]);
_module.directive('gfsConfigTable', [() =>{
return{
restrict: 'AE',
replace : true,
scope: {
tableTitle: '=',
tableContent: '='
},
template: `<table class="table table-hover">
<tr>
<th ng-repeat="column in tableTitle.column" class="no-fade table-header">
<span class="{{column.class}}">{{column.title}}</span>
</th>
</tr>
<tr ng-repeat = "row in tableContent" class="row.class">
<td ng-repeat="col in row" class="col.class">
<span class="col.class">{{col.title}}</span>
</td>
</tr>
</table>
`,
link: (scope, element, attr) =>{
}
}
}]);
hawtioPluginLoader.addModule(pluginName);
}