From add7078f6688a0a6b0fac57ceb717c0a9ae83575 Mon Sep 17 00:00:00 2001 From: bergquist Date: Tue, 26 Jan 2016 19:03:43 +0100 Subject: [PATCH 01/15] tech(playlist): convert to typescript --- .../features/playlist/partials/playlist.html | 38 ++--- .../features/playlist/partials/playlists.html | 4 +- .../features/playlist/playlist_edit_ctrl.js | 144 ------------------ .../features/playlist/playlist_edit_ctrl.ts | 141 +++++++++++++++++ .../app/features/playlist/playlist_routes.js | 5 +- .../app/features/playlist/playlists_ctrl.js | 43 ------ .../app/features/playlist/playlists_ctrl.ts | 45 ++++++ 7 files changed, 211 insertions(+), 209 deletions(-) delete mode 100644 public/app/features/playlist/playlist_edit_ctrl.js create mode 100644 public/app/features/playlist/playlist_edit_ctrl.ts delete mode 100644 public/app/features/playlist/playlists_ctrl.js create mode 100644 public/app/features/playlist/playlists_ctrl.ts diff --git a/public/app/features/playlist/partials/playlist.html b/public/app/features/playlist/partials/playlist.html index 6f47c65568f..ca5cd05a997 100644 --- a/public/app/features/playlist/partials/playlist.html +++ b/public/app/features/playlist/partials/playlist.html @@ -1,14 +1,14 @@
-

New playlist

-

Edit playlist

+

New playlist

+

Edit playlist

Name and interval

