Skip to content

Commit

Permalink
Merge pull request #16 from rashidkpc/master
Browse files Browse the repository at this point in the history
Add config directive
  • Loading branch information
Rashid Khan committed Feb 27, 2014
2 parents 61eb549 + 360a1f2 commit bc89b88
Show file tree
Hide file tree
Showing 8 changed files with 5,982 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/kibana/apps/dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
{{dashboard.title}}
</div>

<ul class="nav navbar-nav pull-right">
<ul class="nav navbar-nav">
<li><a class="link" ng-click="gridControl.addWidget()"><i class="fa fa-plus"></i></a></li>
<li><a class="link" ng-click="save(dashboard.title)"><i class="fa fa-save"></i></a></li>
<li><a class="link" ng-click="load(dashboard.title)"><i class="fa fa-folder-open"></i></a></li>

<li><a class="link" ng-click="openSave()"><i class="fa fa-save"></i></a></li>
<li><a class="link" ng-click="openLoad()"><i class="fa fa-folder-open"></i></a></li>
</ul>
</nav>
<config config-template="configTemplate" config-object="configurable" config-close="configClose" config-submit="configSubmit"></config>

<div class="container-default">
<ul dashboard-grid grid="dashboard.panels" control="gridControl"></ul>
Expand Down
26 changes: 25 additions & 1 deletion src/kibana/apps/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,37 @@ define(function (require) {

require('css!./styles/main.css');
require('css!../../../bower_components/gridster/dist/jquery.gridster.css');
require('directives/config');
require('gridster');


var app = angular.module('app/dashboard', []);
var app = angular.module('app/dashboard');

app.controller('dashboard', function ($scope, courier) {

$scope.$broadcast('application.load');

// Passed in the grid attr to the directive so we can access the directive's function from
// the controller and view
$scope.gridControl = {foo: true};

$scope.openSave = function () {
$scope.configTemplate = 'kibana/apps/dashboard/partials/saveDashboard.html';
$scope.configClose = function () {
console.log('SAVE close');
};
$scope.configSubmit = function () {
$scope.save($scope.dashboard.title);
};
};

$scope.openLoad = function () {
$scope.configTemplate = 'kibana/apps/dashboard/partials/loadDashboard.html';
$scope.configClose = function () {
console.log('LOAD close');
};
};

$scope.save = function (title) {
var doc = courier.createSource('doc')
.index(configFile.kibanaIndex)
Expand Down Expand Up @@ -111,6 +131,10 @@ define(function (require) {
]
};

$scope.configurable = {
dashboard: $scope.dashboard,
};


});

Expand Down
5 changes: 5 additions & 0 deletions src/kibana/apps/dashboard/partials/loadDashboard.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="form-group">
<label for="exampleInputEmail1">Load</label>
<input type="text" ng-model="configObject.dashboard.title" class="form-control" placeholder="Dashboard title">
</div>
<button type="submit" class="btn btn-default">Load</button>
5 changes: 5 additions & 0 deletions src/kibana/apps/dashboard/partials/saveDashboard.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="form-group">
<label for="exampleInputEmail1">Save As</label>
<input type="text" ng-model="configObject.dashboard.title" class="form-control" placeholder="Dashboard title">
</div>
<button type="submit" class="btn btn-primary">Save</button>
Loading

0 comments on commit bc89b88

Please sign in to comment.