-
Notifications
You must be signed in to change notification settings - Fork 2
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
Create foundation for a controller status history view #1402
Merged
travjenkins
merged 44 commits into
main
from
kiahna-tucker/entity-status/init-controller-status-history
Jan 21, 2025
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
a60b508
Create foundation for a controller status history view
kiahna-tucker 515ed8f
Rename Details table column to Event
kiahna-tucker 728c9d6
Correct styling of ControllerErrors when no errors exist
kiahna-tucker 01bfec6
Move control-plane related types into deps/control-plane
kiahna-tucker 02ec799
Move getEntityStatus into a file within src/api
kiahna-tucker 4fb88cd
Merge branch 'main' into kiahna-tucker/entity-status/init-controller-…
kiahna-tucker 34a4fc1
Move controller status history table cells into entityStatus directory
kiahna-tucker b40b47b
Update format of /status request URL
kiahna-tucker eb1873c
Update /status response URL and associated types
kiahna-tucker fb0cff7
Create a foundation for controller status overview component
kiahna-tucker 048f618
Create foundation for auto-discovery status overview component
kiahna-tucker 9a96839
Merge branch 'main' into kiahna-tucker/entity-status/init-controller-…
kiahna-tucker 3172ab0
Rename EntityStatusResponse.status to controller_status
kiahna-tucker f9986c9
Move component-defined colors to theme
kiahna-tucker d8e77c5
Hide auto-discovery overview for non-captures
kiahna-tucker 0250ebe
Add refresh cta to status section
kiahna-tucker 9d17a18
Toggle between dashboard and code views
kiahna-tucker 09ec67a
Display time the endpoint was last successfully reached
kiahna-tucker edeec18
Remove superfluous padding on SectionUpdated
kiahna-tucker d1c750d
Replace response store state with computed value
kiahna-tucker e70c8f7
Identify loading view state using computed value
kiahna-tucker 6fab387
Reset entity status store state when details page unmounts
kiahna-tucker 436c508
Remove logging statements
kiahna-tucker d314ea7
Create production env variable for base entity status url
kiahna-tucker 62787e2
Update status section styling
kiahna-tucker 70ef39a
Update the overview card style
kiahna-tucker fb22211
Update auto discovery failure timestamp
kiahna-tucker 33fdaa4
Distinguish between loading and hydrating states
kiahna-tucker 78840b7
Display server error
kiahna-tucker f5ca921
Store entity status swr mutator
kiahna-tucker 27f7dec
Remove loading-related store state and action
kiahna-tucker e942402
Display response viewer loading state when refreshing
kiahna-tucker 973ab4c
Convert getSingleResponse to store hook
kiahna-tucker d787efc
Update control-plane declaration file comments
kiahna-tucker 531b353
Address a handful of nits
kiahna-tucker ac3b0d9
Add log rocket events
kiahna-tucker b317aa6
Hide section for non-support users
kiahna-tucker 87ed464
Merge branch 'main' into kiahna-tucker/entity-status/init-controller-…
kiahna-tucker 648a999
Move control-plane types from deps/ to src/types/
kiahna-tucker b336ecc
Merge branch 'main' into kiahna-tucker/entity-status/init-controller-…
kiahna-tucker 9f0f7d1
Replace temp number formatting util with readable
kiahna-tucker 06af24e
Set active during hydration only when store is not hydrated
kiahna-tucker 5c70228
Remove optional controller status history table column code
kiahna-tucker 6dedc93
Merge branch 'main' into kiahna-tucker/entity-status/init-controller-…
travjenkins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { client } from 'services/client'; | ||
import { EntityStatusResponse } from 'types/controlPlane'; | ||
import { getEntityStatusSettings } from 'utils/env-utils'; | ||
|
||
const { entityStatusBaseEndpoint } = getEntityStatusSettings(); | ||
|
||
// Local API documentation can be found here: http://localhost:8675/api/v1/docs | ||
export const getEntityStatus = async ( | ||
accessToken: string, | ||
catalogName: string | ||
): Promise<EntityStatusResponse[]> => | ||
client(`${entityStatusBaseEndpoint}?name=${catalogName}`, {}, accessToken); | ||
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
42 changes: 42 additions & 0 deletions
42
src/components/shared/Entity/Details/Logs/Status/Overview/ActivationDetail.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Skeleton, Typography } from '@mui/material'; | ||
import useGlobalSearchParams, { | ||
GlobalSearchParams, | ||
} from 'hooks/searchParams/useGlobalSearchParams'; | ||
import { useIntl } from 'react-intl'; | ||
import { | ||
useEntityStatusStore_lastActivated, | ||
useEntityStatusStore_singleResponse, | ||
} from 'stores/EntityStatus/hooks'; | ||
import { useEntityStatusStore } from 'stores/EntityStatus/Store'; | ||
import { getDataPlaneActivationStatus } from 'utils/entityStatus-utils'; | ||
import DetailWrapper from './DetailWrapper'; | ||
import { BaseDetailProps } from './types'; | ||
|
||
export default function ActivationDetail({ headerMessageId }: BaseDetailProps) { | ||
const catalogName = useGlobalSearchParams(GlobalSearchParams.CATALOG_NAME); | ||
|
||
const intl = useIntl(); | ||
|
||
const hydrating = useEntityStatusStore((state) => !state.hydrated); | ||
const lastActivated = useEntityStatusStore_lastActivated(catalogName); | ||
const lastBuildId = | ||
useEntityStatusStore_singleResponse(catalogName)?.last_build_id; | ||
|
||
const contentMessageId = getDataPlaneActivationStatus( | ||
lastActivated, | ||
lastBuildId | ||
); | ||
|
||
return ( | ||
<DetailWrapper | ||
headerMessageId={headerMessageId} | ||
Hydrating={ | ||
hydrating ? <Skeleton height={21} width={75} /> : undefined | ||
} | ||
> | ||
<Typography> | ||
{intl.formatMessage({ id: contentMessageId })} | ||
</Typography> | ||
</DetailWrapper> | ||
); | ||
} |
32 changes: 32 additions & 0 deletions
32
src/components/shared/Entity/Details/Logs/Status/Overview/AutoDiscoverChanges.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Divider, Stack } from '@mui/material'; | ||
import NumberDetail from './NumberDetail'; | ||
import { AutoDiscoverChangesProps } from './types'; | ||
|
||
export default function AutoDiscoverChanges({ | ||
added, | ||
modified, | ||
removed, | ||
}: AutoDiscoverChangesProps) { | ||
return ( | ||
<Stack direction="row" spacing={1}> | ||
<NumberDetail | ||
headerMessageId="details.ops.status.overview.autoDiscovery.subheaderAdded" | ||
value={added?.length ?? 0} | ||
/> | ||
|
||
<Divider flexItem orientation="vertical" /> | ||
|
||
<NumberDetail | ||
headerMessageId="details.ops.status.overview.autoDiscovery.subheaderModified" | ||
value={modified?.length ?? 0} | ||
/> | ||
|
||
<Divider flexItem orientation="vertical" /> | ||
|
||
<NumberDetail | ||
headerMessageId="details.ops.status.overview.autoDiscovery.subheaderRemoved" | ||
value={removed?.length ?? 0} | ||
/> | ||
</Stack> | ||
); | ||
} |
49 changes: 49 additions & 0 deletions
49
src/components/shared/Entity/Details/Logs/Status/Overview/AutoDiscoverOutcome.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import useGlobalSearchParams, { | ||
GlobalSearchParams, | ||
} from 'hooks/searchParams/useGlobalSearchParams'; | ||
import { | ||
useEntityStatusStore_autoDiscoverFailure, | ||
useEntityStatusStore_autoDiscoverLastSuccess, | ||
} from 'stores/EntityStatus/hooks'; | ||
import AutoDiscoverChanges from './AutoDiscoverChanges'; | ||
import TimestampDetail from './TimestampDetail'; | ||
|
||
export default function AutoDiscoverOutcome() { | ||
const catalogName = useGlobalSearchParams(GlobalSearchParams.CATALOG_NAME); | ||
|
||
const failure = useEntityStatusStore_autoDiscoverFailure(catalogName); | ||
const lastSuccess = | ||
useEntityStatusStore_autoDiscoverLastSuccess(catalogName); | ||
|
||
if (failure) { | ||
return ( | ||
<> | ||
<AutoDiscoverChanges | ||
added={failure.last_outcome.added} | ||
modified={failure.last_outcome.modified} | ||
removed={failure.last_outcome.removed} | ||
/> | ||
|
||
<TimestampDetail | ||
headerMessageId="details.ops.status.overview.autoDiscovery.subheaderLastFailure" | ||
time={failure.last_outcome.ts} | ||
/> | ||
</> | ||
); | ||
} | ||
|
||
return ( | ||
<> | ||
<AutoDiscoverChanges | ||
added={lastSuccess?.added} | ||
modified={lastSuccess?.modified} | ||
removed={lastSuccess?.removed} | ||
/> | ||
|
||
<TimestampDetail | ||
headerMessageId="details.ops.status.overview.autoDiscovery.subheaderLastSuccess" | ||
time={lastSuccess?.ts} | ||
/> | ||
</> | ||
); | ||
} |
33 changes: 33 additions & 0 deletions
33
src/components/shared/Entity/Details/Logs/Status/Overview/AutoDiscoveryOverview.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Grid, Stack, Typography } from '@mui/material'; | ||
import CardWrapper from 'components/shared/CardWrapper'; | ||
import { cardHeaderSx } from 'context/Theme'; | ||
import { useIntl } from 'react-intl'; | ||
import AutoDiscoverOutcome from './AutoDiscoverOutcome'; | ||
import AutoDiscoveryStatus from './AutoDiscoveryStatus'; | ||
|
||
export default function AutoDiscoveryOverview() { | ||
const intl = useIntl(); | ||
|
||
return ( | ||
<Grid item xs={12} md={6} lg={3}> | ||
<CardWrapper> | ||
<Stack | ||
direction="row" | ||
style={{ marginBottom: 16, marginLeft: -4 }} | ||
> | ||
<AutoDiscoveryStatus /> | ||
|
||
<Typography component="div" sx={{ ...cardHeaderSx, mr: 3 }}> | ||
{intl.formatMessage({ | ||
id: 'details.ops.status.overview.autoDiscovery.header', | ||
})} | ||
</Typography> | ||
</Stack> | ||
|
||
<Stack spacing={2} style={{ marginLeft: 14 }}> | ||
<AutoDiscoverOutcome /> | ||
</Stack> | ||
</CardWrapper> | ||
</Grid> | ||
); | ||
} |
23 changes: 23 additions & 0 deletions
23
src/components/shared/Entity/Details/Logs/Status/Overview/AutoDiscoveryStatus.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useTheme } from '@mui/material'; | ||
import useGlobalSearchParams, { | ||
GlobalSearchParams, | ||
} from 'hooks/searchParams/useGlobalSearchParams'; | ||
import { useEntityStatusStore_autoDiscoverFailure } from 'stores/EntityStatus/hooks'; | ||
import { getAutoDiscoveryIndicatorState } from 'utils/entityStatus-utils'; | ||
import StatusIndicator from './StatusIndicator'; | ||
|
||
export default function AutoDiscoveryStatus() { | ||
const catalogName = useGlobalSearchParams(GlobalSearchParams.CATALOG_NAME); | ||
|
||
const theme = useTheme(); | ||
|
||
const autoDiscoveryFailure = | ||
useEntityStatusStore_autoDiscoverFailure(catalogName); | ||
|
||
const status = getAutoDiscoveryIndicatorState( | ||
theme.palette.mode, | ||
autoDiscoveryFailure | ||
); | ||
kiahna-tucker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
return <StatusIndicator status={status} />; | ||
} |
36 changes: 36 additions & 0 deletions
36
src/components/shared/Entity/Details/Logs/Status/Overview/ControllerOverview.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Grid, Stack, Typography } from '@mui/material'; | ||
import CardWrapper from 'components/shared/CardWrapper'; | ||
import { cardHeaderSx } from 'context/Theme'; | ||
import { useIntl } from 'react-intl'; | ||
import ActivationDetail from './ActivationDetail'; | ||
import ControllerStatus from './ControllerStatus'; | ||
import ControllerUpdatedDetail from './ControllerUpdatedDetail'; | ||
|
||
export default function ControllerOverview() { | ||
const intl = useIntl(); | ||
|
||
return ( | ||
<Grid item xs={12} md={6} lg={3}> | ||
<CardWrapper> | ||
<Stack | ||
direction="row" | ||
style={{ marginBottom: 16, marginLeft: -4 }} | ||
> | ||
<ControllerStatus /> | ||
|
||
<Typography component="div" sx={{ ...cardHeaderSx, mr: 3 }}> | ||
{intl.formatMessage({ | ||
id: 'details.ops.status.overview.controller.header', | ||
})} | ||
</Typography> | ||
</Stack> | ||
|
||
<Stack spacing={2} style={{ marginLeft: 14 }}> | ||
<ActivationDetail headerMessageId="details.ops.status.overview.controller.subheaderActivation" /> | ||
|
||
<ControllerUpdatedDetail headerMessageId="details.ops.status.overview.controller.subheaderLastUpdated" /> | ||
</Stack> | ||
</CardWrapper> | ||
</Grid> | ||
); | ||
} |
27 changes: 27 additions & 0 deletions
27
src/components/shared/Entity/Details/Logs/Status/Overview/ControllerStatus.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { useTheme } from '@mui/material'; | ||
import useGlobalSearchParams, { | ||
GlobalSearchParams, | ||
} from 'hooks/searchParams/useGlobalSearchParams'; | ||
import { useEntityStatusStore_singleResponse } from 'stores/EntityStatus/hooks'; | ||
import { getControllerStatusIndicatorState } from 'utils/entityStatus-utils'; | ||
import StatusIndicator from './StatusIndicator'; | ||
|
||
export default function ControllerStatus() { | ||
const catalogName = useGlobalSearchParams(GlobalSearchParams.CATALOG_NAME); | ||
|
||
const theme = useTheme(); | ||
|
||
const controllerError = | ||
useEntityStatusStore_singleResponse(catalogName)?.controller_error; | ||
|
||
const controllerNextRun = | ||
useEntityStatusStore_singleResponse(catalogName)?.controller_next_run; | ||
|
||
const status = getControllerStatusIndicatorState( | ||
theme.palette.mode, | ||
controllerError, | ||
controllerNextRun | ||
); | ||
|
||
return <StatusIndicator status={status} />; | ||
} |
19 changes: 19 additions & 0 deletions
19
src/components/shared/Entity/Details/Logs/Status/Overview/ControllerUpdatedDetail.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import useGlobalSearchParams, { | ||
GlobalSearchParams, | ||
} from 'hooks/searchParams/useGlobalSearchParams'; | ||
import { useEntityStatusStore_singleResponse } from 'stores/EntityStatus/hooks'; | ||
import TimestampDetail from './TimestampDetail'; | ||
import { BaseDetailProps } from './types'; | ||
|
||
export default function ControllerUpdatedDetail({ | ||
headerMessageId, | ||
}: BaseDetailProps) { | ||
const catalogName = useGlobalSearchParams(GlobalSearchParams.CATALOG_NAME); | ||
|
||
const lastUpdated = | ||
useEntityStatusStore_singleResponse(catalogName)?.controller_updated_at; | ||
|
||
return ( | ||
<TimestampDetail headerMessageId={headerMessageId} time={lastUpdated} /> | ||
); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think probably best to do it here - but we need to make sure
catalogName
is safe / escaped. Normally we have usedescapeReservedCharacters
but that is really for PostgREST so not 100% sure what we wanna do here.