diff --git a/grafana/grafana-plugins/pytest-command/src/ButtonPanel.tsx b/grafana/grafana-plugins/pytest-command/src/ButtonPanel.tsx index c01fe9b45e9906890bb7cee4f7f4ad471e736535..af49a713dfbdbe7e27bdc64e270669a123090b72 100755 --- a/grafana/grafana-plugins/pytest-command/src/ButtonPanel.tsx +++ b/grafana/grafana-plugins/pytest-command/src/ButtonPanel.tsx @@ -11,7 +11,7 @@ export const ButtonPanel: React.FC<Props> = ({ options, data, width, height }) = const handleClick = async () => { const result = await fetch(options.url, { method: 'POST', // *GET, POST, PUT, DELETE, etc. - mode: 'no-cors', // no-cors, *cors, same-origin + mode: 'cors', // no-cors, *cors, same-origin cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached credentials: 'same-origin', // include, *same-origin, omit headers: { @@ -36,8 +36,12 @@ export const ButtonPanel: React.FC<Props> = ({ options, data, width, height }) = setError(result.statusText); return; } - if (json['data']['executeCommand']['ok']) { - alert('Command executed successfully. '); + if (json['path'] === options.test_path) { + if (json['module'] === options.test_module) { + if (json['test'] === options.test_name) { + alert('Command executed successfully. '); + } + } } else { setError(json['data']['executeCommand']['message']); alert('Command failed!');