-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add details drawer to Grid View #22123
Changes from all commits
583ff81
2250a4b
2925f47
60cf89f
cada012
5b89e18
8a55597
5adbf0c
6862f98
2d1b48d
ff5a461
6c91288
b6d3b2f
3b7c025
cd2c5f1
ec930f7
a47ed4f
912b733
50a8e44
20aebb2
a25704d
5c60ab0
a3f70a9
ea1ed4d
6229ace
7ff5c72
8c36a1c
39e732b
4c29813
09ff24f
566eca6
aef7325
5824b12
a3a01dd
ea3551d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,18 +17,17 @@ | |
* under the License. | ||
*/ | ||
|
||
/* global moment */ | ||
|
||
import React from 'react'; | ||
import { Box, Text } from '@chakra-ui/react'; | ||
|
||
import { formatDateTime, getDuration, formatDuration } from '../datetime_utils'; | ||
import { finalStatesMap } from '../utils'; | ||
import { formatDuration, getDuration } from '../datetime_utils'; | ||
import Time from './Time'; | ||
|
||
const InstanceTooltip = ({ | ||
group, | ||
instance: { | ||
duration, operator, startDate, endDate, state, taskId, runId, mappedStates, | ||
startDate, endDate, duration, state, runId, mappedStates, | ||
}, | ||
}) => { | ||
const isGroup = !!group.children; | ||
|
@@ -78,87 +77,28 @@ const InstanceTooltip = ({ | |
}); | ||
} | ||
|
||
const taskIdTitle = isGroup ? 'Task Group Id: ' : 'Task Id: '; | ||
|
||
return ( | ||
<Box fontSize="12px" py="4px"> | ||
<Box fontSize="12px" py="2px"> | ||
{group.tooltip && ( | ||
<Text>{group.tooltip}</Text> | ||
)} | ||
<Text> | ||
<Text as="strong">Status:</Text> | ||
{isGroup ? 'Overall ' : ''} | ||
Status: | ||
{' '} | ||
{state || 'no status'} | ||
</Text> | ||
{isGroup && ( | ||
<> | ||
<br /> | ||
<Text as="strong">Group Summary</Text> | ||
{groupSummary} | ||
</> | ||
)} | ||
{group.isMapped && ( | ||
<> | ||
<br /> | ||
<Text as="strong"> | ||
{mappedStates.length} | ||
{' '} | ||
{mappedStates.length === 1 ? 'Task ' : 'Tasks '} | ||
Mapped | ||
</Text> | ||
{mapSummary} | ||
</> | ||
)} | ||
<br /> | ||
{isGroup && groupSummary} | ||
<Text> | ||
{taskIdTitle} | ||
{taskId} | ||
</Text> | ||
<Text whiteSpace="nowrap"> | ||
Run Id: | ||
{' '} | ||
{runId} | ||
</Text> | ||
{operator && ( | ||
<Text> | ||
Operator: | ||
Started: | ||
{' '} | ||
{operator} | ||
<Time dateTime={startDate} /> | ||
</Text> | ||
)} | ||
<Text> | ||
Duration: | ||
{' '} | ||
{formatDuration(duration || getDuration(startDate, endDate))} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this show when the task is still in progress? Do we not show end date anymore? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
</Text> | ||
<br /> | ||
<Text as="strong">UTC</Text> | ||
<Text> | ||
Started: | ||
{' '} | ||
{startDate && formatDateTime(moment.utc(startDate))} | ||
</Text> | ||
<Text> | ||
Ended: | ||
{' '} | ||
{endDate && formatDateTime(moment.utc(endDate))} | ||
</Text> | ||
<br /> | ||
<Text as="strong"> | ||
Local: | ||
{' '} | ||
{moment().format('Z')} | ||
</Text> | ||
<Text> | ||
Started: | ||
{' '} | ||
{startDate && formatDateTime(startDate)} | ||
</Text> | ||
<Text> | ||
Ended: | ||
{' '} | ||
{endDate && formatDateTime(endDate)} | ||
</Text> | ||
</Box> | ||
); | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
--> | ||
|
||
# Grid View | ||
|
||
In 2.3.0 the Tree view was completely rebuilt using React and renamed to Grid. Here is a primer on the new technologies used: | ||
|
||
## [React](https://reactjs.org/) | ||
|
||
The most popular javascript framework for building user interfaces with reusable components. | ||
Written as javascript and html together in `.jsx` files. | ||
In-component state can be managed via `useState()`, application state that spans many components can be managed via a context provider (see `/context` for examples), API state can be managed by React Query (see below) | ||
|
||
|
||
## [Chakra UI](https://chakra-ui.com/) | ||
|
||
A good component and helper function library. Tooltips, modals, toasts, switches, etc are all out of the box | ||
Styles are applied via global theme when initializing the app or inline with individual components like `<Box padding="5px" />` | ||
|
||
|
||
## [React Query](https://react-query.tanstack.com/) | ||
|
||
A powerful async data handler that makes it easy to manage loading/error states as well as caching, refetching, background updates, etc. | ||
This is our state management for any data that comes from an API. | ||
Each API request is its own hook. Ie `useTasks` will get all the tasks for a DAG | ||
|
||
|
||
## [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/) | ||
|
||
Easily write tests for react components and hooks |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/*! | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { Button, Link } from '@chakra-ui/react'; | ||
|
||
import { getMetaValue } from '../utils'; | ||
|
||
const root = getMetaValue('root'); | ||
const url = getMetaValue('grid_url_no_root'); | ||
|
||
const ResetRoot = () => ( | ||
root | ||
? ( | ||
<Button | ||
as={Link} | ||
variant="outline" | ||
href={url} | ||
colorScheme="blue" | ||
mr={2} | ||
title="Reset root to show the whole DAG" | ||
> | ||
Reset Root | ||
</Button> | ||
) | ||
: null | ||
); | ||
|
||
export default ResetRoot; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only called this in the grid view, so we can fully replace it