Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@
"server_display_without-engagement": "ohne Vertragsbindung",
"server_display_renew-automatic": "automatisch",
"server_display_renew-manual": "manuell",
"server_display_vrack": "vRack"
"server_display_vrack": "vRack",
"guide_first_step_label": "Erste Schritte mit einem Dedicated Server",
"guide_secure_label": "Einen Dedicated Server absichern",
"guide_ssh_connections_label": "Erste Schritte mit SSH-Verbindungen"
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@
"server_display_without-engagement": "without commitment",
"server_display_renew-automatic": "Automatic",
"server_display_renew-manual": "manual",
"server_display_vrack": "vRack"
"server_display_vrack": "vRack",
"guide_first_step_label": "Getting started with a dedicated server",
"guide_secure_label": "Secure my dedicated server",
"guide_ssh_connections_label": "How to get started with SSH connections"
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@
"server_display_without-engagement": "sin compromiso",
"server_display_renew-automatic": "automΓ‘tico",
"server_display_renew-manual": "manual",
"server_display_vrack": "vRack"
"server_display_vrack": "vRack",
"guide_first_step_label": "Primeros pasos con un servidor dedicado",
"guide_secure_label": "Proteger un servidor dedicado",
"guide_ssh_connections_label": "Primeros pasos para utilizar las conexiones SSH"
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@
"server_display_with-engagement": "avec engagement",
"server_display_without-engagement": "sans engagement",
"server_display_renew-automatic": "automatique",
"server_display_renew-manual": "manuel"
"server_display_renew-manual": "manuel",
"guide_first_step_label": "Premiers pas avec un serveur dΓ©diΓ©",
"guide_secure_label": "SΓ©curiser un serveur dΓ©diΓ©",
"guide_ssh_connections_label": "Comment bien dΓ©buter avec les connexions SSH"
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@
"server_display_with-engagement": "avec engagement",
"server_display_without-engagement": "sans engagement",
"server_display_renew-automatic": "automatique",
"server_display_renew-manual": "manuel"
"server_display_renew-manual": "manuel",
"guide_first_step_label": "Premiers pas avec un serveur dΓ©diΓ©",
"guide_secure_label": "SΓ©curiser un serveur dΓ©diΓ©",
"guide_ssh_connections_label": "Comment bien dΓ©buter avec les connexions SSH"
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@
"server_display_without-engagement": "senza impegno",
"server_display_renew-automatic": "automatico",
"server_display_renew-manual": "manuale",
"server_display_vrack": "vRack"
"server_display_vrack": "vRack",
"guide_first_step_label": "Iniziare a utilizzare un server dedicato",
"guide_secure_label": "Mettere in sicurezza un server dedicato",
"guide_ssh_connections_label": "Come iniziare a utilizzare le connessioni SSH"
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@
"server_display_without-engagement": "bez umowy terminowej",
"server_display_renew-automatic": "automatycznie",
"server_display_renew-manual": "rΔ™cznie",
"server_display_vrack": "vRack"
"server_display_vrack": "vRack",
"guide_first_step_label": "Pierwsze kroki z serwerem dedykowanym",
"guide_secure_label": "BezpieczeΕ„stwo serwera dedykowanego",
"guide_ssh_connections_label": "Jak rozpoczΔ…Δ‡ korzystanie z poΕ‚Δ…czeΕ„ SSH"
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@
"server_display_without-engagement": "sem compromisso",
"server_display_renew-automatic": "automΓ‘tico",
"server_display_renew-manual": "manual",
"server_display_vrack": "vRack"
"server_display_vrack": "vRack",
"guide_first_step_label": "Primeiros passos com um servidor dedicado",
"guide_secure_label": "Proteger um servidor dedicado",
"guide_ssh_connections_label": "Como comeΓ§ar com as ligaΓ§Γ΅es SSH"
}
138 changes: 138 additions & 0 deletions packages/manager/apps/dedicated-servers/src/hooks/useGuides.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
import { useContext, useEffect, useState } from 'react';
import { GuideItem } from '@ovh-ux/manager-react-components';
import { CountryCode } from '@ovh-ux/manager-config';
import { ShellContext } from '@ovh-ux/manager-react-shell-client';

