Commit f67563e9 by Torkel Ödegaard

feat(apps): moving things around

parent 69d0e824
......@@ -55,6 +55,20 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
Url: "/",
})
if c.OrgRole == m.ROLE_ADMIN {
data.MainNavLinks = append(data.MainNavLinks, &dtos.NavLink{
Text: "Data Sources",
Icon: "fa fa-fw fa-database",
Url: "/datasources",
})
data.MainNavLinks = append(data.MainNavLinks, &dtos.NavLink{
Text: "Apps",
Icon: "fa fa-fw fa-cubes",
Url: "/apps",
})
}
orgApps := m.GetAppPluginsQuery{OrgId: c.OrgId}
err = bus.Dispatch(&orgApps)
if err != nil {
......
......@@ -19,7 +19,7 @@ function (angular, _, $, coreModule, config) {
$scope.mainLinks.push({
text: item.text,
icon: item.icon,
href: $scope.getUrl(item.href)
url: $scope.getUrl(item.url)
});
});
};
......@@ -40,14 +40,6 @@ function (angular, _, $, coreModule, config) {
text: "API Keys",
href: $scope.getUrl("/org/apikeys"),
});
$scope.orgMenu.push({
text: "Datasources",
href: $scope.getUrl("/datasources"),
});
$scope.orgMenu.push({
text: "Apps",
href: $scope.getUrl("/org/apps"),
});
}
if ($scope.orgMenu.length > 0) {
......
......@@ -10,6 +10,7 @@ define([
$locationProvider.html5Mode(true);
var loadOrgBundle = new BundleLoader.BundleLoader('app/features/org/all');
var loadAppsBundle = new BundleLoader.BundleLoader('app/features/apps/all');
$routeProvider
.when('/', {
......@@ -131,17 +132,17 @@ define([
templateUrl: 'app/partials/reset_password.html',
controller : 'ResetPasswordCtrl',
})
.when('/org/apps', {
templateUrl: 'app/features/org/partials/app_list.html',
.when('/apps', {
templateUrl: 'app/features/apps/partials/list.html',
controller: 'AppListCtrl',
controllerAs: 'ctrl',
resolve: loadOrgBundle,
resolve: loadAppsBundle,
})
.when('/org/apps/edit/:type', {
templateUrl: 'app/features/org/partials/app_edit.html',
.when('/apps/edit/:type', {
templateUrl: 'app/features/apps/partials/edit.html',
controller: 'AppEditCtrl',
controllerAs: 'ctrl',
resolve: loadOrgBundle,
resolve: loadAppsBundle,
})
.when('/global-alerts', {
templateUrl: 'app/features/dashboard/partials/globalAlerts.html',
......
import './edit_ctrl';
import './list_ctrl';
import './app_srv';
......@@ -18,7 +18,7 @@
<li>
<div class="filter-list-card-controls">
<div class="filter-list-card-config">
<a href="org/apps/edit/{{app.type}}">
<a href="apps/edit/{{app.type}}">
<i class="fa fa-cog"></i>
</a>
</div>
......
define([
'angular',
],
function (angular) {
'use strict';
var module = angular.module('grafana.directives');
module.directive('appConfigLoader', function($compile) {
return {
restrict: 'E',
link: function(scope, elem) {
var directive = 'grafana-app-default';
//wait for the parent scope to be applied.
scope.panelAdded = false;
scope.$watch("current", function(newVal) {
if (newVal && !scope.panelAdded) {
if (newVal.module) {
scope.panelAdded = true;
directive = 'grafana-app-'+newVal.type;
scope.require([newVal.module], function () {
var panelEl = angular.element(document.createElement(directive));
elem.append(panelEl);
$compile(panelEl)(scope);
});
}
}
});
}
};
});
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment