Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix explorer dark mode issue and restructure scss #157

Merged
merged 3 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

import './data_grid.scss';

import React, { useMemo, useState, useEffect, useRef, RefObject } from 'react';
import { IExplorerFields } from '../../../../../common/types/explorer';
import { DEFAULT_COLUMNS, PAGE_SIZE } from '../../../../../common/constants/explorer';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
* SPDX-License-Identifier: Apache-2.0
*/

import './docView.scss';
import moment from 'moment';
import React, { forwardRef, useImperativeHandle, useMemo, useState } from 'react';
import { toPairs, uniqueId, has, forEach, isEqual } from 'lodash';
import { EuiButtonEmpty, EuiButtonIcon, EuiIcon, EuiLink } from '@elastic/eui';
import { EuiButtonIcon, EuiLink } from '@elastic/eui';
import { useEffect } from 'react';
import { IExplorerFields, IField } from '../../../../../common/types/explorer';
import { DocFlyout } from './doc_flyout';
Expand Down
4 changes: 2 additions & 2 deletions public/components/event_analytics/explorer/explorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ import {
} from '../redux/slices/viualization_config_slice';
import { formatError, getDefaultVisConfig } from '../utils';
import { DataGrid } from './events_views/data_grid';
import './explorer.scss';
import { HitsCounter } from './hits_counter/hits_counter';
import { PatternsTable } from './log_patterns/patterns_table';
import { NoResults } from './no_results';
Expand All @@ -104,6 +103,7 @@ import { TimechartHeader } from './timechart_header';
import { ExplorerVisualizations } from './visualizations';
import { CountDistribution } from './visualizations/count_distribution';
import { QueryManager } from '../../../../common/query_manager';
import { uiSettingsService } from '../../../../common/utils';

const TYPE_TAB_MAPPING = {
[SAVED_QUERY]: TAB_EVENT_ID,
Expand Down Expand Up @@ -1478,7 +1478,7 @@ export const Explorer = ({
query,
}}
>
<div className="dscAppContainer">
<div className={`dscAppContainer${uiSettingsService.get('theme:darkMode') && ' explorer-dark'}`}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't remember if theme:darkMode is a boolean, if so then when uiSettingsService.get('theme:darkMode') is false, the className would be dscAppContainerfalse?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is boolean true when under dark mode, but is empty when not under dark mode therefore should not be seeing 'dscAppContainerfalse' case.

<Search
key="search-component"
query={appLogEvents ? generateViewQuery(tempQuery) : query[RAW_QUERY]}
Expand Down
4 changes: 0 additions & 4 deletions public/components/event_analytics/explorer/log_explorer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
}
}

// #queryTabs {
// height: calc(100vh - 98px);
// }

