Closes #62, there is now a New button in the open / search dashboard view.

This commit is contained in:
Torkel Ödegaard 2014-02-05 20:56:48 +01:00
parent 8816e18027
commit 0032f934c9
7 changed files with 126 additions and 22 deletions

View File

@ -51,12 +51,6 @@ function (angular, _, config, $) {
});
};
$scope.toggleImport = function ($event) {
$event.stopPropagation();
$scope.showImport = !$scope.showImport;
};
$scope.elasticsearch_dblist = function(queryStr) {
$scope.showImport = false;
$scope.selectedIndex = -1;
@ -120,6 +114,15 @@ function (angular, _, config, $) {
});
};
$scope.toggleImport = function ($event) {
$event.stopPropagation();
$scope.showImport = !$scope.showImport;
};
$scope.newDashboard = function() {
$location.url('/dashboard/file/empty.json');
};
});

View File

@ -1,5 +1,5 @@
{
"title": "New Dashboard",
"title": "Welcome to Grafana!",
"services": {
"filter": {
"list": [],

View File

@ -0,0 +1,83 @@
{
"title": "New Dashboard",
"services": {
"filter": {
"list": [],
"time": {
"from": "now-6h",
"to": "now"
}
}
},
"rows": [
{
"title": "Row1",
"height": "250px",
"editable": true,
"collapse": false,
"collapsable": true,
"panels": [],
"notice": false
}
],
"editable": true,
"failover": false,
"panel_hints": true,
"style": "dark",
"pulldowns": [
{
"type": "filtering",
"collapse": false,
"notice": false,
"enable": false
}
],
"nav": [
{
"type": "timepicker",
"collapse": false,
"notice": false,
"enable": true,
"status": "Stable",
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
],
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"now": true
}
],
"loader": {
"save_gist": false,
"save_elasticsearch": true,
"save_local": true,
"save_default": true,
"save_temp": true,
"save_temp_ttl_enable": true,
"save_temp_ttl": "30d",
"load_gist": false,
"load_elasticsearch": true,
"load_elasticsearch_size": 20,
"load_local": false,
"hide": false
},
"refresh": false
}

View File

@ -19,12 +19,24 @@
<ul class="dropdown-menu" id="grafana-search">
<li ng-if="!showImport">
<div class="grafana-search-panel">
<input type="text"
placeholder="search dashboards, metrics, or graphs"
xng-focus="giveSearchFocus"
ng-keydown="keyDown($event)"
ng-model="elasticsearch.query"
ng-change="elasticsearch_dblist(elasticsearch.query)" />
<div class="search-field-wrapper">
<button class="btn btn-success pull-right" ng-click="toggleImport($event)">
<i class="icon-download-alt"></i>
Import
</button>
<button class="btn btn-success pull-right" ng-click="newDashboard()">
<i class="icon-th-large"></i>
New
</button>
<span>
<input type="text"
placeholder="search dashboards, metrics, or graphs"
xng-focus="giveSearchFocus"
ng-keydown="keyDown($event)"
ng-model="elasticsearch.query"
ng-change="elasticsearch_dblist(elasticsearch.query)" />
</span>
</div>
<h6 ng-hide="search_results.dashboards.length || search_results.metrics.length">No dashboards or metrics matching your query found</h6>
<table class="table table-condensed table-striped">
<tr bindonce ng-repeat="row in search_results.metrics"
@ -52,9 +64,6 @@
</div>
</li>
<li class="pull-right" style="margin: 5px;">
<a ng-click="toggleImport($event)">Import</a>
</li>
<!-- ng-show="dashboard.current.loader.load_gist || dashboard.current.loader.load_local" -->
<li ng-if="showImport" style="margin: 20px;">
<div class="editor-row">

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -12,10 +12,19 @@
.grafana-search-panel {
padding: 6px 10px;
input {
width: 100%;
.box-sizing(border-box);
padding: 15px;
.search-field-wrapper {
input {
width: 100%;
}
button {
margin: 0 2px 0 0;
}
> span {
display: block;
overflow: hidden;
padding-right: 25px;
}
}
.selected td, tr.selected:nth-child(odd)>td {