Skip to content

Commit 992a1a4

Browse files
authored
Fix: Rework Frontend (#51)
1 parent 7982dea commit 992a1a4

File tree

7 files changed

+34
-21
lines changed

7 files changed

+34
-21
lines changed

src/datasource/components/configeditor/ConfigEditor.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ interface Props
1717
KubernetesSecureJsonData
1818
> { }
1919

20-
export function ConfigEditor(props: Props) {
20+
export function ConfigEditor({ options, onOptionsChange }: Props) {
2121
return (
2222
<>
23-
<Cluster {...props} />
24-
<Grafana {...props} />
25-
<Impersonate {...props} />
26-
<GenerateKubeconfig {...props} />
27-
<Integrations {...props} />
23+
<Cluster options={options} onOptionsChange={onOptionsChange} />
24+
<Grafana options={options} onOptionsChange={onOptionsChange} />
25+
<Impersonate options={options} onOptionsChange={onOptionsChange} />
26+
<GenerateKubeconfig options={options} onOptionsChange={onOptionsChange} />
27+
<Integrations options={options} onOptionsChange={onOptionsChange} />
2828
</>
2929
);
3030
}

src/datasource/components/configeditor/GenerateKubeconfig.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface Props
1717
KubernetesSecureJsonData
1818
> { }
1919

20-
export function GenerateKubeconfig({ onOptionsChange, options }: Props) {
20+
export function GenerateKubeconfig({ options, onOptionsChange }: Props) {
2121
const styles = useStyles2((theme: GrafanaTheme2) => {
2222
return {
2323
container: css({

src/datasource/components/configeditor/Grafana.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface Props
1717
KubernetesSecureJsonData
1818
> { }
1919

20-
export function Grafana({ onOptionsChange, options }: Props) {
20+
export function Grafana({ options, onOptionsChange }: Props) {
2121
const styles = useStyles2((theme: GrafanaTheme2) => {
2222
return {
2323
container: css({

src/datasource/components/configeditor/Impersonate.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface Props
1717
KubernetesSecureJsonData
1818
> { }
1919

20-
export function Impersonate({ onOptionsChange, options }: Props) {
20+
export function Impersonate({ options, onOptionsChange }: Props) {
2121
const styles = useStyles2((theme: GrafanaTheme2) => {
2222
return {
2323
containerKubeconfigGeneration: css({

src/datasource/components/configeditor/Integrations.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface Props
1717
KubernetesSecureJsonData
1818
> { }
1919

20-
export function Integrations({ onOptionsChange, options }: Props) {
20+
export function Integrations({ options, onOptionsChange }: Props) {
2121
const styles = useStyles2((theme: GrafanaTheme2) => {
2222
return {
2323
containerKubeconfigGeneration: css({

src/datasource/components/kubernetes/metrics/MetricsDaemonSets.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ interface Props {
99
namespace?: string;
1010
name?: string;
1111
}
12-
/**
13-
* The MetricsDaemonSets component displays the DaemonSet metrics.
14-
*/
12+
1513
export function MetricsDaemonSets({ settings, namespace, name }: Props) {
1614
const scene = new EmbeddedScene({
1715
body: new SceneFlexLayout({

src/datasource/components/variablequeryeditor/VariableQueryEditor.tsx

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ import { KubernetesContainers } from './KubernetesContainers';
1616
interface Props
1717
extends QueryEditorProps<DataSource, any, DataSourceOptions, Query> { }
1818

19-
export function VariableQueryEditor(props: Props) {
19+
export function VariableQueryEditor({
20+
datasource,
21+
query,
22+
onChange,
23+
onRunQuery,
24+
}: Props) {
2025
return (
2126
<>
2227
<InlineFieldRow>
2328
<InlineField label="Type">
2429
<Combobox<QueryType>
25-
value={props.query.queryType}
30+
value={query.queryType}
2631
options={[
2732
{
2833
label: 'Kubernetes: Resources IDs',
@@ -39,8 +44,8 @@ export function VariableQueryEditor(props: Props) {
3944
{ label: 'Kubernetes: Resources', value: 'kubernetes-resources' },
4045
]}
4146
onChange={(option: ComboboxOption<QueryType>) => {
42-
props.onChange({
43-
...props.query,
47+
onChange({
48+
...query,
4449
...DEFAULT_QUERIES[option.value],
4550
queryType: option.value,
4651
});
@@ -49,12 +54,22 @@ export function VariableQueryEditor(props: Props) {
4954
</InlineField>
5055
</InlineFieldRow>
5156

52-
{props.query.queryType === 'kubernetes-containers' && (
53-
<KubernetesContainers {...props} />
57+
{query.queryType === 'kubernetes-containers' && (
58+
<KubernetesContainers
59+
datasource={datasource}
60+
query={query}
61+
onChange={onChange}
62+
onRunQuery={onRunQuery}
63+
/>
5464
)}
5565

56-
{props.query.queryType === 'kubernetes-resources' && (
57-
<KubernetesResources {...props} />
66+
{query.queryType === 'kubernetes-resources' && (
67+
<KubernetesResources
68+
datasource={datasource}
69+
query={query}
70+
onChange={onChange}
71+
onRunQuery={onRunQuery}
72+
/>
5873
)}
5974
</>
6075
);

0 commit comments

Comments
 (0)