Skip to content

Commit

Permalink
Feat mitigate to oui style variables (#227) (#246)
Browse files Browse the repository at this point in the history
* feat: remove customized font size and font weight

Signed-off-by: Lin Wang <wonglam@amazon.com>

* feat: update color to $ouiLinkColor

Signed-off-by: Lin Wang <wonglam@amazon.com>

* feat: remove white background for refresh interval

Signed-off-by: Lin Wang <wonglam@amazon.com>

* remove ace theme

Signed-off-by: Lin Wang <wonglam@amazon.com>

* refactor: update <b> to <strong>

Signed-off-by: Lin Wang <wonglam@amazon.com>

---------

Signed-off-by: Lin Wang <wonglam@amazon.com>
(cherry picked from commit 3aa8eaf)

Co-authored-by: Lin Wang <wonglam@amazon.com>
  • Loading branch information
opensearch-trigger-bot[bot] and wanglam authored Aug 23, 2023
1 parent 7ed315e commit 55e9e38
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 239 deletions.
19 changes: 0 additions & 19 deletions public/ace-themes/sql_console.js

This file was deleted.

2 changes: 1 addition & 1 deletion public/components/monitoring/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
.ml-modelModelIdText {
&:hover{
cursor: pointer;
color: #006BB4;
color: $ouiLinkColor;
text-decoration: underline;
}
}
Expand Down
8 changes: 1 addition & 7 deletions public/components/monitoring/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
} from '@elastic/eui';
import React, { useState, useRef, useCallback } from 'react';

import { useUiSetting } from '../../../../../src/plugins/opensearch_dashboards_react/public';
import { ModelDeploymentProfile } from '../../apis/profile';
import { RefreshInterval } from '../common/refresh_interval';
import { PreviewPanel } from '../preview_panel';
Expand All @@ -36,7 +35,6 @@ export const Monitoring = () => {
reload,
searchByStatus,
} = useMonitoring();
const darkMode = useUiSetting<boolean>('theme:darkMode');
const [previewModel, setPreviewModel] = useState<ModelDeploymentItem | null>(null);
const searchInputRef = useRef<HTMLInputElement | null>();

Expand Down Expand Up @@ -75,11 +73,7 @@ export const Monitoring = () => {
<EuiSpacer size="xs" />
<EuiPageHeader
pageTitle="Overview"
rightSideItems={[
<div style={{ backgroundColor: darkMode ? undefined : '#fff' }}>
<RefreshInterval onRefresh={reload} />
</div>,
]}
rightSideItems={[<RefreshInterval onRefresh={reload} />]}
/>
<EuiSpacer size="m" />
<EuiPanel>
Expand Down
11 changes: 5 additions & 6 deletions public/components/monitoring/model_deployment_table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ export const ModelDeploymentTable = ({
return (
<EuiHealth className="ml-modelStatusCell" color="danger">
<div className="eui-textTruncate">
<span style={{ fontWeight: 600 }}>Not responding</span> on {planningNodesCount} of{' '}
{planningNodesCount} nodes
<strong>Not responding</strong> on {planningNodesCount} of {planningNodesCount}{' '}
nodes
</div>
</EuiHealth>
);
Expand All @@ -108,17 +108,16 @@ export const ModelDeploymentTable = ({
return (
<EuiHealth className="ml-modelStatusCell" color="success">
<div className="eui-textTruncate">
<span style={{ fontWeight: 600 }}>Responding</span> on {planningNodesCount} of{' '}
{planningNodesCount} nodes
<strong>Responding</strong> on {planningNodesCount} of {planningNodesCount} nodes
</div>
</EuiHealth>
);
}
return (
<EuiHealth className="ml-modelStatusCell" color="warning">
<div className="eui-textTruncate">
<span style={{ fontWeight: 600 }}>Partially responding</span> on{' '}
{respondingNodesCount} of {planningNodesCount} nodes
<strong>Partially responding</strong> on {respondingNodesCount} of{' '}
{planningNodesCount} nodes
</div>
</EuiHealth>
);
Expand Down
15 changes: 0 additions & 15 deletions public/components/monitoring/tests/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import userEvent from '@testing-library/user-event';
import React from 'react';

import * as opensearchDashboardsReactExports from '../../../../../../src/plugins/opensearch_dashboards_react/public';
import { render, screen, waitFor, within } from '../../../../test/test_utils';
import { Monitoring } from '../index';
import * as useMonitoringExports from '../use_monitoring';
Expand Down Expand Up @@ -330,18 +329,4 @@ describe('<Monitoring />', () => {
await user.click(screen.getByLabelText('Close this dialog'));
expect(reload).not.toHaveBeenCalled();
});

it('should NOT render background for refresh interval picker in the dark mode', () => {
const useUiSettingMock = jest
.spyOn(opensearchDashboardsReactExports, 'useUiSetting')
.mockReturnValue(true);

setup();
expect(
screen.getByLabelText('current interval value').closest('div.euiFormControlLayout')
?.parentElement
).not.toHaveStyle('background-color: rgb(255, 255, 255);');

useUiSettingMock.mockRestore();
});
});
8 changes: 3 additions & 5 deletions public/components/preview_panel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,13 @@ export const PreviewPanel = ({ onClose, model }: Props) => {
</EuiFlyoutHeader>
<EuiFlyoutBody>
<EuiDescriptionList>
<EuiDescriptionListTitle style={{ fontSize: '14px' }}>Model ID</EuiDescriptionListTitle>
<EuiDescriptionListTitle>Model ID</EuiDescriptionListTitle>
<EuiDescriptionListDescription>
<CopyableText text={id} iconLeft={false} tooltipText="Copy model ID" />
</EuiDescriptionListDescription>
<EuiDescriptionListTitle style={{ fontSize: '14px' }}>Source</EuiDescriptionListTitle>
<EuiDescriptionListTitle>Source</EuiDescriptionListTitle>
<EuiDescriptionListDescription>{source}</EuiDescriptionListDescription>
<EuiDescriptionListTitle style={{ fontSize: '14px' }}>
Model status by node
</EuiDescriptionListTitle>
<EuiDescriptionListTitle>Model status by node</EuiDescriptionListTitle>
<EuiDescriptionListDescription>{respondingStatus}</EuiDescriptionListDescription>
</EuiDescriptionList>
<EuiSpacer />
Expand Down
2 changes: 1 addition & 1 deletion public/components/preview_panel/nodes_table.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.ml-nodesTableNodeIdCellText {
&:hover{
cursor: pointer;
color: #006BB4;
color: $ouiLinkColor;
text-decoration: underline;
}
}
183 changes: 0 additions & 183 deletions public/index.scss

This file was deleted.

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

import './index.scss';

import { MlCommonsPluginPlugin } from './plugin';

// This exports static code and TypeScript types,
Expand Down

0 comments on commit 55e9e38

Please sign in to comment.