diff --git a/web/src/components/env/env.jsx b/web/src/components/env/env.jsx index 7c4b1a114..0c37cabe1 100644 --- a/web/src/components/env/env.jsx +++ b/web/src/components/env/env.jsx @@ -5,9 +5,9 @@ import { InformationCircleIcon } from '@heroicons/react/20/solid'; export function Env(props) { const { store, gimletClient } = props const { env, repoRolloutHistory, envConfigs, navigateToConfigEdit, linkToDeployment, rollback, owner, repoName, fileInfos } = props; - const { releaseHistorySinceDays, deploymentFromParams, scmUrl, alerts, appFilter } = props; + const { releaseHistorySinceDays, deploymentFromParams, settings, alerts, appFilter } = props; - const renderedServices = renderServices(env.stacks, envConfigs, env, repoRolloutHistory, navigateToConfigEdit, linkToDeployment, rollback, owner, repoName, fileInfos, releaseHistorySinceDays, gimletClient, store, deploymentFromParams, scmUrl, alerts, appFilter); + const renderedServices = renderServices(env.stacks, envConfigs, env, repoRolloutHistory, navigateToConfigEdit, linkToDeployment, rollback, owner, repoName, fileInfos, releaseHistorySinceDays, gimletClient, store, deploymentFromParams, settings.scmUrl, alerts, appFilter); const navigate = useNavigate() return ( @@ -24,7 +24,7 @@ export function Env(props) {
{!env.isOnline && - + } {renderedServices.length === 10 && Displaying at most 10 application configurations per environment. @@ -55,7 +55,7 @@ function renderServices( gimletClient, store, deploymentFromParams, - scmUrl, + settings, alerts, appFilter) { let services = []; @@ -105,7 +105,7 @@ function renderServices( gimletClient={gimletClient} store={store} deploymentFromParams={deploymentFromParams} - scmUrl={scmUrl} + scmUrl={settings.scmUrl} serviceAlerts={alerts[deployment]} />
@@ -142,7 +142,7 @@ function renderServices( gimletClient={gimletClient} store={store} deploymentFromParams={deploymentFromParams} - scmUrl={scmUrl} + scmUrl={settings.scmUrl} /> ) } @@ -158,24 +158,74 @@ function fileName(fileInfos, appName) { } function ConnectEnvCard(props) { - const {envName} = props + let { env, trial } = props const navigate = useNavigate() + let expired = false + let stuck = false + let startingUp = false + if (trial) { + const expiringAt = new Date(env.expiry * 1000); + expired = expiringAt < new Date() + const age = new Date() - expiringAt + stuck = age > 5*60*1000 + startingUp = !expired && !stuck + } + + const color = startingUp ? 'blue' : 'red' + return ( -
+
-
-

Environment disconnected

-
- This environment is disconnected.
- +

Environment disconnected

+
+ {startingUp && + <> + This environment is still initializing and should be up in a couple of minutes. + + + +
+ + + } + {expired && + <> + This environment is disconnected. + Your trial expired, so the underlying Kubernetes cluster is stopped.
+ + + } + {!expired && stuck && + <> + This environment is disconnected as + your trial Kubernetes cluster is stuck - please contact support. + + } + {!trial && + <> + This environment is disconnected.
+ + + }
diff --git a/web/src/components/nav/nav.jsx b/web/src/components/nav/nav.jsx index 318c10134..062b54cb3 100644 --- a/web/src/components/nav/nav.jsx +++ b/web/src/components/nav/nav.jsx @@ -7,6 +7,7 @@ import logo from "./logo.svg"; import DefaultProfilePicture from '../../../src/views/profile/defaultProfilePicture.png'; import { ThemeSelector } from '../../views/repositories/themeSelector'; import { useMatch, useLocation, useParams, useNavigate } from 'react-router-dom' +import { format, formatDistance } from "date-fns"; const navigation = [ {name: 'Repositories', href: '/repositories'}, @@ -411,24 +412,34 @@ function Connecting(props) { const env = envs[0] const isOnline = Object.keys(connectedAgents).includes(env.name) + const expiringAt = new Date(env.expiry * 1000); + const expired = expiringAt < new Date() + const exactDate = format(env.expiry * 1000, 'h:mm:ss a, MMMM do yyyy') + const dateLabel = formatDistance(env.expiry * 1000, new Date()); + if (isOnline) { - return null + return ( +
+ + Trial expires in {dateLabel} + +
+ ) } - const expiringAt = new Date(env.expiry * 1000); - const expired = expiringAt < new Date() if (expired) { return (
- Trial Kubernetes cluster expired + Trial expired, click to purchase license
) } const age = new Date() - expiringAt - if (age > 5*60*1000) { + const stuck = age > 5*60*1000 + if (stuck) { return (
diff --git a/web/src/views/repo/repo.jsx b/web/src/views/repo/repo.jsx index 6fc4d79b8..fcc9fdfad 100644 --- a/web/src/views/repo/repo.jsx +++ b/web/src/views/repo/repo.jsx @@ -183,7 +183,7 @@ export default function Repo(props) { store={store} envFromParams={environment} deploymentFromParams={deployment} - scmUrl={settings.scmUrl} + settings={settings} alerts={alerts} appFilter={appFilter} />