type GuideLinks = Partial<{ [key in CountryCode | 'DEFAULT']: string }>;

const ENDPOINT = 'https://help.ovhcloud.com/csm/';

const getFirstStepUrl = (language: string, article: string) =>
`${ENDPOINT}${language}-dedicated-servers-getting-started-dedicated-server?id=kb_article_view&sysparm_article=${article}`;

const firstStepEnIe = ['en-ie', 'KB0043476'] as const;
const firstStepFr = ['fr', 'KB0043481'] as const;

const FIRST_STEP_LINKS: GuideLinks = {
FR: getFirstStepUrl(...firstStepFr),
DE: getFirstStepUrl('de', 'KB0030498'),
ES: getFirstStepUrl('es-es', 'KB0043480'),
IE: getFirstStepUrl(...firstStepEnIe),
IT: getFirstStepUrl('it', 'KB0043487'),
NL: getFirstStepUrl(...firstStepEnIe),
PL: getFirstStepUrl('pl', 'KB0043483'),
PT: getFirstStepUrl('pt', 'KB0043484'),
GB: getFirstStepUrl('en-gb', 'KB0043475'),
CA: getFirstStepUrl('en-ca', 'KB0043473'),
QC: getFirstStepUrl('fr-ca', 'KB0043482'),
MA: getFirstStepUrl(...firstStepFr),
SN: getFirstStepUrl(...firstStepFr),
TN: getFirstStepUrl(...firstStepFr),
AU: getFirstStepUrl('en-au', 'KB0043474'),
IN: getFirstStepUrl('en-in', 'KB0067915'),
SG: getFirstStepUrl('en-sg', 'KB0043478'),
ASIA: getFirstStepUrl('asia', 'KB0043472'),
WE: getFirstStepUrl(...firstStepEnIe),
WS: getFirstStepUrl('es', 'KB0043479'),
DEFAULT: getFirstStepUrl(...firstStepEnIe),
};

const getSecureUrl = (language: string, article: string) =>
`${ENDPOINT}${language}-dedicated-servers-securing-server?id=kb_article_view&sysparm_article=${article}`;

const secureEnIe = ['en-ie', 'KB0043971'] as const;
const secureFr = ['fr', 'KB0043978'] as const;

const SECURE_LINKS: GuideLinks = {
FR: getSecureUrl(...secureFr),
DE: getSecureUrl('de', 'KB0043981'),
ES: getSecureUrl('es-es', 'KB0043976'),
IE: getSecureUrl(...secureEnIe),
IT: getSecureUrl('it', 'KB0043982'),
NL: getSecureUrl(...secureEnIe),
PL: getSecureUrl('pl', 'KB0043983'),
PT: getSecureUrl('pt', 'KB0043986'),
GB: getSecureUrl('en-gb', 'KB0043969'),
CA: getSecureUrl('en-ca', 'KB0043970'),
QC: getSecureUrl('fr-ca', 'KB0043979'),
MA: getSecureUrl(...secureFr),
SN: getSecureUrl(...secureFr),
TN: getSecureUrl(...secureFr),
AU: getSecureUrl('en-au', 'KB0043972'),
IN: getSecureUrl('en-in', 'KB0067991'),
SG: getSecureUrl('en-sg', 'KB0043974'),
ASIA: getSecureUrl('asia', 'KB0031024'),
WE: getSecureUrl(...secureEnIe),
WS: getSecureUrl(...secureEnIe),
DEFAULT: getSecureUrl(...secureEnIe),
};

const getSSHConnectionsUrl = (language: string, article: string) =>
`${ENDPOINT}${language}-dedicated-servers-ssh-introduction?id=kb_article_view&sysparm_article=${article}`;

