Skip to content
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

fix(billing): add forgotten services helper from dedicated #14995

Merged
merged 2 commits into from
Jan 23, 2025
Merged
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
2 changes: 2 additions & 0 deletions packages/manager/modules/new-billing/src/billing.module.js
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ import sortingFieldButtonDirective from './components/directives/sortingFieldBut
import renewDateComponent from './components/renewDate/billing-renew-date.component';
import renewLabelComponent from './components/renewLabel/billing-renew-label.component';
import renewFrequenceFilter from './components/filters/renewFrequence';
import servicesHelper from './services/servicesHelper.service';

import routing from './billing.routing';
import billingTracking from './atInternetTracking.config';
@@ -73,6 +74,7 @@ angular
.service('BillingmessageParser', messageParser)
.service('billingRenewHelper', renewHelper)
.service('BillingUser', userService)
.service('ServicesHelper', servicesHelper)
.config(routing)
.directive('billingDateRange', dateRangeDirective)
.directive('billingSortingFieldButton', sortingFieldButtonDirective)
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
export const SERVICES_TARGET_URLS = {
'/cdn/dedicated/{serviceName}': {
universe: 'dedicated',
url: '#/configuration/cdn/:serviceName',
},
'/cloud/project/{serviceName}': {
universe: 'cloud',
url: '#/iaas/pci/project/:serviceName/compute/infrastructure/diagram',
type: 'pci',
},
'/dedicated/nasha/{serviceName}': {
universe: 'dedicated',
url: '#/configuration/nas/nas/nasha_:serviceName',
},
'/domain/zone/{zoneName}': {
universe: 'web',
url: '#/configuration/domain/:serviceName',
},
'/domain/zone/{zoneName}/history': {
universe: 'web',
url: '#/configuration/domain/:serviceName/history',
},
'/hosting/web/{serviceName}': {
universe: 'web',
url: '#/configuration/hosting/:serviceName',
},
'/hosting/privateDatabase/{serviceName}': {
universe: 'web',
url: '#/configuration/private_database/:serviceName',
},
'/email/domain/{domain}': {
universe: 'web',
url: '#/configuration/email-domain/:serviceName',
},
'/email/pro/{service}': {
universe: 'web',
url: '#/configuration/email_pro/:serviceName',
},
'/license/office/{serviceName}': {
universe: 'web',
url: '#/configuration/microsoft/office/license/:serviceName',
},
'/dbaas/logs/{serviceName}': {
universe: 'cloud',
url: '#/dbaas/logs/:serviceName/home',
},
'/dedicated/housing/{serviceName}': {
universe: 'dedicated',
url: '#/configuration/housing/:serviceName',
},
'/dedicated/server/{serviceName}': {
universe: 'dedicated',
url: '#/configuration/server/:serviceName',
},
'/dedicatedCloud/{serviceName}': {
universe: 'dedicated',
url: '#/configuration/dedicated_cloud/:serviceName',
},
'/domain/{serviceName}': {
universe: 'web',
url: '#/configuration/domain/:serviceName',
},
'/ip/service/{serviceName}': {
universe: 'dedicated',
url: '#/configuration/ip',
},
'/ipLoadbalancing/{serviceName}': {
universe: 'dedicated',
url: '#/network/iplb/:serviceName',
},
'/license/plesk/{serviceName}': {
universe: 'dedicated',
url: '#/configuration/license/:serviceName/detail',
},
'/license/windows/{serviceName}': {
universe: 'dedicated',
url: '#/configuration/license/:serviceName/detail',
},
'/license/sqlserver/{serviceName}': {
universe: 'dedicated',
url: '#/configuration/license/:serviceName/detail',
},
'/license/virtuozzo/{serviceName}': {
universe: 'dedicated',
url: '#/configuration/license/:serviceName/detail',
},
'/license/worklight/{serviceName}': {
universe: 'dedicated',
url: '#/configuration/license/:serviceName/detail',
},
'/license/cpanel/{serviceName}': {
universe: 'dedicated',
url: '#/configuration/license/:serviceName/detail',
},
'/license/directadmin/{serviceName}': {
universe: 'dedicated',
url: '#/configuration/license/:serviceName/detail',
},
'/license/cloudlinux/{serviceName}': {
universe: 'dedicated',
url: '#/configuration/license/:serviceName/detail',
},
'/pack/xdsl/{packName}': {
universe: 'telecom',
url: '#/pack/:serviceName',
},
'/telephony/{billingAccount}': {
universe: 'telecom',
url: '#/telephony/:serviceName',
},
'/telephony/lines/{serviceName}': {
universe: 'telecom',
},
'/sms/{serviceName}': {
universe: 'telecom',
url: '#/sms/:serviceName',
},
'/freefax/{serviceName}': {
universe: 'telecom',
url: '#/freefax/:serviceName',
},
'/overTheBox/{serviceName}': {
universe: 'telecom',
url: '#/overTheBox/:serviceName/details',
},
'/vps/{serviceName}': {
universe: 'cloud',
url: '#/iaas/vps/:serviceName/dashboard',
},
'/vrack/{serviceName}': {
universe: 'cloud',
url: '#/vrack/:serviceName',
},
'/deskaas/{serviceName}': {
universe: 'cloud',
url: '#/deskaas/:serviceName',
},
};

export default { SERVICES_TARGET_URLS };
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import kebabCase from 'lodash/kebabCase';
import get from 'lodash/get';
import has from 'lodash/has';

import { SERVICES_TARGET_URLS } from '../constants/servicesHelper.constants';

export default class ServicesHelper {
/* @ngInject */
constructor($http, $q, coreURLBuilder) {
this.$http = $http;
this.$q = $q;
this.SERVICES_TARGET_URLS = SERVICES_TARGET_URLS;
this.coreURLBuilder = coreURLBuilder;
}

getServiceDetails(service) {
if (has(service, 'route.url')) {
return this.$http.get(get(service, 'route.url')).then(({ data }) => data);
}
return this.$q.when({});
}

getServiceManageUrl(service) {
if (!has(service, 'route.path')) {
return '';
}

const target = get(this.SERVICES_TARGET_URLS, get(service, 'route.path'));

return this.coreURLBuilder.buildURL(
kebabCase(target.universe),
target.url,
{
serviceName: get(service, 'resource.name'),
},
);
}

getServiceType(service) {
return get(this.SERVICES_TARGET_URLS, `${get(service, 'route.path')}.type`);
}
}