Skip to content

Commit

Permalink
feat(msc-billing-tile): domain whoisOwner request, fixes
Browse files Browse the repository at this point in the history
ref: MANAGER-11620

Signed-off-by: Nicolas BAPTISTA <[email protected]>
  • Loading branch information
Kranysys committed Jul 25, 2023
1 parent 661dcd1 commit f8bbf55
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ export interface IMscBillingTile {
servicePath: string;
}

/**
* @slot footer - Footer content
*/
@Component({
tag: 'msc-billing-tile',
styleUrl: 'msc-billing-tile.scss',
Expand Down Expand Up @@ -82,6 +79,8 @@ export class MscBillingTile implements IMscBillingTile {

@State() requestDate: string;

@State() whoisOwnerDomain: string;

@State() showTooltip = false; // will be removed with ODS-MENU

@State() showTooltipContact = false; // will be removed with ODS-MENU
Expand Down Expand Up @@ -127,6 +126,8 @@ export class MscBillingTile implements IMscBillingTile {
);

this.fetchServiceId();
if (this.getServiceType() === 'DOMAIN')
this.fetchDomainOwner(this.getServiceName());
});
}

Expand Down Expand Up @@ -223,6 +224,19 @@ export class MscBillingTile implements IMscBillingTile {
});
}

fetchDomainOwner(domain: string) {
apiClient.v6
.get(`/domain/${domain}`)
.then((response) => {
const { data } = response;
console.log('response:', response);
this.whoisOwnerDomain = data.whoisOwner;
})
.catch((error) => {
console.error('Error:', error);
});
}

getServiceName() {
const parts = this.servicePath.split('/');
return parts[parts.length - 1]; // get the last part
Expand Down Expand Up @@ -283,7 +297,8 @@ export class MscBillingTile implements IMscBillingTile {
return (
<osds-link
color={OdsThemeColorIntent.primary}
href={`https://eu.ovh.com/fr/cgi-bin/order/renew.cgi?domainChooser=${this.getServiceName}`}
href={`https://eu.ovh.com/fr/cgi-bin/order/renew.cgi?domainChooser=${this.getServiceName()}`}
target="blank"
>
{this.getTranslation('billing_services_actions_menu_renew')}
<osds-icon
Expand Down Expand Up @@ -509,7 +524,7 @@ export class MscBillingTile implements IMscBillingTile {
<osds-link
data-tracking={this.dataTracking}
color={OdsThemeColorIntent.primary}
href={'#'}
href={`https://www.ovh.com/manager/dedicated/#/${this.servicePath}/dashboard/commitment`}
target={OdsHTMLAnchorElementTarget._blank}
>
{this.getTranslation(
Expand Down Expand Up @@ -540,22 +555,52 @@ export class MscBillingTile implements IMscBillingTile {
'manager_billing_subscription_contacts_management',
)}
</osds-link>
<osds-link href={``} color={OdsThemeColorIntent.primary}>
{this.getTranslation(
'billing_services_actions_menu_change_owner',
)}
<osds-icon
class="link-icon"
size={OdsIconSize.xxs}
name={OdsIconName.EXTERNAL_LINK}
{this.getServiceType() === 'DOMAIN' && (
<>
<osds-link
href={`https://www.ovh.com/fr/order/domain/#/legacy/domain/trade/informations?options=~~(domain~~'${this.getServiceName()})`}
target="blank"
color={OdsThemeColorIntent.primary}
>
{this.getTranslation(
'billing_services_actions_menu_change_owner',
)}
<osds-icon
class="link-icon"
size={OdsIconSize.xxs}
name={OdsIconName.EXTERNAL_LINK}
color={OdsThemeColorIntent.primary}
/>
</osds-link>
<osds-link
href={`https://www.ovh.com/manager/#/dedicated/contact/${this.getServiceName()}/${
this.whoisOwnerDomain
}`}
color={OdsThemeColorIntent.primary}
>
{this.getTranslation(
'billing_services_actions_menu_configuration_update_owner',
)}
</osds-link>
</>
)}
{this.getServiceType() !== 'DOMAIN' && (
<osds-link
href={`https://www.ovh.com/cgi-bin/fr/procedure/procedureChangeOwner.cgi`}
target="blank"
color={OdsThemeColorIntent.primary}
/>
</osds-link>
<osds-link href={``} color={OdsThemeColorIntent.primary}>
{this.getTranslation(
'billing_services_actions_menu_configuration_update_owner',
)}
</osds-link>
>
{this.getTranslation(
'billing_services_actions_menu_change_owner',
)}
<osds-icon
class="link-icon"
size={OdsIconSize.xxs}
name={OdsIconName.EXTERNAL_LINK}
color={OdsThemeColorIntent.primary}
/>
</osds-link>
)}
</div>
);
};
Expand Down
19 changes: 19 additions & 0 deletions packages/super-components/mock/billing-tile.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -617,3 +617,22 @@ mock.onGet(`services/117150473`).reply(200, {
},
tags: [],
});

/* ------- domain ------- */

mock.onGet(`domain/agora3.ovh`).reply(200, {
state: 'ok',
glueRecordMultiIpSupported: true,
parentService: null,
suspensionState: 'not_suspended',
glueRecordIpv6Supported: true,
domain: 'agora3.ovh',
whoisOwner: '13466563',
offer: 'platinum',
lastUpdate: '2022-12-06T17:00:45+01:00',
nameServerType: 'external',
hostSupported: true,
owoSupported: false,
transferLockStatus: 'locked',
dnssecSupported: true,
});

0 comments on commit f8bbf55

Please sign in to comment.