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

Loading…
Cancel
Save