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

Minor UI changes for sidebar and update to PPL request #1246

Merged
merged 1 commit into from
Nov 4, 2022
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
4 changes: 2 additions & 2 deletions dashboards-observability/common/constants/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// requests constants
export const VISUALIZATION = 'viz';
export const SAVED_VISUALIZATION = 'savedVisualization';
export const PPL_PROMETHEUS_CATALOG_REQUEST =
'show catalogs | where CONNECTOR_TYPE="PROMETHEUS" | fields CATALOG_NAME';
export const PPL_DATASOURCES_REQUEST =
'show datasources | where CONNECTOR_TYPE="PROMETHEUS" | fields DATASOURCE_NAME';

// redux
export const REDUX_SLICE_METRICS = 'metrics';
Expand Down
4 changes: 2 additions & 2 deletions dashboards-observability/public/components/metrics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const Home = ({ http, chrome, parentBreadcrumb, renderProps, pplService }
}, [editMode]);

const mainSectionClassName = classNames({
'col-md-9': !isSidebarClosed,
'col-md-10': !isSidebarClosed,
'col-md-12': isSidebarClosed,
});

Expand Down Expand Up @@ -140,7 +140,7 @@ export const Home = ({ http, chrome, parentBreadcrumb, renderProps, pplService }
/>
<div className="dscAppContainer">
<div
className={`col-md-3 dscSidebar__container dscCollapsibleSidebar ${sidebarClassName}`}
className={`col-md-2 dscSidebar__container dscCollapsibleSidebar ${sidebarClassName}`}
>
<div className="">
{!isSidebarClosed && <Sidebar http={http} pplService={pplService} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { createSlice, createAsyncThunk } from '@reduxjs/toolkit';
import {
PPL_PROMETHEUS_CATALOG_REQUEST,
PPL_DATASOURCES_REQUEST,
REDUX_SLICE_METRICS,
} from '../../../../../common/constants/metrics';
import { pplServiceRequestor, getVisualizations, getNewVizDimensions } from '../../helpers/utils';
Expand Down Expand Up @@ -44,16 +44,16 @@ const fetchCustomMetrics = async (http: any) => {

const fetchRemoteMetrics = async (pplService: any) => {
const dataSet = [];
const catalogs = await pplServiceRequestor(pplService, PPL_PROMETHEUS_CATALOG_REQUEST);
for (const catalog of catalogs.jsonData) {
const dataSources = await pplServiceRequestor(pplService, PPL_DATASOURCES_REQUEST);
for (const dataSource of dataSources.jsonData) {
const catalogData = await pplServiceRequestor(
pplService,
`source = ${catalog.CATALOG_NAME}.information_schema.tables`
`source = ${dataSource.DATASOURCE_NAME}.information_schema.tables`
);
const normalizedData = catalogData.jsonData.map((obj: any) => ({
id: `${obj.TABLE_CATALOG}.${obj.TABLE_NAME}`,
name: `${obj.TABLE_CATALOG}.${obj.TABLE_NAME}`,
catalog: `${catalog.CATALOG_NAME}`,
catalog: `${dataSource.DATASOURCE_NAME}`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

do you want to change this to datasource?

Copy link
Member Author

Choose a reason for hiding this comment

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

think I'll keep it as catalog for now, changing it would mess with Pratik's code for visualizations.

type: obj.TABLE_TYPE,
recentlyCreated: false,
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,14 @@

.metricsList {
line-height:normal;
margin-top:10px;
margin-top:5px;
}

.metricsListContainer {
margin-left:25px;
margin-right:5px;
}

.metricName {
overflow:hidden;
white-space:nowrap;
text-overflow:ellipsis;
margin-bottom:10px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ export const Sidebar = (props: ISidebarProps) => {
<span>Recently Created Metrics</span>
</EuiTitle>
}
paddingSize="xs"
paddingSize="none"
>
<ul className="metricsList">
{recentlyCreatedMetrics.map((metric: any) => (
<li className="metricName" key={metric.id}>
<li key={metric.id} className="metricsListContainer">
<EuiLink
className="metricName eui-textTruncate"
title={metric.name}
Expand All @@ -81,11 +81,11 @@ export const Sidebar = (props: ISidebarProps) => {
<span>Selected Metrics</span>
</EuiTitle>
}
paddingSize="xs"
paddingSize="none"
>
<ul className="metricsList">
{selectedMetrics.map((metric: any) => (
<li key={metric.id}>
<li key={metric.id} className="metricsListContainer">
<EuiLink
className="metricName eui-textTruncate"
title={metric.name}
Expand All @@ -106,11 +106,11 @@ export const Sidebar = (props: ISidebarProps) => {
<span>Available Metrics</span>
</EuiTitle>
}
paddingSize="xs"
paddingSize="none"
>
<ul className="metricsList">
{availableMetrics.slice(0, 100).map((metric: any) => (
<li key={metric.id}>
<li key={metric.id} className="metricsListContainer">
<EuiLink
className="metricName eui-textTruncate"
title={metric.name}
Expand Down