@postgres.ai/shared 3.5.1-pr-1027.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitlab-ci.yml +60 -0
- package/components/AlertSnackbar/index.tsx +23 -0
- package/components/AlertSnackbar/useAlertSnackbar.tsx +65 -0
- package/components/Button/index.tsx +79 -0
- package/components/Button2/index.tsx +43 -0
- package/components/Button2/styles.module.scss +82 -0
- package/components/DestroyCloneModal/index.tsx +56 -0
- package/components/DestroyCloneRestrictionModal/index.tsx +50 -0
- package/components/ErrorStub/index.tsx +83 -0
- package/components/FormattedText/index.tsx +44 -0
- package/components/FormattedText/styles.module.scss +34 -0
- package/components/GatewayLink/index.tsx +33 -0
- package/components/HorizontalScrollContainer/index.tsx +131 -0
- package/components/HorizontalScrollContainer/types.ts +12 -0
- package/components/HorizontalScrollContainer/utils.ts +16 -0
- package/components/ImportantText/index.tsx +29 -0
- package/components/Link2/index.tsx +31 -0
- package/components/Link2/styles.module.scss +12 -0
- package/components/MenuButton/index.tsx +80 -0
- package/components/MenuButton/styles.module.scss +42 -0
- package/components/Modal/index.tsx +93 -0
- package/components/PageSpinner/index.tsx +18 -0
- package/components/PageSpinner/styles.module.scss +13 -0
- package/components/ResetCloneModal/index.tsx +154 -0
- package/components/SectionTitle/index.tsx +74 -0
- package/components/Select/index.tsx +42 -0
- package/components/SimpleModalControls/index.tsx +56 -0
- package/components/Spinner/icon.tsx +29 -0
- package/components/Spinner/index.tsx +16 -0
- package/components/Spinner/styles.module.scss +33 -0
- package/components/Status/index.tsx +61 -0
- package/components/Status/styles.module.scss +45 -0
- package/components/StubContainer/index.tsx +41 -0
- package/components/StubSpinner/index.tsx +49 -0
- package/components/StubSpinnerFlex/index.tsx +20 -0
- package/components/StubSpinnerFlex/styles.module.scss +20 -0
- package/components/SyntaxHighlight/index.tsx +107 -0
- package/components/Table/RowMenu/index.tsx +111 -0
- package/components/Table/index.tsx +140 -0
- package/components/Text/index.tsx +28 -0
- package/components/TextField/index.tsx +117 -0
- package/components/Tooltip/index.tsx +52 -0
- package/config/index.ts +32 -0
- package/config/links.ts +6 -0
- package/craco.config.js +80 -0
- package/helpers/getEntropy.ts +232 -0
- package/helpers/localStorage.ts +15 -0
- package/helpers/request.ts +47 -0
- package/hooks/useWindowDimensions.ts +16 -0
- package/icons/ArrowDropDown/index.tsx +29 -0
- package/icons/Circle/index.tsx +27 -0
- package/icons/External/index.tsx +14 -0
- package/icons/Info/index.tsx +12 -0
- package/icons/Renewable/index.tsx +65 -0
- package/icons/Shield/index.tsx +33 -0
- package/icons/Warning/index.tsx +29 -0
- package/meta.json +1 -0
- package/package.json +55 -0
- package/pages/Clone/Status/index.tsx +73 -0
- package/pages/Clone/context.ts +22 -0
- package/pages/Clone/index.tsx +634 -0
- package/pages/Clone/stores/Main.ts +206 -0
- package/pages/Clone/useCreatedStores.ts +11 -0
- package/pages/Configuration/Header/index.tsx +84 -0
- package/pages/Configuration/InputWithTooltip/index.tsx +240 -0
- package/pages/Configuration/ResponseMessage/index.tsx +71 -0
- package/pages/Configuration/configOptions.ts +60 -0
- package/pages/Configuration/index.tsx +1184 -0
- package/pages/Configuration/styles.module.scss +122 -0
- package/pages/Configuration/tooltipText.tsx +157 -0
- package/pages/Configuration/useForm.ts +108 -0
- package/pages/Configuration/utils/index.ts +153 -0
- package/pages/CreateClone/index.tsx +311 -0
- package/pages/CreateClone/stores/Main.ts +107 -0
- package/pages/CreateClone/styles.module.scss +71 -0
- package/pages/CreateClone/useCreatedStores.ts +11 -0
- package/pages/CreateClone/useForm.ts +36 -0
- package/pages/Instance/Clones/Header/Item/index.tsx +15 -0
- package/pages/Instance/Clones/Header/Item/styles.module.scss +17 -0
- package/pages/Instance/Clones/Header/index.tsx +74 -0
- package/pages/Instance/Clones/Header/styles.module.scss +11 -0
- package/pages/Instance/Clones/index.tsx +135 -0
- package/pages/Instance/ClonesModal/index.tsx +71 -0
- package/pages/Instance/ClonesModal/utils.ts +21 -0
- package/pages/Instance/InactiveInstance/index.tsx +165 -0
- package/pages/Instance/InactiveInstance/utils.ts +9 -0
- package/pages/Instance/Info/Connection/ConnectModal/Content/index.tsx +176 -0
- package/pages/Instance/Info/Connection/ConnectModal/Content/utils.ts +24 -0
- package/pages/Instance/Info/Connection/ConnectModal/index.tsx +36 -0
- package/pages/Instance/Info/Connection/index.tsx +81 -0
- package/pages/Instance/Info/Details/index.tsx +20 -0
- package/pages/Instance/Info/Disks/Disk/ActionsMenu/index.tsx +100 -0
- package/pages/Instance/Info/Disks/Disk/Marker/index.tsx +26 -0
- package/pages/Instance/Info/Disks/Disk/ProgressBar/PointerIcon.tsx +20 -0
- package/pages/Instance/Info/Disks/Disk/ProgressBar/index.tsx +73 -0
- package/pages/Instance/Info/Disks/Disk/Status/index.tsx +75 -0
- package/pages/Instance/Info/Disks/Disk/index.tsx +168 -0
- package/pages/Instance/Info/Disks/index.tsx +65 -0
- package/pages/Instance/Info/Icons/index.tsx +39 -0
- package/pages/Instance/Info/Retrieval/RefreshFailedAlert/index.tsx +32 -0
- package/pages/Instance/Info/Retrieval/RefreshFailedAlert/styles.module.scss +33 -0
- package/pages/Instance/Info/Retrieval/RetrievalModal/index.tsx +49 -0
- package/pages/Instance/Info/Retrieval/RetrievalModal/styles.module.scss +6 -0
- package/pages/Instance/Info/Retrieval/RetrievalTable/index.tsx +53 -0
- package/pages/Instance/Info/Retrieval/RetrievalTable/styles.module.scss +29 -0
- package/pages/Instance/Info/Retrieval/index.tsx +95 -0
- package/pages/Instance/Info/Retrieval/utils.ts +10 -0
- package/pages/Instance/Info/Snapshots/Calendar/Day/index.tsx +125 -0
- package/pages/Instance/Info/Snapshots/Calendar/index.tsx +133 -0
- package/pages/Instance/Info/Snapshots/Calendar/utils.ts +74 -0
- package/pages/Instance/Info/Snapshots/TimeLine/Day/index.tsx +79 -0
- package/pages/Instance/Info/Snapshots/TimeLine/index.tsx +57 -0
- package/pages/Instance/Info/Snapshots/index.tsx +97 -0
- package/pages/Instance/Info/Snapshots/utils.ts +18 -0
- package/pages/Instance/Info/Status/InstanceResponseModal/index.tsx +32 -0
- package/pages/Instance/Info/Status/InstanceResponseModal/styles.module.scss +3 -0
- package/pages/Instance/Info/Status/index.tsx +85 -0
- package/pages/Instance/Info/Status/styles.module.scss +12 -0
- package/pages/Instance/Info/Status/utils.ts +24 -0
- package/pages/Instance/Info/components/Property/index.tsx +32 -0
- package/pages/Instance/Info/components/Property/styles.module.scss +21 -0
- package/pages/Instance/Info/components/Section/index.tsx +50 -0
- package/pages/Instance/Info/components/ValueStatus/index.tsx +51 -0
- package/pages/Instance/Info/index.tsx +129 -0
- package/pages/Instance/SnapshotsModal/index.tsx +169 -0
- package/pages/Instance/SnapshotsModal/utils.ts +17 -0
- package/pages/Instance/Tabs/index.tsx +98 -0
- package/pages/Instance/components/ClonesList/ConnectionModal/index.tsx +196 -0
- package/pages/Instance/components/ClonesList/MenuCell/index.tsx +98 -0
- package/pages/Instance/components/ClonesList/MenuCell/utils.ts +21 -0
- package/pages/Instance/components/ClonesList/index.tsx +189 -0
- package/pages/Instance/components/ClonesList/styles.module.scss +32 -0
- package/pages/Instance/components/ErrorStub/index.tsx +77 -0
- package/pages/Instance/components/ModalReloadButton/index.tsx +43 -0
- package/pages/Instance/components/Tags/Tag/index.tsx +60 -0
- package/pages/Instance/components/Tags/index.tsx +42 -0
- package/pages/Instance/context.ts +39 -0
- package/pages/Instance/index.tsx +235 -0
- package/pages/Instance/stores/ClonesModal.ts +35 -0
- package/pages/Instance/stores/Main.ts +335 -0
- package/pages/Instance/stores/SnapshotsModal.ts +35 -0
- package/pages/Instance/styles.scss +40 -0
- package/pages/Instance/useCreatedStores.ts +14 -0
- package/pages/Logs/Icons/PlusIcon.tsx +8 -0
- package/pages/Logs/constants/index.ts +7 -0
- package/pages/Logs/hooks/useWsScroll.tsx +44 -0
- package/pages/Logs/index.tsx +267 -0
- package/pages/Logs/utils/index.ts +20 -0
- package/pages/Logs/wsLogs.ts +110 -0
- package/pages/Logs/wsSnackbar.ts +27 -0
- package/postgres.ai-shared-3.5.0.tgz +0 -0
- package/react-app-env.d.ts +71 -0
- package/scripts/copy-assets.js +30 -0
- package/scripts/pack.js +70 -0
- package/stores/Snapshots.ts +54 -0
- package/styles/colors.ts +67 -0
- package/styles/global.scss +29 -0
- package/styles/icons.tsx +1917 -0
- package/styles/mixins.scss +30 -0
- package/styles/styles.ts +87 -0
- package/styles/theme.ts +53 -0
- package/styles/vars.scss +43 -0
- package/styles/vars.ts +40 -0
- package/tsconfig.build.json +37 -0
- package/tsconfig.json +30 -0
- package/types/api/endpoints/createClone.ts +10 -0
- package/types/api/endpoints/destroyClone.ts +7 -0
- package/types/api/endpoints/getClone.ts +6 -0
- package/types/api/endpoints/getConfig.ts +6 -0
- package/types/api/endpoints/getEngine.ts +13 -0
- package/types/api/endpoints/getFullConfig.ts +4 -0
- package/types/api/endpoints/getInstance.ts +6 -0
- package/types/api/endpoints/getInstanceRetrieval.ts +6 -0
- package/types/api/endpoints/getSeImages.ts +22 -0
- package/types/api/endpoints/getSnapshots.ts +6 -0
- package/types/api/endpoints/getWSToken.ts +6 -0
- package/types/api/endpoints/initWS.ts +1 -0
- package/types/api/endpoints/refreshInstance.ts +4 -0
- package/types/api/endpoints/resetClone.ts +8 -0
- package/types/api/endpoints/testDbSource.ts +48 -0
- package/types/api/endpoints/updateClone.ts +10 -0
- package/types/api/endpoints/updateConfig.ts +6 -0
- package/types/api/entities/clone.ts +42 -0
- package/types/api/entities/config.ts +114 -0
- package/types/api/entities/dbSource.ts +13 -0
- package/types/api/entities/instance.ts +67 -0
- package/types/api/entities/instanceRetrieval.ts +46 -0
- package/types/api/entities/instanceState.ts +102 -0
- package/types/api/entities/pool.ts +27 -0
- package/types/api/entities/snapshot.ts +18 -0
- package/types/api/entities/wsToken.ts +7 -0
- package/types/byte-size/index.d.ts +22 -0
- package/utils/api.ts +30 -0
- package/utils/clone.ts +31 -0
- package/utils/connection.ts +38 -0
- package/utils/date.ts +87 -0
- package/utils/instance.ts +10 -0
- package/utils/numbers.ts +11 -0
- package/utils/react.ts +10 -0
- package/utils/snapshot.ts +4 -0
- package/utils/strings.ts +11 -0
- package/utils/units.ts +23 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*--------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) 2019-2021, Postgres.ai, Nikolay Samokhvalov nik@postgres.ai
|
|
3
|
+
* All Rights Reserved. Proprietary and confidential.
|
|
4
|
+
* Unauthorized copying of this file, via any medium is strictly prohibited
|
|
5
|
+
*--------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { makeStyles } from '@material-ui/styles'
|
|
9
|
+
|
|
10
|
+
import { colors } from '@postgres.ai/shared/styles/colors'
|
|
11
|
+
|
|
12
|
+
type Props = {
|
|
13
|
+
text: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const useStyles = makeStyles(
|
|
17
|
+
{
|
|
18
|
+
root: {
|
|
19
|
+
flex: '0 1 auto',
|
|
20
|
+
display: 'flex',
|
|
21
|
+
flexDirection: 'column',
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
'&:first-child': {
|
|
24
|
+
alignItems: 'flex-start',
|
|
25
|
+
|
|
26
|
+
'& $division': {
|
|
27
|
+
marginLeft: '9px',
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
'& $date': {
|
|
31
|
+
color: colors.black,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
'&:last-child': {
|
|
35
|
+
alignItems: 'flex-end',
|
|
36
|
+
|
|
37
|
+
'& $division': {
|
|
38
|
+
marginRight: '9px',
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
'& $date': {
|
|
42
|
+
color: colors.black,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
point: {
|
|
47
|
+
width: '19px',
|
|
48
|
+
flex: '0 0 19px',
|
|
49
|
+
borderRadius: '50%',
|
|
50
|
+
background: colors.secondary2.lightLight,
|
|
51
|
+
border: `1px solid ${colors.secondary2.main}`,
|
|
52
|
+
},
|
|
53
|
+
division: {
|
|
54
|
+
marginTop: '4px',
|
|
55
|
+
flex: '0 0 4px',
|
|
56
|
+
width: '1px',
|
|
57
|
+
background: colors.pgaiDarkGray,
|
|
58
|
+
},
|
|
59
|
+
date: {
|
|
60
|
+
fontSize: '10px',
|
|
61
|
+
marginTop: '4px',
|
|
62
|
+
color: colors.pgaiDarkGray,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{ index: 1 },
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
export const Day = (props: Props) => {
|
|
69
|
+
const { text } = props
|
|
70
|
+
const classes = useStyles()
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<div className={classes.root}>
|
|
74
|
+
<div className={classes.point} />
|
|
75
|
+
<div className={classes.division} />
|
|
76
|
+
<span className={classes.date}>{text}</span>
|
|
77
|
+
</div>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*--------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) 2019-2021, Postgres.ai, Nikolay Samokhvalov nik@postgres.ai
|
|
3
|
+
* All Rights Reserved. Proprietary and confidential.
|
|
4
|
+
* Unauthorized copying of this file, via any medium is strictly prohibited
|
|
5
|
+
*--------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { makeStyles } from '@material-ui/styles'
|
|
9
|
+
|
|
10
|
+
import { colors } from '@postgres.ai/shared/styles/colors'
|
|
11
|
+
|
|
12
|
+
import { Day } from './Day'
|
|
13
|
+
|
|
14
|
+
const useStyles = makeStyles(
|
|
15
|
+
{
|
|
16
|
+
root: {
|
|
17
|
+
marginTop: '10px',
|
|
18
|
+
},
|
|
19
|
+
container: {
|
|
20
|
+
display: 'flex',
|
|
21
|
+
justifyContent: 'space-between',
|
|
22
|
+
position: 'relative',
|
|
23
|
+
},
|
|
24
|
+
line: {
|
|
25
|
+
margin: '0 9px -23px 9px',
|
|
26
|
+
paddingTop: '22px',
|
|
27
|
+
borderBottom: `1px solid ${colors.pgaiDarkGray}`,
|
|
28
|
+
},
|
|
29
|
+
label: {
|
|
30
|
+
fontSize: '12px',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
{ index: 1 },
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
export const TimeLine = () => {
|
|
37
|
+
const classes = useStyles()
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div className={classes.root}>
|
|
41
|
+
<div className={classes.line} />
|
|
42
|
+
<div className={classes.container}>
|
|
43
|
+
<Day text="Jun 20" />
|
|
44
|
+
<Day text="Jun 21" />
|
|
45
|
+
<Day text="Jun 22" />
|
|
46
|
+
<Day text="Jun 23" />
|
|
47
|
+
<Day text="Jun 24" />
|
|
48
|
+
<Day text="Jun 25" />
|
|
49
|
+
<Day text="Jun 26" />
|
|
50
|
+
</div>
|
|
51
|
+
<div className={classes.container}>
|
|
52
|
+
<span className={classes.label}>16:33:20 UTC</span>
|
|
53
|
+
<span className={classes.label}>10:30:00 UTC</span>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/*--------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) 2019-2021, Postgres.ai, Nikolay Samokhvalov nik@postgres.ai
|
|
3
|
+
* All Rights Reserved. Proprietary and confidential.
|
|
4
|
+
* Unauthorized copying of this file, via any medium is strictly prohibited
|
|
5
|
+
*--------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { makeStyles } from '@material-ui/styles'
|
|
9
|
+
import { observer } from 'mobx-react-lite'
|
|
10
|
+
import { formatDistanceToNowStrict } from 'date-fns'
|
|
11
|
+
|
|
12
|
+
import { Button } from '@postgres.ai/shared/components/Button2'
|
|
13
|
+
import { Spinner } from '@postgres.ai/shared/components/Spinner'
|
|
14
|
+
import { ErrorStub } from '@postgres.ai/shared/components/ErrorStub'
|
|
15
|
+
import { useStores } from '@postgres.ai/shared/pages/Instance/context'
|
|
16
|
+
|
|
17
|
+
import { Section } from '../components/Section'
|
|
18
|
+
import { Property } from '../components/Property'
|
|
19
|
+
|
|
20
|
+
import { getEdgeSnapshots } from './utils'
|
|
21
|
+
import { Calendar } from './Calendar'
|
|
22
|
+
|
|
23
|
+
const useStyles = makeStyles(
|
|
24
|
+
{
|
|
25
|
+
button: {
|
|
26
|
+
marginTop: '20px',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{ index: 1 },
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
export const Snapshots = observer(() => {
|
|
33
|
+
const stores = useStores()
|
|
34
|
+
|
|
35
|
+
const { snapshots } = stores.main
|
|
36
|
+
|
|
37
|
+
const classes = useStyles()
|
|
38
|
+
|
|
39
|
+
const { firstSnapshot, lastSnapshot } = getEdgeSnapshots(snapshots.data ?? [])
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Section
|
|
43
|
+
title="Snapshots"
|
|
44
|
+
rightContent={
|
|
45
|
+
!snapshots.data && !snapshots.error && <Spinner size="sm" />
|
|
46
|
+
}
|
|
47
|
+
>
|
|
48
|
+
{snapshots.error && <ErrorStub message={snapshots.error} size="normal" />}
|
|
49
|
+
|
|
50
|
+
{snapshots.data && !snapshots.error && (
|
|
51
|
+
<>
|
|
52
|
+
<Property name="Number of snapshots">
|
|
53
|
+
{snapshots.data.length}
|
|
54
|
+
</Property>
|
|
55
|
+
|
|
56
|
+
<Property name="Oldest data state time">
|
|
57
|
+
{lastSnapshot && (
|
|
58
|
+
<>
|
|
59
|
+
{lastSnapshot.dataStateAt} (
|
|
60
|
+
{formatDistanceToNowStrict(lastSnapshot.dataStateAtDate, {
|
|
61
|
+
addSuffix: true,
|
|
62
|
+
})}
|
|
63
|
+
)
|
|
64
|
+
</>
|
|
65
|
+
)}
|
|
66
|
+
{!lastSnapshot && '-'}
|
|
67
|
+
</Property>
|
|
68
|
+
|
|
69
|
+
<Property name="Newest data state time">
|
|
70
|
+
{firstSnapshot && (
|
|
71
|
+
<>
|
|
72
|
+
{firstSnapshot.dataStateAt} (
|
|
73
|
+
{formatDistanceToNowStrict(firstSnapshot.dataStateAtDate, {
|
|
74
|
+
addSuffix: true,
|
|
75
|
+
})}
|
|
76
|
+
)
|
|
77
|
+
</>
|
|
78
|
+
)}
|
|
79
|
+
{!firstSnapshot && '-'}
|
|
80
|
+
</Property>
|
|
81
|
+
|
|
82
|
+
<Calendar
|
|
83
|
+
snapshots={snapshots.data}
|
|
84
|
+
onSelectDate={(date) => stores.snapshotsModal.openModal({ date })}
|
|
85
|
+
/>
|
|
86
|
+
|
|
87
|
+
<Button
|
|
88
|
+
className={classes.button}
|
|
89
|
+
onClick={() => stores.snapshotsModal.openModal()}
|
|
90
|
+
>
|
|
91
|
+
Show all snapshots
|
|
92
|
+
</Button>
|
|
93
|
+
</>
|
|
94
|
+
)}
|
|
95
|
+
</Section>
|
|
96
|
+
)
|
|
97
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*--------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) 2019-2021, Postgres.ai, Nikolay Samokhvalov nik@postgres.ai
|
|
3
|
+
* All Rights Reserved. Proprietary and confidential.
|
|
4
|
+
* Unauthorized copying of this file, via any medium is strictly prohibited
|
|
5
|
+
*--------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Snapshot } from '@postgres.ai/shared/types/api/entities/snapshot'
|
|
9
|
+
|
|
10
|
+
export const getEdgeSnapshots = (snapshots: Snapshot[]) => {
|
|
11
|
+
const list = [...snapshots]
|
|
12
|
+
const [first] = list
|
|
13
|
+
const [last] = list.reverse()
|
|
14
|
+
return {
|
|
15
|
+
firstSnapshot: (first as Snapshot | undefined) ?? null,
|
|
16
|
+
lastSnapshot: (last as Snapshot | undefined) ?? null
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { observer } from 'mobx-react-lite'
|
|
2
|
+
|
|
3
|
+
import { Modal } from '@postgres.ai/shared/components/Modal'
|
|
4
|
+
import { FormattedText } from '@postgres.ai/shared/components/FormattedText'
|
|
5
|
+
import { useStores } from '@postgres.ai/shared/pages/Instance/context'
|
|
6
|
+
|
|
7
|
+
import styles from './styles.module.scss'
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
isOpen: boolean
|
|
11
|
+
onClose: () => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const InstanceResponseModal = observer((props: Props) => {
|
|
15
|
+
const stores = useStores()
|
|
16
|
+
|
|
17
|
+
if (!stores.main.instance) return null
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Modal
|
|
21
|
+
isOpen={props.isOpen}
|
|
22
|
+
onClose={props.onClose}
|
|
23
|
+
title="Instance Full Response"
|
|
24
|
+
size="md"
|
|
25
|
+
>
|
|
26
|
+
<FormattedText
|
|
27
|
+
value={JSON.stringify(stores.main.instance.dto, null, 2)}
|
|
28
|
+
className={styles.formattedText}
|
|
29
|
+
/>
|
|
30
|
+
</Modal>
|
|
31
|
+
)
|
|
32
|
+
})
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*--------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) 2019-2021, Postgres.ai, Nikolay Samokhvalov nik@postgres.ai
|
|
3
|
+
* All Rights Reserved. Proprietary and confidential.
|
|
4
|
+
* Unauthorized copying of this file, via any medium is strictly prohibited
|
|
5
|
+
*--------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { useState } from 'react'
|
|
9
|
+
import { observer } from 'mobx-react-lite'
|
|
10
|
+
|
|
11
|
+
import { GatewayLink } from '@postgres.ai/shared/components/GatewayLink'
|
|
12
|
+
import { Status as StatusIndicator } from '@postgres.ai/shared/components/Status'
|
|
13
|
+
import { useStores } from '@postgres.ai/shared/pages/Instance/context'
|
|
14
|
+
import { formatDateStd } from '@postgres.ai/shared/utils/date'
|
|
15
|
+
import { Button } from '@postgres.ai/shared/components/Button2'
|
|
16
|
+
import { linksConfig } from '@postgres.ai/shared/config/links'
|
|
17
|
+
|
|
18
|
+
import { Section } from '../components/Section'
|
|
19
|
+
import { Property } from '../components/Property'
|
|
20
|
+
|
|
21
|
+
import { InstanceResponseModal } from './InstanceResponseModal'
|
|
22
|
+
|
|
23
|
+
import { getType, getText } from './utils'
|
|
24
|
+
|
|
25
|
+
import styles from './styles.module.scss'
|
|
26
|
+
|
|
27
|
+
export const Status = observer(() => {
|
|
28
|
+
const [isOpenInstanceResponseModal, setIsOpenInstanceResponseModal] =
|
|
29
|
+
useState(false)
|
|
30
|
+
const stores = useStores()
|
|
31
|
+
|
|
32
|
+
const { instance } = stores.main
|
|
33
|
+
if (!instance || !instance.state) return null
|
|
34
|
+
|
|
35
|
+
const { code, message } = instance.state.status
|
|
36
|
+
const { version, startedAt } = instance.state.engine
|
|
37
|
+
|
|
38
|
+
const isStatusOk = code === 'OK'
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Section title="Status">
|
|
42
|
+
<Property name="Status">
|
|
43
|
+
<StatusIndicator type={getType(code)}>
|
|
44
|
+
{getText(code)}
|
|
45
|
+
{!isStatusOk && (
|
|
46
|
+
<>
|
|
47
|
+
<br />
|
|
48
|
+
{message}
|
|
49
|
+
</>
|
|
50
|
+
)}
|
|
51
|
+
</StatusIndicator>
|
|
52
|
+
</Property>
|
|
53
|
+
{startedAt && (
|
|
54
|
+
<Property name="Started">
|
|
55
|
+
{formatDateStd(startedAt, { withDistance: true })}
|
|
56
|
+
</Property>
|
|
57
|
+
)}
|
|
58
|
+
{instance.createdAt && (
|
|
59
|
+
<Property name="Registered">
|
|
60
|
+
{formatDateStd(instance.createdAt, { withDistance: true })}
|
|
61
|
+
</Property>
|
|
62
|
+
)}
|
|
63
|
+
{version && <Property name="Version">{version}</Property>}
|
|
64
|
+
|
|
65
|
+
{!isStatusOk && (
|
|
66
|
+
<div className={styles.controls}>
|
|
67
|
+
<Button
|
|
68
|
+
onClick={() => setIsOpenInstanceResponseModal(true)}
|
|
69
|
+
className={styles.button}
|
|
70
|
+
>
|
|
71
|
+
Show full response
|
|
72
|
+
</Button>
|
|
73
|
+
<GatewayLink className={styles.button} href={linksConfig.support}>
|
|
74
|
+
<Button theme="accent">Ask support</Button>
|
|
75
|
+
</GatewayLink>
|
|
76
|
+
</div>
|
|
77
|
+
)}
|
|
78
|
+
|
|
79
|
+
<InstanceResponseModal
|
|
80
|
+
isOpen={isOpenInstanceResponseModal}
|
|
81
|
+
onClose={() => setIsOpenInstanceResponseModal(false)}
|
|
82
|
+
/>
|
|
83
|
+
</Section>
|
|
84
|
+
)
|
|
85
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*--------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) 2019-2021, Postgres.ai, Nikolay Samokhvalov nik@postgres.ai
|
|
3
|
+
* All Rights Reserved. Proprietary and confidential.
|
|
4
|
+
* Unauthorized copying of this file, via any medium is strictly prohibited
|
|
5
|
+
*--------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { capitalize } from '@postgres.ai/shared/utils/strings'
|
|
9
|
+
|
|
10
|
+
const STATUS_CODE_TO_TYPE = {
|
|
11
|
+
OK: 'ok' as const,
|
|
12
|
+
WARNING: 'warning' as const,
|
|
13
|
+
NO_RESPONSE: 'error' as const
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const getType = (code: keyof typeof STATUS_CODE_TO_TYPE) => {
|
|
17
|
+
return STATUS_CODE_TO_TYPE[code] ?? 'unknown'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const getText = (code: keyof typeof STATUS_CODE_TO_TYPE) => {
|
|
21
|
+
if (code === 'OK') return code
|
|
22
|
+
if (code === 'NO_RESPONSE') return 'No response'
|
|
23
|
+
return capitalize(code)
|
|
24
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*--------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) 2019-2021, Postgres.ai, Nikolay Samokhvalov nik@postgres.ai
|
|
3
|
+
* All Rights Reserved. Proprietary and confidential.
|
|
4
|
+
* Unauthorized copying of this file, via any medium is strictly prohibited
|
|
5
|
+
*--------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import cn from 'classnames'
|
|
9
|
+
|
|
10
|
+
import styles from './styles.module.scss'
|
|
11
|
+
|
|
12
|
+
type Props = {
|
|
13
|
+
name: React.ReactNode
|
|
14
|
+
children: React.ReactNode
|
|
15
|
+
classes?: {
|
|
16
|
+
name?: string
|
|
17
|
+
content?: string
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const Property = (props: Props) => {
|
|
22
|
+
const { name, children } = props
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div className={styles.root}>
|
|
26
|
+
<label className={cn(styles.name, props.classes?.name)}>{name}</label>
|
|
27
|
+
<div className={cn(styles.content, props.classes?.content)}>
|
|
28
|
+
{children}
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: flex;
|
|
3
|
+
margin-top: 4px;
|
|
4
|
+
font-size: 12px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.name {
|
|
8
|
+
flex: 0 0 134px;
|
|
9
|
+
margin-right: 14px;
|
|
10
|
+
|
|
11
|
+
@media screen and (max-width: '600px') {
|
|
12
|
+
flex: 1 1 100%;
|
|
13
|
+
margin-right: 7px;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.content {
|
|
18
|
+
flex: 1 1 100%;
|
|
19
|
+
font-weight: 700;
|
|
20
|
+
width: 0;
|
|
21
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*--------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) 2019-2021, Postgres.ai, Nikolay Samokhvalov nik@postgres.ai
|
|
3
|
+
* All Rights Reserved. Proprietary and confidential.
|
|
4
|
+
* Unauthorized copying of this file, via any medium is strictly prohibited
|
|
5
|
+
*--------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react'
|
|
9
|
+
import { makeStyles } from '@material-ui/styles'
|
|
10
|
+
|
|
11
|
+
import { SectionTitle } from '@postgres.ai/shared/components/SectionTitle'
|
|
12
|
+
|
|
13
|
+
type Props = {
|
|
14
|
+
title: string
|
|
15
|
+
children: React.ReactNode
|
|
16
|
+
rightContent?: React.ReactNode
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const useStyles = makeStyles(
|
|
20
|
+
{
|
|
21
|
+
root: {
|
|
22
|
+
'& + $root': {
|
|
23
|
+
marginTop: '28px',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
content: {
|
|
27
|
+
marginTop: '8px',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{ index: 1 },
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
export const Section = (props: Props) => {
|
|
34
|
+
const { title, children, rightContent } = props
|
|
35
|
+
|
|
36
|
+
const classes = useStyles()
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div className={classes.root}>
|
|
40
|
+
<SectionTitle
|
|
41
|
+
text={title}
|
|
42
|
+
level={2}
|
|
43
|
+
tag="h3"
|
|
44
|
+
rightContent={rightContent}
|
|
45
|
+
/>
|
|
46
|
+
|
|
47
|
+
<div className={classes.content}>{children}</div>
|
|
48
|
+
</div>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*--------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) 2019-2021, Postgres.ai, Nikolay Samokhvalov nik@postgres.ai
|
|
3
|
+
* All Rights Reserved. Proprietary and confidential.
|
|
4
|
+
* Unauthorized copying of this file, via any medium is strictly prohibited
|
|
5
|
+
*--------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react'
|
|
9
|
+
import { makeStyles } from '@material-ui/core'
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
Status,
|
|
13
|
+
Props as StatusProps,
|
|
14
|
+
} from '@postgres.ai/shared/components/Status'
|
|
15
|
+
|
|
16
|
+
type Props = {
|
|
17
|
+
children: React.ReactNode
|
|
18
|
+
type?: StatusProps['type']
|
|
19
|
+
icon?: StatusProps['icon']
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const useStyles = makeStyles(
|
|
23
|
+
{
|
|
24
|
+
root: {
|
|
25
|
+
fontWeight: 400,
|
|
26
|
+
marginTop: '2px',
|
|
27
|
+
fontSize: '10px',
|
|
28
|
+
},
|
|
29
|
+
icon: {
|
|
30
|
+
alignSelf: 'flex-start',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
{ index: 1 },
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
export const ValueStatus = (props: Props) => {
|
|
37
|
+
const { children, type, icon } = props
|
|
38
|
+
|
|
39
|
+
const classes = useStyles()
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Status
|
|
43
|
+
className={classes.root}
|
|
44
|
+
classNameIcon={classes.icon}
|
|
45
|
+
type={type}
|
|
46
|
+
icon={icon}
|
|
47
|
+
>
|
|
48
|
+
{children}
|
|
49
|
+
</Status>
|
|
50
|
+
)
|
|
51
|
+
}
|