-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathQueryEditorWorkflowRuns.tsx
72 lines (68 loc) · 2.15 KB
/
QueryEditorWorkflowRuns.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import React, { useState } from 'react';
import { Input, InlineField } from '@grafana/ui';
import { RightColumnWidth, LeftColumnWidth } from './QueryEditor';
import type { WorkflowRunsOptions } from 'types/query';
interface Props extends WorkflowRunsOptions {
onChange: (value: WorkflowRunsOptions) => void;
}
const QueryEditorWorkflowRuns = (props: Props) => {
const [workflow, setWorkflow] = useState<string | undefined>(props.workflow);
const [branch, setBranch] = useState<string | undefined>(props.branch);
const [status, setStatus] = useState<string | undefined>(props.status);
return (
<>
<InlineField
labelWidth={LeftColumnWidth * 2}
label="Workflow"
tooltip="The workflow id number or file name (e.g my-workflow.yml)"
>
<Input
value={workflow}
width={RightColumnWidth * 2 + LeftColumnWidth}
onChange={(el) => setWorkflow(el.currentTarget.value)}
onBlur={(el) =>
props.onChange({
...props,
workflow: el.currentTarget.value,
})
}
/>
</InlineField>
<InlineField
labelWidth={LeftColumnWidth * 2}
label="Branch"
tooltip="The branch to filter on (can be left empty)"
>
<Input
value={branch}
width={RightColumnWidth * 2 + LeftColumnWidth}
onChange={(el) => setBranch(el.currentTarget.value)}
onBlur={(el) =>
props.onChange({
...props,
branch: el.currentTarget.value,
})
}
/>
</InlineField>
<InlineField
labelWidth={LeftColumnWidth * 2}
label="Status"
tooltip="The status to filter on (e.g. completed, in_progress) - optional"
>
<Input
value={status}
width={RightColumnWidth * 2 + LeftColumnWidth}
onChange={(el) => setStatus(el.currentTarget.value)}
onBlur={(el) =>
props.onChange({
...props,
status: el.currentTarget.value,
})
}
/>
</InlineField>
</>
);
};
export default QueryEditorWorkflowRuns;