Live: search for pipeline files in data folder (#39198)

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
Alexander Emelin
2021-09-14 23:27:51 +03:00
committed by GitHub
parent 548b4daa49
commit 15e278e9e1
4 changed files with 36 additions and 13 deletions

View File

@@ -10,6 +10,7 @@ import { GrafanaCloudBackend } from './types';
export default function CloudAdminPage() {
const navModel = useNavModel('live-cloud');
const [cloud, setCloud] = useState<GrafanaCloudBackend[]>([]);
const [error, setError] = useState<string>();
const styles = useStyles(getStyles);
useEffect(() => {
@@ -18,12 +19,17 @@ export default function CloudAdminPage() {
.then((data) => {
setCloud(data.remoteWriteBackends);
})
.catch((e) => console.error(e));
.catch((e) => {
if (e.data) {
setError(JSON.stringify(e.data, null, 2));
}
});
}, []);
return (
<Page navModel={navModel}>
<Page.Contents>
{error && <pre>{error}</pre>}
{!cloud && <>Loading cloud definitions</>}
{cloud &&
cloud.map((v) => {

View File

@@ -24,6 +24,7 @@ export default function PipelineAdminPage() {
const [selectedRule, setSelectedRule] = useState<Rule>();
const [defaultRules, setDefaultRules] = useState<any[]>([]);
const navModel = useNavModel('live-pipeline');
const [error, setError] = useState<string>();
const styles = useStyles(getStyles);
useEffect(() => {
@@ -33,7 +34,11 @@ export default function PipelineAdminPage() {
setRules(data.rules);
setDefaultRules(data.rules);
})
.catch((e) => console.error(e));
.catch((e) => {
if (e.data) {
setError(JSON.stringify(e.data, null, 2));
}
});
}, []);
const onRowClick = (event: any) => {
@@ -57,6 +62,7 @@ export default function PipelineAdminPage() {
return (
<Page navModel={navModel}>
<Page.Contents>
{error && <pre>{error}</pre>}
<div className="page-action-bar">
<div className="gf-form gf-form--grow">
<Input placeholder="Search pattern..." onChange={onSearchQueryChange} />