const sshConnectionEnIe = ['en-ie', 'KB0044020'] as const;
const sshConnectionFr = ['fr', 'KB0044339'] as const;

const SSH_CONNECTIONS_LINKS: GuideLinks = {
FR: getSSHConnectionsUrl(...sshConnectionFr),
DE: getSSHConnectionsUrl('de', 'KB0044338'),
ES: getSSHConnectionsUrl('es-es', 'KB0044025'),
IE: getSSHConnectionsUrl(...sshConnectionEnIe),
IT: getSSHConnectionsUrl('it', 'KB0044027'),
NL: getSSHConnectionsUrl(...sshConnectionEnIe),
PL: getSSHConnectionsUrl('pl', 'KB0044030'),
PT: getSSHConnectionsUrl('pt', 'KB0044029'),
GB: getSSHConnectionsUrl('en-gb', 'KB0044024'),
CA: getSSHConnectionsUrl('en-ca', 'KB0044022'),
QC: getSSHConnectionsUrl('fr-ca', 'KB0044023'),
MA: getSSHConnectionsUrl(...sshConnectionFr),
SN: getSSHConnectionsUrl(...sshConnectionFr),
TN: getSSHConnectionsUrl(...sshConnectionFr),
AU: getSSHConnectionsUrl('en-au', 'KB0044019'),
IN: getSSHConnectionsUrl('en-in', 'KB0068003'),
SG: getSSHConnectionsUrl('en-sg', 'KB0044327'),
ASIA: getSSHConnectionsUrl('asia', 'KB0031077'),
WE: getSSHConnectionsUrl(...sshConnectionEnIe),
WS: getSSHConnectionsUrl('es', 'KB0044028'),
DEFAULT: getSSHConnectionsUrl(...sshConnectionEnIe),
};

const guidesList = [
{
label: 'guide_first_step_label',
links: FIRST_STEP_LINKS,
},
{
label: 'guide_secure_label',
links: SECURE_LINKS,
},
{
label: 'guide_ssh_connections_label',
links: SSH_CONNECTIONS_LINKS,
},
];

