diff --git a/dashboards-observability/common/constants/explorer.ts b/dashboards-observability/common/constants/explorer.ts index 9b01afb00e..5caca409fe 100644 --- a/dashboards-observability/common/constants/explorer.ts +++ b/dashboards-observability/common/constants/explorer.ts @@ -25,6 +25,7 @@ export const TAB_EVENT_TITLE = 'Events'; export const TAB_EVENT_ID_TXT_PFX = 'main-content-events-'; export const TAB_CHART_ID_TXT_PFX = 'main-content-vis-'; export const HAS_SAVED_TIMESTAMP = 'hasSavedTimestamp'; +export const FILTER_OPTIONS = ['Visualization', 'Query']; export const DATE_PICKER_FORMAT = 'YYYY-MM-DD HH:mm:ss'; export const TIME_INTERVAL_OPTIONS = [ diff --git a/dashboards-observability/public/components/explorer/home.tsx b/dashboards-observability/public/components/explorer/home.tsx index 2d6fcaf0d5..1c6ab32f1d 100644 --- a/dashboards-observability/public/components/explorer/home.tsx +++ b/dashboards-observability/public/components/explorer/home.tsx @@ -204,7 +204,7 @@ export const Home = (props: IHomeProps) => { wrapText={ true } > -

{ "Saved Queries and Visualizations" }

+

{ "Queries and Visualizations" }

void; + savedQuerySearch: ( + searchQuery: string, + selectedDateRange: [], + selectedTimeStamp, + selectedFields: [] + ) => void; } export function Table(options: TableData) { @@ -31,7 +32,6 @@ export function Table(options: TableData) { const pageSizeRef = useRef(); pageSizeRef.current = pageSize; - const onTableChange = ({ page = {} }) => { const { index: pageIndex, size: pageSize } = page; @@ -40,44 +40,100 @@ export function Table(options: TableData) { }; const columns = [ + { + field: 'type', + name: '', + width: '3%', + render: (item) => { + if (item == 'Visualization') { + return ( +
+ +
+ ); + } else { + return ( +
+ +
+ ); + } + }, + }, { field: 'data', name: 'Name', - render: (item)=>{return - {options.savedQuerySearch(item.query, [item.date_start, item.date_end], item.timestamp, item.fields)}}> - {item.name} - }, + align: 'left', + render: (item) => { + return ( + { + options.savedQuerySearch( + item.query, + [item.date_start, item.date_end], + item.timestamp, + item.fields + ); + }} + > + {item.name} + + ); + }, }, { - field: 'description', - name: 'Description', + field: 'type', + name: 'Type', + align: 'right', }, ]; - - + let queryType = ''; const queries = options.savedHistory.map((h) => { const savedObject = h.hasOwnProperty('savedVisualization') ? h.savedVisualization : h.savedQuery; + const isSavedVisualization = h.hasOwnProperty('savedVisualization'); + if (isSavedVisualization) { + queryType = 'Visualization'; + } else { + queryType = 'Query'; + } return { data: { name: savedObject.name, query: savedObject.query, date_start: savedObject.selected_date_range.start, - date_end : savedObject.selected_date_range.end, - timestamp: savedObject.selected_timestamp?.name || '', - fields: savedObject.selected_fields?.tokens || [] + date_end: savedObject.selected_date_range.end, + timestamp: savedObject.selected_timestamp?.name, + fields: savedObject.selected_fields?.tokens || [], }, - name: savedObject.name || '', - description: savedObject.description || '', - + name: savedObject.name, + type: queryType, }; }); - const totalItemCount = queries.length; + const search = { + box: { + incremental: true, + }, + filters: [ + { + type: 'field_value_selection', + field: 'type', + name: 'Type', + multiSelect: false, + options: FILTER_OPTIONS.map((i) => ({ + value: i, + name: i, + view: i, + })), + }, + ], + }; + const pagination = { pageIndex, pageSize, @@ -88,14 +144,13 @@ export function Table(options: TableData) { return (
-
); } - -