Commit f67563e9 by Torkel Ödegaard

feat(apps): moving things around

parent 69d0e824
...@@ -55,6 +55,20 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) { ...@@ -55,6 +55,20 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
Url: "/", 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} orgApps := m.GetAppPluginsQuery{OrgId: c.OrgId}
err = bus.Dispatch(&orgApps) err = bus.Dispatch(&orgApps)
if err != nil { if err != nil {
......
...@@ -19,7 +19,7 @@ function (angular, _, $, coreModule, config) { ...@@ -19,7 +19,7 @@ function (angular, _, $, coreModule, config) {
$scope.mainLinks.push({ $scope.mainLinks.push({
text: item.text, text: item.text,
icon: item.icon, icon: item.icon,
href: $scope.getUrl(item.href) url: $scope.getUrl(item.url)
}); });
}); });
}; };
...@@ -40,14 +40,6 @@ function (angular, _, $, coreModule, config) { ...@@ -40,14 +40,6 @@ function (angular, _, $, coreModule, config) {
text: "API Keys", text: "API Keys",
href: $scope.getUrl("/org/apikeys"), 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) { if ($scope.orgMenu.length > 0) {
......
...@@ -10,6 +10,7 @@ define([ ...@@ -10,6 +10,7 @@ define([
$locationProvider.html5Mode(true); $locationProvider.html5Mode(true);
var loadOrgBundle = new BundleLoader.BundleLoader('app/features/org/all'); var loadOrgBundle = new BundleLoader.BundleLoader('app/features/org/all');
var loadAppsBundle = new BundleLoader.BundleLoader('app/features/apps/all');
$routeProvider $routeProvider
.when('/', { .when('/', {
...@@ -131,17 +132,17 @@ define([ ...@@ -131,17 +132,17 @@ define([
templateUrl: 'app/partials/reset_password.html', templateUrl: 'app/partials/reset_password.html',
controller : 'ResetPasswordCtrl', controller : 'ResetPasswordCtrl',
}) })
.when('/org/apps', { .when('/apps', {
templateUrl: 'app/features/org/partials/app_list.html', templateUrl: 'app/features/apps/partials/list.html',
controller: 'AppListCtrl', controller: 'AppListCtrl',
controllerAs: 'ctrl', controllerAs: 'ctrl',
resolve: loadOrgBundle, resolve: loadAppsBundle,
}) })
.when('/org/apps/edit/:type', { .when('/apps/edit/:type', {
templateUrl: 'app/features/org/partials/app_edit.html', templateUrl: 'app/features/apps/partials/edit.html',
controller: 'AppEditCtrl', controller: 'AppEditCtrl',
controllerAs: 'ctrl', controllerAs: 'ctrl',
resolve: loadOrgBundle, resolve: loadAppsBundle,
}) })
.when('/global-alerts', { .when('/global-alerts', {
templateUrl: 'app/features/dashboard/partials/globalAlerts.html', templateUrl: 'app/features/dashboard/partials/globalAlerts.html',
......
import './edit_ctrl';
import './list_ctrl';
import './app_srv';
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<li> <li>
<div class="filter-list-card-controls"> <div class="filter-list-card-controls">
<div class="filter-list-card-config"> <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> <i class="fa fa-cog"></i>
</a> </a>
</div> </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