mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[chrome] consume app switcher, convert to use chrome.getNavLinks()
This commit is contained in:
parent
4df68cd0ad
commit
9f9bbe2838
8 changed files with 18 additions and 43 deletions
|
@ -1,3 +0,0 @@
|
|||
module.exports = function (kibana) {
|
||||
return new kibana.Plugin();
|
||||
};
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"name": "appSwitcher",
|
||||
"version": "1.0.0"
|
||||
}
|
|
@ -40,15 +40,6 @@ module.exports = async (kbnServer, server, config) => {
|
|||
server.setupViews(resolve(__dirname, 'views'));
|
||||
server.exposeStaticFile('/loading.gif', resolve(__dirname, 'public/loading.gif'));
|
||||
|
||||
// serve the app switcher
|
||||
server.route({
|
||||
path: '/api/apps',
|
||||
method: 'GET',
|
||||
handler: function (req, reply) {
|
||||
return reply(uiExports.apps);
|
||||
}
|
||||
});
|
||||
|
||||
server.route({
|
||||
path: '/app/{id}',
|
||||
method: 'GET',
|
||||
|
|
9
src/ui/public/chrome/api/angular.js
vendored
9
src/ui/public/chrome/api/angular.js
vendored
|
@ -1,7 +1,11 @@
|
|||
var modules = require('ui/modules');
|
||||
var $ = require('jquery');
|
||||
var _ = require('lodash');
|
||||
|
||||
require('../appSwitcher/appSwitcher.less');
|
||||
var modules = require('ui/modules');
|
||||
var ConfigTemplate = require('ui/ConfigTemplate');
|
||||
require('ui/directives/config');
|
||||
|
||||
module.exports = function (chrome, internals) {
|
||||
chrome.setupAngular = function () {
|
||||
var kibana = modules.get('kibana');
|
||||
|
@ -58,6 +62,9 @@ module.exports = function (chrome, internals) {
|
|||
// and some local values
|
||||
$scope.httpActive = $http.pendingRequests;
|
||||
$scope.notifList = require('ui/notify')._notifs;
|
||||
$scope.appSwitcherTemplate = new ConfigTemplate({
|
||||
switcher: require('../appSwitcher/appSwitcher.html')
|
||||
});
|
||||
|
||||
return chrome;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
<div ng-if="switcher.loading">
|
||||
<div class="spinner large"></div>
|
||||
</div>
|
||||
<div ng-if="!switcher.loading" class="app-links">
|
||||
<div class="app-link" ng-repeat="app in switcher.apps | orderBy:'title'">
|
||||
<a ng-href="/app/{{app.id}}">
|
||||
<div class="app-links">
|
||||
<div class="app-link" ng-repeat="app in chrome.getNavLinks() | orderBy:'title'">
|
||||
<a ng-href="{{ app.url }}">
|
||||
|
||||
<div ng-if="app.icon" ng-style="{ 'background-image': 'url(../' + app.icon + ')' }" class="app-icon"></div>
|
||||
<div ng-if="!app.icon" class="app-icon app-icon-missing">{{app.title[0]}}</div>
|
|
@ -47,9 +47,9 @@
|
|||
</a>
|
||||
</li>
|
||||
|
||||
<li class="to-body" ng-class="{active: appTemplate.is('switcher')}" ng-if="chrome.getShowAppsLink()">
|
||||
<a ng-click="appTemplate.toggle('switcher')">
|
||||
<i class="fa fa-th" alt="Go to app switcher"></i>
|
||||
<li class="to-body" ng-class="{ active: appSwitcherTemplate.is('switcher') }" ng-if="chrome.getShowAppsLink()">
|
||||
<a ng-click="appSwitcherTemplate.toggle('switcher')">
|
||||
<i class="fa fa-th" alt="Show app switcher"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -98,9 +98,9 @@
|
|||
</nav>
|
||||
|
||||
<config
|
||||
config-template="appTemplate"
|
||||
config-object="switcher"
|
||||
config-close="appTemplate.close">
|
||||
config-template="appSwitcherTemplate"
|
||||
config-object="chrome"
|
||||
config-close="appSwitcherTemplate.close">
|
||||
</config>
|
||||
|
||||
<config
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
define(function (require) {
|
||||
require('plugins/appSwitcher/appSwitcher.less');
|
||||
|
||||
var _ = require('lodash');
|
||||
var ConfigTemplate = require('ui/ConfigTemplate');
|
||||
|
||||
require('ui/modules')
|
||||
.get('kibana')
|
||||
.directive('chromeContext', function (timefilter, globalState, $http) {
|
||||
.directive('chromeContext', function (timefilter, globalState) {
|
||||
|
||||
var listenForUpdates = _.once(function ($scope) {
|
||||
$scope.$listen(timefilter, 'update', function (newVal, oldVal) {
|
||||
|
@ -27,17 +25,6 @@ define(function (require) {
|
|||
interval: require('ui/chrome/config/interval.html')
|
||||
});
|
||||
|
||||
|
||||
$scope.switcher = {loading: true};
|
||||
$http.get('/api/apps')
|
||||
.then(function (resp) {
|
||||
$scope.switcher.loading = false;
|
||||
$scope.switcher.apps = resp.data;
|
||||
});
|
||||
$scope.appTemplate = new ConfigTemplate({
|
||||
switcher: require('plugins/appSwitcher/appSwitcher.html')
|
||||
});
|
||||
|
||||
$scope.toggleRefresh = function () {
|
||||
timefilter.refreshInterval.pause = !timefilter.refreshInterval.pause;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue