-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add absolute timestamp to uptime
- Loading branch information
1 parent
4ed2fab
commit b5699d7
Showing
14 changed files
with
132 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
src/components/TooltipsContent/TabletTooltipContent/TabletTooltipContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import {DefinitionList} from '@gravity-ui/uikit'; | ||
|
||
import {EMPTY_DATA_PLACEHOLDER} from '../../utils/constants'; | ||
import { | ||
formatDateTime, | ||
getDowntimeFromDateFormatted, | ||
getUptimeFromDateFormatted, | ||
} from '../../utils/dataFormatters/dataFormatters'; | ||
import {CellWithPopover} from '../CellWithPopover/CellWithPopover'; | ||
|
||
import i18n from './i18n'; | ||
|
||
interface NodeUptimeProps { | ||
StartTime?: string; | ||
DisconnectTime?: string; | ||
} | ||
|
||
export function NodeUptime({StartTime, DisconnectTime}: NodeUptimeProps) { | ||
let uptime: string | undefined; | ||
|
||
if (DisconnectTime) { | ||
uptime = getDowntimeFromDateFormatted(DisconnectTime); | ||
} else { | ||
uptime = getUptimeFromDateFormatted(StartTime); | ||
} | ||
|
||
if (!uptime) { | ||
return EMPTY_DATA_PLACEHOLDER; | ||
} | ||
return ( | ||
<CellWithPopover | ||
placement={['top', 'auto']} | ||
inline | ||
content={ | ||
<DefinitionList responsive> | ||
{StartTime ? ( | ||
<DefinitionList.Item key={'StartTime'} name={i18n('start-time')}> | ||
{formatDateTime(StartTime, {withTimeZone: true})} | ||
</DefinitionList.Item> | ||
) : null} | ||
{DisconnectTime ? ( | ||
<DefinitionList.Item key={'DisconnectTime'} name={i18n('disconnect-time')}> | ||
{formatDateTime(DisconnectTime, {withTimeZone: true})} | ||
</DefinitionList.Item> | ||
) : null} | ||
</DefinitionList> | ||
} | ||
> | ||
{uptime} | ||
</CellWithPopover> | ||
); | ||
} | ||
|
||
interface TabletUptimeProps { | ||
ChangeTime?: string; | ||
} | ||
|
||
export function TabletUptime({ChangeTime}: TabletUptimeProps) { | ||
const uptime = getUptimeFromDateFormatted(ChangeTime); | ||
|
||
if (!uptime) { | ||
return EMPTY_DATA_PLACEHOLDER; | ||
} | ||
return ( | ||
<CellWithPopover | ||
placement={['top', 'auto']} | ||
inline | ||
content={ | ||
<DefinitionList responsive> | ||
<DefinitionList.Item key={'changeTime'} name={i18n('change-time')}> | ||
{formatDateTime(ChangeTime, {withTimeZone: true})} | ||
</DefinitionList.Item> | ||
</DefinitionList> | ||
} | ||
> | ||
{uptime} | ||
</CellWithPopover> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"start-time": "Start time", | ||
"disconnect-time": "Disconnect time", | ||
"change-time": "Change time" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import {registerKeysets} from '../../../utils/i18n'; | ||
|
||
import en from './en.json'; | ||
|
||
const COMPONENT = 'ydb-uptime-viewer'; | ||
|
||
export default registerKeysets(COMPONENT, {en}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters