Skip to content

Commit 814a558

Browse files
authored
Merge pull request #104 from olavtar/DBAAS-494
DBAAS-494
2 parents b31c076 + 14c5335 commit 814a558

File tree

3 files changed

+60
-4
lines changed

3 files changed

+60
-4
lines changed

src/components/_dbaas-import-view.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,8 @@
189189
.issue-text {
190190
color: '#2b9af3';
191191
padding-left: '3px';
192+
}
193+
194+
.emptyState-title {
195+
padding-top: 20px;
192196
}

src/components/instanceListPage.jsx

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
Split,
1616
SplitItem,
1717
} from '@patternfly/react-core'
18-
import { InfoCircleIcon } from '@patternfly/react-icons'
18+
import { ExclamationTriangleIcon, ExternalLinkAltIcon, InfoCircleIcon } from '@patternfly/react-icons'
1919
import * as _ from 'lodash'
2020
import * as React from 'react'
2121
import { useK8sWatchResource } from '@openshift-console/dynamic-plugin-sdk'
@@ -26,6 +26,9 @@ import {
2626
mongoProviderName,
2727
mongoProviderType,
2828
cockroachdbProviderName,
29+
DBaaSInventoryCRName,
30+
DBaaSOperatorName,
31+
providerAcctResourceUrl,
2932
} from '../const.ts'
3033
import { DBAAS_PROVIDER_KIND } from '../catalog/const.ts'
3134
import {
@@ -34,6 +37,7 @@ import {
3437
isDbaasConnectionUsed,
3538
disableNSSelection,
3639
filterInventoriesByConnNS,
40+
fetchDbaasCSV,
3741
} from '../utils.ts'
3842
import FlexForm from './form/flexForm.tsx'
3943
import FormBody from './form/formBody.tsx'
@@ -64,6 +68,7 @@ const InstanceListPage = () => {
6468
const [dbaasConnectionList, setDbaasConnectionList] = React.useState([])
6569
const [serviceBindingList, setServiceBindingList] = React.useState([])
6670
const [connectionAndServiceBindingList, setConnectionAndServiceBindingList] = React.useState([])
71+
const [dBaaSOperatorNameWithVersion, setDBaaSOperatorNameWithVersion] = React.useState()
6772

6873
const currentNS = window.location.pathname.split('/')[3]
6974

@@ -246,6 +251,14 @@ const InstanceListPage = () => {
246251

247252
setShowResults(true)
248253
}
254+
const fetchCSV = async () => {
255+
const dbaasCSV = await fetchDbaasCSV(currentNS, DBaaSOperatorName)
256+
setDBaaSOperatorNameWithVersion(dbaasCSV.metadata?.name)
257+
}
258+
259+
React.useEffect(() => {
260+
fetchCSV()
261+
}, [])
249262

250263
React.useEffect(() => {
251264
parseSelectedDBProvider()
@@ -284,13 +297,50 @@ const InstanceListPage = () => {
284297
{noInstances ? (
285298
<>
286299
<EmptyState>
287-
<EmptyStateIcon variant="container" component={InfoCircleIcon} className="warning-icon" />
288-
<Title headingLevel="h2" size="md">
300+
<ExclamationTriangleIcon className="warning-icon" size="xl" />
301+
<Title headingLevel="h2" size="md" className="emptyState-title">
289302
No Database Instances
290303
</Title>
291304
<EmptyStateBody>
292-
There are no Provider Accounts available. Please work with an administrator to create one first.
305+
You currently have no database Provider Accounts imported. Work with your administrator to &nbsp;
306+
<Button
307+
variant="link"
308+
component="a"
309+
href={`/k8s/ns/${currentNS}/clusterserviceversions/${dBaaSOperatorNameWithVersion}/${DBaaSInventoryCRName}/~new`}
310+
target="_blank"
311+
rel="noopener noreferrer"
312+
icon={<ExternalLinkAltIcon />}
313+
iconPosition="right"
314+
isInline
315+
>
316+
Import a Provider Account
317+
</Button>
318+
&nbsp; from the supported cloud-hosted database providers. If you receive an error message when
319+
trying to import a provider account, then you do not have the required privileges to access this
320+
page.
321+
<br />
322+
<br />
323+
See the &nbsp;
324+
<Button
325+
variant="link"
326+
component="a"
327+
href={providerAcctResourceUrl}
328+
target="_blank"
329+
rel="noopener noreferrer"
330+
icon={<ExternalLinkAltIcon />}
331+
iconPosition="right"
332+
isInline
333+
>
334+
Importing a provider account resource
335+
</Button>
336+
&nbsp; section of the Red Hat OpenShift Database Access Quick Start Guide on the Customer Portal for
337+
more details.
293338
</EmptyStateBody>
339+
<EmptyStateSecondaryActions>
340+
<Button component="a" href={`/add/ns/${currentNS}`} variant="link">
341+
Close
342+
</Button>
343+
</EmptyStateSecondaryActions>
294344
</EmptyState>
295345
</>
296346
) : (

src/const.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export const crunchyFetchCredentialsUrl =
2020
'https://access.redhat.com/documentation/en-us/red_hat_openshift_database_access/1/html-single/quick_start_guide/index#find-your-crunchy-data-bridge-account-credentials_dbaas'
2121
export const cockroachFetchCredentialsUrl =
2222
'https://access.redhat.com/documentation/en-us/red_hat_openshift_database_access/1/html-single/quick_start_guide/index#find-your-cockroachdb-account-credentials_dbaas'
23+
export const providerAcctResourceUrl =
24+
'https://access.redhat.com/documentation/en-us/red_hat_openshift_database_access/1/html-single/quick_start_guide/index#creating-a-provider-account-resource_admin'
2325
export const prerequisitesUrl =
2426
'https://access.redhat.com/documentation/en-us/red_hat_openshift_database_access/1/html-single/quick_start_guide/index#prerequisites'
2527
export const mongoUrl = 'https://www.mongodb.com/atlas/database'

0 commit comments

Comments
 (0)