From d9d25dc64939acc9d46f543ffdeee3bca02dac28 Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Fri, 10 May 2024 10:52:51 +0100 Subject: [PATCH] Chore: Remove some more old SCSS (#87506) * remove some more old styles and consolidate any angular ones into their own file * few more --- public/sass/_angular.scss | 62 ++++++++++ public/sass/_grafana.scss | 15 +-- public/sass/components/_popover-box.scss | 31 ----- public/sass/components/_tabbed_view.scss | 52 --------- public/sass/components/_tables_lists.scss | 43 ------- public/sass/components/_tabs.scss | 60 ---------- .../sass/components/_toggle_button_group.scss | 39 ------- public/sass/components/_toolbar.scss | 51 --------- public/sass/components/_view_states.scss | 64 ----------- public/sass/components/edit_sidemenu.scss | 58 ---------- public/sass/pages/_errorpage.scss | 106 ------------------ public/sass/pages/_login.scss | 5 - public/sass/utils/_angular.scss | 5 - public/sass/utils/_flex.scss | 58 ---------- public/sass/utils/_hacks.scss | 24 ---- public/sass/utils/_validation.scss | 8 -- 16 files changed, 65 insertions(+), 616 deletions(-) create mode 100644 public/sass/_angular.scss delete mode 100644 public/sass/components/_popover-box.scss delete mode 100644 public/sass/components/_tables_lists.scss delete mode 100644 public/sass/components/_tabs.scss delete mode 100644 public/sass/components/_toggle_button_group.scss delete mode 100644 public/sass/components/_toolbar.scss delete mode 100644 public/sass/components/_view_states.scss delete mode 100644 public/sass/components/edit_sidemenu.scss delete mode 100644 public/sass/pages/_errorpage.scss delete mode 100644 public/sass/pages/_login.scss delete mode 100644 public/sass/utils/_angular.scss delete mode 100644 public/sass/utils/_flex.scss delete mode 100644 public/sass/utils/_hacks.scss delete mode 100644 public/sass/utils/_validation.scss diff --git a/public/sass/_angular.scss b/public/sass/_angular.scss new file mode 100644 index 00000000000..b6bbed0ff07 --- /dev/null +++ b/public/sass/_angular.scss @@ -0,0 +1,62 @@ +// these styles are only used by angular components/pages +// once angular is disabled, this file can be deleted + +.edit-tab-content { + flex-grow: 1; + min-width: 0; +} + +.view-mode--inactive { + .react-resizable-handle, + .add-row-panel-hint, + .dash-row-menu-container, + .panel-info-corner--info, + .panel-info-corner--links { + display: none; + } +} + +.login-form { + margin-bottom: $space-md; + width: 100%; +} + +[ng\:cloak], +[ng-cloak], +.ng-cloak { + display: none !important; +} + +// <3: https://medium.com/@brunn/detecting-autofilled-fields-in-javascript-aed598d25da7 +@keyframes onAutoFillStart { + from { + /**/ + } + to { + /**/ + } +} +@keyframes onAutoFillCancel { + from { + /**/ + } + to { + /**/ + } +} +input:-webkit-autofill { + animation-name: onAutoFillStart; + transition: transform 1ms; +} +input:not(:-webkit-autofill) { + animation-name: onAutoFillCancel; +} + +input.validation-error, +input.ng-dirty.ng-invalid { + box-shadow: inset 0 0px 5px $red; +} + +input.invalid { + box-shadow: inset 0 0px 5px $red; +} diff --git a/public/sass/_grafana.scss b/public/sass/_grafana.scss index e6227cdabb0..c6a9653a224 100644 --- a/public/sass/_grafana.scss +++ b/public/sass/_grafana.scss @@ -21,17 +21,13 @@ // UTILS @import 'utils/utils'; -@import 'utils/validation'; -@import 'utils/angular'; @import 'utils/spacings'; @import 'utils/widths'; -@import 'utils/hacks'; // COMPONENTS @import 'components/scrollbar'; @import 'components/buttons'; @import 'components/navs'; -@import 'components/tabs'; @import 'components/alerts'; @import 'components/switch'; @import 'components/tooltip'; @@ -44,7 +40,6 @@ @import 'components/panel_table'; @import 'components/panel_heatmap'; @import 'components/tagsinput'; -@import 'components/tables_lists'; @import 'components/gf-form'; @import 'components/filter-controls'; @import 'components/filter-list'; @@ -60,29 +55,25 @@ @import 'components/query_editor'; @import 'components/tabbed_view'; @import 'components/query_part'; -@import 'components/edit_sidemenu'; @import 'components/row'; @import 'components/json_explorer'; @import 'components/code_editor'; @import 'components/dashboard_grid'; @import 'components/page_header'; @import 'components/dashboard_settings'; -@import 'components/toolbar'; @import 'components/add_data_source'; @import 'components/page_loader'; -@import 'components/toggle_button_group'; -@import 'components/popover-box'; @import 'components/panel_header'; // LOAD @grafana/ui components @import '@grafana/ui/src/index'; // PAGES -@import 'pages/login'; @import 'pages/dashboard'; @import 'pages/admin'; @import 'pages/alerting'; @import 'pages/history'; -@import 'pages/errorpage'; @import 'pages/explore'; -@import 'components/view_states'; + +// ANGULAR +@import 'angular'; diff --git a/public/sass/components/_popover-box.scss b/public/sass/components/_popover-box.scss deleted file mode 100644 index 6f0b3fb4310..00000000000 --- a/public/sass/components/_popover-box.scss +++ /dev/null @@ -1,31 +0,0 @@ -.popover-box { - background-color: $popover-bg; - color: $popover-color; - border: 1px solid $popover-border-color; - border-radius: $border-radius; - max-width: 500px; -} - -.popover-box__header { - background-color: $popover-border-color; - padding: 6px 10px; - display: flex; -} - -.popover-box__title { - font-weight: $font-weight-semi-bold; - padding-right: $spacer; - overflow: hidden; - display: inline-block; - white-space: nowrap; - text-overflow: ellipsis; - flex-grow: 1; -} - -.popover-box__body { - padding: 20px 10px 10px 10px; -} - -.popover-box__close { - cursor: pointer; -} diff --git a/public/sass/components/_tabbed_view.scss b/public/sass/components/_tabbed_view.scss index 6213ce32b0c..48b90642ed7 100644 --- a/public/sass/components/_tabbed_view.scss +++ b/public/sass/components/_tabbed_view.scss @@ -1,55 +1,3 @@ -.tabbed-view { - display: flex; - flex-direction: column; - height: 100%; - flex-grow: 1; - - &.tabbed-view--new { - padding: 0 0 0 0; - height: 100%; - } -} - -.tabbed-view-header { - box-shadow: $page-header-shadow; - border-bottom: 1px solid $page-header-border-color; - padding: 0 $space-md; - @include clearfix(); -} - -.tabbed-view-title { - float: left; - padding-top: $space-sm; - margin: 0 $spacer * 3 0 0; -} - -.tabbed-view-close-btn { - float: right; - margin: 0; - background-color: transparent; - border: none; - padding: $tabs-padding; - color: $text-color; - i { - font-size: 120%; - } - &:hover { - color: $text-color-strong; - } -} - -.tabbed-view-body { - padding: $spacer * 2 $spacer $spacer $spacer; - display: flex; - flex-direction: column; - flex: 1; - - &--small { - min-height: 0px; - padding-bottom: 0px; - } -} - .section-heading { font-size: $font-size-md; margin-bottom: $space-sm; diff --git a/public/sass/components/_tables_lists.scss b/public/sass/components/_tables_lists.scss deleted file mode 100644 index 43be08eac33..00000000000 --- a/public/sass/components/_tables_lists.scss +++ /dev/null @@ -1,43 +0,0 @@ -.grafana-options-table { - width: 100%; - - th { - text-align: left; - padding: 5px 10px; - border-bottom: 4px solid $panel-bg; - } - - tr td { - background-color: $list-item-bg; - padding: 5px 10px; - white-space: nowrap; - border-bottom: 4px solid $panel-bg; - &.nobg { - background-color: transparent; - } - } - - .max-width-btns { - padding-right: 0px; - .btn { - box-sizing: border-box; - width: 100%; - } - } -} - -.max-width { - overflow: hidden; - text-overflow: ellipsis; - -o-text-overflow: ellipsis; - white-space: nowrap; -} - -.grafana-list-item { - display: block; - padding: 1px 10px; - line-height: 34px; - background-color: $list-item-bg; - margin-bottom: 4px; - cursor: pointer; -} diff --git a/public/sass/components/_tabs.scss b/public/sass/components/_tabs.scss deleted file mode 100644 index 0bf6208c321..00000000000 --- a/public/sass/components/_tabs.scss +++ /dev/null @@ -1,60 +0,0 @@ -.gf-tabs { - @include clearfix(); - float: left; - position: relative; - top: 1px; -} - -.gf-tabs-item { - float: left; - list-style: none; -} - -.gf-tabs-link { - padding: $tabs-padding; - margin-right: calc($spacer/2); - position: relative; - display: block; - border: solid transparent; - border-width: 0 1px 1px; - border-radius: 3px 3px 0 0; - color: $text-color; - - i { - margin-right: 5px; - } - - .gicon { - position: relative; - top: -2px; - } - - &:hover, - &:focus { - color: $link-hover-color; - } - - &.active, - &.active:hover, - &.active:focus { - border-color: $orange $tab-border-color transparent; - background: $page-bg; - color: $link-color; - overflow: hidden; - - &::before { - display: block; - content: ' '; - position: absolute; - left: 0; - right: 0; - height: 2px; - top: 0; - background-image: $brand-gradient-horizontal; - } - } - - &.active--panel { - background: $panel-bg !important; - } -} diff --git a/public/sass/components/_toggle_button_group.scss b/public/sass/components/_toggle_button_group.scss deleted file mode 100644 index 62e5c85ea36..00000000000 --- a/public/sass/components/_toggle_button_group.scss +++ /dev/null @@ -1,39 +0,0 @@ -.toggle-button-group { - display: flex; - - .btn { - @include buttonBackground($btn-inverse-bg, $btn-inverse-bg-hl, $btn-inverse-text-color, $btn-inverse-text-shadow); - - height: $input-height; - padding: 7px 10px; - font-weight: $font-weight-semi-bold; - font-size: $font-size-sm; - border-radius: 0; - border-right: $button-toggle-group-btn-separator-border; - - &.active { - background: $button-toggle-group-btn-active-bg; - box-shadow: $button-toggle-group-btn-active-shadow; - border-right: 0; - color: $white; - - &:hover { - cursor: default; - } - } - - &:first-child { - border-radius: $border-radius 0 0 $border-radius; - margin: 0; - } - - &:last-child { - border-radius: 0 $border-radius $border-radius 0; - margin-left: 0; - } - } - - &--padded { - padding-left: 2px; - } -} diff --git a/public/sass/components/_toolbar.scss b/public/sass/components/_toolbar.scss deleted file mode 100644 index b4b9dd5d273..00000000000 --- a/public/sass/components/_toolbar.scss +++ /dev/null @@ -1,51 +0,0 @@ -.toolbar { - display: flex; - align-content: center; - align-items: center; - padding: 16px; - position: relative; - flex: 0 0 auto; -} - -.toolbar__heading { - font-size: $font-size-lg; - padding-right: 20px; -} - -.toolbar__left { - display: flex; - flex-grow: 1; - align-items: center; -} - -.toolbar__main { - padding: 0 $space-sm; - font-size: $font-size-md; - line-height: $input-line-height; - color: $input-color; - background-color: $input-bg; - height: $input-height; - border: $input-border; - border-radius: $input-border-radius; - display: flex; - align-items: center; - cursor: pointer; - - .fa { - margin-left: 20px; - display: inline-block; - position: relative; - } -} - -.toolbar__main-image { - margin-right: 10px; - display: inline-block; - width: 20px; - height: 20px; -} - -.toolbar__close { - flex-grow: 1; - text-align: left; -} diff --git a/public/sass/components/_view_states.scss b/public/sass/components/_view_states.scss deleted file mode 100644 index cfa76e95c8a..00000000000 --- a/public/sass/components/_view_states.scss +++ /dev/null @@ -1,64 +0,0 @@ -.view-mode--inactive { - .react-resizable-handle, - .add-row-panel-hint, - .dash-row-menu-container, - .panel-info-corner--info, - .panel-info-corner--links { - display: none; - } -} - -.view-mode--tv { - @extend .view-mode--inactive; - - .sidemenu { - position: fixed; - background-color: transparent; - box-shadow: none; - - .sidemenu__top, - .sidemenu__bottom, - .sidemenu__logo_small_breakpoint { - display: none; - } - - .sidemenu__logo { - @include media-breakpoint-down(sm) { - display: block; - } - } - } - - .page-toolbar { - padding-left: $side-menu-width; - - &--fullscreen { - padding-left: $space-md; - } - } - - .submenu-controls { - display: none; - } -} - -.view-mode--kiosk { - @extend .view-mode--tv; - - .sidemenu, - .page-toolbar { - display: none; - } - - .submenu-controls { - display: none; - } -} - -@include media-breakpoint-down(sm) { - nav.page-toolbar { - &--fullscreen { - padding-left: $space-md; - } - } -} diff --git a/public/sass/components/edit_sidemenu.scss b/public/sass/components/edit_sidemenu.scss deleted file mode 100644 index 0223c8a5ba7..00000000000 --- a/public/sass/components/edit_sidemenu.scss +++ /dev/null @@ -1,58 +0,0 @@ -.edit-tab-with-sidemenu { - display: flex; - flex-direction: row; -} - -.edit-tab-content { - flex-grow: 1; - min-width: 0; -} - -//Deprecated class but maybe used by plugins (in panel settings) -.edit-sidemenu-aside { - margin-right: $spacer * 2; -} - -//Deprecated class but maybe used by plugins (in panel settings) -.edit-sidemenu { - width: 100%; - list-style: none; - - li.active { - @include left-brand-border-gradient(); - } - - a { - display: block; - color: $text-color; - margin: 0 0 1.5rem 1rem; - white-space: nowrap; - } -} - -.column-styles-heading { - border-bottom: 1px solid $gray-1; -} - -@include media-breakpoint-down(sm) { - .edit-tab-with-sidemenu { - flex-direction: column; - } - - //Deprecated class but maybe used by plugins (in panel settings) - .edit-sidemenu-aside { - width: 100%; - margin-bottom: 2rem; - } - - //Deprecated class but maybe used by plugins (in panel settings) - .edit-sidemenu { - li { - float: left; - } - - a { - margin: 0.3rem 1rem; - } - } -} diff --git a/public/sass/pages/_errorpage.scss b/public/sass/pages/_errorpage.scss deleted file mode 100644 index e01adbfac01..00000000000 --- a/public/sass/pages/_errorpage.scss +++ /dev/null @@ -1,106 +0,0 @@ -// -// Layout -// - -.error-container { - display: flex; - flex-direction: row; -} - -.error-row { - display: flex; - flex-direction: row; -} - -.error-column { - display: flex; - flex-direction: column; -} - -.error-space-between { - justify-content: space-between; -} - -.graph-box { - width: 62%; - padding: $space-xl $space-md; -} - -.info-box { - width: 38%; - padding: $space-xl $space-md; -} - -.graph-percentage { - padding: 0 0 18px; -} - -.image-box { - padding: $space-sm; -} - -.left-margin { - padding: 0 0 0 64px; -} - -.current-box { - justify-content: flex-end; -} - -// -// Text -// - -.current-text { - color: $blue; - font-weight: bold; - line-height: 14px; -} - -.error-link { - color: $orange; -} - -.error-minus { - color: #7eb26d; - padding: 0 $space-sm; - line-height: 21px; -} - -.graph-percentage p { - text-align: right; - margin: 0; - line-height: 14px; -} - -.graph-text { - margin: 0; -} - -@include media-breakpoint-down(sm) { - .graph-box { - width: 50%; - } - - .info-box { - width: 50%; - } -} - -@include media-breakpoint-down(xs) { - .error-container { - flex-direction: column; - } - - .graph-box { - width: 100%; - } - - .info-box { - width: 100%; - } - - .error-full-width { - width: 100%; - } -} diff --git a/public/sass/pages/_login.scss b/public/sass/pages/_login.scss deleted file mode 100644 index 4e4f455d587..00000000000 --- a/public/sass/pages/_login.scss +++ /dev/null @@ -1,5 +0,0 @@ -/* Is still used in some angular templates*/ -.login-form { - margin-bottom: $space-md; - width: 100%; -} diff --git a/public/sass/utils/_angular.scss b/public/sass/utils/_angular.scss deleted file mode 100644 index 53ea1573245..00000000000 --- a/public/sass/utils/_angular.scss +++ /dev/null @@ -1,5 +0,0 @@ -[ng\:cloak], -[ng-cloak], -.ng-cloak { - display: none !important; -} diff --git a/public/sass/utils/_flex.scss b/public/sass/utils/_flex.scss deleted file mode 100644 index f1e115528a7..00000000000 --- a/public/sass/utils/_flex.scss +++ /dev/null @@ -1,58 +0,0 @@ -@if $enable-flex { - @each $breakpoint in map-keys($grid-breakpoints) { - // Flex column reordering - @include media-breakpoint-up($breakpoint) { - .flex-#{$breakpoint}-first { - order: -1; - } - .flex-#{$breakpoint}-last { - order: 1; - } - } - - // Alignment for every item - @include media-breakpoint-up($breakpoint) { - .flex-items-#{$breakpoint}-top { - align-items: flex-start; - } - .flex-items-#{$breakpoint}-middle { - align-items: center; - } - .flex-items-#{$breakpoint}-bottom { - align-items: flex-end; - } - } - - // Alignment per item - @include media-breakpoint-up($breakpoint) { - .flex-#{$breakpoint}-top { - align-self: flex-start; - } - .flex-#{$breakpoint}-middle { - align-self: center; - } - .flex-#{$breakpoint}-bottom { - align-self: flex-end; - } - } - - // Horizontal alignment of item - @include media-breakpoint-up($breakpoint) { - .flex-items-#{$breakpoint}-left { - justify-content: flex-start; - } - .flex-items-#{$breakpoint}-center { - justify-content: center; - } - .flex-items-#{$breakpoint}-right { - justify-content: flex-end; - } - .flex-items-#{$breakpoint}-around { - justify-content: space-around; - } - .flex-items-#{$breakpoint}-between { - justify-content: space-between; - } - } - } -} diff --git a/public/sass/utils/_hacks.scss b/public/sass/utils/_hacks.scss deleted file mode 100644 index a3d5c528dd7..00000000000 --- a/public/sass/utils/_hacks.scss +++ /dev/null @@ -1,24 +0,0 @@ -// <3: https://medium.com/@brunn/detecting-autofilled-fields-in-javascript-aed598d25da7 -@keyframes onAutoFillStart { - from { - /**/ - } - to { - /**/ - } -} -@keyframes onAutoFillCancel { - from { - /**/ - } - to { - /**/ - } -} -input:-webkit-autofill { - animation-name: onAutoFillStart; - transition: transform 1ms; -} -input:not(:-webkit-autofill) { - animation-name: onAutoFillCancel; -} diff --git a/public/sass/utils/_validation.scss b/public/sass/utils/_validation.scss deleted file mode 100644 index 307afde42d1..00000000000 --- a/public/sass/utils/_validation.scss +++ /dev/null @@ -1,8 +0,0 @@ -input.validation-error, -input.ng-dirty.ng-invalid { - box-shadow: inset 0 0px 5px $red; -} - -input.invalid { - box-shadow: inset 0 0px 5px $red; -}