New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CONSOLE-3735: React router migration #13216
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
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
31 changes: 18 additions & 13 deletions
31
dynamic-demo-plugin/src/components/ProjectOverview/Inventory.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 |
---|---|---|
@@ -1,45 +1,50 @@ | ||
import * as React from 'react'; | ||
import { | ||
K8sResourceCommon, | ||
useK8sWatchResource, | ||
InventoryItem, | ||
InventoryItemTitle, | ||
InventoryItemLoading, | ||
} from '@openshift-console/dynamic-plugin-sdk'; | ||
K8sResourceCommon, | ||
useK8sWatchResource, | ||
InventoryItem, | ||
InventoryItemTitle, | ||
InventoryItemLoading, | ||
} from '@openshift-console/dynamic-plugin-sdk'; | ||
import { Link } from 'react-router-dom'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
const getCronJobsLink = (namespace: string) => `/k8s/ns/${namespace}/cronjobs`; | ||
const getCronJobsLink = (namespace: string) => `/k8s/ns/${namespace}/cronjobs`; | ||
|
||
type ProjectInventoryItemProps = { | ||
projectName: string; | ||
} | ||
}; | ||
|
||
const ProjectInventoryItem = ({ projectName }: ProjectInventoryItemProps) => { | ||
const { t } = useTranslation("plugin__console-demo-plugin"); | ||
const { t } = useTranslation('plugin__console-demo-plugin'); | ||
const [cronjobs, loaded, loadError] = useK8sWatchResource<K8sResourceCommon[]>({ | ||
groupVersionKind: { | ||
group: 'batch', | ||
version: 'v1', | ||
kind: 'CronJob' | ||
kind: 'CronJob', | ||
}, | ||
namespace: projectName, | ||
isList: true | ||
isList: true, | ||
}); | ||
|
||
const cronJobsLink = getCronJobsLink(projectName); | ||
let title = <Link to={cronJobsLink}>{t('{{count}} Cron Job', { count: cronjobs.length })}</Link>; | ||
if (loadError) { | ||
title = <Link to={cronJobsLink}>{t('Cron Jobs')}</Link>; | ||
} else if (!loaded) { | ||
title = <><InventoryItemLoading /><Link to={cronJobsLink}>{t('Cron Jobs')}</Link></>; | ||
title = ( | ||
<> | ||
<InventoryItemLoading /> | ||
<Link to={cronJobsLink}>{t('Cron Jobs')}</Link> | ||
</> | ||
); | ||
} | ||
|
||
return ( | ||
<InventoryItem> | ||
<InventoryItemTitle>{title}</InventoryItemTitle> | ||
</InventoryItem> | ||
); | ||
} | ||
}; | ||
|
||
export default ProjectInventoryItem; |
3 changes: 1 addition & 2 deletions
3
dynamic-demo-plugin/src/components/ProjectTabExtensionContent.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
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
16 changes: 12 additions & 4 deletions
16
frontend/__tests__/components/cluster-settings/gitlab-idp-form.spec.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
16 changes: 12 additions & 4 deletions
16
frontend/__tests__/components/cluster-settings/google-idp-form.spec.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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just seeing this. I think it would have been better to set up a reusable test render function for this instead of repeating, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we could do it as a follow up 👍