-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1154 from kubev2v/dont-show-ui-link-on-non-rhev
🧼 Move web ui link to a new details item
- Loading branch information
Showing
14 changed files
with
170 additions
and
131 deletions.
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
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
73 changes: 73 additions & 0 deletions
73
.../views/details/components/DetailsSection/components/ExternalManagementLinkDetailsItem.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,73 @@ | ||
import React from 'react'; | ||
import { EditProviderUIModal, useModal } from 'src/modules/Providers/modals'; | ||
import { ForkliftTrans, useForkliftTranslation } from 'src/utils/i18n'; | ||
|
||
import { ExternalLink } from '@kubev2v/common'; | ||
import { DescriptionListDescription } from '@patternfly/react-core'; | ||
|
||
import { DetailsItem } from '../../../../../utils'; | ||
|
||
import { ProviderDetailsItemProps } from './ProviderDetailsItem'; | ||
|
||
/** | ||
* @typedef {Object} ExternalManagementLinkDetailsItemProps - extends ProviderDetailsItemProps | ||
* | ||
* @property {string} [webUILinkText - A label text to be displayed as a content. | ||
* @property {string} [webUILink] - provider's management system external link. | ||
*/ | ||
export interface ExternalManagementLinkDetailsItemProps extends ProviderDetailsItemProps { | ||
webUILinkText?: string; | ||
webUILink?: string; | ||
} | ||
|
||
/** | ||
* Component for displaying the provider management system external link. | ||
* | ||
* @component | ||
* @param {DetailsItemProps} props - The props of the details item. | ||
*/ | ||
export const ExternalManagementLinkDetailsItem: React.FC< | ||
ExternalManagementLinkDetailsItemProps | ||
> = ({ resource: provider, moreInfoLink, helpContent, canPatch, webUILinkText, webUILink }) => { | ||
const { t } = useForkliftTranslation(); | ||
const { showModal } = useModal(); | ||
|
||
const defaultHelpContent = ( | ||
<ForkliftTrans> | ||
<p> | ||
Use the external management system link to access the web-based user interface for the | ||
provider virtual machine management system. | ||
</p> | ||
<p>You can edit and store the link to the management system to customize the link URL.</p> | ||
</ForkliftTrans> | ||
); | ||
|
||
const webUILinkContent = webUILink ? ( | ||
<ExternalLink text={webUILinkText} href={webUILink} isInline={true}> | ||
{webUILink} | ||
</ExternalLink> | ||
) : ( | ||
<span className="text-muted"> | ||
{canPatch && provider?.metadata | ||
? t('Click the pencil for setting provider web UI link') | ||
: t('No value for provider web UI link')} | ||
</span> | ||
); | ||
|
||
return ( | ||
<DescriptionListDescription> | ||
<DetailsItem | ||
title={t('External management system')} | ||
moreInfoLink={moreInfoLink} | ||
helpContent={helpContent ?? defaultHelpContent} | ||
crumbs={['metadata', 'annotations', 'forklift.konveyor.io/providerUI']} | ||
content={webUILinkContent} | ||
onEdit={ | ||
canPatch && | ||
provider?.metadata && | ||
(() => showModal(<EditProviderUIModal resource={provider} content={webUILink} />)) | ||
} | ||
/> | ||
</DescriptionListDescription> | ||
); | ||
}; |
43 changes: 43 additions & 0 deletions
43
...c/modules/Providers/views/details/components/DetailsSection/components/NamDetailsItem.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,43 @@ | ||
import React from 'react'; | ||
import { useForkliftTranslation } from 'src/utils/i18n'; | ||
|
||
import { DescriptionListDescription } from '@patternfly/react-core'; | ||
|
||
import { DetailsItem } from '../../../../../utils'; | ||
|
||
import { ProviderDetailsItemProps } from './ProviderDetailsItem'; | ||
|
||
/** | ||
* Component for displaying the provider name details item. | ||
* | ||
* @component | ||
* @param {DetailsItemProps} props - The props of the details item. | ||
*/ | ||
export const NameDetailsItem: React.FC<ProviderDetailsItemProps> = ({ | ||
resource: provider, | ||
moreInfoLink, | ||
helpContent, | ||
}) => { | ||
const { t } = useForkliftTranslation(); | ||
|
||
const defaultMoreInfoLink = | ||
'https://kubernetes.io/docs/concepts/overview/working-with-objects/names'; | ||
|
||
const defaultHelpContent = `Name is a client-provided string that refers to an object in a resource URL. | ||
Only one object of a given kind can have a given name at a time. | ||
However, if you delete the object, you can make a new object with the same name.`; | ||
|
||
const nameContent = provider?.metadata?.name; | ||
|
||
return ( | ||
<DescriptionListDescription> | ||
<DetailsItem | ||
title={t('Name')} | ||
moreInfoLink={moreInfoLink ?? defaultMoreInfoLink} | ||
helpContent={helpContent ?? defaultHelpContent} | ||
crumbs={['Provider', 'metadata', 'name']} | ||
content={nameContent} | ||
/> | ||
</DescriptionListDescription> | ||
); | ||
}; |
101 changes: 0 additions & 101 deletions
101
...Providers/views/details/components/DetailsSection/components/NameAndUiLinkDetailsItem.tsx
This file was deleted.
Oops, something went wrong.
3 changes: 2 additions & 1 deletion
3
...-plugin/src/modules/Providers/views/details/components/DetailsSection/components/index.ts
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
2 changes: 2 additions & 0 deletions
2
...ift-console-plugin/src/modules/Providers/views/details/components/DetailsSection/index.ts
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 |
---|---|---|
@@ -1,8 +1,10 @@ | ||
// @index(['./*', /style/g], f => `export * from '${f.path}';`) | ||
export * from './components'; | ||
export * from './DetailsSection'; | ||
export * from './OpenshiftDetailsSection'; | ||
export * from './OpenstackDetailsSection'; | ||
export * from './OVADetailsSection'; | ||
export * from './OvirtDetailsSection'; | ||
export * from './utils'; | ||
export * from './VSphereDetailsSection'; | ||
// @endindex |
Oops, something went wrong.