Skip to content

Commit 3251e1f

Browse files
committed
Fix issue with collection and no key on dashboard
1 parent 5767464 commit 3251e1f

File tree

1 file changed

+116
-57
lines changed

1 file changed

+116
-57
lines changed

client/web/src/dashboard/DashboardComponent.js

Lines changed: 116 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -26,46 +26,68 @@ import {
2626
countTenantsByActiveFlag,
2727
} from '../tenant/ducks'
2828
import { useDispatch, useSelector } from 'react-redux'
29-
import { fetchConfig, selectSettingsById, selectConfig } from '../settings/ducks'
29+
import {
30+
fetchConfig,
31+
selectSettingsById,
32+
selectConfig,
33+
} from '../settings/ducks'
3034
import * as SETTINGS from '../settings/common'
3135
import { isEmpty } from 'lodash'
3236
import { selectOSLabel, selectDbLabel } from '../options/ducks'
3337
import ECRInstructions from '../components/ECRInstructions'
3438
import { selectAllTiers } from '../tier/ducks'
3539

36-
const ActiveTenantsComponent = React.lazy(() => import('./ActiveTenantsComponent'))
40+
const ActiveTenantsComponent = React.lazy(() =>
41+
import('./ActiveTenantsComponent')
42+
)
3743

3844
const CurrentApplicationVersionComponent = React.lazy(() =>
39-
import('./CurrentApplicationVersionComponent'),
45+
import('./CurrentApplicationVersionComponent')
4046
)
4147

42-
const SaasBoostEnvNameComponent = React.lazy(() => import('./SaasBoostEnvNameComponent'))
48+
const SaasBoostEnvNameComponent = React.lazy(() =>
49+
import('./SaasBoostEnvNameComponent')
50+
)
4351

44-
const InstalledExtensionsComponent = React.lazy(() => import('./InstalledExtensionsComponent'))
52+
const InstalledExtensionsComponent = React.lazy(() =>
53+
import('./InstalledExtensionsComponent')
54+
)
4555

