Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.

added fixes for filtering of url #949

Merged
merged 1 commit into from
May 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
8 changes: 7 additions & 1 deletion frontend/src/containers/DataSource/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, { useEffect, useState } from 'react';
import { Link } from 'react-router-dom';

import { useDispatch, useSelector } from 'react-redux';
import { useLocation } from 'react-router-dom';

import Plus from '../../assets/images/plus.svg';

Expand All @@ -22,6 +23,8 @@ const RESET_ACTION = {
};
const DataSource = () => {
const dispatch = useDispatch();
const location = useLocation();
const query = new URLSearchParams(location.search);
const [search, setSearch] = useState('');
const [data, setData] = useState(false);
const [dashboardTypeList, setDashboardTypeList] = useState([]);
Expand All @@ -30,7 +33,10 @@ const DataSource = () => {
page: 1,
per_page: 10,
search: '',
datasource_type: []
datasource_type:
query.getAll('datasource_type').length !== 0
? query.getAll('datasource_type')
: []
});
const [datasourceType, setDatasourceType] = useState([]);
const [pages, setPages] = useState({});
Expand Down
13 changes: 11 additions & 2 deletions frontend/src/containers/KpiExplorer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
import { Link } from 'react-router-dom';

import { useDispatch, useSelector } from 'react-redux';
import { useLocation } from 'react-router-dom';

import Plus from '../../assets/images/plus.svg';

Expand Down Expand Up @@ -29,6 +30,8 @@ const SETTING_RESET = {

const KpiExplorer = () => {
const dispatch = useDispatch();
const location = useLocation();
const query = new URLSearchParams(location.search);

const [kpiSearch, setKpiSearch] = useState('');
const [data, setData] = useState(false);
Expand All @@ -40,8 +43,14 @@ const KpiExplorer = () => {
page: 1,
per_page: 10,
search: '',
dashboard_id: [],
datasource_type: []
dashboard_id:
query.getAll('dashboard_id').length !== 0
? query.getAll('dashboard_id')
: [],
datasource_type:
query.getAll('datasource_type').length !== 0
? query.getAll('datasource_type')
: []
});
const { isLoading, kpiExplorerList, pagination } = useSelector(
(state) => state.kpiExplorer
Expand Down