Skip to content

Commit 29d3402

Browse files
implement new app designs (#1458)
Co-authored-by: michaeljguarino <[email protected]>
1 parent 9fb54f9 commit 29d3402

40 files changed

+948
-440
lines changed

apps/core/lib/core/pubsub/protocols/cacheable.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ defimpl Core.PubSub.Cacheable, for: Core.PubSub.ClusterDependencyCreated do
3838
end
3939
end
4040

41-
defimpl Core.PubSub.Cacheable, for: Core.PubSub.UserDeleted do
41+
42+
defimpl Core.PubSub.Cacheable, for: [Core.PubSub.UserDeleted, Core.PubSub.UserCreated] do
4243
def cache(%{item: %{id: user_id}}), do: {:del, {:login, user_id}, nil}
4344
end
4445

apps/core/lib/core/schema/invite.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ defmodule Core.Schema.Invite do
4040
|> foreign_key_constraint(:oidc_provider_id)
4141
|> foreign_key_constraint(:service_account_id)
4242
|> unique_constraint(:secure_id)
43-
|> unique_constraint(:email)
43+
|> unique_constraint(:email, message: "the user with this email has already been invited")
4444
|> validate_format(:email, @email_re)
4545
|> validate_required([:email, :account_id, :secure_id])
4646
end

apps/core/test/pubsub/cache/users_test.exs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,21 @@ defmodule Core.PubSub.Consumers.Cache.UsersTest do
1919
test "it will wipe the login cache" do
2020
user = insert(:user)
2121

22+
Core.Cache.put({:login, user.id}, user)
23+
24+
event = %PubSub.UserDeleted{item: user}
25+
Cache.handle_event(event)
26+
27+
refute Core.Cache.get({:login, user.id})
28+
end
29+
end
30+
31+
describe "UserCreated" do
32+
test "it will wipe the login cache" do
33+
user = insert(:user)
34+
35+
Core.Cache.put({:login, user.id}, user)
36+
2237
event = %PubSub.UserDeleted{item: user}
2338
Cache.handle_event(event)
2439

www/public/login-bg-img.webp

501 KB
Loading

www/src/App.tsx

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,46 @@
1-
import 'react-toggle/style.css'
2-
import { Suspense, lazy } from 'react'
3-
import { Route, Routes } from 'react-router-dom'
41
import { ApolloProvider } from '@apollo/client'
5-
import { IntercomProvider } from 'react-use-intercom'
6-
import { Grommet, ThemeType } from 'grommet'
2+
import { mergeDeep } from '@apollo/client/utilities'
3+
import { GrowthBook, GrowthBookProvider } from '@growthbook/growthbook-react'
74
import {
85
BreadcrumbsProvider,
96
GlobalStyle,
10-
honorableThemeDark,
11-
honorableThemeLight,
12-
styledThemeDark,
13-
styledThemeLight,
147
useThemeColorMode,
158
} from '@pluralsh/design-system'
169
import { MarkdocContextProvider } from '@pluralsh/design-system/dist/markdoc'
10+
import { Grommet, ThemeType } from 'grommet'
1711
import {
1812
CssBaseline,
1913
ThemeProvider as HonorableThemeProvider,
2014
mergeTheme,
2115
} from 'honorable'
16+
import mpRecipe from 'honorable-recipe-mp'
17+
import { Suspense, lazy } from 'react'
18+
import { Route, Routes } from 'react-router-dom'
19+
import 'react-toggle/style.css'
20+
import { IntercomProvider } from 'react-use-intercom'
2221
import styled, {
2322
StyleSheetManager,
2423
ThemeProvider as StyledThemeProvider,
2524
} from 'styled-components'
26-
import { mergeDeep } from '@apollo/client/utilities'
27-
import mpRecipe from 'honorable-recipe-mp'
28-
import { GrowthBook, GrowthBookProvider } from '@growthbook/growthbook-react'
2925

3026
import { shouldForwardProp } from './utils/shouldForwardProp'
3127

3228
import { PluralErrorBoundary } from './components/utils/PluralErrorBoundary'
3329

34-
import { client } from './helpers/client'
35-
import { INTERCOM_APP_ID } from './constants'
36-
import { DEFAULT_THEME } from './theme'
37-
import { HistoryRouter, browserHistory } from './router'
38-
import { growthbook } from './helpers/growthbook'
30+
import {
31+
polyfilledHonorableThemeDark,
32+
polyfilledHonorableThemeLight,
33+
polyfilledStyledThemeDark,
34+
polyfilledStyledThemeLight,
35+
} from './styles'
3936
import { OverlayContextProvider } from './components/layout/Overlay'
40-
import NavContextProvider from './contexts/NavigationContext'
4137
import { CursorPositionProvider } from './components/utils/CursorPosition'
38+
import { INTERCOM_APP_ID } from './constants'
39+
import NavContextProvider from './contexts/NavigationContext'
40+
import { client } from './helpers/client'
41+
import { growthbook } from './helpers/growthbook'
42+
import { HistoryRouter, browserHistory } from './router'
43+
import { DEFAULT_THEME } from './theme'
4244

4345
const Plural = lazy(() => import('./components/Plural'))
4446
const Invite = lazy(() => import('./components/Invite'))
@@ -105,7 +107,9 @@ function App() {
105107
const colorMode = useThemeColorMode()
106108

107109
const honorableTheme = mergeTheme(
108-
colorMode === 'light' ? honorableThemeLight : honorableThemeDark,
110+
colorMode === 'light'
111+
? polyfilledHonorableThemeLight
112+
: polyfilledHonorableThemeDark,
109113
{
110114
global: [
111115
// This provides the mp spacing props to honorable
@@ -114,7 +118,10 @@ function App() {
114118
],
115119
}
116120
)
117-
const styledTheme = colorMode === 'light' ? styledThemeLight : styledThemeDark
121+
const styledTheme =
122+
colorMode === 'light'
123+
? polyfilledStyledThemeLight
124+
: polyfilledStyledThemeDark
118125
const mergedStyledTheme = mergeDeep(DEFAULT_THEME, styledTheme)
119126

120127
const routes = (
@@ -182,6 +189,7 @@ function App() {
182189
<IntercomProvider appId={INTERCOM_APP_ID}>
183190
<StyleSheetManager shouldForwardProp={shouldForwardProp}>
184191
<HonorableThemeProvider theme={honorableTheme}>
192+
{/* @ts-ignore - this will be fixed when we bump DS */}
185193
<StyledThemeProvider theme={mergedStyledTheme}>
186194
<GrowthBookProvider
187195
growthbook={growthbook as any as GrowthBook}

www/src/components/Plural.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ const Clusters = lazy(() =>
7676
default: module.Clusters,
7777
}))
7878
)
79+
const AllClusters = lazy(() =>
80+
import('./overview/clusters/all/AllClusters').then((module) => ({
81+
default: module.AllClusters,
82+
}))
83+
)
7984
const SelfHostedClusters = lazy(() =>
8085
import('./overview/clusters/self-hosted/SelfHostedClusters').then(
8186
(module) => ({
@@ -646,10 +651,14 @@ export function PluralInner() {
646651
element={
647652
<Navigate
648653
replace
649-
to="self-hosted"
654+
to="all"
650655
/>
651656
}
652657
/>
658+
<Route
659+
path="all"
660+
element={<AllClusters />}
661+
/>
653662
<Route
654663
path="self-hosted"
655664
element={<SelfHostedClusters />}

www/src/components/cluster/ClusterConsole.tsx

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
1-
import { ReactElement } from 'react'
2-
3-
import LoadingIndicator from '../utils/LoadingIndicator'
1+
import { ClusterFragment, useRepositoryQuery } from '../../generated/graphql'
42
import { EmptyListMessage } from '../overview/clusters/misc'
5-
import { Cluster, useRepositoryQuery } from '../../generated/graphql'
3+
import LoadingIndicator from '../utils/LoadingIndicator'
64

7-
import { GqlError } from '../utils/Alert'
8-
import { useNavigate, useParams } from 'react-router-dom'
9-
import { useTheme } from 'styled-components'
105
import {
11-
IconFrame,
12-
Flex,
6+
ArrowTopRightIcon,
7+
Button,
138
Card,
149
Chip,
10+
Flex,
1511
GearTrainIcon,
16-
Button,
17-
ArrowTopRightIcon,
12+
IconFrame,
1813
} from '@pluralsh/design-system'
19-
import { Body1BoldP } from '../utils/Typography'
20-
import { ensureURLValidity } from '../../utils/url'
14+
import { useNavigate, useParams } from 'react-router-dom'
15+
import { useTheme } from 'styled-components'
2116
import { ignoreEvent } from '../../utils/ignore-event'
17+
import { ensureURLValidity } from '../../utils/url'
18+
import { GqlError } from '../utils/Alert'
19+
import { Body1BoldP } from '../utils/Typography'
2220

2321
const CONSOLE_APP_NAME = 'console'
2422

25-
type ClusterAppsProps = { cluster: Cluster }
26-
2723
export function ClusterConsole({
2824
cluster: { consoleUrl },
29-
}: ClusterAppsProps): ReactElement {
25+
}: {
26+
cluster: ClusterFragment
27+
}) {
3028
const theme = useTheme()
3129
const navigate = useNavigate()
3230
const { clusterId } = useParams()

www/src/components/cluster/ClusterDependencyModal.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useMutation } from '@apollo/client'
55

66
import subscriptionContext from '../../contexts/SubscriptionContext'
77

8-
import { Cluster } from '../../generated/graphql'
8+
import { ClusterFragment } from '../../generated/graphql'
99
import { ClusterPicker } from '../utils/ClusterPicker'
1010
import { GqlError } from '../utils/Alert'
1111

@@ -16,7 +16,7 @@ import UpgradeNeededModal from './UpgradeNeededModal'
1616
type ClusterDependencyModalProps = {
1717
open: boolean
1818
setOpen: Dispatch<boolean>
19-
destination: Cluster
19+
destination: ClusterFragment
2020
}
2121

2222
export function ClusterDependencyModal({
@@ -25,7 +25,7 @@ export function ClusterDependencyModal({
2525
destination,
2626
}: ClusterDependencyModalProps) {
2727
const { isPaidPlan, isTrialPlan } = useContext(subscriptionContext)
28-
const [source, setSource] = useState<Cluster | undefined>()
28+
const [source, setSource] = useState<ClusterFragment | undefined>()
2929

3030
const close = useCallback(() => {
3131
setOpen(false)
@@ -42,7 +42,7 @@ export function ClusterDependencyModal({
4242
)
4343

4444
const filterSources = useCallback(
45-
(s: Cluster) => {
45+
(s: ClusterFragment) => {
4646
const d = destination
4747

4848
return (

www/src/components/cluster/ClusterMetadataPanel.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import { A } from 'honorable'
22
import moment from 'moment'
33
import { Tooltip } from '@pluralsh/design-system'
4-
import { Dispatch, ReactElement } from 'react'
4+
import { Dispatch } from 'react'
55
import { Link } from 'react-router-dom'
66

7-
import { Cluster } from '../../generated/graphql'
7+
import { ClusterFragment } from '../../generated/graphql'
88
import CopyButton from '../utils/CopyButton'
99
import ClusterHealth from '../overview/clusters/ClusterHealth'
1010
import ClusterOwner from '../overview/clusters/ClusterOwner'
1111
import { InfoPanel } from '../utils/InfoPanel'
1212
import Prop from '../utils/Prop'
1313

1414
type ClusterMetadataPanelProps = {
15-
cluster: Cluster
15+
cluster: ClusterFragment
1616
open: boolean
1717
setOpen: Dispatch<boolean>
1818
}
@@ -21,7 +21,7 @@ export default function ClusterMetadataPanel({
2121
cluster,
2222
open,
2323
setOpen,
24-
}: ClusterMetadataPanelProps): ReactElement | null {
24+
}: ClusterMetadataPanelProps) {
2525
if (!open) return null
2626

2727
return (

www/src/components/cluster/ClusterPromoteModal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Dispatch, useCallback, useContext, useState } from 'react'
44
import isNil from 'lodash/isNil'
55
import { useMutation } from '@apollo/client'
66

7-
import { Cluster } from '../../generated/graphql'
7+
import { ClusterFragment } from '../../generated/graphql'
88
import { ClusterPicker } from '../utils/ClusterPicker'
99
import { GqlError } from '../utils/Alert'
1010
import { ensureURLValidity } from '../../utils/url'
@@ -18,7 +18,7 @@ import ClustersContext from '../../contexts/ClustersContext'
1818
type ClusterPromoteModalProps = {
1919
open: boolean
2020
setOpen: Dispatch<boolean>
21-
destination: Cluster
21+
destination: ClusterFragment
2222
}
2323

2424
export function ClusterPromoteModal({

0 commit comments

Comments
 (0)