You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aggregation-platform/plugins/developer/ts/developerPlugin.ts

79 lines
4.5 KiB

9 years ago
/// <reference path="../../includes.ts"/>
/// <reference path="developerHelpers.ts"/>
module Developer {
export var _module = angular.module(pluginName, ['hawtio-core', 'hawtio-ui', 'ui.codemirror', 'nvd3', 'treeControl']);
export var controller = PluginHelpers.createControllerFunction(_module, pluginName);
export var route = PluginHelpers.createRoutingFunction(templatePath);
_module.config(['$routeProvider', ($routeProvider:ng.route.IRouteProvider) => {
$routeProvider.when(context, route('workspaces.html', false))
.when("/namespaces", route('workspaces.html', false))
//.when("/home", route('home.html', false))
.when(UrlHelpers.join(context, '/:namespace'), route('projects.html', false))
.when(UrlHelpers.join(context, '/:namespace/detail'), route('workspace.html', false))
.when(UrlHelpers.join(context, '/:namespace/jenkinsJob'), route('jenkinsJobs.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects'), route('projects.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id'), route('environments.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id/detail'), Kubernetes.route('buildConfig.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id/builds'), Kubernetes.route('builds.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id/environments'), route('environments.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id/jenkinsJob/:job'), route('jenkinsJob.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id/jenkinsJob/:job/log/:build'), route('jenkinsLog.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id/jenkinsJob/:job/pipelines'), route('pipelines.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id/jenkinsJob/:job/pipeline/:build'), route('pipeline.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id/jenkinsJob/:job/metrics'), route('jenkinsMetrics.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id/jenkinsMetrics'), route('jenkinsMetrics.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id/tools'), route('tools.html', false))
.when(UrlHelpers.join(context, '/:workspace/projects/:project/environments/:namespace'), route('environment.html', false))
.when(UrlHelpers.join(context, '/:workspace/projects/:project/environments/:namespace'), route('environment.html', false))
.when(UrlHelpers.join(context, '/Aggregate/overview'), route('addDataFile.html', false))
.otherwise("/workspaces");
}]);
_module.run(['viewRegistry', 'ServiceRegistry', 'HawtioNav', 'KubernetesModel', '$templateCache', 'DataInfoModel',(viewRegistry, ServiceRegistry, HawtioNav, KubernetesModel, $templateCache, DataInfoModel) => {
log.debug("Running");
viewRegistry['workspaces'] = Kubernetes.templatePath + 'layoutKubernetes.html';
viewRegistry['namespaces'] = Kubernetes.templatePath + 'layoutKubernetes.html';
var builder = HawtioNav.builder();
var workspaces = builder.id('workspaces')
.href(() => context)
.title(() => '查看')
.build();
/*
var workspaceOverview = builder.id('workspaces')
.href(() => UrlHelpers.join(context, 'overview'))
.title(() => 'Workspace')
.build();
*/
/* var dataadd = builder.id('dataadd')
.href(() => context)
.title(() => '汇总')
.build();
*/
var Aggregate = builder.id('Aggregate;')
.rank(200)
.href(() => context)
.title(() => '数据汇总')
//.isValid(() => !Core.isRemoteConnection())
.tabs(workspaces)
.build();
HawtioNav.add(Aggregate);
}]);
_module.filter('asTrustedHtml', ['$sce', function ($sce) {
return function (text) {
return $sce.trustAsHtml(text);
};
}]);
hawtioPluginLoader.addModule(pluginName);
// for scroll-glue directive
hawtioPluginLoader.addModule('luegg.directives');
}