From a47183f74010b91a76b3bde71f964106980b093d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 11 Apr 2017 07:43:40 +0200 Subject: [PATCH 001/584] ux: panel title ux improvements poc --- public/app/features/panel/panel_menu.js | 12 ++++- public/sass/_variables.dark.scss | 3 +- public/sass/_variables.light.scss | 3 +- public/sass/components/_cards.scss | 2 +- public/sass/pages/_dashboard.scss | 61 +++++++++++++++++++++---- 5 files changed, 69 insertions(+), 12 deletions(-) diff --git a/public/app/features/panel/panel_menu.js b/public/app/features/panel/panel_menu.js index 2e71fd19ff5..a78753d0944 100644 --- a/public/app/features/panel/panel_menu.js +++ b/public/app/features/panel/panel_menu.js @@ -11,10 +11,17 @@ function (angular, $, _, Tether) { .module('grafana.directives') .directive('panelMenu', function($compile) { var linkTemplate = - '' + + '' + '' + '{{ctrl.panel.title | interpolateTemplateVars:this}}' + + '' + ' {{ctrl.timeInfo}}' + + '' + ''; function createMenuTemplate(ctrl) { @@ -100,6 +107,9 @@ function (angular, $, _, Tether) { } var showMenu = function(e) { + if (true) { + return; + } // if menu item is clicked and menu was just removed from dom ignore this event if (!$.contains(document, e.target)) { return; diff --git a/public/sass/_variables.dark.scss b/public/sass/_variables.dark.scss index 8ecad9e3287..e3030df387a 100644 --- a/public/sass/_variables.dark.scss +++ b/public/sass/_variables.dark.scss @@ -89,7 +89,8 @@ $component-active-bg: $brand-primary !default; // Panel // ------------------------- $panel-bg: $dark-2; -$panel-border: solid 1px $dark-3; +$panel-border-color: $dark-3; +$panel-border: solid 1px $panel-border-color; $panel-drop-zone-bg: repeating-linear-gradient(-128deg, #111, #111 10px, #191919 10px, #222 20px); $panel-menu-border: solid 1px black; diff --git a/public/sass/_variables.light.scss b/public/sass/_variables.light.scss index c089be378b4..438dde22e21 100644 --- a/public/sass/_variables.light.scss +++ b/public/sass/_variables.light.scss @@ -96,7 +96,8 @@ $component-active-bg: $brand-primary !default; // ------------------------- $panel-bg: $gray-7; -$panel-border: solid 1px $gray-6; +$panel-border-color: $gray-5; +$panel-border: solid 1px $panel-border-color; $panel-drop-zone-bg: repeating-linear-gradient(-128deg, $body-bg, $body-bg 10px, $gray-6 10px, $gray-6 20px); $panel-menu-border: solid 1px white; diff --git a/public/sass/components/_cards.scss b/public/sass/components/_cards.scss index 6dba94494b1..3f17d9e94b7 100644 --- a/public/sass/components/_cards.scss +++ b/public/sass/components/_cards.scss @@ -27,7 +27,7 @@ &:nth-child(2) { border-radius: 3px 0 0 3px; - border-right: 1px solid $panel-border; + border-right: $panel-border; } &:nth-child(1) { diff --git a/public/sass/pages/_dashboard.scss b/public/sass/pages/_dashboard.scss index beaf463fa8f..57cf74a9eb1 100644 --- a/public/sass/pages/_dashboard.scss +++ b/public/sass/pages/_dashboard.scss @@ -55,7 +55,7 @@ div.flot-text { .panel-title-container { min-height: 9px; - padding-top: 4px; + padding: 2px 0; cursor: pointer; word-wrap: break-word; } @@ -69,6 +69,16 @@ div.flot-text { display: block; } +.panel-title-caret { + color: $text-color-faint; + margin-left: 10px; + padding: 3px 5px; + + &:hover { + background: $dark-4; + } +} + .panel-loading { position:absolute; top: -3px; @@ -78,8 +88,43 @@ div.flot-text { .panel-header { text-align: center; + + &:hover { + background: $side-menu-bg; + + .panel-title-caret { + color: $text-color; + } + } } +.panel-dropdown-menu { + border: none; + left: 50%; + text-align: left; + transform: translateX(-50%); + background: $side-menu-bg; + box-shadow: $search-shadow; + + li a { + display: block; + white-space: nowrap; + color: $text-muted; + font-size: $font-size-sm; + padding: $spacer/2 $spacer; + border-left: 2px solid $side-menu-bg; + i { + display: inline-block; + padding-right: $spacer/2; + } + + &:hover { + @include left-brand-border-gradient(); + color: $link-color; + background: $input-label-bg; + } + } +} .panel-info-corner-inner { width: 0; @@ -181,13 +226,13 @@ div.flot-text { } } -.panel-highlight { - box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 5px rgba(82,168,236,10.8) -} - -.panel-hover-highlight { - box-shadow: inset 0 1px 1px rgba(0,0,0,0.025), 0 0 1px rgba(82,168,236,0.5) -} +// .panel-highlight { +// box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 5px rgba(82,168,236,10.8) +// } +// +// .panel-hover-highlight { +// box-shadow: inset 0 1px 1px rgba(0,0,0,0.025), 0 0 1px rgba(82,168,236,0.5) +// } .on-drag-hover { .panel-container { From 702978eff72e652a3e5dd99f9e53518ce10bb1be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 11 Apr 2017 10:05:30 +0200 Subject: [PATCH 002/584] ux: more work on panel menu --- public/app/core/routes/dashboard_loaders.js | 2 +- .../app/features/dashboard/row/add_panel.ts | 2 +- public/app/features/panel/all.js | 2 +- public/app/features/panel/panel_directive.ts | 2 +- public/app/features/panel/panel_header.ts | 45 +++++++++++++++++ public/app/features/panel/panel_menu.js | 6 --- public/sass/_variables.dark.scss | 2 + public/sass/_variables.light.scss | 1 + public/sass/components/_dropdown.scss | 10 ++-- public/sass/components/_row.scss | 2 +- public/sass/pages/_dashboard.scss | 49 ++++--------------- 11 files changed, 68 insertions(+), 55 deletions(-) create mode 100644 public/app/features/panel/panel_header.ts diff --git a/public/app/core/routes/dashboard_loaders.js b/public/app/core/routes/dashboard_loaders.js index 728b7e0092f..869f486fbfd 100644 --- a/public/app/core/routes/dashboard_loaders.js +++ b/public/app/core/routes/dashboard_loaders.js @@ -34,7 +34,7 @@ function (coreModule) { rows: [ { title: 'Dashboard Row', - height: '250px', + height: '350px', panels:[], isNew: true, } diff --git a/public/app/features/dashboard/row/add_panel.ts b/public/app/features/dashboard/row/add_panel.ts index 1ea0cc5159e..a5cdda2fb83 100644 --- a/public/app/features/dashboard/row/add_panel.ts +++ b/public/app/features/dashboard/row/add_panel.ts @@ -78,7 +78,7 @@ export class AddPanelCtrl { } addPanel(panelPluginInfo) { - var defaultSpan = 12; + var defaultSpan = 6; var span = 12 - this.row.span; var panel = { diff --git a/public/app/features/panel/all.js b/public/app/features/panel/all.js index 2f978e65345..72a70a6c8d7 100644 --- a/public/app/features/panel/all.js +++ b/public/app/features/panel/all.js @@ -1,5 +1,5 @@ define([ - './panel_menu', + './panel_header', './panel_directive', './solo_panel_ctrl', './query_ctrl', diff --git a/public/app/features/panel/panel_directive.ts b/public/app/features/panel/panel_directive.ts index 63fdba693cb..ba7e5ef0a01 100644 --- a/public/app/features/panel/panel_directive.ts +++ b/public/app/features/panel/panel_directive.ts @@ -19,7 +19,7 @@ var panelTemplate = ` -
+
diff --git a/public/app/features/panel/panel_header.ts b/public/app/features/panel/panel_header.ts new file mode 100644 index 00000000000..4c299d0d214 --- /dev/null +++ b/public/app/features/panel/panel_header.ts @@ -0,0 +1,45 @@ +/// + +import angular from 'angular'; +import {coreModule} from 'app/core/core'; + +var template = ` + + + {{ctrl.panel.title | interpolateTemplateVars:this}} + + + + + {{ctrl.timeInfo}} +`; + +/** @ngInject **/ +function panelHeader() { + return { + restrict: 'E', + template: template, + link: function() { + } + }; +} + +coreModule.directive('panelHeader', panelHeader); diff --git a/public/app/features/panel/panel_menu.js b/public/app/features/panel/panel_menu.js index a78753d0944..d6e414610d4 100644 --- a/public/app/features/panel/panel_menu.js +++ b/public/app/features/panel/panel_menu.js @@ -16,12 +16,6 @@ function (angular, $, _, Tether) { '{{ctrl.panel.title | interpolateTemplateVars:this}}' + '' + ' {{ctrl.timeInfo}}' + - '' + ''; function createMenuTemplate(ctrl) { diff --git a/public/sass/_variables.dark.scss b/public/sass/_variables.dark.scss index e3030df387a..57ab4d01aa9 100644 --- a/public/sass/_variables.dark.scss +++ b/public/sass/_variables.dark.scss @@ -192,6 +192,8 @@ $dropdownLinkColorActive: $white; $dropdownLinkBackgroundActive: $dark-4; $dropdownLinkBackgroundHover: $dark-4; +$dropdown-link-color: $gray-3; + // COMPONENT VARIABLES // -------------------------------------------------- diff --git a/public/sass/_variables.light.scss b/public/sass/_variables.light.scss index 438dde22e21..f6acd0a5930 100644 --- a/public/sass/_variables.light.scss +++ b/public/sass/_variables.light.scss @@ -204,6 +204,7 @@ $dropdownLinkColorActive: $link-color; $dropdownLinkBackgroundActive: $gray-6; $dropdownLinkBackgroundHover: $gray-6; +$dropdown-link-color: $gray-3; // COMPONENT VARIABLES // -------------------------------------------------- diff --git a/public/sass/components/_dropdown.scss b/public/sass/components/_dropdown.scss index 7b0cbc5fd36..073825b6010 100644 --- a/public/sass/components/_dropdown.scss +++ b/public/sass/components/_dropdown.scss @@ -31,7 +31,7 @@ width: 0; height: 0; vertical-align: top; - border-top: 4px solid $black; + border-top: 4px solid $text-color-weak; border-right: 4px solid transparent; border-left: 4px solid transparent; content: ""; @@ -192,7 +192,7 @@ .dropdown-submenu > .dropdown-menu { top: 0; left: 100%; - margin-top: -6px; + margin-top: 0px; margin-left: -1px; @include border-radius(0 6px 6px 6px); } @@ -218,9 +218,9 @@ height: 0; border-color: transparent; border-style: solid; - border-width: 5px 0 5px 5px; - border-left-color: darken($dropdownBackground, 20%); - margin-top: 5px; + border-width: 4px 0 4px 4px; + border-left-color: $text-color-weak; + margin-top: 4px; margin-right: -10px; } .dropdown-submenu:hover > a::after { diff --git a/public/sass/components/_row.scss b/public/sass/components/_row.scss index 840db839607..0d91cf8074d 100644 --- a/public/sass/components/_row.scss +++ b/public/sass/components/_row.scss @@ -147,7 +147,7 @@ $dash-row-menu-animation-speed: 0.20s; li a { display: block; white-space: nowrap; - color: $text-muted; + color: $dropdown-link-color; font-size: $font-size-sm; padding: $spacer/2 $spacer; border-left: 2px solid $side-menu-bg; diff --git a/public/sass/pages/_dashboard.scss b/public/sass/pages/_dashboard.scss index 57cf74a9eb1..5547d449bc2 100644 --- a/public/sass/pages/_dashboard.scss +++ b/public/sass/pages/_dashboard.scss @@ -56,22 +56,26 @@ div.flot-text { .panel-title-container { min-height: 9px; padding: 2px 0; - cursor: pointer; + cursor: move; word-wrap: break-word; + display: block; } .panel-title { border: 0px; font-weight: $font-weight-semi-bold; position: relative; - cursor: pointer; width: 100%; display: block; } -.panel-title-caret { +.panel-menu-container { + margin-left: 8px; +} + +.panel-menu-toggle { color: $text-color-faint; - margin-left: 10px; + cursor: pointer; padding: 3px 5px; &:hover { @@ -98,18 +102,16 @@ div.flot-text { } } -.panel-dropdown-menu { +.panel-menu { border: none; - left: 50%; text-align: left; - transform: translateX(-50%); background: $side-menu-bg; box-shadow: $search-shadow; li a { display: block; white-space: nowrap; - color: $text-muted; + color: $dropdown-link-color; font-size: $font-size-sm; padding: $spacer/2 $spacer; border-left: 2px solid $side-menu-bg; @@ -195,37 +197,6 @@ div.flot-text { margin-bottom: 20px; } -.panel-menu { - z-index: 500; - position: absolute; - background: $tight-form-func-bg; - border: $panel-menu-border; - - .panel-menu-row { - white-space: nowrap; - border-bottom: $panel-menu-border; - &:last-child { - border-bottom: none; - } - } - - .panel-menu-link, .panel-menu-icon { - padding: 5px 10px; - } - - .panel-menu-link { - display: inline-block; - border-right: $panel-menu-border; - &:last-child { - border: none; - } - } - - .dropdown-menu { - text-align: left; - } -} - // .panel-highlight { // box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 5px rgba(82,168,236,10.8) // } From 25683c688fffd3f6242eacb2ec9a43229d702bb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 8 Jun 2017 16:22:51 +0200 Subject: [PATCH 003/584] ux: minor progress on panel title menu makover --- public/app/features/panel/panel_header.ts | 17 ++++++++++++++++- public/sass/_variables.dark.scss | 3 ++- public/sass/_variables.light.scss | 3 ++- public/sass/components/_view_states.scss | 1 + public/sass/pages/_dashboard.scss | 14 +++++++------- 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/public/app/features/panel/panel_header.ts b/public/app/features/panel/panel_header.ts index 4c299d0d214..359a5cc4125 100644 --- a/public/app/features/panel/panel_header.ts +++ b/public/app/features/panel/panel_header.ts @@ -1,5 +1,6 @@ /// +import $ from 'jquery'; import angular from 'angular'; import {coreModule} from 'app/core/core'; @@ -37,7 +38,21 @@ function panelHeader() { return { restrict: 'E', template: template, - link: function() { + link: function(scope, elem, attrs) { + + elem.click(function(evt) { + const targetClass = evt.target.className; + + if (targetClass === 'panel-title-text drag-handle' || targetClass === 'panel-title drag-handle') { + evt.stopPropagation(); + elem.find('[data-toggle=dropdown]').dropdown('toggle'); + } + + // var toggleAttribute = evt.getAttribute('data-toggle'); + // if (!toggleAttribute) { + // elem.find('[data-toggle=dropdown]').click(); + // } + }); } }; } diff --git a/public/sass/_variables.dark.scss b/public/sass/_variables.dark.scss index ebac8eab5cc..b2b991d6b8b 100644 --- a/public/sass/_variables.dark.scss +++ b/public/sass/_variables.dark.scss @@ -92,7 +92,8 @@ $panel-bg: $dark-2; $panel-border-color: $dark-3; $panel-border: solid 1px $panel-border-color; $panel-drop-zone-bg: repeating-linear-gradient(-128deg, #111, #111 10px, #191919 10px, #222 20px); -$panel-menu-border: solid 1px black; +$panel-header-hover-bg: $dark-3; +$panel-header-menu-hover-bg: $dark-5; $divider-border-color: #555; diff --git a/public/sass/_variables.light.scss b/public/sass/_variables.light.scss index 50e39696f7f..26e3814797d 100644 --- a/public/sass/_variables.light.scss +++ b/public/sass/_variables.light.scss @@ -99,7 +99,8 @@ $panel-bg: $gray-7; $panel-border-color: $gray-5; $panel-border: solid 1px $panel-border-color; $panel-drop-zone-bg: repeating-linear-gradient(-128deg, $body-bg, $body-bg 10px, $gray-6 10px, $gray-6 20px); -$panel-menu-border: solid 1px white; +$panel-header-hover-bg: $gray-6; +$panel-header-menu-hover-bg: $gray-4; $divider-border-color: $gray-2; diff --git a/public/sass/components/_view_states.scss b/public/sass/components/_view_states.scss index 900c9d1489b..2a4cd62ae48 100644 --- a/public/sass/components/_view_states.scss +++ b/public/sass/components/_view_states.scss @@ -28,6 +28,7 @@ .panel-drop-zone .dashnav-refresh-action, .dashnav-zoom-out, + .panel-menu-container, .dashnav-action-icons, .panel-info-corner--info, .panel-info-corner--links, diff --git a/public/sass/pages/_dashboard.scss b/public/sass/pages/_dashboard.scss index e02ffefe5aa..a8a8726a11c 100644 --- a/public/sass/pages/_dashboard.scss +++ b/public/sass/pages/_dashboard.scss @@ -70,17 +70,13 @@ div.flot-text { } .panel-menu-container { - margin-left: 8px; + margin-left: 6px; } .panel-menu-toggle { color: $text-color-faint; cursor: pointer; padding: 3px 5px; - - &:hover { - background: $dark-4; - } } .panel-loading { @@ -94,11 +90,13 @@ div.flot-text { text-align: center; &:hover { - background: $side-menu-bg; + background: $panel-header-hover-bg; - .panel-title-caret { + .panel-menu-toggle { color: $text-color; + background: $panel-header-menu-hover-bg; } + } } @@ -107,6 +105,8 @@ div.flot-text { text-align: left; background: $side-menu-bg; box-shadow: $search-shadow; + top: 25px; + left: -100px; li a { display: block; From f3fe664f24ad9f39b30617d62cefcc72d4a9744d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 8 Jun 2017 16:57:37 +0200 Subject: [PATCH 004/584] ux: minor tweak to faintness of icons of panel menu caret --- public/sass/components/_row.scss | 2 +- public/sass/pages/_dashboard.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/sass/components/_row.scss b/public/sass/components/_row.scss index 0d91cf8074d..9c61ac332f8 100644 --- a/public/sass/components/_row.scss +++ b/public/sass/components/_row.scss @@ -167,7 +167,7 @@ $dash-row-menu-animation-speed: 0.20s; .dash-row-menu-grip { text-align: center; font-size: 130%; - color: $text-color-faint; + color: $text-color-weak; opacity: 1; transition: $dash-row-menu-animation-speed ease-out 0.5s; width: 1rem; diff --git a/public/sass/pages/_dashboard.scss b/public/sass/pages/_dashboard.scss index a8a8726a11c..bd4416963c6 100644 --- a/public/sass/pages/_dashboard.scss +++ b/public/sass/pages/_dashboard.scss @@ -74,7 +74,7 @@ div.flot-text { } .panel-menu-toggle { - color: $text-color-faint; + color: $text-color-weak; cursor: pointer; padding: 3px 5px; } From ef9fa7b0cc94d4e678116923ffbb24c6bb425bba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 8 Jun 2017 22:17:43 +0200 Subject: [PATCH 005/584] ux: very early start to new sidemenu --- public/app/core/components/navbar/navbar.html | 3 -- .../core/components/sidemenu/sidemenu.html | 2 -- public/sass/_variables.dark.scss | 9 ++++-- public/sass/_variables.light.scss | 5 ++- public/sass/_variables.scss | 2 +- public/sass/components/_navbar.scss | 21 ------------- public/sass/components/_row.scss | 4 +-- public/sass/components/_sidemenu.scss | 31 +++++++++++-------- 8 files changed, 31 insertions(+), 46 deletions(-) diff --git a/public/app/core/components/navbar/navbar.html b/public/app/core/components/navbar/navbar.html index ea8eb21d6d6..bed1ef0e270 100644 --- a/public/app/core/components/navbar/navbar.html +++ b/public/app/core/components/navbar/navbar.html @@ -3,9 +3,6 @@ - - - diff --git a/public/app/core/components/sidemenu/sidemenu.html b/public/app/core/components/sidemenu/sidemenu.html index 8aa3c6ae571..cc28175bd95 100644 --- a/public/app/core/components/sidemenu/sidemenu.html +++ b/public/app/core/components/sidemenu/sidemenu.html @@ -13,7 +13,6 @@ {{::ctrl.user.orgName}}
- + + + Find more plugins on Grafana.com + + + +
+ + +
    +
  1. + +
    +
    + + {{plugin.type}} +
    +
    + Update available! +
    +
    +
    +
    + +
    +
    +
    {{plugin.name}}
    +
    By {{plugin.info.author.name}}
    +
    +
    +
    +
  2. +
+
diff --git a/public/sass/_variables.dark.scss b/public/sass/_variables.dark.scss index 6172fc77515..5eef1264aca 100644 --- a/public/sass/_variables.dark.scss +++ b/public/sass/_variables.dark.scss @@ -299,7 +299,7 @@ $checkboxImageUrl: '../img/checkbox.png'; $info-box-background: linear-gradient(100deg, #1a4552, #00374a); // footer -$footer-link-color: $gray-1; +$footer-link-color: $gray-2; $footer-link-hover: $gray-4; // collapse box diff --git a/public/views/index.template.html b/public/views/index.template.html index da72f16161d..e022cc4873b 100644 --- a/public/views/index.template.html +++ b/public/views/index.template.html @@ -35,44 +35,46 @@ -
-
+
+
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
From 08d470d76a94015287e66ff8c7a2d969d1febd74 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Wed, 29 Nov 2017 12:51:14 +0300 Subject: [PATCH 312/584] dashboard: initial repeat row implementation --- .../app/features/dashboard/dashboard_model.ts | 78 +++++++++++++------ .../features/dashboard/specs/repeat.jest.ts | 16 ++-- 2 files changed, 67 insertions(+), 27 deletions(-) diff --git a/public/app/features/dashboard/dashboard_model.ts b/public/app/features/dashboard/dashboard_model.ts index 0e37acb201a..9481ef6d63b 100644 --- a/public/app/features/dashboard/dashboard_model.ts +++ b/public/app/features/dashboard/dashboard_model.ts @@ -274,7 +274,7 @@ export class DashboardModel { return sourcePanel; } - var clone = new PanelModel(sourcePanel.getSaveModel()); + let clone = new PanelModel(sourcePanel.getSaveModel()); clone.id = this.getNextPanelId(); if (sourcePanel.type === 'row') { @@ -282,7 +282,7 @@ export class DashboardModel { let rowPanels = this.getRowPanels(sourcePanelIndex); clone.panels = _.map(rowPanels, panel => panel.getSaveModel()); - // insert after preceding row's panels + // insert copied row after preceding row's panels let insertPos = sourcePanelIndex + ((rowPanels.length + 1)*valueIndex); this.panels.splice(insertPos, 0, clone); } else { @@ -300,12 +300,12 @@ export class DashboardModel { } repeatPanel(panel: PanelModel, panelIndex: number) { - var variable = _.find(this.templating.list, {name: panel.repeat}); + let variable = _.find(this.templating.list, {name: panel.repeat}); if (!variable) { return; } - var selected; + let selected; if (variable.current.text === 'All') { selected = variable.options.slice(1, variable.options.length); } else { @@ -317,38 +317,72 @@ export class DashboardModel { let yPos = panel.gridPos.y; for (let index = 0; index < selected.length; index++) { - var option = selected[index]; - var copy = this.getPanelRepeatClone(panel, index, panelIndex); + let option = selected[index]; + let copy = this.getPanelRepeatClone(panel, index, panelIndex); copy.scopedVars = {}; copy.scopedVars[variable.name] = option; if (copy.type === 'row') { // place row below row panels - } + let rowHeight = this.getRowHeight(copy); + if (rowHeight) { + copy.gridPos.y += rowHeight * index; + let rowPanels = copy.panels; + // insert after preceding row's panels + let insertPos = panelIndex + ((rowPanels.length + 1) * index) + 1; + _.each(rowPanels, (rowPanel, i) => { + let cloneRowPanel = new PanelModel(rowPanel); + cloneRowPanel.id = this.getNextPanelId(); + cloneRowPanel.repeatIteration = this.iteration; + cloneRowPanel.repeatPanelId = rowPanel.id; + cloneRowPanel.repeat = null; + cloneRowPanel.gridPos.y += rowHeight * index; + this.panels.splice(insertPos+i, 0, cloneRowPanel); + }); + copy.panels = []; + yPos += rowHeight; - if (panel.repeatDirection === REPEAT_DIR_VERTICAL) { - copy.gridPos.y = yPos; - yPos += copy.gridPos.h; + // Update gridPos for panels below + for (let i = insertPos+rowPanels.length; i< this.panels.length; i++) { + this.panels[i].gridPos.y += yPos; + } + } } else { - // set width based on how many are selected - // assumed the repeated panels should take up full row width - - copy.gridPos.w = Math.max(GRID_COLUMN_COUNT / selected.length, minWidth); - copy.gridPos.x = xPos; - copy.gridPos.y = yPos; - - xPos += copy.gridPos.w; - - // handle overflow by pushing down one row - if (xPos + copy.gridPos.w > GRID_COLUMN_COUNT) { - xPos = 0; + if (panel.repeatDirection === REPEAT_DIR_VERTICAL) { + copy.gridPos.y = yPos; yPos += copy.gridPos.h; + } else { + // set width based on how many are selected + // assumed the repeated panels should take up full row width + + copy.gridPos.w = Math.max(GRID_COLUMN_COUNT / selected.length, minWidth); + copy.gridPos.x = xPos; + copy.gridPos.y = yPos; + + xPos += copy.gridPos.w; + + // handle overflow by pushing down one row + if (xPos + copy.gridPos.w > GRID_COLUMN_COUNT) { + xPos = 0; + yPos += copy.gridPos.h; + } } } } } + getRowHeight(rowPanel: PanelModel): number { + if (!rowPanel.panels || rowPanel.panels.length === 0) { + return 0; + } + const positions = _.map(rowPanel.panels, 'gridPos'); + const maxPos = _.maxBy(positions, (pos) => { + return pos.y + pos.h; + }); + return maxPos.h + 1; + } + removePanel(panel: PanelModel) { var index = _.indexOf(this.panels, panel); this.panels.splice(index, 1); diff --git a/public/app/features/dashboard/specs/repeat.jest.ts b/public/app/features/dashboard/specs/repeat.jest.ts index 2ad1400990c..7f5d382fe9c 100644 --- a/public/app/features/dashboard/specs/repeat.jest.ts +++ b/public/app/features/dashboard/specs/repeat.jest.ts @@ -1,3 +1,4 @@ +import _ from 'lodash'; import {DashboardModel} from '../dashboard_model'; jest.mock('app/core/services/context_srv', () => ({ @@ -146,7 +147,7 @@ describe('given dashboard with panel repeat in vertical direction', function() { }); }); -describe.skip('given dashboard with row repeat', function() { +describe('given dashboard with row repeat', function() { var dashboard; beforeEach(function() { @@ -177,14 +178,19 @@ describe.skip('given dashboard with row repeat', function() { }); it('should not repeat only row', function() { - expect(dashboard.panels[1].type).toBe('graph'); + const panel_types = _.map(dashboard.panels, 'type'); + expect(panel_types).toEqual([ + 'row', 'graph', 'graph', + 'row', 'graph', 'graph', + 'row', 'graph' + ]); }); - // + // it('should set scopedVars on panels', function() { // expect(dashboard.panels[1].scopedVars).toMatchObject({apps: {text: 'se1', value: 'se1'}}) // }); - // - // it.skip('should repeat row and panels below two times', function() { + + // it('should repeat row and panels below two times', function() { // expect(dashboard.panels).toMatchObject([ // // first (original row) // {id: 1, type: 'row', repeat: 'apps', gridPos: {x: 0, y: 0, h: 1 , w: 24}}, From dd9c727e6050c515c62b5a97955b4a16c606eec5 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Wed, 29 Nov 2017 14:14:43 +0300 Subject: [PATCH 313/584] repeat row: handle collapsed rows --- .../app/features/dashboard/dashboard_model.ts | 71 +++++++++++++------ .../features/dashboard/specs/repeat.jest.ts | 56 ++++++++++++++- 2 files changed, 104 insertions(+), 23 deletions(-) diff --git a/public/app/features/dashboard/dashboard_model.ts b/public/app/features/dashboard/dashboard_model.ts index 9481ef6d63b..cc5c743cb41 100644 --- a/public/app/features/dashboard/dashboard_model.ts +++ b/public/app/features/dashboard/dashboard_model.ts @@ -181,6 +181,14 @@ export class DashboardModel { if (panel.id > max) { max = panel.id; } + + if (panel.collapsed) { + for (let rowPanel of panel.panels) { + if (rowPanel.id > max) { + max = rowPanel.id; + } + } + } } return max + 1; @@ -266,6 +274,7 @@ export class DashboardModel { this.sortPanelsByGridPos(); this.events.emit('repeats-processed'); + console.log(this.panels); } getPanelRepeatClone(sourcePanel, valueIndex, sourcePanelIndex) { @@ -279,11 +288,18 @@ export class DashboardModel { if (sourcePanel.type === 'row') { // for row clones we need to figure out panels under row to clone and where to insert clone - let rowPanels = this.getRowPanels(sourcePanelIndex); - clone.panels = _.map(rowPanels, panel => panel.getSaveModel()); - - // insert copied row after preceding row's panels - let insertPos = sourcePanelIndex + ((rowPanels.length + 1)*valueIndex); + let rowPanels, insertPos; + if (sourcePanel.collapsed) { + rowPanels = sourcePanel.panels; + clone.panels = _.cloneDeep(rowPanels); + // insert copied row after preceding row + insertPos = sourcePanelIndex + valueIndex; + } else { + rowPanels = this.getRowPanels(sourcePanelIndex); + clone.panels = _.map(rowPanels, panel => panel.getSaveModel()); + // insert copied row after preceding row's panels + insertPos = sourcePanelIndex + ((rowPanels.length + 1)*valueIndex); + } this.panels.splice(insertPos, 0, clone); } else { // insert after source panel + value index @@ -324,27 +340,42 @@ export class DashboardModel { copy.scopedVars[variable.name] = option; if (copy.type === 'row') { - // place row below row panels let rowHeight = this.getRowHeight(copy); if (rowHeight) { - copy.gridPos.y += rowHeight * index; + let panelsBelowIndex; let rowPanels = copy.panels; - // insert after preceding row's panels + // insert after 'row' panel let insertPos = panelIndex + ((rowPanels.length + 1) * index) + 1; - _.each(rowPanels, (rowPanel, i) => { - let cloneRowPanel = new PanelModel(rowPanel); - cloneRowPanel.id = this.getNextPanelId(); - cloneRowPanel.repeatIteration = this.iteration; - cloneRowPanel.repeatPanelId = rowPanel.id; - cloneRowPanel.repeat = null; - cloneRowPanel.gridPos.y += rowHeight * index; - this.panels.splice(insertPos+i, 0, cloneRowPanel); - }); - copy.panels = []; - yPos += rowHeight; + + if (copy.collapsed) { + copy.gridPos.y += index; + yPos += index; + panelsBelowIndex = panelIndex + index + 1; + _.each(copy.panels, (panel, i) => { + panel.id = this.getNextPanelId(); + panel.repeatIteration = this.iteration; + panel.repeatPanelId = rowPanels[i].id; + panel.repeat = null; + copy.panels[i] = panel; + }); + } else { + _.each(rowPanels, (rowPanel, i) => { + let cloneRowPanel = new PanelModel(rowPanel); + cloneRowPanel.id = this.getNextPanelId(); + cloneRowPanel.repeatIteration = this.iteration; + cloneRowPanel.repeatPanelId = rowPanel.id; + cloneRowPanel.repeat = null; + cloneRowPanel.gridPos.y += rowHeight * index; + this.panels.splice(insertPos+i, 0, cloneRowPanel); + }); + copy.panels = []; + copy.gridPos.y += rowHeight * index; + yPos += rowHeight; + panelsBelowIndex = insertPos+rowPanels.length; + } // Update gridPos for panels below - for (let i = insertPos+rowPanels.length; i< this.panels.length; i++) { + for (let i = panelsBelowIndex; i< this.panels.length; i++) { this.panels[i].gridPos.y += yPos; } } diff --git a/public/app/features/dashboard/specs/repeat.jest.ts b/public/app/features/dashboard/specs/repeat.jest.ts index 7f5d382fe9c..cb1da3e767a 100644 --- a/public/app/features/dashboard/specs/repeat.jest.ts +++ b/public/app/features/dashboard/specs/repeat.jest.ts @@ -148,10 +148,10 @@ describe('given dashboard with panel repeat in vertical direction', function() { }); describe('given dashboard with row repeat', function() { - var dashboard; + let dashboard, dashboardJSON; beforeEach(function() { - dashboard = new DashboardModel({ + dashboardJSON = { panels: [ {id: 1, type: 'row', repeat: 'apps', gridPos: {x: 0, y: 0, h: 1 , w: 24}}, {id: 2, type: 'graph', gridPos: {x: 0, y: 1, h: 1 , w: 6}}, @@ -173,7 +173,8 @@ describe('given dashboard with row repeat', function() { ] }] } - }); + }; + dashboard = new DashboardModel(dashboardJSON); dashboard.processRepeats(); }); @@ -186,6 +187,55 @@ describe('given dashboard with row repeat', function() { ]); }); + it('should repeat only row if it is collapsed', function() { + dashboardJSON.panels = [ + { + id: 1, type: 'row', collapsed: true, repeat: 'apps', gridPos: {x: 0, y: 0, h: 1 , w: 24}, + panels: [ + {id: 2, type: 'graph', gridPos: {x: 0, y: 1, h: 1 , w: 6}}, + {id: 3, type: 'graph', gridPos: {x: 6, y: 1, h: 1 , w: 6}}, + ] + }, + {id: 4, type: 'row', gridPos: {x: 0, y: 1, h: 1 , w: 24}}, + {id: 5, type: 'graph', gridPos: {x: 0, y: 2, h: 1 , w: 12}}, + ]; + dashboard = new DashboardModel(dashboardJSON); + dashboard.processRepeats(); + + const panel_types = _.map(dashboard.panels, 'type'); + expect(panel_types).toEqual([ + 'row', 'row', 'row', 'graph' + ]); + expect(dashboard.panels[0].panels).toHaveLength(2); + expect(dashboard.panels[1].panels).toHaveLength(2); + }); + + it('should assign unique ids for repeated panels', function() { + dashboardJSON.panels = [ + { + id: 1, type: 'row', collapsed: true, repeat: 'apps', gridPos: {x: 0, y: 0, h: 1 , w: 24}, + panels: [ + {id: 2, type: 'graph', gridPos: {x: 0, y: 1, h: 1 , w: 6}}, + {id: 3, type: 'graph', gridPos: {x: 6, y: 1, h: 1 , w: 6}}, + ] + }, + {id: 4, type: 'row', gridPos: {x: 0, y: 1, h: 1 , w: 24}}, + {id: 5, type: 'graph', gridPos: {x: 0, y: 2, h: 1 , w: 12}}, + ]; + dashboard = new DashboardModel(dashboardJSON); + dashboard.processRepeats(); + + const panel_ids = _.flattenDeep(_.map(dashboard.panels, (panel) => { + let ids = []; + if (panel.panels && panel.panels.length) { + ids = _.map(panel.panels, 'id'); + } + ids.push(panel.id); + return ids; + })); + expect(panel_ids.length).toEqual(_.uniq(panel_ids).length); + }); + // it('should set scopedVars on panels', function() { // expect(dashboard.panels[1].scopedVars).toMatchObject({apps: {text: 'se1', value: 'se1'}}) // }); From d981fe4f045f13825605c75f6946549a9f783ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 29 Nov 2017 13:21:42 +0100 Subject: [PATCH 314/584] ux: search design update --- public/app/core/components/search/search.html | 7 +---- public/sass/_variables.dark.scss | 4 +-- public/sass/_variables.scss | 1 + public/sass/components/_search.scss | 28 +++++++++++++++---- public/sass/layout/_page.scss | 12 ++++---- public/sass/pages/_dashboard.scss | 2 +- 6 files changed, 34 insertions(+), 20 deletions(-) diff --git a/public/app/core/components/search/search.html b/public/app/core/components/search/search.html index dff9cc6947a..e3d99501d78 100644 --- a/public/app/core/components/search/search.html +++ b/public/app/core/components/search/search.html @@ -74,15 +74,10 @@
- + {{tag}} - - - - - diff --git a/public/sass/_variables.dark.scss b/public/sass/_variables.dark.scss index 5eef1264aca..a47e8fcae48 100644 --- a/public/sass/_variables.dark.scss +++ b/public/sass/_variables.dark.scss @@ -51,7 +51,7 @@ $critical: #ed2e18; // Scaffolding // ------------------------- $body-bg: rgb(23,24,25); -$page-bg: $dark-2; +$page-bg: rgb(22, 23, 25); $body-color: $gray-4; $text-color: $gray-4; $text-color-strong: $white; @@ -64,7 +64,7 @@ $text-shadow-faint: 1px 1px 4px rgb(45, 45, 45); // gradients $brand-gradient: linear-gradient(to right, rgba(255,213,0,0.7) 0%, rgba(255,68,0,0.7) 99%, rgba(255,68,0,0.7) 100%); -$page-gradient: linear-gradient(180deg, #222426 10px, rgba(15, 15, 16, .03) 100px, rgba(10, 10, 11, .03)); +$page-gradient: linear-gradient(180deg, #222426 10px, rgb(22, 23, 25) 100px); // Links // ------------------------- diff --git a/public/sass/_variables.scss b/public/sass/_variables.scss index f853c3e4387..19813cd6f1e 100644 --- a/public/sass/_variables.scss +++ b/public/sass/_variables.scss @@ -224,6 +224,7 @@ $side-menu-width: 60px; // dashboard $panel-margin: 10px; $dashboard-padding: $panel-margin * 2; +$panel-padding: 0px 10px 5px 10px; // tabs $tabs-padding-top: 0.6rem; diff --git a/public/sass/components/_search.scss b/public/sass/components/_search.scss index d7b8e00ded8..0c550e42922 100644 --- a/public/sass/components/_search.scss +++ b/public/sass/components/_search.scss @@ -69,6 +69,7 @@ padding: $spacer; position: relative; flex-grow: 10; + margin-bottom: 1rem; .label-tag { margin-left: 6px; @@ -84,9 +85,16 @@ } } +.search-section { + background: $panel-bg; + border: $panel-border; + padding: $panel-padding; + margin-bottom: 8px; +} + .search-section__header { font-size: $font-size-h6; - padding: 0.6rem 0; + padding: 8px 0 2px 0; color: $text-color-weak; display: flex; flex-grow: 1; @@ -105,7 +113,7 @@ } .search-section__header__icon { - padding: 3px 10px; + padding: 5px 10px; } .search-section__header__toggle { @@ -170,24 +178,34 @@ } .search-item__tags { - padding: 8px; + padding: 10px; } .search-item__actions { flex: 0 0 auto; + padding: 0 10px 0 0; } .search-item__actions__item { - display: none; + display: inline-block; + opacity: 0; + width: 0; + transition: all 0.2s ease-in-out; + .fa-star, .fa-star-o { + color: $orange; + line-height: 37px; + } } .search-item:hover { .search-item__actions__item { - opacity: 0.8; + width: 15px; + opacity: 1; } } .search-button-row { text-align: center; padding: $spacer*2 $spacer; + background: $panel-bg; } diff --git a/public/sass/layout/_page.scss b/public/sass/layout/_page.scss index 310ecd51532..e36e0301162 100644 --- a/public/sass/layout/_page.scss +++ b/public/sass/layout/_page.scss @@ -141,16 +141,16 @@ display: block; float: left; font-size: 12px; - line-height: 36px; + line-height: 30px; padding: 0 7px 0 37px; @include gradientBar($btn-inverse-bg, $btn-inverse-bg-hl, $btn-inverse-text-color); position: relative; box-shadow: $card-shadow; &:first-child { - padding-left: 13px; + padding-left: 10px; border-radius: 5px 0 0 5px; /*to match with the parent's radius*/ - font-size: 20px; + font-size: 18px; } &:first-child:before { @@ -178,11 +178,11 @@ content: ''; position: absolute; top: 0; - right: -18px; // half of square's length + right: -14px; // half of square's length // same dimension as the line-height of .breadcrumb-item - width: 36px; - height: 36px; + width: 30px; + height: 30px; transform: scale(0.707) rotate(45deg); // we need to prevent the arrows from getting buried under the next link diff --git a/public/sass/pages/_dashboard.scss b/public/sass/pages/_dashboard.scss index 766a900ae31..45f2e673372 100644 --- a/public/sass/pages/_dashboard.scss +++ b/public/sass/pages/_dashboard.scss @@ -42,7 +42,7 @@ div.flot-text { } .panel-content { - padding: 0px 10px 5px 10px; + padding: $panel-padding; height: calc(100% - 27px); position: relative; overflow: hidden; From 36ef1865875b677ec3b71de822c250e10b2fc4ac Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Wed, 29 Nov 2017 16:40:13 +0300 Subject: [PATCH 315/584] repeat row: expose scopedVars to row panels --- .../app/features/dashboard/dashboard_model.ts | 121 +++++++++++------- .../features/dashboard/specs/repeat.jest.ts | 17 +++ 2 files changed, 93 insertions(+), 45 deletions(-) diff --git a/public/app/features/dashboard/dashboard_model.ts b/public/app/features/dashboard/dashboard_model.ts index cc5c743cb41..c54a9460c08 100644 --- a/public/app/features/dashboard/dashboard_model.ts +++ b/public/app/features/dashboard/dashboard_model.ts @@ -274,7 +274,6 @@ export class DashboardModel { this.sortPanelsByGridPos(); this.events.emit('repeats-processed'); - console.log(this.panels); } getPanelRepeatClone(sourcePanel, valueIndex, sourcePanelIndex) { @@ -286,26 +285,43 @@ export class DashboardModel { let clone = new PanelModel(sourcePanel.getSaveModel()); clone.id = this.getNextPanelId(); - if (sourcePanel.type === 'row') { - // for row clones we need to figure out panels under row to clone and where to insert clone - let rowPanels, insertPos; - if (sourcePanel.collapsed) { - rowPanels = sourcePanel.panels; - clone.panels = _.cloneDeep(rowPanels); - // insert copied row after preceding row - insertPos = sourcePanelIndex + valueIndex; - } else { - rowPanels = this.getRowPanels(sourcePanelIndex); - clone.panels = _.map(rowPanels, panel => panel.getSaveModel()); - // insert copied row after preceding row's panels - insertPos = sourcePanelIndex + ((rowPanels.length + 1)*valueIndex); + // insert after source panel + value index + this.panels.splice(sourcePanelIndex+valueIndex, 0, clone); + + clone.repeatIteration = this.iteration; + clone.repeatPanelId = sourcePanel.id; + clone.repeat = null; + return clone; + } + + getRowRepeatClone(sourcePanel, valueIndex, sourcePanelIndex) { + // if first clone return source + if (valueIndex === 0) { + if (!sourcePanel.collapsed) { + let rowPanels = this.getRowPanels(sourcePanelIndex); + sourcePanel.panels = rowPanels; } - this.panels.splice(insertPos, 0, clone); - } else { - // insert after source panel + value index - this.panels.splice(sourcePanelIndex+valueIndex, 0, clone); + return sourcePanel; } + let clone = new PanelModel(sourcePanel.getSaveModel()); + clone.id = this.getNextPanelId(); + + // for row clones we need to figure out panels under row to clone and where to insert clone + let rowPanels, insertPos; + if (sourcePanel.collapsed) { + rowPanels = _.cloneDeep(sourcePanel.panels); + clone.panels = rowPanels; + // insert copied row after preceding row + insertPos = sourcePanelIndex + valueIndex; + } else { + rowPanels = this.getRowPanels(sourcePanelIndex); + clone.panels = _.map(rowPanels, panel => panel.getSaveModel()); + // insert copied row after preceding row's panels + insertPos = sourcePanelIndex + ((rowPanels.length + 1)*valueIndex); + } + this.panels.splice(insertPos, 0, clone); + clone.repeatIteration = this.iteration; clone.repeatPanelId = sourcePanel.id; clone.repeat = null; @@ -334,32 +350,43 @@ export class DashboardModel { for (let index = 0; index < selected.length; index++) { let option = selected[index]; - let copy = this.getPanelRepeatClone(panel, index, panelIndex); + let copy; - copy.scopedVars = {}; - copy.scopedVars[variable.name] = option; + if (panel.type === 'row') { + copy = this.getRowRepeatClone(panel, index, panelIndex); + copy.scopedVars = {}; + copy.scopedVars[variable.name] = option; - if (copy.type === 'row') { let rowHeight = this.getRowHeight(copy); - if (rowHeight) { - let panelsBelowIndex; - let rowPanels = copy.panels; - // insert after 'row' panel - let insertPos = panelIndex + ((rowPanels.length + 1) * index) + 1; + // if (rowHeight) { + let panelsBelowIndex; + let rowPanels = copy.panels || []; + // insert after 'row' panel + let insertPos = panelIndex + ((rowPanels.length + 1) * index) + 1; - if (copy.collapsed) { - copy.gridPos.y += index; - yPos += index; - panelsBelowIndex = panelIndex + index + 1; - _.each(copy.panels, (panel, i) => { + if (copy.collapsed) { + copy.gridPos.y += index; + yPos += index; + panelsBelowIndex = panelIndex + index + 1; + + _.each(copy.panels, (panel, i) => { + panel.scopedVars = {}; + panel.scopedVars[variable.name] = option; + + if (index > 0) { panel.id = this.getNextPanelId(); panel.repeatIteration = this.iteration; panel.repeatPanelId = rowPanels[i].id; panel.repeat = null; copy.panels[i] = panel; - }); - } else { - _.each(rowPanels, (rowPanel, i) => { + } + }); + } else { + _.each(rowPanels, (rowPanel, i) => { + rowPanel.scopedVars = {}; + rowPanel.scopedVars[variable.name] = option; + + if (index > 0) { let cloneRowPanel = new PanelModel(rowPanel); cloneRowPanel.id = this.getNextPanelId(); cloneRowPanel.repeatIteration = this.iteration; @@ -367,19 +394,23 @@ export class DashboardModel { cloneRowPanel.repeat = null; cloneRowPanel.gridPos.y += rowHeight * index; this.panels.splice(insertPos+i, 0, cloneRowPanel); - }); - copy.panels = []; - copy.gridPos.y += rowHeight * index; - yPos += rowHeight; - panelsBelowIndex = insertPos+rowPanels.length; - } + } + }); + copy.panels = []; + copy.gridPos.y += rowHeight * index; + yPos += rowHeight; + panelsBelowIndex = insertPos+rowPanels.length; + } - // Update gridPos for panels below - for (let i = panelsBelowIndex; i< this.panels.length; i++) { - this.panels[i].gridPos.y += yPos; - } + // Update gridPos for panels below + for (let i = panelsBelowIndex; i< this.panels.length; i++) { + this.panels[i].gridPos.y += yPos; } } else { + copy = this.getPanelRepeatClone(panel, index, panelIndex); + copy.scopedVars = {}; + copy.scopedVars[variable.name] = option; + if (panel.repeatDirection === REPEAT_DIR_VERTICAL) { copy.gridPos.y = yPos; yPos += copy.gridPos.h; diff --git a/public/app/features/dashboard/specs/repeat.jest.ts b/public/app/features/dashboard/specs/repeat.jest.ts index cb1da3e767a..d44c9b1d610 100644 --- a/public/app/features/dashboard/specs/repeat.jest.ts +++ b/public/app/features/dashboard/specs/repeat.jest.ts @@ -187,6 +187,23 @@ describe('given dashboard with row repeat', function() { ]); }); + it('should set scopedVars for each panel', function() { + dashboardJSON.templating.list[0].options[2].selected = true; + dashboard = new DashboardModel(dashboardJSON); + dashboard.processRepeats(); + const scopedVars = _.compact(_.map(dashboard.panels, (panel) => { + if (panel.scopedVars) { + return panel.scopedVars.apps.value; + } + })); + + expect(scopedVars).toEqual([ + 'se1', 'se1', 'se1', + 'se2', 'se2', 'se2', + 'se3', 'se3', 'se3', + ]); + }); + it('should repeat only row if it is collapsed', function() { dashboardJSON.panels = [ { From ce494fbedb688ab43d8b9b051f97ebfd47ead308 Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 29 Nov 2017 14:45:12 +0100 Subject: [PATCH 316/584] Added border radius and tightened up the folder boxes. Still needs to have the bottom margin expanded to 8px when in opened state (this needs @torkelo) --- public/sass/components/_search.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/sass/components/_search.scss b/public/sass/components/_search.scss index 0c550e42922..9b5c08839b8 100644 --- a/public/sass/components/_search.scss +++ b/public/sass/components/_search.scss @@ -89,7 +89,8 @@ background: $panel-bg; border: $panel-border; padding: $panel-padding; - margin-bottom: 8px; + margin-bottom: 3px; + border-radius: 5px; } .search-section__header { From c9be5c21ae2e85bbe97ae3d37f6a435db4a20c3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 29 Nov 2017 15:26:16 +0100 Subject: [PATCH 317/584] ux: changed body default font size to 13px --- public/sass/_variables.scss | 22 +++++++++++----------- public/sass/components/_dropdown.scss | 2 +- public/sass/components/_gf-form.scss | 8 +++++++- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/public/sass/_variables.scss b/public/sass/_variables.scss index 19813cd6f1e..2e0bc160b84 100644 --- a/public/sass/_variables.scss +++ b/public/sass/_variables.scss @@ -86,11 +86,11 @@ $font-family-monospace: Menlo, Monaco, Consolas, "Courier New", monospace; $font-family-base: $font-family-sans-serif !default; $font-size-root: 14px !default; +$font-size-base: 13px !default; -$font-size-base: 1rem !default; -$font-size-lg: 1.25rem !default; -$font-size-sm: .875rem !default; -$font-size-xs: .75rem !default; +$font-size-lg: 18px !default; +$font-size-sm: 12px !default; +$font-size-xs: 10px !default; $line-height-base: 1.5 !default; $font-weight-semi-bold: 500; @@ -159,9 +159,9 @@ $table-cell-padding: 4px 10px !default; $table-sm-cell-padding: .3rem !default; // Forms -$input-padding-x: .75rem !default; -$input-padding-y: .6rem !default; -$input-line-height: 1.35rem !default; +$input-padding-x: 10px !default; +$input-padding-y: 8px !default; +$input-line-height: 19px !default; $input-btn-border-width: 1px; $input-border-radius: 0 $border-radius $border-radius 0 !default; @@ -172,11 +172,11 @@ $label-border-radius: $border-radius 0 0 $border-radius !default; $label-border-radius-lg: $border-radius-lg 0 0 $border-radius-lg !default; $label-border-radius-sm: $border-radius-sm 0 0 $border-radius-sm !default; -$input-padding-x-sm: .5rem !default; -$input-padding-y-sm: .25rem !default; +$input-padding-x-sm: 7px !default; +$input-padding-y-sm: 4px !default; -$input-padding-x-lg: 1.5rem !default; -$input-padding-y-lg: .75rem !default; +$input-padding-x-lg: 20px !default; +$input-padding-y-lg: 10px !default; $input-height: (($font-size-base * $line-height-base) + ($input-padding-y * 2)) !default; $input-height-lg: (($font-size-lg * $line-height-lg) + ($input-padding-y-lg * 2)) !default; diff --git a/public/sass/components/_dropdown.scss b/public/sass/components/_dropdown.scss index c10c1ecd0ab..cc6007d0be4 100644 --- a/public/sass/components/_dropdown.scss +++ b/public/sass/components/_dropdown.scss @@ -18,7 +18,7 @@ position: relative; top: -3px; width: 250px; - font-size: 80%; + font-size: $font-size-sm; margin-left: 22px; color: $gray-2; white-space: normal; diff --git a/public/sass/components/_gf-form.scss b/public/sass/components/_gf-form.scss index 421e80f89d1..38baae3b6a0 100644 --- a/public/sass/components/_gf-form.scss +++ b/public/sass/components/_gf-form.scss @@ -1,4 +1,5 @@ $gf-form-margin: 3px; +$input-border: 1px solid $input-border-color; .gf-form { margin-bottom: $gf-form-margin; @@ -115,7 +116,7 @@ $gf-form-margin: 3px; background-color: $input-bg; background-image: none; background-clip: padding-box; - border: 1px solid $input-border-color; + border: $input-border; @include border-radius($input-border-radius-sm); @include box-shadow($input-box-shadow); white-space: nowrap; @@ -268,6 +269,7 @@ $gf-form-margin: 3px; position: relative; background-color: $input-bg; padding-right: $input-padding-x; + border: $input-border; &::after { position: absolute; @@ -279,6 +281,10 @@ $gf-form-margin: 3px; content: '\f0d7'; pointer-events: none; } + + .gf-form-input { + border: none; + } } .gf-form-help-icon { From 3d2d789ca265056d6426ab1533d4ac42a9ca5f41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 29 Nov 2017 17:13:50 +0100 Subject: [PATCH 318/584] ux: search filter box --- public/app/core/components/search/search.html | 129 +++++++++--------- public/app/core/components/search/search.ts | 25 +--- public/sass/_variables.dark.scss | 1 + public/sass/_variables.light.scss | 1 + public/sass/_variables.scss | 4 +- public/sass/components/_gf-form.scss | 9 ++ public/sass/components/_search.scss | 40 ++++-- 7 files changed, 108 insertions(+), 101 deletions(-) diff --git a/public/app/core/components/search/search.html b/public/app/core/components/search/search.html index e3d99501d78..811e21bc64a 100644 --- a/public/app/core/components/search/search.html +++ b/public/app/core/components/search/search.html @@ -15,79 +15,74 @@ ng-blur="ctrl.searchInputBlur()" /> - -
- diff --git a/public/app/core/components/search/search.ts b/public/app/core/components/search/search.ts index c7ac381c7ce..728b6a3ee18 100644 --- a/public/app/core/components/search/search.ts +++ b/public/app/core/components/search/search.ts @@ -9,16 +9,18 @@ export class SearchCtrl { selectedIndex: number; results: any; currentSearchId: number; - tagsMode: boolean; showImport: boolean; dismiss: any; ignoreClose: any; isLoading: boolean; + initialFolderFilterTitle: string; /** @ngInject */ constructor($scope, private $location, private $timeout, private searchSrv: SearchSrv, $rootScope) { $rootScope.onAppEvent('show-dash-search', this.openSearch.bind(this), $scope); $rootScope.onAppEvent('hide-dash-search', this.closeSearch.bind(this), $scope); + + this.initialFolderFilterTitle = "All"; } closeSearch() { @@ -44,14 +46,6 @@ export class SearchCtrl { this.query.starred = true; } - if (payload && payload.tagsMode) { - return this.$timeout(() => { - this.ignoreClose = false; - this.giveSearchFocus = this.giveSearchFocus + 1; - this.getTags(); - }, 100); - } - this.$timeout(() => { this.ignoreClose = false; this.giveSearchFocus = this.giveSearchFocus + 1; @@ -70,14 +64,6 @@ export class SearchCtrl { this.moveSelection(-1); } if (evt.keyCode === 13) { - if (this.tagsMode) { - var tag = this.results[this.selectedIndex]; - if (tag) { - this.filterByTag(tag.term, null); - } - return; - } - var selectedDash = this.results[this.selectedIndex]; if (selectedDash) { this.$location.search({}); @@ -93,7 +79,6 @@ export class SearchCtrl { } searchDashboards() { - this.tagsMode = false; this.currentSearchId = this.currentSearchId + 1; var localSearchId = this.currentSearchId; @@ -129,12 +114,8 @@ export class SearchCtrl { getTags() { return this.searchSrv.getDashboardTags().then((results) => { - this.tagsMode = !this.tagsMode; this.results = results; this.giveSearchFocus = this.giveSearchFocus + 1; - if ( !this.tagsMode ) { - this.search(); - } }); } diff --git a/public/sass/_variables.dark.scss b/public/sass/_variables.dark.scss index a47e8fcae48..1164f8305e0 100644 --- a/public/sass/_variables.dark.scss +++ b/public/sass/_variables.dark.scss @@ -180,6 +180,7 @@ $input-invalid-border-color: lighten($red, 5%); // Search $search-shadow: 0 0 35px 0 $body-bg; +$search-filter-box-bg: $gray-blue; // Dropdowns // ------------------------- diff --git a/public/sass/_variables.light.scss b/public/sass/_variables.light.scss index 61c2c34962a..f33ef4debed 100644 --- a/public/sass/_variables.light.scss +++ b/public/sass/_variables.light.scss @@ -205,6 +205,7 @@ $breadcrumb-hover-hl: #d9dadd; // search $search-shadow: 0 5px 30px 0 $gray-4; +$search-filter-box-bg: $gray-4; // Dropdowns // ------------------------- diff --git a/public/sass/_variables.scss b/public/sass/_variables.scss index 2e0bc160b84..8b1805480b2 100644 --- a/public/sass/_variables.scss +++ b/public/sass/_variables.scss @@ -89,8 +89,8 @@ $font-size-root: 14px !default; $font-size-base: 13px !default; $font-size-lg: 18px !default; -$font-size-sm: 12px !default; -$font-size-xs: 10px !default; +$font-size-sm: 11px !default; +$font-size-xs: 9px !default; $line-height-base: 1.5 !default; $font-weight-semi-bold: 500; diff --git a/public/sass/components/_gf-form.scss b/public/sass/components/_gf-form.scss index 38baae3b6a0..16cb2873cbe 100644 --- a/public/sass/components/_gf-form.scss +++ b/public/sass/components/_gf-form.scss @@ -21,6 +21,15 @@ $input-border: 1px solid $input-border-color; &--flex-end { justify-content: flex-end; } + + &--alt { + flex-direction: column; + align-items: flex-start; + + .gf-form-label { + padding: 4px 0; + } + } } .gf-form-disabled { diff --git a/public/sass/components/_search.scss b/public/sass/components/_search.scss index 9b5c08839b8..240cfe80e5d 100644 --- a/public/sass/components/_search.scss +++ b/public/sass/components/_search.scss @@ -6,7 +6,7 @@ top: $navbarHeight; z-index: $zindex-modal-backdrop; background-color: $black; - @include opacity(70); + @include opacity(75); } .search-container { @@ -44,12 +44,6 @@ flex-grow: 1; } -.search-switches { - flex-grow: 1; - padding: 1rem 1rem 0.75rem 1rem; - white-space: nowrap; -} - .search-field-icon { font-size: $font-size-lg; padding: 1rem 1rem 0.75rem 1.5rem; @@ -57,12 +51,38 @@ .search-dropdown { display: flex; - flex-direction: column; - max-width: 800px; - background: $page-bg; + flex-direction: row; height: calc(100% - #{$navbarHeight}); } +.search-dropdown__col_1 { + background: $page-bg; + max-width: 700px; + display: flex; + flex-direction: column; + flex-grow: 1; +} + +.search-dropdown__col_2 { + flex-grow: 1; + height: 100%; + padding-top: 16px; +} + +.search-filter-box { + background: $search-filter-box-bg; + border-radius: 2px; + padding: $spacer*1.5; + max-width: 340px; + margin-bottom: $spacer * 1.5; + margin-left: $spacer * 1.5; +} + +.search-filter-box__header { + border-bottom: 1px solid $dark-5; + margin-bottom: $spacer * 1.5; +} + .search-results-container { height: 100%; display: block; From 583a4f5314a69f44505fc1c298fe869923370b14 Mon Sep 17 00:00:00 2001 From: Trent White Date: Wed, 29 Nov 2017 16:41:48 -0500 Subject: [PATCH 319/584] new test svg background, minor form tweaks --- public/img/heatmap_bg_test.svg | 2334 ++++++++++++++++++++++++++++++++ public/sass/pages/_login.scss | 7 +- 2 files changed, 2339 insertions(+), 2 deletions(-) create mode 100644 public/img/heatmap_bg_test.svg diff --git a/public/img/heatmap_bg_test.svg b/public/img/heatmap_bg_test.svg new file mode 100644 index 00000000000..41f8d36f1da --- /dev/null +++ b/public/img/heatmap_bg_test.svg @@ -0,0 +1,2334 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/sass/pages/_login.scss b/public/sass/pages/_login.scss index fba8c497a41..268940375ee 100644 --- a/public/sass/pages/_login.scss +++ b/public/sass/pages/_login.scss @@ -8,6 +8,8 @@ display: flex; align-items: center; justify-content: center; + background-image: url(../img/heatmap_bg_test.svg); + background-size: 100%; } input:-webkit-autofill, @@ -39,6 +41,7 @@ select:-webkit-autofill:focus { .login-form-input { border: 1px solid #fafafa !important; border-radius: 4px !important; + opacity: .6; } .login-button-group { @@ -69,13 +72,13 @@ select:-webkit-autofill:focus { justify-content: center; border-right: 1px solid #fafafa; img { - width: 12rem; + width: 10rem; } .icon-gf-grafana_wordmark { color: $link-color; position: relative; font-size: 4rem; - text-shadow: 3px 3px 5px black; + text-shadow: 2px 2px 5px rgba(0,0,0,0.3); } } From 66831fb0cde660cca142b31bf8f4cf5c699e1108 Mon Sep 17 00:00:00 2001 From: Trent White Date: Wed, 29 Nov 2017 16:43:06 -0500 Subject: [PATCH 320/584] tweak background size --- public/sass/pages/_login.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/sass/pages/_login.scss b/public/sass/pages/_login.scss index 268940375ee..b1e53887a57 100644 --- a/public/sass/pages/_login.scss +++ b/public/sass/pages/_login.scss @@ -9,7 +9,7 @@ align-items: center; justify-content: center; background-image: url(../img/heatmap_bg_test.svg); - background-size: 100%; + background-size: cover; } input:-webkit-autofill, From 47f11c26c0b866576c148147f630c55eedef741e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 30 Nov 2017 08:18:23 +0100 Subject: [PATCH 321/584] ux: new page header design --- public/app/core/components/navbar/navbar.html | 16 ++-- public/app/core/components/navbar/navbar.ts | 8 +- .../features/plugins/partials/ds_edit.html | 48 ++++++----- .../plugins/partials/plugin_edit.html | 2 +- public/sass/_old_responsive.scss | 3 +- public/sass/_variables.scss | 4 +- public/sass/components/_tabbed_view.scss | 2 +- public/sass/components/_tabs.scss | 58 +++----------- public/sass/layout/_page.scss | 79 +++++++++++-------- 9 files changed, 97 insertions(+), 123 deletions(-) diff --git a/public/app/core/components/navbar/navbar.html b/public/app/core/components/navbar/navbar.html index aafd806e47d..6d611692efc 100644 --- a/public/app/core/components/navbar/navbar.html +++ b/public/app/core/components/navbar/navbar.html @@ -1,13 +1,11 @@