-
Notifications
You must be signed in to change notification settings - Fork 114
feat(web-domains): add guides to host page #21381
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
base: release/web-domains-w2
Are you sure you want to change the base?
Conversation
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.
Pull request overview
Adds a guide link to the hosts listing page that directs users to external documentation about DNS glue registry configuration. The link dynamically adapts to the user's language preference and opens in a new tab.
- Added language-aware guide link to hosts listing page banner
- Created new HOST guide constant with multi-language URL support
- Enhanced Link component with external navigation styling and behavior
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| hostsListing.tsx | Converted placeholder link to functional external guide link with language support and styling |
| guideLinks.ts | Added HOST guide constant definition with URL template for DNS glue registry documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const baseGuideUrl = `${helpRoot}{{lang}}-documentation-web-cloud-domains?id=kb_browse_cat&kb_id=e17b4f25551974502d4c6e78b7421955&kb_category=54441955f49801102d4ca4d466a7fdb2`; | ||
| const modifyDnsGuideUrl = `${helpRoot}{{lang}}-dns-servers-edit?id=kb_article_view&sysparm_article=KB0063455`; | ||
| const manualRenewGuideUrl = `${helpRoot}{{lang}}-fr-billing-automatic-renewal?id=kb_article_view&sysparm_article=KB0042839`; | ||
| const hostGuideUrl = `${helpRoot}{{lang}}-dns-glue-registry?id=kb_article_view&sysparm_article=KB0051754`; |
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.
approach is not good, KB0**** change for each language page
| @@ -1,40 +1,89 @@ | |||
| import { generateGuideLinks } from '@/domain/utils/generateGuideLinks'; | |||
| import { Links } from '../pages/onboarding/onboarding.constants'; | |||
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.
| import { Links } from '../pages/onboarding/onboarding.constants'; | |
| import { useMemo } from 'react'; | |
| import { Links } from '../pages/onboarding/onboarding.constants'; | |
| const helpRoot = 'https://help.ovhcloud.com/csm/'; | |
| export const Languages = { | |
| DEFAULT: 'en-ie', | |
| ASIA: 'asia', | |
| CA: 'en-ca', | |
| DE: 'de', | |
| ES: 'es-es', | |
| FR: 'fr', | |
| GB: 'en-gb', | |
| IN: 'en-in', | |
| IT: 'it', | |
| LT: 'es', | |
| MA: 'fr', | |
| NL: 'en-ie', | |
| PL: 'pl', | |
| PT: 'pt', | |
| QC: 'fr-ca', | |
| SG: 'en-sg', | |
| SN: 'fr', | |
| TN: 'fr', | |
| } as const; | |
| export type LanguageKey = keyof typeof Languages; | |
| type ArticleGuide = { | |
| type: 'article'; | |
| target: string; | |
| articles: Record<LanguageKey, string>; | |
| }; | |
| type CategoryGuide = { | |
| type: 'category'; | |
| suffix: string; | |
| }; | |
| type GuideConfig = ArticleGuide | CategoryGuide; | |
| const guides: Record<string, GuideConfig> = { | |
| DOMAINS_LINK: { | |
| type: 'category', | |
| suffix: | |
| '-documentation-web-cloud-domains?id=kb_browse_cat&kb_id=e17b4f25551974502d4c6e78b7421955&kb_category=54441955f49801102d4ca4d466a7fdb2', | |
| }, | |
| HOST_LINK: { | |
| type: 'article', | |
| target: '-dns-glue-registry', | |
| articles: { | |
| DEFAULT: 'KB0051745', | |
| ASIA: 'KB0039681', | |
| CA: 'KB0051746', | |
| DE: 'KB0051751', | |
| ES: 'KB0051755', | |
| FR: 'KB0051754', | |
| GB: 'KB0051749', | |
| IN: 'KB0069751', | |
| IT: 'KB0051762', | |
| LT: 'KB0051758', | |
| MA: 'KB0051754', | |
| NL: 'KB0051745', | |
| PL: 'KB0051761', | |
| PT: 'KB0051753', | |
| QC: 'KB0051752', | |
| SG: 'KB0051747', | |
| SN: 'KB0051754', | |
| TN: 'KB0051754', | |
| }, | |
| }, | |
| MODIFY_DNS_LINK: { | |
| type: 'article', | |
| target: '-dns-servers-edit', | |
| articles: { | |
| DEFAULT: 'KB0063603', | |
| ASIA: 'KB0063601', | |
| CA: 'KB0063613', | |
| DE: 'KB0063611', | |
| ES: 'KB0063604', | |
| FR: 'KB0063455', | |
| GB: 'KB0063607', | |
| IN: 'KB0069726', | |
| IT: 'KB0063610', | |
| LT: 'KB0063599', | |
| MA: 'KB0063455', | |
| NL: 'KB0063603', | |
| PL: 'KB0063600', | |
| PT: 'KB0063598', | |
| QC: 'KB0063453', | |
| SG: 'KB0063612', | |
| SN: 'KB0063455', | |
| TN: 'KB0063455', | |
| }, | |
| }, | |
| MANUAL_RENEW_LINK: { | |
| type: 'article', | |
| target: '-billing-automatic-renewal', | |
| articles: { | |
| DEFAULT: 'KB0029780', | |
| ASIA: 'KB0042824', | |
| CA: 'KB0042827', | |
| DE: 'KB0042837', | |
| ES: 'KB0042847', | |
| FR: 'KB0042839', | |
| GB: 'KB0042838', | |
| IN: 'KB0067855', | |
| IT: 'KB0042846', | |
| LT: 'KB0042849', | |
| MA: 'KB0042839', | |
| NL: 'KB0029780', | |
| PL: 'KB0042841', | |
| PT: 'KB0042842', | |
| QC: 'KB0042845', | |
| SG: 'KB0042840', | |
| SN: 'KB0042839', | |
| TN: 'KB0042839', | |
| }, | |
| }, | |
| }; | |
| const buildLinksByLanguage = ( | |
| guides: Record<string, GuideConfig> | |
| ): Record<LanguageKey, Record<string, string>> => | |
| Object.fromEntries( | |
| (Object.keys(Languages) as LanguageKey[]).map((lang) => { | |
| const urls: Record<string, string> = {}; | |
| for (const [guideKey, config] of Object.entries(guides)) { | |
| if (config.type === 'category') { | |
| urls[guideKey] = `${helpRoot}${Languages[lang]}${config.suffix}`; | |
| } else { | |
| urls[guideKey] = | |
| `${helpRoot}${Languages[lang]}${config.target}?id=kb_article_view&sysparm_article=` + | |
| (config.articles[lang] ?? config.articles.DEFAULT); | |
| } | |
| } | |
| return [lang, urls]; | |
| }) | |
| ) as Record<LanguageKey, Record<string, string>>; | |
| export const LINKS_BY_LANGUAGE = buildLinksByLanguage(guides); | |
| export const useLinks = (language: LanguageKey) => | |
| useMemo( | |
| () => LINKS_BY_LANGUAGE[language] || LINKS_BY_LANGUAGE.DEFAULT, | |
| [language] | |
| ); |
| ); | ||
| const context = useContext(ShellContext); | ||
| const { ovhSubsidiary } = context.environment.getUser(); | ||
| const domainUrl = useMemo(() => { |
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.
| const domainUrl = useMemo(() => { | |
| const urls = useLinks(ovhSubsidiary.toUppercase()); |
| { | ||
| id: 1, | ||
| href: GUIDES_LIST.domains.url[langCode], | ||
| href: domainUrl, |
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.
| href: domainUrl, | |
| href: urls.DOMAIN_LINK, |
| <br /> | ||
| <Link | ||
| href={GUIDES_LIST.modifyDns.url[langCode]} | ||
| href={modifyDNSUrl} |
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.
| href={modifyDNSUrl} | |
| href={urls.MODIFY_DNS_LINK} |
ref: #DCE-98 Signed-off-by: Louis BENSI <[email protected]>
ref: #DCE-98 Signed-off-by: Kylian Bainvel <[email protected]>
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Description
Add guides link to host listing page
Ticket Reference: #DCE-98