The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
grafana/public/sass/components/_gf-form.scss

454 lines
7.5 KiB

$input-border: 1px solid $input-border-color;
.gf-form {
margin-bottom: $space-xxs;
display: flex;
flex-direction: row;
align-items: flex-start;
text-align: left;
position: relative;
&--offset-1 {
margin-left: $spacer;
}
&--grow {
flex-grow: 1;
}
&--flex-end {
justify-content: flex-end;
}
&--align-center {
align-content: center;
}
&--alt {
flex-direction: column;
align-items: flex-start;
.gf-form-label {
padding: 4px 0;
}
}
}
.gf-form--has-input-icon {
position: relative;
margin-right: $space-xs;
.gf-form-input-icon {
position: absolute;
@grafana/ui: Create Icon component and replace part of the icons (#23402) * Part1: Unicons implementation (#23197) * Create a new Icon component * Update icons in main sidebar * Update icons in Useful links and in react components on main site * Update icons in Useful links and in main top navigation * Adjust sizing * Update panel navigation and timepicker * Update icons in Panel menu * NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179) * Update icons in add panel widget * Resolve merge conflict * Fix part of the test errors and type errors * Fix storybook errors * Update getAvailableIcons import in storybook knobs * Fix import path * Fix SyntaxError: Cannot use import statement outside a module in test environment error * Remove dynamic imports * Remove types as using @ts-ignore * Update snapshot test * Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax * Remove color prop from icon, remove color implemetation in mono icons * Update navbar styling * Move toPascalCase to utils/string Co-authored-by: Torkel Ödegaard <torkel@grafana.com> * Resolve type errors resulted from merge * Part2: Unicons implementation (#23266) * Create a new Icon component * Update icons in main sidebar * Update icons in Useful links and in react components on main site * Update icons in Useful links and in main top navigation * Adjust sizing * Update panel navigation and timepicker * Update icons in Panel menu * Update icons in add panel widget * Resolve merge conflict * Fix part of the test errors and type errors * Fix storybook errors * Update getAvailableIcons import in storybook knobs * Fix import path * Fix SyntaxError: Cannot use import statement outside a module in test environment error * Remove dynamic imports * Remove types as using @ts-ignore * Update snapshot test * Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax * Implment icons in Tabs * Implement icons in search items and empty list * Update buttons * Update button-related snapshot tests * Update icons in modals and page headers * Create anfular wrapper and update all icons on search screen * Update sizing, remove colors, update snapshot tests * Remove color prop from icon, remove color implemetation in mono icons * Remove color props from monochrome icons * Complete update of icons for search screen * Update icons for infor tooltips, playlist, permissions * Support temporarly font awesome icons used in enterprise grafana * Part1: Unicons implementation (#23197) * Create a new Icon component * Update icons in main sidebar * Update icons in Useful links and in react components on main site * Update icons in Useful links and in main top navigation * Adjust sizing * Update panel navigation and timepicker * Update icons in Panel menu * NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179) * Update icons in add panel widget * Resolve merge conflict * Fix part of the test errors and type errors * Fix storybook errors * Update getAvailableIcons import in storybook knobs * Fix import path * Fix SyntaxError: Cannot use import statement outside a module in test environment error * Remove dynamic imports * Remove types as using @ts-ignore * Update snapshot test * Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax * Remove color prop from icon, remove color implemetation in mono icons * Update navbar styling * Move toPascalCase to utils/string Co-authored-by: Torkel Ödegaard <torkel@grafana.com> * Icons update * Add optional chaining to for isFontAwesome variable Co-authored-by: Torkel Ödegaard <torkel@grafana.com> * Part3: Unicons implementation (#23356) * Create a new Icon component * Update icons in main sidebar * Update icons in Useful links and in react components on main site * Update icons in Useful links and in main top navigation * Adjust sizing * Update panel navigation and timepicker * Update icons in Panel menu * Update icons in add panel widget * Resolve merge conflict * Fix part of the test errors and type errors * Fix storybook errors * Update getAvailableIcons import in storybook knobs * Fix import path * Fix SyntaxError: Cannot use import statement outside a module in test environment error * Remove dynamic imports * Remove types as using @ts-ignore * Update snapshot test * Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax * Implment icons in Tabs * Implement icons in search items and empty list * Update buttons * Update button-related snapshot tests * Update icons in modals and page headers * Create anfular wrapper and update all icons on search screen * Update sizing, remove colors, update snapshot tests * Remove color prop from icon, remove color implemetation in mono icons * Remove color props from monochrome icons * Complete update of icons for search screen * Update icons for infor tooltips, playlist, permissions * Support temporarly font awesome icons used in enterprise grafana * Part1: Unicons implementation (#23197) * Create a new Icon component * Update icons in main sidebar * Update icons in Useful links and in react components on main site * Update icons in Useful links and in main top navigation * Adjust sizing * Update panel navigation and timepicker * Update icons in Panel menu * NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179) * Update icons in add panel widget * Resolve merge conflict * Fix part of the test errors and type errors * Fix storybook errors * Update getAvailableIcons import in storybook knobs * Fix import path * Fix SyntaxError: Cannot use import statement outside a module in test environment error * Remove dynamic imports * Remove types as using @ts-ignore * Update snapshot test * Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax * Remove color prop from icon, remove color implemetation in mono icons * Update navbar styling * Move toPascalCase to utils/string Co-authored-by: Torkel Ödegaard <torkel@grafana.com> * Update icons in Explore * Update icons in alerting * Update + and x buttons * Update icons in configurations and settings * Update close icons * Update icons in rich history * Update alert messages * Add optional chaining to for isFontAwesome variable * Remove icon mock, set up jest.config * Fix navbar plus icon * Fir enable-bacground to enableBackgournd Co-authored-by: Torkel Ödegaard <torkel@grafana.com> * Merge remote branch origin master to icons-unicons * Revert "Merge remote branch origin master to icons-unicons" This reverts commit 3f25d50a39a940883fefe73ce51219139c1ed37f. * Size-up dashnav icons * Fix alerting icons, panel headers, update tests * Fix typecheck error * Adjustments - add panel icon, spacing * Set TerserPlugin sourceMap to false to prevent running out of memory when publishing storybook Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
5 years ago
top: 10px;
font-size: $font-size-lg;
left: 10px;
color: $input-color-placeholder;
}
> input {
padding-left: 35px;
&:focus + .gf-form-input-icon {
color: $text-muted;
}
}
.Select--multi .Select-multi-value-wrapper,
.Select-placeholder {
padding-left: 30px;
}
}
.gf-form-disabled {
color: $text-color-weak;
8 years ago
.gf-form-select-wrapper::after {
color: $text-color-weak;
}
a,
.gf-form-input {
color: $text-color-weak;
}
}
.gf-form-group {
margin-bottom: $spacer * 2.5;
}
.gf-form-inline {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-content: flex-start;
.gf-form + .gf-form {
margin-left: $space-xs;
}
&--nowrap {
flex-wrap: nowrap;
}
}
.gf-form-button-row {
padding-top: $spacer * 1.5;
a,
button {
margin-right: $spacer;
}
}
.gf-form-label {
display: flex;
align-items: center;
padding: $input-padding;
flex-shrink: 0;
font-weight: $font-weight-semi-bold;
font-size: $font-size-sm;
background-color: $input-label-bg;
height: $input-height;
border: $border-width solid $input-label-border-color;
border-right: none;
border-radius: $label-border-radius;
&--grow {
flex-grow: 1;
}
&--error {
color: $critical;
}
&--transparent {
background-color: transparent;
border: 0;
text-align: right;
padding-left: 0px;
}
&--variable {
color: $variable;
background: $panel-bg;
border: $panel-border;
border-right: none;
}
&--btn {
border-right: $border-width solid $input-label-border-color;
border-radius: $border-radius;
&:hover {
background: $list-item-hover-bg;
color: $link-color;
}
.fa-caret-down {
padding-left: 4px;
}
}
&:disabled {
color: $text-color-weak;
}
}
.gf-form-label + .gf-form-label {
margin-right: $space-xs;
}
.gf-form-pre {
display: block;
flex-grow: 1;
margin: 0;
margin-right: $space-xs;
border: $border-width solid transparent;
border-left: none;
@include border-radius($label-border-radius-sm);
}
.gf-form-textarea {
max-width: 650px;
}
.gf-form-input {
display: block;
width: 100%;
height: $input-height;
padding: $input-padding;
font-size: $font-size-md;
line-height: $input-line-height;
color: $input-color;
background-color: $input-bg;
background-image: none;
background-clip: padding-box;
border: $input-border;
border-radius: $input-border-radius;
@include box-shadow($input-box-shadow);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
// text areas should be scrollable
@at-root textarea#{&} {
overflow: auto;
white-space: pre-wrap;
7 years ago
height: auto;
}
// Unstyle the caret on `<select>`s in IE10+.
&::-ms-expand {
background-color: transparent;
border: 0;
display: none;
}
// Customize the `:focus` state to imitate native WebKit styles.
@include form-control-focus();
// Placeholder
&::placeholder {
color: $input-color-placeholder;
opacity: 1;
}
&:disabled,
&[readonly] {
background-color: $input-bg-disabled;
// iOS fix for unreadable disabled content; see https://github.com/twbs/bootstrap/issues/11655.
opacity: 1;
}
&:disabled {
cursor: $cursor-disabled;
}
&.gf-size-auto {
width: auto;
}
&--dropdown {
padding-right: $space-lg;
&::after {
position: absolute;
top: 36%;
right: 11px;
font-size: 11px;
background-color: transparent;
color: $text-color;
font: normal normal normal $font-size-sm/1 FontAwesome;
content: '\f0d7';
pointer-events: none;
}
}
&--small {
padding-top: 4px;
padding-bottom: 4px;
font-size: $font-size-sm;
}
&--plaintext {
white-space: unset;
}
&--has-help-icon {
padding-right: $space-xl;
}
}
History and Version Control for Dashboard Updates A simple version control system for dashboards. Closes #1504. Goals 1. To create a new dashboard version every time a dashboard is saved. 2. To allow users to view all versions of a given dashboard. 3. To allow users to rollback to a previous version of a dashboard. 4. To allow users to compare two versions of a dashboard. Usage Navigate to a dashboard, and click the settings cog. From there, click the "Changelog" button to be brought to the Changelog view. In this view, a table containing each version of a dashboard can be seen. Each entry in the table represents a dashboard version. A selectable checkbox, the version number, date created, name of the user who created that version, and commit message is shown in the table, along with a button that allows a user to restore to a previous version of that dashboard. If a user wants to restore to a previous version of their dashboard, they can do so by clicking the previously mentioned button. If a user wants to compare two different versions of a dashboard, they can do so by clicking the checkbox of two different dashboard versions, then clicking the "Compare versions" button located below the dashboard. From there, the user is brought to a view showing a summary of the dashboard differences. Each summarized change contains a link that can be clicked to take the user a JSON diff highlighting the changes line by line. Overview of Changes Backend Changes - A `dashboard_version` table was created to store each dashboard version, along with a dashboard version model and structs to represent the queries and commands necessary for the dashboard version API methods. - API endpoints were created to support working with dashboard versions. - Methods were added to create, update, read, and destroy dashboard versions in the database. - Logic was added to compute the diff between two versions, and display it to the user. - The dashboard migration logic was updated to save a "Version 1" of each existing dashboard in the database. Frontend Changes - New views - Methods to pull JSON and HTML from endpoints New API Endpoints Each endpoint requires the authorization header to be sent in the format, ``` Authorization: Bearer <jwt> ``` where `<jwt>` is a JSON web token obtained from the Grafana admin panel. `GET "/api/dashboards/db/:dashboardId/versions?orderBy=<string>&limit=<int>&start=<int>"` Get all dashboard versions for the given dashboard ID. Accepts three URL parameters: - `orderBy` String to order the results by. Possible values are `version`, `created`, `created_by`, `message`. Default is `versions`. Ordering is always in descending order. - `limit` Maximum number of results to return - `start` Position in results to start from `GET "/api/dashboards/db/:dashboardId/versions/:id"` Get an individual dashboard version by ID, for the given dashboard ID. `POST "/api/dashboards/db/:dashboardId/restore"` Restore to the given dashboard version. Post body is of content-type `application/json`, and must contain. ```json { "dashboardId": <int>, "version": <int> } ``` `GET "/api/dashboards/db/:dashboardId/compare/:versionA...:versionB"` Compare two dashboard versions by ID for the given dashboard ID, returning a JSON delta formatted representation of the diff. The URL format follows what GitHub does. For example, visiting [/api/dashboards/db/18/compare/22...33](http://ec2-54-80-139-44.compute-1.amazonaws.com:3000/api/dashboards/db/18/compare/22...33) will return the diff between versions 22 and 33 for the dashboard ID 18. Dependencies Added - The Go package [gojsondiff](https://github.com/yudai/gojsondiff) was added and vendored.
8 years ago
.gf-form-hint {
width: 100%;
}
.gf-form-hint-text {
display: block;
text-align: right;
padding-top: 0.5em;
}
.gf-form-select-wrapper {
position: relative;
background-color: $input-bg;
.gf-form-select-icon {
position: absolute;
z-index: 1;
left: $input-padding;
top: 50%;
margin-top: -7px;
& + .gf-form-input {
position: relative;
z-index: 2;
padding-left: $space-xl;
background-color: transparent;
option {
// Firefox
color: $black;
}
}
}
.gf-form-input {
margin-right: 0;
}
select.gf-form-input {
text-indent: 0.01px;
text-overflow: '';
padding-right: $space-xl;
appearance: none;
&:-moz-focusring {
outline: none;
color: transparent;
text-shadow: 0 0 0 $text-color;
}
&.ng-empty {
color: $text-color-weak;
}
}
&::after {
position: absolute;
top: 36%;
right: 11px;
background-color: transparent;
color: $text-color;
font: normal normal normal $font-size-sm/1 FontAwesome;
content: '\f0d7';
pointer-events: none;
font-size: 11px;
}
&--has-help-icon {
&::after {
right: $space-xl;
}
}
}
.gf-form--v-stretch {
align-items: stretch;
}
.gf-form-btn {
padding: $input-padding;
margin-right: $space-xs;
line-height: $input-line-height;
font-size: $font-size-sm;
flex-shrink: 0;
flex-grow: 0;
}
.natural-language-input {
&input[type='number'] {
font-size: $font-size-base;
line-height: $input-line-height;
margin: -6px -5px 0 5px;
padding: $space-xs;
}
}
.gf-form-dropdown-typeahead {
//margin-right: $space-xs; ?
position: relative;
&::after {
position: absolute;
top: 35%;
right: $space-sm;
background-color: transparent;
color: $input-color;
font: normal normal normal $font-size-sm/1 FontAwesome;
content: '\f0d7';
pointer-events: none;
font-size: 11px;
}
}
.gf-form-help-icon {
flex-grow: 0;
color: $text-color-weak;
&--bold {
color: $text-color-emphasis;
padding-left: 0;
}
&--right-absolute {
position: absolute;
right: $spacer;
top: 10px;
}
&--right-normal {
float: right;
}
&--header {
margin-bottom: $space-xxs;
}
&--small-padding {
padding-left: 4px;
}
&:hover {
color: $text-color;
}
}
select.gf-form-input ~ .gf-form-help-icon {
right: 10px;
}
.gf-form-icon--right-absolute {
position: absolute;
right: $spacer;
top: 10px;
color: $text-muted;
}
.cta-form {
position: relative;
padding: $space-lg;
background-color: $empty-list-cta-bg;
margin-bottom: $space-lg;
border-top: 3px solid $green-base;
}
.cta-form__close {
background: transparent;
padding: 4px 8px 4px 9px;
border: none;
position: absolute;
right: 0;
top: -2px;
font-size: $font-size-md;
&:hover {
color: $text-color-strong;
}
}
.cta-form__bar {
display: flex;
align-items: center;
align-content: center;
margin-bottom: 20px;
}
.cta-form__bar-header {
font-size: $font-size-h4;
padding-right: 20px;
}