Sfoglia il codice sorgente

refactoring & cleaning up css

Torkel Ödegaard 7 anni fa
parent
commit
c4ad069083

+ 9 - 11
public/app/features/dashboard/dashgrid/EditorTabBody.tsx

@@ -40,9 +40,9 @@ export class EditorTabBody extends PureComponent<Props, State> {
 
   renderMainSelection(view: EditorToolBarView) {
     return (
-      <div className="edit-section__selected" onClick={() => this.onToggleToolBarView(view)} key={view.title}>
-        <img className="edit-section__selected-image" src={view.imgSrc} />
-        <div className="edit-section__selected-name">{view.title}</div>
+      <div className="toolbar__main" onClick={() => this.onToggleToolBarView(view)} key={view.title}>
+        <img className="toolbar__main-image" src={view.imgSrc} />
+        <div className="toolbar__main-name">{view.title}</div>
         <i className="fa fa-caret-down" />
       </div>
     );
@@ -60,8 +60,8 @@ export class EditorTabBody extends PureComponent<Props, State> {
 
   renderOpenView(view: EditorToolBarView) {
     return (
-      <div className="editor-toolbar-view">
-        <button className="editor-toolbar-view__close" onClick={this.onCloseOpenView}>
+      <div className="toolbar-subview">
+        <button className="toolbar-subview__close" onClick={this.onCloseOpenView}>
           <i className="fa fa-chevron-up" />
         </button>
         {view.render()}
@@ -75,12 +75,10 @@ export class EditorTabBody extends PureComponent<Props, State> {
 
     return (
       <>
-        <div className="edit-section">
-          <div className="edit-section__header">
-            {this.renderMainSelection(main)}
-            <div className="gf-form--grow" />
-            {toolbarItems.map(item => this.renderButton(item))}
-          </div>
+        <div className="toolbar">
+          {this.renderMainSelection(main)}
+          <div className="gf-form--grow" />
+          {toolbarItems.map(item => this.renderButton(item))}
         </div>
         <div className="panel-editor__scroll">
           <CustomScrollbar>

+ 2 - 2
public/app/features/dashboard/dashgrid/VisualizationTab.tsx

@@ -1,16 +1,16 @@
 import React, { PureComponent } from 'react';
 
-import { getAngularLoader, AngularComponent } from 'app/core/services/AngularLoader';
 import { EditorTabBody } from './EditorTabBody';
 import { VizTypePicker } from './VizTypePicker';
 
 import { PanelModel } from '../panel_model';
 import { DashboardModel } from '../dashboard_model';
+import { PanelPlugin } from 'app/types/plugins';
 
 interface Props {
   panel: PanelModel;
   dashboard: DashboardModel;
-  plugin: PluginModel;
+  plugin: PanelPlugin;
   onTypeChanged: (newType: PanelPlugin) => void;
 }
 

+ 1 - 1
public/app/features/dashboard/dashgrid/VizTypePicker.tsx

@@ -85,7 +85,7 @@ export class VizTypePicker extends PureComponent<Props, State> {
           <div className="gf-form--grow" />
         </div>
 
-        <div className="viz-picker__items">{pluginList.map(this.renderVizPlugin)}</div>
+        <div className="viz-picker">{pluginList.map(this.renderVizPlugin)}</div>
       </>
     );
   }

+ 1 - 1
public/app/features/panel/partials/metrics_tab.html

@@ -1,4 +1,4 @@
-<div class="gf-form-group hide">
+<div class="gf-form-group">
   <div class="gf-form-inline">
     <div class="gf-form">
       <label class="gf-form-label">Data Source</label>

+ 2 - 1
public/sass/_grafana.scss

@@ -97,7 +97,8 @@
 @import 'components/form_select_box';
 @import 'components/user-picker';
 @import 'components/description-picker';
-@import 'components/viz_editor';
+@import 'components/panel_editor';
+@import 'components/toolbar';
 @import 'components/delete_button';
 @import 'components/add_data_source.scss';
 @import 'components/page_loader';

+ 4 - 0
public/sass/components/_navbar.scss

@@ -40,6 +40,10 @@
 }
 
 .panel-in-fullscreen {
+  .navbar {
+    padding-left: 15px;
+  }
+
   .navbar-button--add-panel,
   .navbar-button--star,
   .navbar-button--tv,

+ 47 - 129
public/sass/components/_viz_editor.scss → public/sass/components/_panel_editor.scss

@@ -28,18 +28,10 @@
 }
 
 .panel-in-fullscreen {
-  // .scroll-canvas--dashboard {
-  //   height: 100%;
-  // }
-
   .sidemenu {
     display: none;
   }
 
-  // .main-view {
-  //   background: unset;
-  // }
-
   .dashboard-container {
     padding: 0;
   }
@@ -53,57 +45,6 @@
   }
 }
 
-.viz-picker {
-  margin-bottom: $spacer;
-}
-
-.viz-picker__items {
-  display: flex;
-  flex-wrap: wrap;
-  margin-bottom: 13px;
-}
-
-.viz-picker__item {
-  background: $card-background;
-  box-shadow: $card-shadow;
-
-  border-radius: 3px;
-  height: 90px;
-  width: 150px;
-  flex-shrink: 0;
-  flex-direction: column;
-  text-align: center;
-  cursor: pointer;
-  display: flex;
-  margin-right: 10px;
-  margin-bottom: 10px;
-  border: 1px solid transparent;
-  align-items: center;
-
-  &:hover {
-    background: $card-background-hover;
-  }
-
-  &--selected {
-    box-shadow: 0 0 12px #ff4d00;
-  }
-}
-
-.viz-picker__item-name {
-  text-overflow: ellipsis;
-  overflow: hidden;
-  white-space: nowrap;
-  font-size: $font-size-sm;
-  display: flex;
-  flex-direction: column;
-  align-self: center;
-  height: 23px;
-}
-
-.viz-picker__item-img {
-  height: 55px;
-}
-
 .panel-editor-resizer {
   position: absolute;
   height: 2px;
@@ -146,73 +87,61 @@
   top: 4px;
 }
 
-.panel-editor {
-  height: calc(100% - 10px);
-}
-
-.form-option-box {
-  margin-bottom: 20px;
-}
-
-.form-option-box__header {
-  border-bottom: 2px solid $blue-dark;
-  padding: 5px 0px;
-  font-size: $font-size-lg;
-  margin-bottom: 20px;
+.viz-picker {
+  display: flex;
+  flex-wrap: wrap;
+  margin-bottom: 13px;
 }
 
-.edit-section {
-  position: relative;
-}
+.viz-picker__item {
+  background: $card-background;
+  box-shadow: $card-shadow;
 
-.edit-section__header {
-  display: flex;
-  align-content: center;
-  align-items: center;
-  background: $page-header-bg;
-  box-shadow: 0 0 20px black;
-  padding: 7px 30px 7px 20px;
+  border-radius: 3px;
+  height: 90px;
+  width: 150px;
+  flex-shrink: 0;
+  flex-direction: column;
+  text-align: center;
   cursor: pointer;
-  position: relative;
-  z-index: 1;
-}
-
-.edit-section__selected {
-  padding: $input-padding-y $input-padding-x;
-  font-size: $font-size-md;
-  line-height: $input-line-height;
-  color: $input-color;
-  background-color: $input-bg;
-  border: $input-border;
-  border-radius: $input-border-radius;
   display: flex;
+  margin-right: 10px;
+  margin-bottom: 10px;
+  border: 1px solid transparent;
   align-items: center;
-  .fa {
-    margin-left: 20px;
-    display: inline-block;
-    position: relative;
+
+  &:hover {
+    background: $card-background-hover;
+  }
+
+  &--selected {
+    box-shadow: 0 0 12px #ff4d00;
   }
 }
 
-.edit-section__title {
-  font-size: $font-size-lg;
-  padding-right: 20px;
-  width: 150px;
+.viz-picker__item-name {
+  text-overflow: ellipsis;
+  overflow: hidden;
+  white-space: nowrap;
+  font-size: $font-size-sm;
+  display: flex;
+  flex-direction: column;
+  align-self: center;
+  height: 23px;
 }
 
-.edit-section__selected-image {
-  margin-right: 10px;
-  display: inline-block;
-  width: 20px;
-  height: 20px;
+.viz-picker__item-img {
+  height: 55px;
 }
 
+
 .panel-editor-tabs {
   position: relative;
   z-index: 2;
   box-shadow: $page-header-shadow;
   border-bottom: 1px solid $page-header-border-color;
   padding: 0 $dashboard-padding;
+
   @include clearfix();
 
   .active.gf-tabs-link {
@@ -238,28 +167,6 @@
   }
 }
 
-.editor-toolbar-view {
-  position: relative;
-  padding: 20px 20px;
-  background-color: $empty-list-cta-bg;
-  top: -45px;
-  margin: 0 30px 20px 0px;
-}
-
-.editor-toolbar-view__close {
-  background: transparent;
-  padding: 4px 8px 4px 9px;
-  border: none;
-  position: absolute;
-  right: 15px;
-  top: 20px;
-  font-size: $font-size-md;
-
-  &:hover {
-    color: $text-color-strong;
-  }
-}
-
 .ds-picker-list {
   display: flex;
   flex-wrap: wrap;
@@ -300,3 +207,14 @@
 .ds-picker-list__img {
   width: 30px;
 }
+
+.form-option-box {
+  margin-bottom: 20px;
+}
+
+.form-option-box__header {
+  border-bottom: 2px solid $blue-dark;
+  padding: 5px 0px;
+  font-size: $font-size-lg;
+  margin-bottom: 20px;
+}

+ 59 - 0
public/sass/components/_toolbar.scss

@@ -0,0 +1,59 @@
+.toolbar {
+  display: flex;
+  align-content: center;
+  align-items: center;
+  background: $page-header-bg;
+  box-shadow: 0 0 20px black;
+  padding: 7px 30px 7px 20px;
+  cursor: pointer;
+  position: relative;
+  z-index: 1;
+  flex: 0 0 auto;
+}
+
+.toolbar__main {
+  padding: $input-padding-y $input-padding-x;
+  font-size: $font-size-md;
+  line-height: $input-line-height;
+  color: $input-color;
+  background-color: $input-bg;
+  border: $input-border;
+  border-radius: $input-border-radius;
+  display: flex;
+  align-items: center;
+
+  .fa {
+    margin-left: 20px;
+    display: inline-block;
+    position: relative;
+  }
+}
+
+.toolbar__main-image {
+  margin-right: 10px;
+  display: inline-block;
+  width: 20px;
+  height: 20px;
+}
+
+.toolbar-subview {
+  position: relative;
+  padding: 20px 20px;
+  background-color: $empty-list-cta-bg;
+  top: -45px;
+  margin: 0 30px 20px 0px;
+}
+
+.toolbar-subview__close {
+  background: transparent;
+  padding: 4px 8px 4px 9px;
+  border: none;
+  position: absolute;
+  right: 15px;
+  top: 20px;
+  font-size: $font-size-md;
+
+  &:hover {
+    color: $text-color-strong;
+  }
+}