4656
export const DashboardComponent = (props) => {
4757
const dispatch = useDispatch()
4858
const appConfig = useSelector(selectConfig)
4959
const tiers = useSelector(selectAllTiers)
50-
const clusterOS = useSelector((state) => selectSettingsById(state, SETTINGS.CLUSTER_OS))
51-
const dbEngine = useSelector((state) => selectSettingsById(state, SETTINGS.DB_ENGINE))
52-
const version = useSelector((state) => selectSettingsById(state, SETTINGS.VERSION))
60+
const clusterOS = useSelector((state) =>
61+
selectSettingsById(state, SETTINGS.CLUSTER_OS)
62+
)
63+
const dbEngine = useSelector((state) =>
64+
selectSettingsById(state, SETTINGS.DB_ENGINE)
65+
)
66+
const version = useSelector((state) =>
67+
selectSettingsById(state, SETTINGS.VERSION)
68+
)
5369
let osLabel = 'N/A'
5470

55-
const osLabelValue = useSelector((state) => selectOSLabel(state, clusterOS?.value))
56-
const dbLabelValue = useSelector((state) => selectDbLabel(state, dbEngine?.value))
71+
const osLabelValue = useSelector((state) =>
72+
selectOSLabel(state, clusterOS?.value)
73+
)
74+
const dbLabelValue = useSelector((state) =>
75+
selectDbLabel(state, dbEngine?.value)
76+
)
5777
if (!isEmpty(osLabelValue)) {
5878
osLabel = osLabelValue
5979
}
6080

6181
const metricsAnalyticsDeployed = useSelector((state) =>
62-
selectSettingsById(state, 'METRICS_ANALYTICS_DEPLOYED'),
82+
selectSettingsById(state, 'METRICS_ANALYTICS_DEPLOYED')
6383
)
6484

65-
const billingApiKey = useSelector((state) => selectSettingsById(state, 'BILLING_API_KEY'))
85+
const billingApiKey = useSelector((state) =>
86+
selectSettingsById(state, 'BILLING_API_KEY')
87+
)
6688

6789
const saasBoostEnvironment = useSelector(
68-
(state) => selectSettingsById(state, 'SAAS_BOOST_ENVIRONMENT')?.value,
90+
(state) => selectSettingsById(state, 'SAAS_BOOST_ENVIRONMENT')?.value
6991
)
7092

7193
const countActiveTenants = useSelector((state) => {
@@ -77,7 +99,9 @@ export const DashboardComponent = (props) => {
7799
})
78100

79101
const ecrRepo = useSelector((state) => selectSettingsById(state, 'ECR_REPO'))
80-
const s3Bucket = useSelector((state) => selectSettingsById(state, 'SAAS_BOOST_BUCKET'))
102+
const s3Bucket = useSelector((state) =>
103+
selectSettingsById(state, 'SAAS_BOOST_BUCKET')
104+
)
81105

82106
const awsAccount = globalConfig.awsAccount
83107
const awsRegion = globalConfig.region
@@ -159,64 +183,99 @@ export const DashboardComponent = (props) => {
159183
<strong className="h4 mb-1">Application</strong>
160184
<dl>
161185
<dt className="mb-1">Application Name</dt>
162-
<dd className="mb-3">{isEmpty(appConfig?.name) ? 'N/A' : appConfig.name}</dd>
186+
<dd className="mb-3">
187+
{isEmpty(appConfig?.name) ? 'N/A' : appConfig.name}
188+
</dd>
163189
<dt className="mb-1">Application Domain Name</dt>
164-
<dd className="mb-3">{isEmpty(appConfig?.domainName) ? 'Not Configured' : appConfig.domainName}</dd>
190+
<dd className="mb-3">
191+
{isEmpty(appConfig?.domainName)
192+
? 'Not Configured'
193+
: appConfig.domainName}
194+
</dd>
165195
<dt className="mb-1">Public API Endpoint</dt>
166196
<dd className="mb-3">{globalConfig.apiUri}</dd>
167197
</dl>
168198
</Col>
169199
<Col xs={12} md={6} lg={6}>
170200
<strong className="h4 mb-1">Tiers</strong>
171-
<dl>
172-
{tiers.map(tier => (
173-
<>
201+
{tiers.map((tier) => (
202+
<dl key={tier}>
174203
<dt className="mb-1">{tier.name}</dt>
175-
<dd className="mb-3">{isEmpty(tier.description) ? 'No Description' : tier.description}</dd>
176-
</>
177-
))}
178-
</dl>
204+
<dd className="mb-3">
205+
{isEmpty(tier.description)
206+
? 'No Description'
207+
: tier.description}
208+
</dd>
209+
</dl>
210+
))}
179211
</Col>
180212
</Row>
181213
<Row>
182214
<strong className="h4 mb-1">Services</strong>
183215
<Row>
184-
{isEmpty(appConfig?.services) ? (<Col xs={12} md={6} xl={4}>No Services</Col>) :
185-
Object.values(appConfig.services).map(service => (
216+
{isEmpty(appConfig?.services) ? (
186217
<Col xs={12} md={6} xl={4}>
187-
<Card className="mb-2">
188-
<CardHeader><strong>{service.name} - {service.path}</strong></CardHeader>
189-
<CardBody>
190-
<dl>
191-
<dt>ECR Repository</dt>
192-
<dd>
193-
{isEmpty(service.containerRepo) ? 'Creating...' : service.containerRepo} {' - '}
194-
<a href={ecrAwsConsoleLink + (service.containerRepo ? `/private/${awsAccount}/` + service.containerRepo : '')} target="new" className="text-muted">
195-
AWS Console Link <CIcon icon={cilExternalLink} />
196-
</a>
197-
</dd>
198-
<dt>
199-
ECR Repository URL{' - '}
200-
<ECRInstructions
201-
awsAccount={awsAccount}
202-
awsRegion={awsRegion}
203-
ecrRepo={service.containerRepo}
204-
>
205-
<span className="text-muted">
206-
View details <CIcon icon={cilExternalLink} />
207-
</span>
208-
</ECRInstructions>
209-
</dt>
210-
<dd className="mb-3">
211-
{awsAccount}.dkr.ecr.{awsRegion}.amazonaws.com{service.containerRepo ? `/${service.containerRepo}` : ''}
212-
</dd>
213-
<dt>Description</dt>
214-
<dd>{service.description}</dd>
215-
</dl>
216-
</CardBody>
217-
</Card>
218+
No Services
218219
</Col>
219-
))}
220+
) : (
221+
Object.values(appConfig.services).map((service) => (
222+
<Col xs={12} md={6} xl={4} key={service.name}>
223+
<Card className="mb-2">
224+
<CardHeader>
225+
<strong>
226+
{service.name} - {service.path}
227+
</strong>
228+
</CardHeader>
229+
<CardBody>
230+
<dl>
231+
<dt>ECR Repository</dt>
232+
<dd>
233+
{isEmpty(service.containerRepo)
234+
? 'Creating...'
235+
: service.containerRepo}{' '}
236+
{' - '}
237+
<a
238+
href={
239+
ecrAwsConsoleLink +
240+
(service.containerRepo
241+
? `/private/${awsAccount}/` +
242+
service.containerRepo
243+
: '')
244+
}
245+
target="new"
246+
className="text-muted"
247+
>
248+
AWS Console Link{' '}
249+
<CIcon icon={cilExternalLink} />
250+
</a>
251+
</dd>
252+
<dt>
253+
ECR Repository URL{' - '}
254+
<ECRInstructions
255+
awsAccount={awsAccount}
256+
awsRegion={awsRegion}
257+
ecrRepo={service.containerRepo}
258+
>
259+
<span className="text-muted">
260+
View details{' '}
261+
<CIcon icon={cilExternalLink} />
262+
</span>
263+
</ECRInstructions>
264+
</dt>
265+
<dd className="mb-3">
266+
{awsAccount}.dkr.ecr.{awsRegion}.amazonaws.com
267+
{service.containerRepo
268+
? `/${service.containerRepo}`
269+
: ''}
270+
</dd>
271+
<dt>Description</dt>
272+
<dd>{service.description}</dd>
273+
</dl>
274+
</CardBody>
275+
</Card>
276+
</Col>
277+
))
278+
)}
220279
</Row>
221280
</Row>
222281
</CardBody>

0 commit comments

Comments
 (0)