@@ -20,7 +20,7 @@ Name
  • - +
  • @@ -31,7 +31,7 @@ Interval
  • - +
  • @@ -50,10 +50,10 @@
  • + ng-change="ctrl.search()">
  • @@ -64,20 +64,20 @@
    -
    Search results ({{filteredPlaylistItems.length}})
    +
    Search results ({{ctrl.filteredPlaylistItems.length}})
    - + - + @@ -87,18 +87,18 @@
    Added dashboards
    {{playlistItem.title}} -
    Search results empty
    - + @@ -113,11 +113,11 @@ + ng-disabled="ctrl.playlistEditForm.$invalid || ctrl.isPlaylistEmpty()" + ng-click="ctrl.savePlaylist(ctrl.playlist, ctrl.playlistItems)">Save + ng-click="ctrl.backToList()">Cancel diff --git a/public/app/features/playlist/partials/playlists.html b/public/app/features/playlist/partials/playlists.html index a8a4724b34c..4aa7944623c 100644 --- a/public/app/features/playlist/partials/playlists.html +++ b/public/app/features/playlist/partials/playlists.html @@ -19,7 +19,7 @@ - + @@ -39,7 +39,7 @@ diff --git a/public/app/features/playlist/playlist_edit_ctrl.js b/public/app/features/playlist/playlist_edit_ctrl.js deleted file mode 100644 index 9b493c47d25..00000000000 --- a/public/app/features/playlist/playlist_edit_ctrl.js +++ /dev/null @@ -1,144 +0,0 @@ -define([ - 'angular', - 'app/core/config', - 'lodash' -], -function (angular, config, _) { - 'use strict'; - - var module = angular.module('grafana.controllers'); - - module.controller('PlaylistEditCtrl', function($scope, playlistSrv, backendSrv, $location, $route) { - $scope.filteredPlaylistItems = []; - $scope.foundPlaylistItems = []; - $scope.searchQuery = ''; - $scope.loading = false; - $scope.playlist = { - interval: '10m', - }; - $scope.playlistItems = []; - - $scope.init = function() { - if ($route.current.params.id) { - var playlistId = $route.current.params.id; - - backendSrv.get('/api/playlists/' + playlistId) - .then(function(result) { - $scope.playlist = result; - }); - - backendSrv.get('/api/playlists/' + playlistId + '/items') - .then(function(result) { - $scope.playlistItems = result; - }); - } - - $scope.search(); - }; - - $scope.search = function() { - var query = {limit: 10}; - - if ($scope.searchQuery) { - query.query = $scope.searchQuery; - } - - $scope.loading = true; - - backendSrv.search(query) - .then(function(results) { - $scope.foundPlaylistItems = results; - $scope.filterFoundPlaylistItems(); - }) - .finally(function() { - $scope.loading = false; - }); - }; - - $scope.filterFoundPlaylistItems = function() { - $scope.filteredPlaylistItems = _.reject($scope.foundPlaylistItems, function(playlistItem) { - return _.findWhere($scope.playlistItems, function(listPlaylistItem) { - return parseInt(listPlaylistItem.value) === playlistItem.id; - }); - }); - }; - - $scope.addPlaylistItem = function(playlistItem) { - playlistItem.value = playlistItem.id.toString(); - playlistItem.type = 'dashboard_by_id'; - playlistItem.order = $scope.playlistItems.length + 1; - - $scope.playlistItems.push(playlistItem); - $scope.filterFoundPlaylistItems(); - }; - - $scope.removePlaylistItem = function(playlistItem) { - _.remove($scope.playlistItems, function(listedPlaylistItem) { - return playlistItem === listedPlaylistItem; - }); - $scope.filterFoundPlaylistItems(); - }; - - $scope.savePlaylist = function(playlist, playlistItems) { - var savePromise; - - playlist.items = playlistItems; - - savePromise = playlist.id - ? backendSrv.put('/api/playlists/' + playlist.id, playlist) - : backendSrv.post('/api/playlists', playlist); - - savePromise - .then(function() { - $scope.appEvent('alert-success', ['Playlist saved', '']); - $location.path('/playlists'); - }, function() { - $scope.appEvent('alert-error', ['Unable to save playlist', '']); - }); - }; - - $scope.isNew = function() { - return !$scope.playlist.id; - }; - - $scope.isPlaylistEmpty = function() { - return !$scope.playlistItems.length; - }; - - $scope.isSearchResultsEmpty = function() { - return !$scope.foundPlaylistItems.length; - }; - - $scope.isSearchQueryEmpty = function() { - return $scope.searchQuery === ''; - }; - - $scope.backToList = function() { - $location.path('/playlists'); - }; - - $scope.isLoading = function() { - return $scope.loading; - }; - - $scope.movePlaylistItem = function(playlistItem, offset) { - var currentPosition = $scope.playlistItems.indexOf(playlistItem); - var newPosition = currentPosition + offset; - - if (newPosition >= 0 && newPosition < $scope.playlistItems.length) { - $scope.playlistItems.splice(currentPosition, 1); - $scope.playlistItems.splice(newPosition, 0, playlistItem); - } - }; - - $scope.movePlaylistItemUp = function(playlistItem) { - $scope.movePlaylistItem(playlistItem, -1); - }; - - $scope.movePlaylistItemDown = function(playlistItem) { - $scope.movePlaylistItem(playlistItem, 1); - }; - - $scope.init(); - }); -}); diff --git a/public/app/features/playlist/playlist_edit_ctrl.ts b/public/app/features/playlist/playlist_edit_ctrl.ts new file mode 100644 index 00000000000..f8f4a29fd5c --- /dev/null +++ b/public/app/features/playlist/playlist_edit_ctrl.ts @@ -0,0 +1,141 @@ +/// + +import angular from 'angular'; +import _ from 'lodash'; +import coreModule from '../../core/core_module'; +import config from 'app/core/config'; + +export class PlaylistEditCtrl { + filteredPlaylistItems: any = []; + foundPlaylistItems: any = []; + searchQuery: string = ''; + loading: boolean = false; + playlist: any = { + interval: '10m', + }; + playlistItems: any = []; + + /** @ngInject */ + constructor(private $scope, private playlistSrv, private backendSrv, private $location, private $route) { + if ($route.current.params.id) { + var playlistId = $route.current.params.id; + + backendSrv.get('/api/playlists/' + playlistId) + .then((result) => { + this.playlist = result; + }); + + backendSrv.get('/api/playlists/' + playlistId + '/items') + .then((result) => { + this.playlistItems = result; + }); + } + + this.search(); + } + + search() { + var query: any = {limit: 10}; + + if (this.searchQuery) { + query.query = this.searchQuery; + } + + this.loading = true; + + this.backendSrv.search(query) + .then((results) => { + this.foundPlaylistItems = results; + this.filterFoundPlaylistItems(); + }) + .finally(() => { + this.loading = false; + }); + }; + + filterFoundPlaylistItems() { + this.filteredPlaylistItems = _.reject(this.foundPlaylistItems, (playlistItem) => { + return _.findWhere(this.playlistItems, (listPlaylistItem) => { + return parseInt(listPlaylistItem.value) === playlistItem.id; + }); + }); + }; + + addPlaylistItem(playlistItem) { + playlistItem.value = playlistItem.id.toString(); + playlistItem.type = 'dashboard_by_id'; + playlistItem.order = this.playlistItems.length + 1; + + this.playlistItems.push(playlistItem); + this.filterFoundPlaylistItems(); + }; + + removePlaylistItem(playlistItem) { + _.remove(this.playlistItems, (listedPlaylistItem) => { + return playlistItem === listedPlaylistItem; + }); + this.filterFoundPlaylistItems(); + }; + + savePlaylist(playlist, playlistItems) { + var savePromise; + + playlist.items = playlistItems; + + savePromise = playlist.id + ? this.backendSrv.put('/api/playlists/' + playlist.id, playlist) + : this.backendSrv.post('/api/playlists', playlist); + + savePromise + .then(() => { + this.$scope.appEvent('alert-success', ['Playlist saved', '']); + this.$location.path('/playlists'); + }, () => { + this.$scope.appEvent('alert-error', ['Unable to save playlist', '']); + }); + }; + + isNew() { + return !this.playlist.id; + }; + + isPlaylistEmpty() { + return !this.playlistItems.length; + }; + + isSearchResultsEmpty() { + return !this.foundPlaylistItems.length; + }; + + isSearchQueryEmpty() { + return this.searchQuery === ''; + }; + + backToList() { + this.$location.path('/playlists'); + }; + + isLoading() { + return this.loading; + }; + + movePlaylistItem(playlistItem, offset) { + var currentPosition = this.playlistItems.indexOf(playlistItem); + var newPosition = currentPosition + offset; + + if (newPosition >= 0 && newPosition < this.playlistItems.length) { + this.playlistItems.splice(currentPosition, 1); + this.playlistItems.splice(newPosition, 0, playlistItem); + } + }; + + movePlaylistItemUp(playlistItem) { + this.movePlaylistItem(playlistItem, -1); + }; + + movePlaylistItemDown(playlistItem) { + this.movePlaylistItem(playlistItem, 1); + }; +} + +coreModule.controller('PlaylistEditCtrl', PlaylistEditCtrl); diff --git a/public/app/features/playlist/playlist_routes.js b/public/app/features/playlist/playlist_routes.js index 2de1f7b30c8..a3f9cc26f8c 100644 --- a/public/app/features/playlist/playlist_routes.js +++ b/public/app/features/playlist/playlist_routes.js @@ -1,4 +1,4 @@ -define([ + define([ 'angular', 'app/core/config', 'lodash' @@ -12,14 +12,17 @@ function (angular) { $routeProvider .when('/playlists', { templateUrl: 'app/features/playlist/partials/playlists.html', + controllerAs: 'ctrl', controller : 'PlaylistsCtrl' }) .when('/playlists/create', { templateUrl: 'app/features/playlist/partials/playlist.html', + controllerAs: 'ctrl', controller : 'PlaylistEditCtrl' }) .when('/playlists/edit/:id', { templateUrl: 'app/features/playlist/partials/playlist.html', + controllerAs: 'ctrl', controller : 'PlaylistEditCtrl' }) .when('/playlists/play/:id', { diff --git a/public/app/features/playlist/playlists_ctrl.js b/public/app/features/playlist/playlists_ctrl.js deleted file mode 100644 index 375492e6772..00000000000 --- a/public/app/features/playlist/playlists_ctrl.js +++ /dev/null @@ -1,43 +0,0 @@ -define([ - 'angular', - 'lodash' -], -function (angular, _) { - 'use strict'; - - var module = angular.module('grafana.controllers'); - - module.controller('PlaylistsCtrl', function($scope, $location, backendSrv) { - backendSrv.get('/api/playlists') - .then(function(result) { - $scope.playlists = result; - }); - - $scope.removePlaylistConfirmed = function(playlist) { - _.remove($scope.playlists, {id: playlist.id}); - - backendSrv.delete('/api/playlists/' + playlist.id) - .then(function() { - $scope.appEvent('alert-success', ['Playlist deleted', '']); - }, function() { - $scope.appEvent('alert-error', ['Unable to delete playlist', '']); - $scope.playlists.push(playlist); - }); - }; - - $scope.removePlaylist = function(playlist) { - - $scope.appEvent('confirm-modal', { - title: 'Confirm delete playlist', - text: 'Are you sure you want to delete playlist ' + playlist.name + '?', - yesText: "Delete", - icon: "fa-warning", - onConfirm: function() { - $scope.removePlaylistConfirmed(playlist); - } - }); - - }; - - }); -}); diff --git a/public/app/features/playlist/playlists_ctrl.ts b/public/app/features/playlist/playlists_ctrl.ts new file mode 100644 index 00000000000..af687a9698a --- /dev/null +++ b/public/app/features/playlist/playlists_ctrl.ts @@ -0,0 +1,45 @@ +/// + +import angular from 'angular'; +import _ from 'lodash'; +import coreModule from '../../core/core_module'; + +export class PlaylistsCtrl { + playlists: any; + + /** @ngInject */ + constructor(private $scope, private $location, private backendSrv) { + backendSrv.get('/api/playlists') + .then((result) => { + this.playlists = result; + }); + } + + removePlaylistConfirmed(playlist) { + _.remove(this.playlists, { id: playlist.id }); + + this.backendSrv.delete('/api/playlists/' + playlist.id) + .then(() => { + this.$scope.appEvent('alert-success', ['Playlist deleted', '']); + }, () => { + this.$scope.appEvent('alert-error', ['Unable to delete playlist', '']); + this.playlists.push(playlist); + }); + }; + + removePlaylist(playlist) { + + this.$scope.appEvent('confirm-modal', { + title: 'Confirm delete playlist', + text: 'Are you sure you want to delete playlist ' + playlist.name + '?', + yesText: "Delete", + icon: "fa-warning", + onConfirm: () => { + this.removePlaylistConfirmed(playlist); + } + }); + + }; +} + +coreModule.controller('PlaylistsCtrl', PlaylistsCtrl); From a7de2ceae4fb1e520477a2fdc2d9af6e9c97b25f Mon Sep 17 00:00:00 2001 From: bergquist Date: Thu, 28 Jan 2016 20:06:50 +0100 Subject: [PATCH 02/15] feat(playlist): basic UI support for tags --- public/app/features/playlist/all.js | 1 + .../features/playlist/partials/playlist.html | 51 +++++----- .../playlist/partials/playlist_search.html | 26 +++++ .../features/playlist/playlist_edit_ctrl.ts | 59 ++++++----- .../app/features/playlist/playlist_search.ts | 95 ++++++++++++++++++ public/less/grafana.less | 1 + public/less/playlist.less | 99 +++++++++++++++++++ 7 files changed, 281 insertions(+), 51 deletions(-) create mode 100644 public/app/features/playlist/partials/playlist_search.html create mode 100644 public/app/features/playlist/playlist_search.ts create mode 100644 public/less/playlist.less diff --git a/public/app/features/playlist/all.js b/public/app/features/playlist/all.js index a37de0f4612..3b07b0d74c5 100644 --- a/public/app/features/playlist/all.js +++ b/public/app/features/playlist/all.js @@ -1,5 +1,6 @@ define([ './playlists_ctrl', + './playlist_search', './playlist_srv', './playlist_edit_ctrl', './playlist_routes' diff --git a/public/app/features/playlist/partials/playlist.html b/public/app/features/playlist/partials/playlist.html index ca5cd05a997..c2a7cda09e1 100644 --- a/public/app/features/playlist/partials/playlist.html +++ b/public/app/features/playlist/partials/playlist.html @@ -39,34 +39,24 @@
    -

    Add dashboards

    -
    -
    -
      -
    • - Search -
    • -
    • - -
    • -
    -
    -
    -
    -
    Search results ({{ctrl.filteredPlaylistItems.length}})
    +
    Add dashboards
    +
    + +
    +
    +
    + +
    +
    +
    Search results ({{ctrl.filteredDashboards.length}})
    {{playlistItem.title}} - - -
    {{playlist.name}} - +
    - + @@ -77,13 +67,22 @@ - - -
    {{playlistItem.title}}
    - Search results empty -
    +
    Added dashboards
    diff --git a/public/app/features/playlist/partials/playlist_search.html b/public/app/features/playlist/partials/playlist_search.html new file mode 100644 index 00000000000..01edcb413c0 --- /dev/null +++ b/public/app/features/playlist/partials/playlist_search.html @@ -0,0 +1,26 @@ +
    + + + + +
    diff --git a/public/app/features/playlist/playlist_edit_ctrl.ts b/public/app/features/playlist/playlist_edit_ctrl.ts index f8f4a29fd5c..e684ba91ecf 100644 --- a/public/app/features/playlist/playlist_edit_ctrl.ts +++ b/public/app/features/playlist/playlist_edit_ctrl.ts @@ -6,14 +6,16 @@ import coreModule from '../../core/core_module'; import config from 'app/core/config'; export class PlaylistEditCtrl { - filteredPlaylistItems: any = []; - foundPlaylistItems: any = []; + filteredDashboards: any = []; + filteredTags: any = []; searchQuery: string = ''; loading: boolean = false; playlist: any = { interval: '10m', }; playlistItems: any = []; + dashboardresult: any = []; + tagresult: any = []; /** @ngInject */ constructor(private $scope, private playlistSrv, private backendSrv, private $location, private $route) { @@ -30,35 +32,18 @@ export class PlaylistEditCtrl { this.playlistItems = result; }); } - - this.search(); } - search() { - var query: any = {limit: 10}; - - if (this.searchQuery) { - query.query = this.searchQuery; - } - - this.loading = true; - - this.backendSrv.search(query) - .then((results) => { - this.foundPlaylistItems = results; - this.filterFoundPlaylistItems(); - }) - .finally(() => { - this.loading = false; - }); - }; - filterFoundPlaylistItems() { - this.filteredPlaylistItems = _.reject(this.foundPlaylistItems, (playlistItem) => { + console.log('filter !'); + console.log(this.dashboardresult); + this.filteredDashboards = _.reject(this.dashboardresult, (playlistItem) => { return _.findWhere(this.playlistItems, (listPlaylistItem) => { return parseInt(listPlaylistItem.value) === playlistItem.id; }); }); + + this.filteredTags = this.tagresult; }; addPlaylistItem(playlistItem) { @@ -70,6 +55,20 @@ export class PlaylistEditCtrl { this.filterFoundPlaylistItems(); }; + addTagPlaylistItem(tag) { + console.log(tag); + + var playlistItem: any = { + value: tag.term, + type: 'dashboard_by_tag', + order: this.playlistItems.length + 1, + title: tag.term + }; + + this.playlistItems.push(playlistItem); + this.filterFoundPlaylistItems(); + } + removePlaylistItem(playlistItem) { _.remove(this.playlistItems, (listedPlaylistItem) => { return playlistItem === listedPlaylistItem; @@ -104,7 +103,7 @@ export class PlaylistEditCtrl { }; isSearchResultsEmpty() { - return !this.foundPlaylistItems.length; + return !this.dashboardresult.length; }; isSearchQueryEmpty() { @@ -119,6 +118,16 @@ export class PlaylistEditCtrl { return this.loading; }; + searchStarted(promise) { + promise.then((data) => { + console.log('searchStarted: ', data); + + this.dashboardresult = data.dashboardResult; + this.tagresult = data.tagResult; + this.filterFoundPlaylistItems(); + }); + }; + movePlaylistItem(playlistItem, offset) { var currentPosition = this.playlistItems.indexOf(playlistItem); var newPosition = currentPosition + offset; diff --git a/public/app/features/playlist/playlist_search.ts b/public/app/features/playlist/playlist_search.ts new file mode 100644 index 00000000000..cf16f4fbfa4 --- /dev/null +++ b/public/app/features/playlist/playlist_search.ts @@ -0,0 +1,95 @@ +/// + +import angular from 'angular'; +import config from 'app/core/config'; +import _ from 'lodash'; +import $ from 'jquery'; +import coreModule from '../../core/core_module'; + +export class PlaylistSearchCtrl { + query: any; + tagsMode: boolean; + + searchStarted: any; + + /** @ngInject */ + constructor(private $scope, private $location, private $timeout, private backendSrv, private contextSrv) { + this.query = { query: '', tag: [], starred: false }; + + $timeout(() => { + this.query.query = ''; + this.searchDashboards(); + }, 100); + } + + searchDashboards() { + this.tagsMode = false; + var prom: any = {}; + + /* + prom.promise = this.backendSrv.search(this.query).then((results) => { + console.log('playlist_search_ctrl: ', results); + return results; + }); + */ + prom.promise = this.backendSrv.search(this.query).then((result) => { + return { + dashboardResult: result, + tagResult: [] + }; + }); + + this.searchStarted(prom); + } + + queryHasNoFilters() { + return this.query.query === '' && this.query.starred === false && this.query.tag.length === 0; + }; + + filterByTag(tag, evt) { + this.query.tag.push(tag); + this.searchDashboards(); + if (evt) { + evt.stopPropagation(); + evt.preventDefault(); + } + }; + + getTags() { + var prom: any = {}; + prom.promise = this.backendSrv.get('/api/dashboards/tags').then((result) => { + console.log('getTags: result', result); + return { + dashboardResult: [], + tagResult: result + }; + }); + + this.searchStarted(prom); + /* + this.searchStarted(prom); + + return this.backendSrv.get('/api/dashboards/tags').then((results) => { + this.tagsMode = true; + + + console.log(results); + }); + */ + }; +} + +export function playlistSearchDirective() { + return { + restrict: 'E', + templateUrl: 'app/features/playlist/partials/playlist_search.html', + controller: PlaylistSearchCtrl, + bindToController: true, + controllerAs: 'ctrl', + scope: { + searchStarted: '&' + }, + }; +} + +coreModule.directive('playlistSearch', playlistSearchDirective); diff --git a/public/less/grafana.less b/public/less/grafana.less index 9cf3630db3e..d10409d55df 100644 --- a/public/less/grafana.less +++ b/public/less/grafana.less @@ -8,6 +8,7 @@ @import "bootstrap-tagsinput.less"; @import "tables_lists.less"; @import "search.less"; +@import "playlist.less"; @import "panel.less"; @import "forms.less"; @import "tightform.less"; diff --git a/public/less/playlist.less b/public/less/playlist.less new file mode 100644 index 00000000000..d120ca22548 --- /dev/null +++ b/public/less/playlist.less @@ -0,0 +1,99 @@ +.playlist-search-container { + //left: 59px; + //top: 39px; + margin: 15px; + z-index: 1000; + //position: relative; + position: relative; + width: 700px; + box-shadow: 0px 0px 55px 0px black; + //padding: 10px; + background-color: @grafanaPanelBackground; + //border: 1px solid @grafanaTargetFuncBackground; + + .label-tag { + margin-left: 6px; + font-size: 11px; + padding: 2px 6px; + } +} + +.playlist-search-switches { + position: relative; + top: -39px; + right: -268px; +} + +.playlist-search-field-wrapper { + //padding-bottom: 10px; + input { + width: 100%; + padding: 8px 8px; + height: 100%; + box-sizing: border-box; + } + button { + margin: 0 4px 0 0; + } + > span { + display: block; + overflow: hidden; + } +} + +.playlist-search-results-container { + min-height: 100px; + overflow: auto; + display: block; + line-height: 28px; + + .search-item:hover, .search-item.selected { + background-color: @grafanaListHighlight; + } + + .selected { + .search-result-tag { + opacity: 0.70; + color: white; + } + } + + .fa-star, .fa-star-o { + padding-left: 13px; + } + + .fa-star { + color: @orange; + } + + .search-result-link { + color: @grafanaListMainLinkColor; + .fa { + padding-right: 10px; + } + } + + .search-item { + display: block; + padding: 3px 10px; + white-space: nowrap; + background-color: @grafanaListBackground; + margin-bottom: 4px; + .search-result-icon:before { + content: "\f009"; + } + + &.search-item-dash-home .search-result-icon:before { + content: "\f015"; + } + } + + .search-result-tags { + float: right; + } + + .search-result-actions { + float: right; + padding-left: 20px; + } +} \ No newline at end of file From f36ade295906c6e3ba93c65d980428aa14ce56c0 Mon Sep 17 00:00:00 2001 From: bergquist Date: Thu, 28 Jan 2016 22:43:54 +0100 Subject: [PATCH 03/15] chore(playlist): cleanup some code --- .../playlist/partials/playlist_search.html | 2 +- .../app/features/playlist/playlist_search.ts | 21 +++++-------------- public/less/playlist.less | 8 +------ 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/public/app/features/playlist/partials/playlist_search.html b/public/app/features/playlist/partials/playlist_search.html index 01edcb413c0..e3005c1b74b 100644 --- a/public/app/features/playlist/partials/playlist_search.html +++ b/public/app/features/playlist/partials/playlist_search.html @@ -1,6 +1,6 @@
    -
    diff --git a/public/app/features/playlist/playlist_search.ts b/public/app/features/playlist/playlist_search.ts index cf16f4fbfa4..8996ec5d104 100644 --- a/public/app/features/playlist/playlist_search.ts +++ b/public/app/features/playlist/playlist_search.ts @@ -26,12 +26,6 @@ export class PlaylistSearchCtrl { this.tagsMode = false; var prom: any = {}; - /* - prom.promise = this.backendSrv.search(this.query).then((results) => { - console.log('playlist_search_ctrl: ', results); - return results; - }); - */ prom.promise = this.backendSrv.search(this.query).then((result) => { return { dashboardResult: result, @@ -42,6 +36,11 @@ export class PlaylistSearchCtrl { this.searchStarted(prom); } + showStarred() { + this.query.starred = !this.query.starred; + this.searchDashboards(); + }; + queryHasNoFilters() { return this.query.query === '' && this.query.starred === false && this.query.tag.length === 0; }; @@ -66,16 +65,6 @@ export class PlaylistSearchCtrl { }); this.searchStarted(prom); - /* - this.searchStarted(prom); - - return this.backendSrv.get('/api/dashboards/tags').then((results) => { - this.tagsMode = true; - - - console.log(results); - }); - */ }; } diff --git a/public/less/playlist.less b/public/less/playlist.less index d120ca22548..5aa5e960979 100644 --- a/public/less/playlist.less +++ b/public/less/playlist.less @@ -1,15 +1,10 @@ .playlist-search-container { - //left: 59px; - //top: 39px; margin: 15px; z-index: 1000; - //position: relative; position: relative; width: 700px; box-shadow: 0px 0px 55px 0px black; - //padding: 10px; background-color: @grafanaPanelBackground; - //border: 1px solid @grafanaTargetFuncBackground; .label-tag { margin-left: 6px; @@ -21,11 +16,10 @@ .playlist-search-switches { position: relative; top: -39px; - right: -268px; + left: 260px; } .playlist-search-field-wrapper { - //padding-bottom: 10px; input { width: 100%; padding: 8px 8px; From 3ccf7c8006fd9e87ea785a4a75ca3bfeb34b30e3 Mon Sep 17 00:00:00 2001 From: bergquist Date: Thu, 28 Jan 2016 23:04:22 +0100 Subject: [PATCH 04/15] feat(playlist): improve the look of tag playlist items --- public/app/features/playlist/partials/playlist.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/public/app/features/playlist/partials/playlist.html b/public/app/features/playlist/partials/playlist.html index c2a7cda09e1..b82f00f69f9 100644 --- a/public/app/features/playlist/partials/playlist.html +++ b/public/app/features/playlist/partials/playlist.html @@ -87,9 +87,16 @@
    Added dashboards
    - + +
    + {{playlistItem.title}} + + + {{playlistItem.title}} + +