export default function useGuides(translate: (key: string) => string) {
const [guides, setGuides] = useState<GuideItem[]>([]);
const {
shell: { environment },
} = useContext(ShellContext);

useEffect(() => {
(async () => {
const env = await environment.getEnvironment();
const { ovhSubsidiary } = env.getUser();

setGuides(
guidesList.map(({ label, links }, id) => ({
id,
label: translate(label),
href: links[ovhSubsidiary as CountryCode] || links.DEFAULT,
target: '_blank',
})),
);
})();
}, []);

return guides;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ import {
useRouteSynchro,
ShellContext,
} from '@ovh-ux/manager-react-shell-client';
import { ChangelogButton, BaseLayout } from '@ovh-ux/manager-react-components';
import {
ChangelogButton,
BaseLayout,
GuideButton,
} from '@ovh-ux/manager-react-components';
import { OdsTabs, OdsTab } from '@ovhcloud/ods-components/react';
import { useTranslation } from 'react-i18next';
import { CHANGELOG_LINKS } from '@/data/constants/changelogLinks';
import { urls } from '@/routes/routes.constant';
import { useCluster } from '@/hooks/useCluster';
import useGuides from '@/hooks/useGuides';

export default function Layout() {
const { t } = useTranslation('dedicated-servers');
Expand All @@ -28,6 +33,7 @@ export default function Layout() {
const { data, isSuccess: isSuccessCluster } = useCluster();
const [activePanel, setActivePanel] = useState('');
const navigate = useNavigate();
const guides = useGuides(t);

useRouteSynchro();

Expand Down Expand Up @@ -66,6 +72,7 @@ export default function Layout() {
header={{
title: t('title'),
changelogButton: <ChangelogButton links={CHANGELOG_LINKS} />,
headerButton: <GuideButton items={guides} />,
}}
tabs={
<div>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export default class DedicatedServerInterfacesService {
id: uuid,
name,
mac: networkInterfaceController.join(', '),
nbMac: networkInterfaceController.length,
type,
vrack,
enabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
<!-- IPv4 -->
<oui-tile-definition term="{{ :: 'server_network_ipv4' | translate }}">
<oui-tile-description>
<oui-clipboard class="ip-clipboard" data-model="$ctrl.server.ip">
</oui-clipboard>
<oui-clipboard data-model="$ctrl.server.ip"> </oui-clipboard>
</oui-tile-description>
<oui-action-menu
aria-label="{{:: 'menu_action_label' | translate:{t0: ('server_network_ipv4' | translate)} }}"
Expand Down Expand Up @@ -68,7 +67,6 @@
>
<oui-tile-description>
<oui-clipboard
class="ip-clipboard"
data-model="$ctrl.server.reverse || ('server_network_reverse_not_configured' | translate)"
>
</oui-clipboard>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import template from './template.html';
import controller from './controller.js';

export default {
template,
controller,
bindings: {
server: '<',
guideUrl: '@',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {
NEW_LACP_MODE_BANNER_FEATURE_ID,
SCALE_HGR_MAC_COUNTER,
} from './ola.constants';

export default class OlaCtrl {
/* @ngInject */
constructor($state, olaService, ovhFeatureFlipping) {
this.$state = $state;
this.olaService = olaService;
this.ovhFeatureFlipping = ovhFeatureFlipping;
}

$onInit() {
this.isLacpBannerAvailable = false;
this.resilienceGuideUrl = this.olaService.getResilienceGuideUrl();
this.olaService.getNetworkInterfaces(this.server?.name).then((data) => {
if (data.length >= SCALE_HGR_MAC_COUNTER) {
this.ovhFeatureFlipping
.checkFeatureAvailability(NEW_LACP_MODE_BANNER_FEATURE_ID)
.then((featureAvailability) => {
this.isLacpBannerAvailable = featureAvailability.isFeatureAvailable(
NEW_LACP_MODE_BANNER_FEATURE_ID,
);
});
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import flatten from 'lodash/flatten';
import get from 'lodash/get';
import map from 'lodash/map';

import { OLA_MODES } from '../ola.constants';
import {
OLA_MODES,
NEW_LACP_MODE_BANNER_FEATURE_ID,
SCALE_HGR_MAC_COUNTER,
} from '../ola.constants';

export default class {
/* @ngInject */
Expand All @@ -13,6 +17,7 @@ export default class {
$translate,
Alerter,
ouiDatagridService,
ovhFeatureFlipping,
olaService,
OvhApiDedicatedServerPhysicalInterface,
OvhApiDedicatedServerVirtualInterface,
Expand All @@ -25,11 +30,24 @@ export default class {
this.PhysicalInterface = OvhApiDedicatedServerPhysicalInterface;
this.VirtualInterface = OvhApiDedicatedServerVirtualInterface;
this.ouiDatagridService = ouiDatagridService;
this.ovhFeatureFlipping = ovhFeatureFlipping;
}

$onInit() {
this.olaModes = Object.values(OLA_MODES);
this.isLoading = false;
const nbMacs = this.interfaces.reduce((acc, item) => acc + item.nbMac, 0);
this.resilienceGuideUrl = this.olaService.getResilienceGuideUrl();
this.isLacpBannerAvailable = false;
if (nbMacs >= SCALE_HGR_MAC_COUNTER) {
this.ovhFeatureFlipping
.checkFeatureAvailability(NEW_LACP_MODE_BANNER_FEATURE_ID)
.then((featureAvailability) => {
this.isLacpBannerAvailable = featureAvailability.isFeatureAvailable(
NEW_LACP_MODE_BANNER_FEATURE_ID,
);
});
}

this.configuration = {
mode:
Expand Down
Loading
Loading