.tab-title {
display: inline-block;
margin-right: 5px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/
/* eslint-disable react-hooks/exhaustive-deps */

import './log_explorer.scss';
import React, { useEffect, useMemo, useRef, useState } from 'react';
import { useDispatch, useSelector, batch } from 'react-redux';
import { uniqueId, map, isEmpty } from 'lodash';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

import './sidebar.scss';

import React, { useState } from 'react';
import { isEmpty } from 'lodash';
import { EuiTitle, EuiSpacer, EuiFieldSearch, EuiAccordion } from '@elastic/eui';
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

.lnsConfigPanel__addLayerBtn {
color: transparentize($euiColorMediumShade, 0.3);
// Remove EuiButton's default shadow to make button more subtle
// sass-lint:disable-block no-important
box-shadow: none !important;
border-color: $euiColorLightShade;
}

//
// LAYOUT
//
Expand Down Expand Up @@ -140,7 +132,7 @@ $vis-editor-sidebar-min-width: 350px;

.cp__rightHeader, .cp__rightSettings {
padding: 8px;
background-color: #FFF;
background-color: transparent;
}

.cp__rightHeader {
Expand Down Expand Up @@ -196,3 +188,10 @@ $vis-editor-sidebar-min-width: 350px;
.color-theme-combo-box-option .euiFlexItem.euiFlexItem--flexGrowZero {
display: none;
}

// dark mode
.explorer-dark {
.panel_section, .cp__rightHeader {
border-bottom: 1px solid $border-color-on-dark;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { getVisTypeData } from '../../../../visualizations/charts/helpers/viz_ty
import { TabContext } from '../../../hooks';
import { reset as resetVisualizationConfig } from '../../../redux/slices/viualization_config_slice';
import { getDefaultSpec } from '../visualization_specs/default_spec';
import './config_panel.scss';

const CONFIG_LAYOUT_TEMPLATE = `
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
*/

.explorer__vizDataConfig {
@include euiYScrollWithShadows;

background: $euiColorLightestShade;
border-left: $euiBorderThin;
border-right: $euiBorderThin;
position: relative;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

import './data_configurations_panel.scss';

import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';
import {
EuiButton,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import './app.scss';

import { isEmpty } from 'lodash';

import React from 'react';
import { EuiResizableContainer } from '@elastic/eui';
import { QueryManager } from 'common/query_manager';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import React from 'react';
import { EuiIcon, EuiText, EuiSpacer } from '@elastic/eui';
import { FormattedMessage } from '@osd/i18n/react';
import './empty_placeholder.scss';

export const EmptyPlaceholder = (props: { icon: string }) => (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
* GitHub history for details.
*/

import './plotly_vis.scss';
import './plotly_editor.scss';

import React, { useCallback } from 'react';
import { EuiCodeEditor } from '@elastic/eui';
import compactStringify from 'json-stringify-pretty-compact';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

import './toolbar_button.scss';
import React from 'react';
import classNames from 'classnames';
import { EuiButton, PropsOf, EuiButtonProps } from '@elastic/eui';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@
display: grid;
grid-template-rows: auto 1fr;
grid-area: workspace;
background-color: #FFF;
height: 100%;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
}

#vis__mainContent .ws__central--canvas {
background-color: #FFF;
border-right: 1px solid #D3DAE6;
}

.explorer-dark #vis__mainContent .ws__central--canvas {
border-right: 1px solid $border-color-on-dark;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

import './workspace_panel.scss';

import React, { useState, useMemo } from 'react';
import { isEmpty } from 'lodash';
import { EuiPanel, EuiSwitch } from '@elastic/eui';
Expand Down
2 changes: 0 additions & 2 deletions public/components/event_analytics/home/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

import './home.scss';

import React, { useState, ReactElement, useRef, useEffect } from 'react';
import { useDispatch, batch, useSelector } from 'react-redux';
import { uniqueId } from 'lodash';
Expand Down
19 changes: 19 additions & 0 deletions public/components/event_analytics/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

@import 'home/home';
@import 'explorer/log_explorer';
@import 'explorer/explorer';
@import 'explorer/sidebar/sidebar';
@import 'explorer/events_views/data_grid';
@import 'explorer/events_views/docView';
@import 'explorer/visualizations/config_panel/config_panel';
@import 'explorer/visualizations/config_panel/config_panes/config_controls/data_configurations_panel';
@import 'explorer/visualizations/visualizations';
@import 'explorer/visualizations/shared_components/empty_placeholder';
@import 'explorer/visualizations/shared_components/toolbar_button';
@import 'explorer/visualizations/shared_components/plotly_viz_editor/plotly_editor';
@import 'explorer/visualizations/shared_components/plotly_viz_editor/plotly_vis';
@import 'explorer/visualizations/workspace_panel/workspace_panel';
13 changes: 13 additions & 0 deletions public/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

/* base */

@import 'variables';

/* components */

// event analytics
@import 'components/event_analytics/index';
2 changes: 2 additions & 0 deletions public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

import './index.scss';

import { AppMountParameters, CoreSetup, CoreStart, Plugin } from '../../../src/core/public';
import {
observabilityID,
Expand Down
7 changes: 7 additions & 0 deletions public/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

// dark mode border color
$border-color-on-dark: #343741;