Browse Source

run prettier

pull/5/head
rozetko 2 years ago
parent
commit
e259d5c33f
  1. 17
      src/panels/corpglory-dataexporter-panel/components/Panel.tsx

17
src/panels/corpglory-dataexporter-panel/components/Panel.tsx

@ -25,11 +25,11 @@ export function Panel({ options, data, width, height, timeRange, onChangeTimeRan
const [dataFrame, setDataFrame] = useState<DataFrame | null>(null);
useEffect(() => {
if(tasks === null) {
if (tasks === null) {
return;
}
const dataFrame = getDataFrameForTable(tasks, setTasks);
setDataFrame(dataFrame)
setDataFrame(dataFrame);
}, [tasks]);
useEffect(() => {
@ -38,11 +38,13 @@ export function Panel({ options, data, width, height, timeRange, onChangeTimeRan
return makeRequest<TableRowConfig[]>('/tasks', {});
}
getTasks().then(tasks => setTasks(tasks)).catch(err => console.error(err));
getTasks()
.then((tasks) => setTasks(tasks))
.catch((err) => console.error(err));
}, []);
function onAddTaskClick(): void {
if(tasks === null) {
if (tasks === null) {
return;
}
const configs = [...tasks, createConfigItem()];
@ -51,9 +53,10 @@ export function Panel({ options, data, width, height, timeRange, onChangeTimeRan
return (
<div>
{dataFrame === null ?
{dataFrame === null ? (
// TODO: if datasource responds with error, display the error
<LoadingPlaceholder text="Loading..."></LoadingPlaceholder> :
<LoadingPlaceholder text="Loading..."></LoadingPlaceholder>
) : (
<div>
<Table width={width} height={height - 40} data={dataFrame} />
<HorizontalGroup justify="flex-end">
@ -68,7 +71,7 @@ export function Panel({ options, data, width, height, timeRange, onChangeTimeRan
</Button>
</HorizontalGroup>
</div>
}
)}
</div>
);
}

Loading…
Cancel
Save