From 2e2cf6f8dd65d9e8ca3d3426be57c46bf60ac033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ars=C3=A8ne?= Date: Tue, 6 Jun 2023 11:48:46 +0200 Subject: [PATCH 01/14] feat(dedicated.carbon): add new carbon calculator uapp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref: MANAGER-11509 Signed-off-by: David Arsène --- .../apps/carbon-calculator/.eslintrc.json | 6 + .../manager/apps/carbon-calculator/README.md | 0 .../apps/carbon-calculator/package.json | 68 +++++++++ .../apps/carbon-calculator/src/app.module.js | 143 ++++++++++++++++++ .../src/error/error.module.js | 9 ++ .../src/error/error.routing.js | 26 ++++ .../apps/carbon-calculator/src/error/index.js | 22 +++ .../apps/carbon-calculator/src/index.html | 16 ++ .../apps/carbon-calculator/src/index.js | 26 ++++ .../apps/carbon-calculator/webpack.config.js | 73 +++++++++ .../modules/carbon-calculator/README.md | 0 .../modules/carbon-calculator/package.json | 27 ++++ .../src/dashboard/component.js | 12 ++ .../src/dashboard/controller.js | 10 ++ .../carbon-calculator/src/dashboard/index.js | 22 +++ .../carbon-calculator/src/dashboard/module.js | 23 +++ .../src/dashboard/routing.js | 14 ++ .../src/dashboard/template.html | 1 + .../translations/Messages_de_DE.json | 3 + .../translations/Messages_en_GB.json | 3 + .../translations/Messages_es_ES.json | 3 + .../translations/Messages_fr_CA.json | 3 + .../translations/Messages_fr_FR.json | 1 + .../translations/Messages_it_IT.json | 3 + .../translations/Messages_pl_PL.json | 3 + .../translations/Messages_pt_PT.json | 3 + .../modules/carbon-calculator/src/index.js | 27 ++++ .../modules/carbon-calculator/src/index.scss | 5 + .../modules/carbon-calculator/src/module.js | 34 +++++ .../src/onboarding/component.js | 10 ++ .../src/onboarding/constants.js | 3 + .../src/onboarding/controller.js | 7 + .../carbon-calculator/src/onboarding/index.js | 22 +++ .../src/onboarding/module.js | 26 ++++ .../src/onboarding/routing.js | 9 ++ .../src/onboarding/template.html | 1 + .../translations/Messages_fr_FR.json | 1 + .../modules/carbon-calculator/src/routing.js | 31 ++++ .../src/translations/Messages_fr_FR.json | 1 + yarn.lock | 11 +- 40 files changed, 706 insertions(+), 2 deletions(-) create mode 100644 packages/manager/apps/carbon-calculator/.eslintrc.json create mode 100644 packages/manager/apps/carbon-calculator/README.md create mode 100644 packages/manager/apps/carbon-calculator/package.json create mode 100644 packages/manager/apps/carbon-calculator/src/app.module.js create mode 100644 packages/manager/apps/carbon-calculator/src/error/error.module.js create mode 100644 packages/manager/apps/carbon-calculator/src/error/error.routing.js create mode 100644 packages/manager/apps/carbon-calculator/src/error/index.js create mode 100644 packages/manager/apps/carbon-calculator/src/index.html create mode 100644 packages/manager/apps/carbon-calculator/src/index.js create mode 100644 packages/manager/apps/carbon-calculator/webpack.config.js create mode 100644 packages/manager/modules/carbon-calculator/README.md create mode 100644 packages/manager/modules/carbon-calculator/package.json create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/component.js create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/controller.js create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/index.js create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/module.js create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/routing.js create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/template.html create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_de_DE.json create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_en_GB.json create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_es_ES.json create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_CA.json create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_FR.json create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_it_IT.json create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pl_PL.json create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pt_PT.json create mode 100644 packages/manager/modules/carbon-calculator/src/index.js create mode 100644 packages/manager/modules/carbon-calculator/src/index.scss create mode 100644 packages/manager/modules/carbon-calculator/src/module.js create mode 100644 packages/manager/modules/carbon-calculator/src/onboarding/component.js create mode 100644 packages/manager/modules/carbon-calculator/src/onboarding/constants.js create mode 100644 packages/manager/modules/carbon-calculator/src/onboarding/controller.js create mode 100644 packages/manager/modules/carbon-calculator/src/onboarding/index.js create mode 100644 packages/manager/modules/carbon-calculator/src/onboarding/module.js create mode 100644 packages/manager/modules/carbon-calculator/src/onboarding/routing.js create mode 100644 packages/manager/modules/carbon-calculator/src/onboarding/template.html create mode 100644 packages/manager/modules/carbon-calculator/src/onboarding/translations/Messages_fr_FR.json create mode 100644 packages/manager/modules/carbon-calculator/src/routing.js create mode 100644 packages/manager/modules/carbon-calculator/src/translations/Messages_fr_FR.json diff --git a/packages/manager/apps/carbon-calculator/.eslintrc.json b/packages/manager/apps/carbon-calculator/.eslintrc.json new file mode 100644 index 000000000000..383e2831c19a --- /dev/null +++ b/packages/manager/apps/carbon-calculator/.eslintrc.json @@ -0,0 +1,6 @@ +{ + "globals": { + "__VERSION__": true, + "__NG_APP_INJECTIONS__": true + } +} diff --git a/packages/manager/apps/carbon-calculator/README.md b/packages/manager/apps/carbon-calculator/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/manager/apps/carbon-calculator/package.json b/packages/manager/apps/carbon-calculator/package.json new file mode 100644 index 000000000000..04e22005b31b --- /dev/null +++ b/packages/manager/apps/carbon-calculator/package.json @@ -0,0 +1,68 @@ +{ + "name": "@ovh-ux/manager-carbon-calculator-app", + "version": "0.0.0", + "private": true, + "description": "OVHcloud CarbonCalculator app", + "repository": { + "type": "git", + "url": "git+https://github.com/ovh/manager.git", + "directory": "packages/manager/apps/carbon-calculator" + }, + "license": "BSD-3-Clause", + "author": "OVH SAS", + "scripts": { + "build": "webpack --env.production", + "dev": "webpack-dev-server", + "dev:watch": "yarn run dev", + "start": "lerna exec --stream --scope='@ovh-ux/manager-carbon-calculator-app' --include-dependencies -- npm run build --if-present", + "start:dev": "lerna exec --stream --scope='@ovh-ux/manager-carbon-calculator-app' --include-dependencies -- npm run dev --if-present", + "start:watch": "lerna exec --stream --parallel --scope='@ovh-ux/manager-carbon-calculator-app' --include-dependencies -- npm run dev:watch --if-present" + }, + "dependencies": { + "@ovh-ux/manager-carbon-calculator": "^0.0.0 || ^1.0.0", + "@ovh-ux/manager-config": "^6.5.1", + "@ovh-ux/manager-core": "^12.0.0 || ^13.0.0", + "@ovh-ux/manager-error-page": "^2.3.1", + "@ovh-ux/manager-ng-layout-helpers": "^2.6.1", + "@ovh-ux/ng-ovh-api-wrappers": "^5.0.0", + "@ovh-ux/ng-ovh-http": "^5.0.0", + "@ovh-ux/ng-ovh-request-tagger": "^1.1.7", + "@ovh-ux/ng-ovh-sso-auth": "^4.6.3", + "@ovh-ux/ng-ovh-swimming-poll": "^5.0.6", + "@ovh-ux/ng-shell-tracking": "^0.2.1", + "@ovh-ux/ng-translate-async-loader": "^2.1.5", + "@ovh-ux/ng-ui-router-breadcrumb": "^1.1.7", + "@ovh-ux/request-tagger": "^0.1.1", + "@ovh-ux/shell": "^1.10.1", + "@ovh-ux/ui-kit": "^6.3.0", + "@uirouter/angularjs": "^1.0.23", + "angular": "^1.7.5", + "angular-aria": "^1.7.8", + "angular-cookies": "^1.7.8", + "angular-dynamic-locale": "^0.1.37", + "angular-i18n": "^1.7.8", + "angular-resource": "^1.7.8", + "angular-sanitize": "^1.7.8", + "angular-translate": "^2.18.1", + "angular-translate-loader-pluggable": "^1.3.1", + "core-js": "^3.6.5", + "flatpickr": "~4.6.3", + "jquery": "^2.1.3", + "lodash-es": "^4.17.15", + "oclazyload": "^1.1.0", + "ovh-api-services": "^16.0.0", + "regenerator-runtime": "^0.13.7", + "whatwg-fetch": "^3.5.0" + }, + "devDependencies": { + "@ovh-ux/manager-webpack-config": "^6.1.1", + "glob": "^7.1.6", + "lodash": "^4.17.15", + "webpack": "^4.44.2", + "webpack-merge": "^4.2.2" + }, + "regions": [ + "CA", + "EU" + ] +} diff --git a/packages/manager/apps/carbon-calculator/src/app.module.js b/packages/manager/apps/carbon-calculator/src/app.module.js new file mode 100644 index 000000000000..17f754d64fe4 --- /dev/null +++ b/packages/manager/apps/carbon-calculator/src/app.module.js @@ -0,0 +1,143 @@ +import angular from 'angular'; +import get from 'lodash/get'; +import has from 'lodash/has'; +import isString from 'lodash/isString'; +import uiRouter, { RejectType } from '@uirouter/angularjs'; +import '@ovh-ux/ui-kit'; +import { isTopLevelApplication } from '@ovh-ux/manager-config'; +import { registerAtInternet } from '@ovh-ux/ng-shell-tracking'; +import { registerCoreModule } from '@ovh-ux/manager-core'; +import ngOvhSsoAuth from '@ovh-ux/ng-ovh-sso-auth'; +import ngUiRouterBreadcrumb from '@ovh-ux/ng-ui-router-breadcrumb'; +import CarbonCalculator from '../../../modules/carbon-calculator/src'; +import errorPage from './error'; + +import '@ovh-ux/ui-kit/dist/css/oui.css'; + +export default async (containerEl, shellClient) => { + const moduleName = 'CarbonCalculatorApp'; + + const routingConfig = /* @ngInject */ ($urlRouterProvider) => { + $urlRouterProvider.otherwise('/carbon'); + }; + + const ssoAuthConfig = /* @ngInject */ (ssoAuthenticationProvider) => { + ssoAuthenticationProvider.setOnLogin(() => { + shellClient.auth.login(); + }); + ssoAuthenticationProvider.setOnLogout(() => { + shellClient.auth.logout(); + }); + }; + + const broadcastAppStarted = /* @ngInject */ ($rootScope, $transitions) => { + const unregisterHook = $transitions.onSuccess({}, async () => { + if (!isTopLevelApplication()) { + await shellClient.ux.hidePreloader(); + } + $rootScope.$broadcast('app:started'); + unregisterHook(); + }); + }; + + const [environment, locale] = await Promise.all([ + shellClient.environment.getEnvironment(), + shellClient.i18n.getLocale(), + ]); + + const coreCallbacks = { + onLocaleChange: (lang) => { + shellClient.i18n.setLocale(lang); + }, + }; + + const defaultErrorHandler = /* @ngInject */ ($state) => { + $state.defaultErrorHandler((error) => { + if (error.type === RejectType.ERROR) { + $state.go( + 'error', + { + detail: { + message: get(error.detail, 'data.message'), + code: has(error.detail, 'headers') + ? error.detail.headers('x-ovh-queryId') + : null, + }, + }, + { location: false }, + ); + } + }); + }; + + const calendarConfigProvider = /* @ngInject */ ( + ouiCalendarConfigurationProvider, + ) => { + const [lang] = locale.split('_'); + return import(`flatpickr/dist/l10n/${lang}.js`) + .then((module) => { + ouiCalendarConfigurationProvider.setLocale(module.default[lang]); + }) + .catch(() => {}); + }; + + const transitionsConfig = /* @ngInject */ ($transitions) => { + if (!isTopLevelApplication()) { + $transitions.onBefore({}, (transition) => { + if ( + !transition.ignored() && + transition.from().name !== '' && + transition.entering().length > 0 + ) { + shellClient.ux.startProgress(); + } + }); + + $transitions.onSuccess({}, () => { + shellClient.ux.stopProgress(); + }); + + $transitions.onError({}, (transition) => { + if (!transition.error().redirected) { + shellClient.ux.stopProgress(); + } + }); + } + }; + + angular + .module( + moduleName, + [ + registerCoreModule(environment, coreCallbacks), + registerAtInternet(shellClient.tracking), + ngOvhSsoAuth, + ngUiRouterBreadcrumb, + 'oui', + uiRouter, + errorPage, + CarbonCalculator, + ...get(__NG_APP_INJECTIONS__, environment.getRegion(), []), + ].filter(isString), + ) + .constant('shellClient', shellClient) + .config( + /* @ngInject */ ($locationProvider) => $locationProvider.hashPrefix(''), + ) + .config(routingConfig) + .config(ssoAuthConfig) + // @TODO initialize tracking configuration here + // .config(async () => { + // await shellClient.tracking.setConfig(TRACKING); + // }) + .config(calendarConfigProvider) + .run(broadcastAppStarted) + .run(transitionsConfig) + .run(defaultErrorHandler); + + angular.bootstrap(containerEl, [moduleName], { + strictDi: true, + }); + + return moduleName; +}; diff --git a/packages/manager/apps/carbon-calculator/src/error/error.module.js b/packages/manager/apps/carbon-calculator/src/error/error.module.js new file mode 100644 index 000000000000..b2a255cc6bf8 --- /dev/null +++ b/packages/manager/apps/carbon-calculator/src/error/error.module.js @@ -0,0 +1,9 @@ +import managerErrorPage from '@ovh-ux/manager-error-page'; + +import routing from './error.routing'; + +const moduleName = 'ovhManagerCarbonCalculatorError'; + +angular.module(moduleName, [managerErrorPage]).config(routing); + +export default moduleName; diff --git a/packages/manager/apps/carbon-calculator/src/error/error.routing.js b/packages/manager/apps/carbon-calculator/src/error/error.routing.js new file mode 100644 index 000000000000..00e506e59084 --- /dev/null +++ b/packages/manager/apps/carbon-calculator/src/error/error.routing.js @@ -0,0 +1,26 @@ +export default /* @ngInject */ ($stateProvider) => { + $stateProvider.state('error', { + params: { + detail: null, + }, + url: '/error', + component: 'managerErrorPage', + resolve: { + cancelLink: /* @ngInject */ ($state) => $state.href('app'), + error: /* @ngInject */ ($transition$) => $transition$.params(), + product: /* @ngInject */ ($state, $transition$) => { + const { state, params } = $transition$.params().to; + // href will include # so split with '/' and take second element + const [, product] = $state + .href(state, params, { lossy: true }) + .split('/'); + // URI params are removed from error tracking + return product?.split('?')[0]; + }, + submitAction: /* @ngInject */ ($window) => () => + $window.location.reload(), + translationsRefresh: /* @ngInject */ ($translate) => $translate.refresh(), + breadcrumb: () => null, + }, + }); +}; diff --git a/packages/manager/apps/carbon-calculator/src/error/index.js b/packages/manager/apps/carbon-calculator/src/error/index.js new file mode 100644 index 000000000000..453a069e8a70 --- /dev/null +++ b/packages/manager/apps/carbon-calculator/src/error/index.js @@ -0,0 +1,22 @@ +import angular from 'angular'; +import '@uirouter/angularjs'; +import 'oclazyload'; + +const moduleName = 'ovhManagerCarbonCalculatorErrorPageLazyLoading'; + +angular.module(moduleName, ['ui.router', 'oc.lazyLoad']).config( + /* @ngInject */ ($stateProvider) => { + $stateProvider.state('error.**', { + url: '/error', + lazyLoad: ($transition$) => { + const $ocLazyLoad = $transition$.injector().get('$ocLazyLoad'); + + return import('./error.module').then((mod) => + $ocLazyLoad.inject(mod.default || mod), + ); + }, + }); + }, +); + +export default moduleName; diff --git a/packages/manager/apps/carbon-calculator/src/index.html b/packages/manager/apps/carbon-calculator/src/index.html new file mode 100644 index 000000000000..86562738a16d --- /dev/null +++ b/packages/manager/apps/carbon-calculator/src/index.html @@ -0,0 +1,16 @@ + + + + + CarbonCalculator App + + + + +
+ + diff --git a/packages/manager/apps/carbon-calculator/src/index.js b/packages/manager/apps/carbon-calculator/src/index.js new file mode 100644 index 000000000000..f0b3f7877f7b --- /dev/null +++ b/packages/manager/apps/carbon-calculator/src/index.js @@ -0,0 +1,26 @@ +import 'script-loader!jquery'; // eslint-disable-line +import 'core-js/stable'; +import 'whatwg-fetch'; +import 'regenerator-runtime/runtime'; + +import { isTopLevelApplication } from '@ovh-ux/manager-config'; +import { defineApplicationVersion } from '@ovh-ux/request-tagger'; + +import { useShellClient } from '@ovh-ux/shell'; + +defineApplicationVersion(__VERSION__); + +useShellClient('carbon-calculator').then((shellClient) => { + if (!isTopLevelApplication()) { + shellClient.ux.startProgress(); + } + shellClient.environment.getEnvironment().then((environment) => { + environment.setVersion(__VERSION__); + import(`./config-${environment.getRegion()}`) + .catch(() => {}) + .then(() => import('./app.module')) + .then(({ default: startApplication }) => { + startApplication(document.body, shellClient); + }); + }); +}); diff --git a/packages/manager/apps/carbon-calculator/webpack.config.js b/packages/manager/apps/carbon-calculator/webpack.config.js new file mode 100644 index 000000000000..874e2b54118b --- /dev/null +++ b/packages/manager/apps/carbon-calculator/webpack.config.js @@ -0,0 +1,73 @@ +const fs = require('fs'); +const glob = require('glob'); +const path = require('path'); +const webpack = require('webpack'); // eslint-disable-line +const merge = require('webpack-merge'); +const webpackConfig = require('@ovh-ux/manager-webpack-config'); + +function readNgAppInjections(file) { + let injections = []; + if (fs.existsSync(file)) { + injections = fs + .readFileSync(file, 'utf8') + .split('\n') + .filter((value) => value !== ''); + } + return injections; +} + +function getNgAppInjections(regions) { + return regions.reduce((ngAppInjections, region) => { + const injections = [ + ...readNgAppInjections(`./.extras-${region}/ng-app-injections`), + ...readNgAppInjections('./.extras/ng-app-injections'), + ]; + + return { + ...ngAppInjections, + [region]: JSON.stringify(injections), + }; + }, {}); +} + +module.exports = (env = {}) => { + const { config } = webpackConfig( + { + template: './src/index.html', + basePath: './src', + lessPath: ['./node_modules'], + root: path.resolve(__dirname, './src'), + }, + env, + ); + + // Extra config files + const extras = glob.sync(`./.extras/**/*.js`); + + return merge(config, { + entry: { + main: path.resolve('./src/index.js'), + ...(extras.length > 0 ? { extras } : {}), + }, + output: { + path: path.join(__dirname, 'dist'), + filename: '[name].[chunkhash].bundle.js', + }, + resolve: { + modules: [ + './node_modules', + path.resolve(__dirname, 'node_modules'), + path.resolve(__dirname, '../../../node_modules'), + ], + mainFields: ['module', 'browser', 'main'], + }, + plugins: [ + new webpack.DefinePlugin({ + __NODE_ENV__: process.env.NODE_ENV + ? `'${process.env.NODE_ENV}'` + : '"development"', + __NG_APP_INJECTIONS__: getNgAppInjections(['EU', 'CA']), + }), + ], + }); +}; diff --git a/packages/manager/modules/carbon-calculator/README.md b/packages/manager/modules/carbon-calculator/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/manager/modules/carbon-calculator/package.json b/packages/manager/modules/carbon-calculator/package.json new file mode 100644 index 000000000000..9b2f18055011 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/package.json @@ -0,0 +1,27 @@ +{ + "name": "@ovh-ux/manager-carbon-calculator", + "version": "0.0.0", + "private": true, + "description": "OVHcloud CarbonCalculator product", + "repository": { + "type": "git", + "url": "git+https://github.com/ovh/manager.git", + "directory": "packages/manager/modules/carbon-calculator" + }, + "license": "BSD-3-Clause", + "author": "OVH SAS", + "main": "./src/index.js", + "dependencies": { + "bootstrap4": "twbs/bootstrap#v4.0.0" + }, + "peerDependencies": { + "@ovh-ux/manager-core": "^10.0.0 || ^11.0.0", + "@ovh-ux/manager-ng-layout-helpers": "^2.0.0", + "@ovh-ux/ng-ui-router-breadcrumb": "^1.0.0", + "@ovh-ux/ui-kit": "^4.4.3", + "@uirouter/angularjs": "^1.0.23", + "angular": "^1.7.5", + "angular-translate": "^2.18.1", + "oclazyload": "^1.1.0" + } +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/component.js b/packages/manager/modules/carbon-calculator/src/dashboard/component.js new file mode 100644 index 000000000000..b9c8cdd419a0 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/component.js @@ -0,0 +1,12 @@ +import controller from './controller'; +import template from './template.html'; + +export default { + bindings: { + serviceName: '<', + currentActiveLink: '<', + dashboardLink: '<', + }, + controller, + template, +}; diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/controller.js b/packages/manager/modules/carbon-calculator/src/dashboard/controller.js new file mode 100644 index 000000000000..3e1d7a1beb58 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/controller.js @@ -0,0 +1,10 @@ +export default class CarbonCalculatorCtrl { + /* @ngInject */ + constructor($translate) { + this.$translate = $translate; + } + + $onInit() { + console.log('Hello', this.$translate.instant('world')); + } +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/index.js b/packages/manager/modules/carbon-calculator/src/dashboard/index.js new file mode 100644 index 000000000000..d7f1ec02fc30 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/index.js @@ -0,0 +1,22 @@ +import angular from 'angular'; +import '@uirouter/angularjs'; +import 'oclazyload'; + +const moduleName = 'ovhManagerCarbonCalculatorDashboardLazyLoading'; + +angular.module(moduleName, ['ui.router', 'oc.lazyLoad']).config( + /* @ngInject */ ($stateProvider) => { + $stateProvider.state('app.dashboard.**', { + url: '/dashboard', + lazyLoad: ($transition$) => { + const $ocLazyLoad = $transition$.injector().get('$ocLazyLoad'); + + return import('./module').then((mod) => + $ocLazyLoad.inject(mod.default || mod), + ); + }, + }); + }, +); + +export default moduleName; diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/module.js b/packages/manager/modules/carbon-calculator/src/dashboard/module.js new file mode 100644 index 000000000000..85d2a9d744a3 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/module.js @@ -0,0 +1,23 @@ +import angular from 'angular'; +import '@ovh-ux/manager-core'; +import '@ovh-ux/ng-ui-router-breadcrumb'; +import '@uirouter/angularjs'; +import 'angular-translate'; + +import component from './component'; +import routing from './routing'; + +const moduleName = 'ovhManagerCarbonCalculatorDashboard'; + +angular + .module(moduleName, [ + 'ngUiRouterBreadcrumb', + 'ovhManagerCore', + 'pascalprecht.translate', + 'ui.router', + ]) + .config(routing) + .component('carbonCalculatorDashboard', component) + .run(/* @ngTranslationsInject:json ./translations */); + +export default moduleName; diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/routing.js b/packages/manager/modules/carbon-calculator/src/dashboard/routing.js new file mode 100644 index 000000000000..80dff03c0cef --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/routing.js @@ -0,0 +1,14 @@ +export default /* @ngInject */ ($stateProvider) => { + $stateProvider.state('app.dashboard', { + url: '/dashboard/', + component: 'carbonCalculatorDashboard', + resolve: { + currentActiveLink: /* @ngInject */ ($transition$, $state) => () => + $state.href($state.current.name, $transition$.params()), + dashboardLink: /* @ngInject */ ($state) => $state.href('app.dashboard'), + serviceName: /* @ngInject */ ($transition$) => + $transition$.params().serviceName, + breadcrumb: /* @ngInject */ (serviceName) => serviceName, + }, + }); +}; diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/template.html b/packages/manager/modules/carbon-calculator/src/dashboard/template.html new file mode 100644 index 000000000000..d039a9f08e7d --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/template.html @@ -0,0 +1 @@ +Carbon footprint dashboard diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_de_DE.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_de_DE.json new file mode 100644 index 000000000000..eae7b63d1490 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_de_DE.json @@ -0,0 +1,3 @@ +{ + "world": "World!" +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_en_GB.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_en_GB.json new file mode 100644 index 000000000000..eae7b63d1490 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_en_GB.json @@ -0,0 +1,3 @@ +{ + "world": "World!" +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_es_ES.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_es_ES.json new file mode 100644 index 000000000000..eae7b63d1490 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_es_ES.json @@ -0,0 +1,3 @@ +{ + "world": "World!" +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_CA.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_CA.json new file mode 100644 index 000000000000..eae7b63d1490 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_CA.json @@ -0,0 +1,3 @@ +{ + "world": "World!" +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_FR.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_FR.json new file mode 100644 index 000000000000..9e26dfeeb6e6 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_FR.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_it_IT.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_it_IT.json new file mode 100644 index 000000000000..eae7b63d1490 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_it_IT.json @@ -0,0 +1,3 @@ +{ + "world": "World!" +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pl_PL.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pl_PL.json new file mode 100644 index 000000000000..eae7b63d1490 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pl_PL.json @@ -0,0 +1,3 @@ +{ + "world": "World!" +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pt_PT.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pt_PT.json new file mode 100644 index 000000000000..eae7b63d1490 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pt_PT.json @@ -0,0 +1,3 @@ +{ + "world": "World!" +} diff --git a/packages/manager/modules/carbon-calculator/src/index.js b/packages/manager/modules/carbon-calculator/src/index.js new file mode 100644 index 000000000000..d36034842eec --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/index.js @@ -0,0 +1,27 @@ +import angular from 'angular'; +import '@ovh-ux/ng-ui-router-breadcrumb'; +import '@uirouter/angularjs'; +import 'oclazyload'; + +import './index.scss'; + +const moduleName = 'ovhManagerCarbonCalculatorLazyLoading'; + +angular + .module(moduleName, ['ngUiRouterBreadcrumb', 'ui.router', 'oc.lazyLoad']) + .config( + /* @ngInject */ ($stateProvider) => { + $stateProvider.state('app.**', { + url: '/carbon', + lazyLoad: ($transition$) => { + const $ocLazyLoad = $transition$.injector().get('$ocLazyLoad'); + + return import('./module').then((mod) => + $ocLazyLoad.inject(mod.default || mod), + ); + }, + }); + }, + ); + +export default moduleName; diff --git a/packages/manager/modules/carbon-calculator/src/index.scss b/packages/manager/modules/carbon-calculator/src/index.scss new file mode 100644 index 000000000000..aff6d0eca0f4 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/index.scss @@ -0,0 +1,5 @@ +@import 'bootstrap4/scss/_functions.scss'; +@import 'bootstrap4/scss/_variables.scss'; +@import 'bootstrap4/scss/_mixins.scss'; +@import 'bootstrap4/scss/_utilities.scss'; +@import 'bootstrap4/scss/_grid.scss'; diff --git a/packages/manager/modules/carbon-calculator/src/module.js b/packages/manager/modules/carbon-calculator/src/module.js new file mode 100644 index 000000000000..630ca1f6f19c --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/module.js @@ -0,0 +1,34 @@ +import angular from 'angular'; + +import '@ovh-ux/manager-core'; +import '@ovh-ux/ng-ui-router-breadcrumb'; +import '@uirouter/angularjs'; +import 'angular-translate'; + +import { ListLayoutHelper } from '@ovh-ux/manager-ng-layout-helpers'; + +import dashboard from './dashboard'; +import onboarding from './onboarding'; +import routing from './routing'; + +const moduleName = 'ovhManagerCarbonCalculator'; + +angular + .module(moduleName, [ + 'ngUiRouterBreadcrumb', + 'ovhManagerCore', + 'pascalprecht.translate', + 'ui.router', + onboarding, + dashboard, + ListLayoutHelper.moduleName, + ]) + .config(routing) + .run(/* @ngTranslationsInject:json ./translations */) + .run( + /* @ngInject */ ($translate, $transitions) => { + $transitions.onBefore({ to: 'app.**' }, () => $translate.refresh()); + }, + ); + +export default moduleName; diff --git a/packages/manager/modules/carbon-calculator/src/onboarding/component.js b/packages/manager/modules/carbon-calculator/src/onboarding/component.js new file mode 100644 index 000000000000..eb54426ab97b --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/onboarding/component.js @@ -0,0 +1,10 @@ +import controller from './controller'; +import template from './template.html'; + +export default { + bindings: { + discover: '<', + }, + controller, + template, +}; diff --git a/packages/manager/modules/carbon-calculator/src/onboarding/constants.js b/packages/manager/modules/carbon-calculator/src/onboarding/constants.js new file mode 100644 index 000000000000..67afef871d86 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/onboarding/constants.js @@ -0,0 +1,3 @@ +export const GUIDES = []; + +export default { GUIDES }; diff --git a/packages/manager/modules/carbon-calculator/src/onboarding/controller.js b/packages/manager/modules/carbon-calculator/src/onboarding/controller.js new file mode 100644 index 000000000000..c603cb348765 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/onboarding/controller.js @@ -0,0 +1,7 @@ +import { GUIDES } from './constants'; + +export default class CarbonCalculatorOnboardingCtrl { + constructor() { + this.GUIDES = GUIDES; + } +} diff --git a/packages/manager/modules/carbon-calculator/src/onboarding/index.js b/packages/manager/modules/carbon-calculator/src/onboarding/index.js new file mode 100644 index 000000000000..03f6dd9612f5 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/onboarding/index.js @@ -0,0 +1,22 @@ +import angular from 'angular'; +import '@uirouter/angularjs'; +import 'oclazyload'; + +const moduleName = 'ovhManagerCarbonCalculatorOnboardingLazyLoading'; + +angular.module(moduleName, ['ui.router', 'oc.lazyLoad']).config( + /* @ngInject */ ($stateProvider) => { + $stateProvider.state('app.onboarding.**', { + url: '/onboarding', + lazyLoad: ($transition$) => { + const $ocLazyLoad = $transition$.injector().get('$ocLazyLoad'); + + return import('./module').then((mod) => + $ocLazyLoad.inject(mod.default || mod), + ); + }, + }); + }, +); + +export default moduleName; diff --git a/packages/manager/modules/carbon-calculator/src/onboarding/module.js b/packages/manager/modules/carbon-calculator/src/onboarding/module.js new file mode 100644 index 000000000000..d2d610edcde6 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/onboarding/module.js @@ -0,0 +1,26 @@ +import angular from 'angular'; +import '@ovh-ux/manager-core'; +import '@ovh-ux/ng-ui-router-breadcrumb'; +import '@uirouter/angularjs'; +import 'angular-translate'; + +import { OnboardingLayoutHelper } from '@ovh-ux/manager-ng-layout-helpers'; + +import component from './component'; +import routing from './routing'; + +const moduleName = 'ovhManagerCarbonCalculatorOnboarding'; + +angular + .module(moduleName, [ + 'ngUiRouterBreadcrumb', + 'ovhManagerCore', + 'pascalprecht.translate', + 'ui.router', + OnboardingLayoutHelper, + ]) + .config(routing) + .component('carbonCalculatorOnboarding', component) + .run(/* @ngTranslationsInject:json ./translations */); + +export default moduleName; diff --git a/packages/manager/modules/carbon-calculator/src/onboarding/routing.js b/packages/manager/modules/carbon-calculator/src/onboarding/routing.js new file mode 100644 index 000000000000..d3d62d87d846 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/onboarding/routing.js @@ -0,0 +1,9 @@ +export default /* @ngInject */ ($stateProvider) => { + $stateProvider.state('app.onboarding', { + url: '/onboarding', + component: 'carbonCalculatorOnboarding', + resolve: { + breadcrumb: () => null, + }, + }); +}; diff --git a/packages/manager/modules/carbon-calculator/src/onboarding/template.html b/packages/manager/modules/carbon-calculator/src/onboarding/template.html new file mode 100644 index 000000000000..d71f699a205b --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/onboarding/template.html @@ -0,0 +1 @@ +Carbon footprint onboarding diff --git a/packages/manager/modules/carbon-calculator/src/onboarding/translations/Messages_fr_FR.json b/packages/manager/modules/carbon-calculator/src/onboarding/translations/Messages_fr_FR.json new file mode 100644 index 000000000000..0967ef424bce --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/onboarding/translations/Messages_fr_FR.json @@ -0,0 +1 @@ +{} diff --git a/packages/manager/modules/carbon-calculator/src/routing.js b/packages/manager/modules/carbon-calculator/src/routing.js new file mode 100644 index 000000000000..f4857e4dcfff --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/routing.js @@ -0,0 +1,31 @@ +export default /* @ngInject */ ($stateProvider) => { + $stateProvider.state('app', { + url: '/carbon', + template: `
+
+
`, + // redirectTo: (transition) => + // transition + // .injector() + // .getAsync('features') + // .then((featureAvailabilityResult) => + // featureAvailabilityResult.isFeatureAvailable('carbon-calculator') + // ? 'app.dashboard' + // : 'app.onboarding', + // ), + redirectTo: () => 'app.dashboard', + resolve: { + breadcrumb: () => 'carbon calculator', // TODO translation + // apiPath: () => '/me/carbon-calculator', + // dataModel: () => 'carbonCalculator.Task', + // defaultFilterColumn: () => 'taskID', + header: () => 'carbon calculator', // TODO translation + // customizableColumns: () => true, + // getServiceNameLink: /* @ngInject */ ($state) => ({ taskID }) => { + // $state.href('app.dashboard', { + // taskID, + // }); + // }, + }, + }); +}; diff --git a/packages/manager/modules/carbon-calculator/src/translations/Messages_fr_FR.json b/packages/manager/modules/carbon-calculator/src/translations/Messages_fr_FR.json new file mode 100644 index 000000000000..0967ef424bce --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/translations/Messages_fr_FR.json @@ -0,0 +1 @@ +{} diff --git a/yarn.lock b/yarn.lock index 2a031d6f2224..232946ba9d0a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6461,7 +6461,7 @@ rollup-plugin-sass "^1.2.2" slash "^2.0.0" -"@ovh-ux/ng-ovh-api-wrappers@^5.1.0": +"@ovh-ux/ng-ovh-api-wrappers@^5.0.0", "@ovh-ux/ng-ovh-api-wrappers@^5.1.0": version "5.1.0" resolved "https://registry.yarnpkg.com/@ovh-ux/ng-ovh-api-wrappers/-/ng-ovh-api-wrappers-5.1.0.tgz#b8bfef258a4e0860eabf219cb1880ca0a15da687" integrity sha512-xljPUGrnTPUNnuTAblmOonCMnrrh2KcoUytvO4eIKFva2Dzd2AavUcSo0qbKgmCdFX86v96DDldHO89S/eQKmA== @@ -14406,7 +14406,7 @@ flat@^5.0.2: resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== -flatpickr@4.6.9, flatpickr@^4.6.3, flatpickr@~4.5.2: +flatpickr@4.6.9, flatpickr@^4.6.3, flatpickr@~4.5.2, flatpickr@~4.6.3: version "4.6.9" resolved "https://registry.yarnpkg.com/flatpickr/-/flatpickr-4.6.9.tgz#9a13383e8a6814bda5d232eae3fcdccb97dc1499" integrity sha512-F0azNNi8foVWKSF+8X+ZJzz8r9sE1G4hl06RyceIaLvyltKvDl6vqk9Lm/6AUUCi5HWaIjiUbk7UpeE/fOXOpw== @@ -20862,6 +20862,13 @@ outvariant@^1.2.1: resolved "https://registry.yarnpkg.com/outvariant/-/outvariant-1.3.0.tgz#c39723b1d2cba729c930b74bf962317a81b9b1c9" integrity sha512-yeWM9k6UPfG/nzxdaPlJkB2p08hCg4xP6Lx99F+vP8YF7xyZVfTmJjrrNalkmzudD4WFvNLVudQikqUmF8zhVQ== +ovh-api-services@^16.0.0: + version "16.0.0" + resolved "https://registry.yarnpkg.com/ovh-api-services/-/ovh-api-services-16.0.0.tgz#5d3f8ef29bbdae90b2982c3e06b8f77438029413" + integrity sha512-+0IR61XLd9LmeU3NtXZ0YfNgySaku84uSAoZTdIs7KgyJMlV12aGjb5nG4ZGBhQkhIewwxBc2+76eqxu8GE1Bw== + dependencies: + lodash "^4.17.21" + ovh-api-services@^17.0.0: version "17.0.0" resolved "https://registry.yarnpkg.com/ovh-api-services/-/ovh-api-services-17.0.0.tgz#9c5e70a97c2587115d9e67de8e5cada06d7eabb4" From 2d8849ecabaf8a1298284d2053c30384ded473b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ars=C3=A8ne?= Date: Fri, 9 Jun 2023 16:50:13 +0200 Subject: [PATCH 02/14] feat(dedicated): add carbon footprint links on sidebar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref: MANAGER-11510 Signed-off-by: David Arsène --- .../legacy/server-sidebar/universe/AccountSidebar.tsx | 7 +++++++ .../nav-reshuffle/sidebar/navigation-tree/root.ts | 9 +++++++++ .../src/public/translations/sidebar/Messages_fr_FR.json | 1 + .../src/dashboard/translations/Messages_de_DE.json | 3 --- .../src/dashboard/translations/Messages_en_GB.json | 3 --- .../src/dashboard/translations/Messages_es_ES.json | 3 --- .../src/dashboard/translations/Messages_fr_CA.json | 3 --- .../src/dashboard/translations/Messages_it_IT.json | 3 --- .../src/dashboard/translations/Messages_pl_PL.json | 3 --- .../src/dashboard/translations/Messages_pt_PT.json | 3 --- 10 files changed, 17 insertions(+), 21 deletions(-) delete mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_de_DE.json delete mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_en_GB.json delete mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_es_ES.json delete mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_CA.json delete mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_it_IT.json delete mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pl_PL.json delete mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pt_PT.json diff --git a/packages/manager/apps/container/src/container/legacy/server-sidebar/universe/AccountSidebar.tsx b/packages/manager/apps/container/src/container/legacy/server-sidebar/universe/AccountSidebar.tsx index 7365e8dbb095..e3667e0670c1 100644 --- a/packages/manager/apps/container/src/container/legacy/server-sidebar/universe/AccountSidebar.tsx +++ b/packages/manager/apps/container/src/container/legacy/server-sidebar/universe/AccountSidebar.tsx @@ -90,6 +90,13 @@ export default function AccountSidebar() { href: navigation.getURL('dedicated', '/contacts'), routeMatcher: new RegExp('^/contacts'), }); + + menu.push({ + id: 'my-carbon-footprint', + label: t('sidebar_carbon_footprint'), + href: navigation.getURL('carbon-calculator', '/'), + routeMatcher: new RegExp('^/carbon-calculator'), + }); } menu.push({ diff --git a/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/navigation-tree/root.ts b/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/navigation-tree/root.ts index 1d9b1bcddb25..0e5ef8339d16 100644 --- a/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/navigation-tree/root.ts +++ b/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/navigation-tree/root.ts @@ -65,6 +65,15 @@ const root: Node = { tag: NodeTag.NEW, count: false, features: ['iam'], + }, { + id: 'carbon_footprint', + translation: 'sidebar_carbon_footprint', + routing: { + application: 'carbon-calculator', + }, + count: false, + features: ['carbon-calculator'], + region: ['EU', 'CA'], }, { id: 'billing_services', diff --git a/packages/manager/apps/container/src/public/translations/sidebar/Messages_fr_FR.json b/packages/manager/apps/container/src/public/translations/sidebar/Messages_fr_FR.json index d6c3b7bfb240..267444db6524 100644 --- a/packages/manager/apps/container/src/public/translations/sidebar/Messages_fr_FR.json +++ b/packages/manager/apps/container/src/public/translations/sidebar/Messages_fr_FR.json @@ -136,6 +136,7 @@ "sidebar_account_profile": "Mon profil", "sidebar_account_contacts": "Mes contacts", "sidebar_account_iam": "Identités et accès (IAM)", + "sidebar_carbon_footprint": "Mon empreinte carbone", "sidebar_billing_services": "Mes services", "sidebar_billing_ssh": "Mes clés SSH", "sidebar_billing_bills": "Mes factures", diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_de_DE.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_de_DE.json deleted file mode 100644 index eae7b63d1490..000000000000 --- a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_de_DE.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "world": "World!" -} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_en_GB.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_en_GB.json deleted file mode 100644 index eae7b63d1490..000000000000 --- a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_en_GB.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "world": "World!" -} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_es_ES.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_es_ES.json deleted file mode 100644 index eae7b63d1490..000000000000 --- a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_es_ES.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "world": "World!" -} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_CA.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_CA.json deleted file mode 100644 index eae7b63d1490..000000000000 --- a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_CA.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "world": "World!" -} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_it_IT.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_it_IT.json deleted file mode 100644 index eae7b63d1490..000000000000 --- a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_it_IT.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "world": "World!" -} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pl_PL.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pl_PL.json deleted file mode 100644 index eae7b63d1490..000000000000 --- a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pl_PL.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "world": "World!" -} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pt_PT.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pt_PT.json deleted file mode 100644 index eae7b63d1490..000000000000 --- a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pt_PT.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "world": "World!" -} From 340008fc93f075421aefc8e14940bc986e7e085d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ars=C3=A8ne?= Date: Tue, 6 Jun 2023 11:48:46 +0200 Subject: [PATCH 03/14] feat(dedicated.carbon): add new carbon calculator uapp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref: MANAGER-11509 Signed-off-by: David Arsène --- .../src/dashboard/translations/Messages_de_DE.json | 3 +++ .../src/dashboard/translations/Messages_en_GB.json | 3 +++ .../src/dashboard/translations/Messages_es_ES.json | 3 +++ .../src/dashboard/translations/Messages_fr_CA.json | 3 +++ .../src/dashboard/translations/Messages_it_IT.json | 3 +++ .../src/dashboard/translations/Messages_pl_PL.json | 3 +++ .../src/dashboard/translations/Messages_pt_PT.json | 3 +++ 7 files changed, 21 insertions(+) create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_de_DE.json create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_en_GB.json create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_es_ES.json create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_CA.json create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_it_IT.json create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pl_PL.json create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pt_PT.json diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_de_DE.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_de_DE.json new file mode 100644 index 000000000000..eae7b63d1490 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_de_DE.json @@ -0,0 +1,3 @@ +{ + "world": "World!" +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_en_GB.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_en_GB.json new file mode 100644 index 000000000000..eae7b63d1490 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_en_GB.json @@ -0,0 +1,3 @@ +{ + "world": "World!" +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_es_ES.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_es_ES.json new file mode 100644 index 000000000000..eae7b63d1490 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_es_ES.json @@ -0,0 +1,3 @@ +{ + "world": "World!" +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_CA.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_CA.json new file mode 100644 index 000000000000..eae7b63d1490 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_CA.json @@ -0,0 +1,3 @@ +{ + "world": "World!" +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_it_IT.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_it_IT.json new file mode 100644 index 000000000000..eae7b63d1490 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_it_IT.json @@ -0,0 +1,3 @@ +{ + "world": "World!" +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pl_PL.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pl_PL.json new file mode 100644 index 000000000000..eae7b63d1490 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pl_PL.json @@ -0,0 +1,3 @@ +{ + "world": "World!" +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pt_PT.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pt_PT.json new file mode 100644 index 000000000000..eae7b63d1490 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pt_PT.json @@ -0,0 +1,3 @@ +{ + "world": "World!" +} From 991fb973c87fd9e5493478f8e7e3a8fa4cb90aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ars=C3=A8ne?= Date: Mon, 12 Jun 2023 18:59:37 +0200 Subject: [PATCH 04/14] feat(dedicated.carbon): add main page for carbon footprint billing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref: MANAGER-11511 Signed-off-by: David Arsène --- .../manager/apps/carbon-calculator/README.md | 0 .../apps/carbon-calculator/src/app.module.js | 2 +- .../apps/carbon-calculator/src/index.html | 2 +- .../apps/carbon-calculator/src/index.scss | 5 ++ .../modules/carbon-calculator/README.md | 0 .../modules/carbon-calculator/package.json | 7 +- .../assets/carbon-balance-EN.svg | 57 ++++++++++++++ .../assets/carbon-balance-FR.svg | 74 +++++++++++++++++++ .../carbon-balance-composition}/component.js | 3 - .../carbon-balance-composition/constants.js | 11 +++ .../carbon-balance-composition/controller.js | 10 +++ .../carbon-balance-composition/template.html | 14 ++++ .../dashboard/carbon-footprint/component.js | 8 ++ .../dashboard/carbon-footprint/controller.js | 6 ++ .../src/dashboard/carbon-footprint/service.js | 20 +++++ .../dashboard/carbon-footprint/template.html | 12 +++ .../src/dashboard/component.js | 3 - .../src/dashboard/controller.js | 10 --- .../carbon-calculator/src/dashboard/module.js | 10 ++- .../src/dashboard/routing.js | 5 +- .../src/dashboard/template.html | 13 +++- .../translations/Messages_de_DE.json | 3 - .../translations/Messages_en_GB.json | 3 - .../translations/Messages_es_ES.json | 3 - .../translations/Messages_fr_CA.json | 3 - .../translations/Messages_fr_FR.json | 9 ++- .../translations/Messages_it_IT.json | 3 - .../translations/Messages_pl_PL.json | 3 - .../translations/Messages_pt_PT.json | 3 - .../modules/carbon-calculator/src/index.js | 2 +- .../modules/carbon-calculator/src/index.scss | 7 ++ .../modules/carbon-calculator/src/module.js | 8 +- .../src/onboarding/constants.js | 3 - .../src/onboarding/controller.js | 7 -- .../carbon-calculator/src/onboarding/index.js | 22 ------ .../src/onboarding/module.js | 26 ------- .../src/onboarding/routing.js | 9 --- .../src/onboarding/template.html | 1 - .../translations/Messages_fr_FR.json | 1 - .../modules/carbon-calculator/src/routing.js | 35 ++++----- .../src/translations/Messages_fr_FR.json | 5 +- 41 files changed, 283 insertions(+), 145 deletions(-) delete mode 100644 packages/manager/apps/carbon-calculator/README.md create mode 100644 packages/manager/apps/carbon-calculator/src/index.scss delete mode 100644 packages/manager/modules/carbon-calculator/README.md create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/carbon-balance-EN.svg create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/carbon-balance-FR.svg rename packages/manager/modules/carbon-calculator/src/{onboarding => dashboard/carbon-balance-composition}/component.js (76%) create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/constants.js create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/controller.js create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/template.html create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/component.js create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/controller.js create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/service.js create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/template.html delete mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/controller.js delete mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_de_DE.json delete mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_en_GB.json delete mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_es_ES.json delete mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_CA.json delete mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_it_IT.json delete mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pl_PL.json delete mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pt_PT.json delete mode 100644 packages/manager/modules/carbon-calculator/src/onboarding/constants.js delete mode 100644 packages/manager/modules/carbon-calculator/src/onboarding/controller.js delete mode 100644 packages/manager/modules/carbon-calculator/src/onboarding/index.js delete mode 100644 packages/manager/modules/carbon-calculator/src/onboarding/module.js delete mode 100644 packages/manager/modules/carbon-calculator/src/onboarding/routing.js delete mode 100644 packages/manager/modules/carbon-calculator/src/onboarding/template.html delete mode 100644 packages/manager/modules/carbon-calculator/src/onboarding/translations/Messages_fr_FR.json diff --git a/packages/manager/apps/carbon-calculator/README.md b/packages/manager/apps/carbon-calculator/README.md deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/packages/manager/apps/carbon-calculator/src/app.module.js b/packages/manager/apps/carbon-calculator/src/app.module.js index 17f754d64fe4..650c16ce12f3 100644 --- a/packages/manager/apps/carbon-calculator/src/app.module.js +++ b/packages/manager/apps/carbon-calculator/src/app.module.js @@ -18,7 +18,7 @@ export default async (containerEl, shellClient) => { const moduleName = 'CarbonCalculatorApp'; const routingConfig = /* @ngInject */ ($urlRouterProvider) => { - $urlRouterProvider.otherwise('/carbon'); + $urlRouterProvider.otherwise('/billing'); }; const ssoAuthConfig = /* @ngInject */ (ssoAuthenticationProvider) => { diff --git a/packages/manager/apps/carbon-calculator/src/index.html b/packages/manager/apps/carbon-calculator/src/index.html index 86562738a16d..9e8f6504817b 100644 --- a/packages/manager/apps/carbon-calculator/src/index.html +++ b/packages/manager/apps/carbon-calculator/src/index.html @@ -9,7 +9,7 @@ } - +
diff --git a/packages/manager/apps/carbon-calculator/src/index.scss b/packages/manager/apps/carbon-calculator/src/index.scss new file mode 100644 index 000000000000..267e2042d35a --- /dev/null +++ b/packages/manager/apps/carbon-calculator/src/index.scss @@ -0,0 +1,5 @@ +@import 'bootstrap4/scss/_functions'; +@import 'bootstrap4/scss/_variables'; +@import 'bootstrap4/scss/_mixins'; +@import 'bootstrap4/scss/_utilities'; +@import 'bootstrap4/scss/_grid'; diff --git a/packages/manager/modules/carbon-calculator/README.md b/packages/manager/modules/carbon-calculator/README.md deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/packages/manager/modules/carbon-calculator/package.json b/packages/manager/modules/carbon-calculator/package.json index 9b2f18055011..8028a9985023 100644 --- a/packages/manager/modules/carbon-calculator/package.json +++ b/packages/manager/modules/carbon-calculator/package.json @@ -17,11 +17,14 @@ "peerDependencies": { "@ovh-ux/manager-core": "^10.0.0 || ^11.0.0", "@ovh-ux/manager-ng-layout-helpers": "^2.0.0", - "@ovh-ux/ng-ui-router-breadcrumb": "^1.0.0", - "@ovh-ux/ui-kit": "^4.4.3", + "@ovh-ux/ng-ovh-feature-flipping": "^1.0.7", + "@ovh-ux/ng-ui-router-breadcrumb": "^1.1.8", + "@ovh-ux/ui-kit": "^6.1.0", "@uirouter/angularjs": "^1.0.23", "angular": "^1.7.5", "angular-translate": "^2.18.1", + "font-awesome": "4.7.0", + "moment": "^2.24.0", "oclazyload": "^1.1.0" } } diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/carbon-balance-EN.svg b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/carbon-balance-EN.svg new file mode 100644 index 000000000000..394b1711c7f1 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/carbon-balance-EN.svg @@ -0,0 +1,57 @@ + + + + + + + + + + Operations + + + + + + + + + + + + + Manufacturing + + + + + + + + + + + + + + + Electricity + + = + + + + + + + + + + + + + + + + GreenhouseGas Emissions + + + diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/carbon-balance-FR.svg b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/carbon-balance-FR.svg new file mode 100644 index 000000000000..ac050410ab89 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/carbon-balance-FR.svg @@ -0,0 +1,74 @@ + + + + + + + + + + Opérations + + + + + + + + + + + + + Fabrication + + + + + + + + + + + + + + + Électricité + + = + + + + + + + + + + + + + + + + + + + + + + + Émissionsde Gaz à Effetde Serre + + + + + + + + + + + + + diff --git a/packages/manager/modules/carbon-calculator/src/onboarding/component.js b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/component.js similarity index 76% rename from packages/manager/modules/carbon-calculator/src/onboarding/component.js rename to packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/component.js index eb54426ab97b..95249af547c0 100644 --- a/packages/manager/modules/carbon-calculator/src/onboarding/component.js +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/component.js @@ -2,9 +2,6 @@ import controller from './controller'; import template from './template.html'; export default { - bindings: { - discover: '<', - }, controller, template, }; diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/constants.js b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/constants.js new file mode 100644 index 000000000000..3de015ec6484 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/constants.js @@ -0,0 +1,11 @@ +import IMG_CARBON_BALANCE_FR from './assets/carbon-balance-FR.svg'; +import IMG_CARBON_BALANCE_EN from './assets/carbon-balance-EN.svg'; + +export const CARBON_BALANCE_PICTURES = { + FR: IMG_CARBON_BALANCE_FR, + DEFAULT: IMG_CARBON_BALANCE_EN, +}; + +export default { + CARBON_BALANCE_PICTURES, +}; diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/controller.js b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/controller.js new file mode 100644 index 000000000000..a258ac27c284 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/controller.js @@ -0,0 +1,10 @@ +import { CARBON_BALANCE_PICTURES } from './constants'; + +export default class CarbonBalanceCompositionCtrl { + /* @ngInject */ + constructor(coreConfig) { + this.IMG_CARBON_BALANCE = + CARBON_BALANCE_PICTURES[coreConfig.getUser().ovhSubsidiary] || + CARBON_BALANCE_PICTURES.DEFAULT; + } +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/template.html b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/template.html new file mode 100644 index 000000000000..24619ed82077 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/template.html @@ -0,0 +1,14 @@ +
+

+

+ +
diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/component.js b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/component.js new file mode 100644 index 000000000000..916f74f5be12 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/component.js @@ -0,0 +1,8 @@ +import controller from './controller'; +import template from './template.html'; +import 'font-awesome/css/font-awesome.css'; + +export default { + controller, + template, +}; diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/controller.js b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/controller.js new file mode 100644 index 000000000000..71e5f4f2a548 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/controller.js @@ -0,0 +1,6 @@ +export default class CarbonFootprintCtrl { + /* @ngInject */ + constructor(carbonFootprintService) { + this.previousMonth = carbonFootprintService.computePreviousMonth(); + } +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/service.js b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/service.js new file mode 100644 index 000000000000..49c87b8aa22e --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/service.js @@ -0,0 +1,20 @@ +export default class CarbonFootprintService { + /* @ngInject */ + constructor(coreConfig) { + this.coreConfig = coreConfig; + } + + computePreviousMonth() { + const date = new Date(); + date.setMonth(date.getMonth() - 1); + + const dateTimeFormat = new Intl.DateTimeFormat( + this.coreConfig.getUserLocale().replace('_', '-'), + { + month: 'long', + year: 'numeric', + }, + ); + return dateTimeFormat.format(date); + } +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/template.html b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/template.html new file mode 100644 index 000000000000..10ffba4868e3 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/template.html @@ -0,0 +1,12 @@ +
+

+ +   + +
diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/component.js b/packages/manager/modules/carbon-calculator/src/dashboard/component.js index b9c8cdd419a0..c911b764d5e2 100644 --- a/packages/manager/modules/carbon-calculator/src/dashboard/component.js +++ b/packages/manager/modules/carbon-calculator/src/dashboard/component.js @@ -1,12 +1,9 @@ -import controller from './controller'; import template from './template.html'; export default { bindings: { - serviceName: '<', currentActiveLink: '<', dashboardLink: '<', }, - controller, template, }; diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/controller.js b/packages/manager/modules/carbon-calculator/src/dashboard/controller.js deleted file mode 100644 index 3e1d7a1beb58..000000000000 --- a/packages/manager/modules/carbon-calculator/src/dashboard/controller.js +++ /dev/null @@ -1,10 +0,0 @@ -export default class CarbonCalculatorCtrl { - /* @ngInject */ - constructor($translate) { - this.$translate = $translate; - } - - $onInit() { - console.log('Hello', this.$translate.instant('world')); - } -} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/module.js b/packages/manager/modules/carbon-calculator/src/dashboard/module.js index 85d2a9d744a3..7618dd89b689 100644 --- a/packages/manager/modules/carbon-calculator/src/dashboard/module.js +++ b/packages/manager/modules/carbon-calculator/src/dashboard/module.js @@ -4,8 +4,11 @@ import '@ovh-ux/ng-ui-router-breadcrumb'; import '@uirouter/angularjs'; import 'angular-translate'; -import component from './component'; +import carbonCalculatorDashboard from './component'; +import carbonBalanceComposition from './carbon-balance-composition/component'; +import carbonFootprint from './carbon-footprint/component'; import routing from './routing'; +import carbonFootprintService from './carbon-footprint/service'; const moduleName = 'ovhManagerCarbonCalculatorDashboard'; @@ -17,7 +20,10 @@ angular 'ui.router', ]) .config(routing) - .component('carbonCalculatorDashboard', component) + .component('carbonCalculatorDashboard', carbonCalculatorDashboard) + .component('carbonBalanceComposition', carbonBalanceComposition) + .component('carbonFootprint', carbonFootprint) + .service('carbonFootprintService', carbonFootprintService) .run(/* @ngTranslationsInject:json ./translations */); export default moduleName; diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/routing.js b/packages/manager/modules/carbon-calculator/src/dashboard/routing.js index 80dff03c0cef..7c416f6a49ab 100644 --- a/packages/manager/modules/carbon-calculator/src/dashboard/routing.js +++ b/packages/manager/modules/carbon-calculator/src/dashboard/routing.js @@ -6,9 +6,8 @@ export default /* @ngInject */ ($stateProvider) => { currentActiveLink: /* @ngInject */ ($transition$, $state) => () => $state.href($state.current.name, $transition$.params()), dashboardLink: /* @ngInject */ ($state) => $state.href('app.dashboard'), - serviceName: /* @ngInject */ ($transition$) => - $transition$.params().serviceName, - breadcrumb: /* @ngInject */ (serviceName) => serviceName, + breadcrumb: /* @ngInject */ ($translate) => + $translate.instant('carbon_calculator_my_carbon_footprint'), }, }); }; diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/template.html b/packages/manager/modules/carbon-calculator/src/dashboard/template.html index d039a9f08e7d..faf5c8310742 100644 --- a/packages/manager/modules/carbon-calculator/src/dashboard/template.html +++ b/packages/manager/modules/carbon-calculator/src/dashboard/template.html @@ -1 +1,12 @@ -Carbon footprint dashboard +
+ + +

+ + +
diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_de_DE.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_de_DE.json deleted file mode 100644 index eae7b63d1490..000000000000 --- a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_de_DE.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "world": "World!" -} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_en_GB.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_en_GB.json deleted file mode 100644 index eae7b63d1490..000000000000 --- a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_en_GB.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "world": "World!" -} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_es_ES.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_es_ES.json deleted file mode 100644 index eae7b63d1490..000000000000 --- a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_es_ES.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "world": "World!" -} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_CA.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_CA.json deleted file mode 100644 index eae7b63d1490..000000000000 --- a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_CA.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "world": "World!" -} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_FR.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_FR.json index 9e26dfeeb6e6..4398d3892383 100644 --- a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_FR.json +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_FR.json @@ -1 +1,8 @@ -{} \ No newline at end of file +{ + "carbon_calculator_dashboard_carbon_footprint_explanation": "Retrouvez et téléchargez l'analyse des émissions des gaz à effet de serre de votre infrastructure. Suivez l'impact environnemental lié à la fabrication, à la consommation énergétique et aux opérations annexes de vos services Cloud.", + "carbon_calculator_dashboard_carbon_balance_title": "Quelle est la composition du bilan carbone d'OVHcloud ?", + "carbon_calculator_dashboard_carbon_balance_img_title": "Composition bilan carbone OVHCloud", + "carbon_calculator_dashboard_carbon_balance_explanation": "OVHcloud inclut l'ensemble des sources émettrices de CO2eq, données fournies par la formule :", + "carbon_calculator_dashboard_billing_explanation": "Ce document comprend les émissions de gaz à effet se serre du mois précédent :
  • de vos services infrastructures Baremetal
dont vous êtes le contact facturation.", + "carbon_calculator_dashboard_billing_download": "Télécharger mon empreinte de {{month}}" +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_it_IT.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_it_IT.json deleted file mode 100644 index eae7b63d1490..000000000000 --- a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_it_IT.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "world": "World!" -} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pl_PL.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pl_PL.json deleted file mode 100644 index eae7b63d1490..000000000000 --- a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pl_PL.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "world": "World!" -} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pt_PT.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pt_PT.json deleted file mode 100644 index eae7b63d1490..000000000000 --- a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pt_PT.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "world": "World!" -} diff --git a/packages/manager/modules/carbon-calculator/src/index.js b/packages/manager/modules/carbon-calculator/src/index.js index d36034842eec..bd4cd0618e0c 100644 --- a/packages/manager/modules/carbon-calculator/src/index.js +++ b/packages/manager/modules/carbon-calculator/src/index.js @@ -12,7 +12,7 @@ angular .config( /* @ngInject */ ($stateProvider) => { $stateProvider.state('app.**', { - url: '/carbon', + url: '/billing', lazyLoad: ($transition$) => { const $ocLazyLoad = $transition$.injector().get('$ocLazyLoad'); diff --git a/packages/manager/modules/carbon-calculator/src/index.scss b/packages/manager/modules/carbon-calculator/src/index.scss index aff6d0eca0f4..c86b5b34e8d0 100644 --- a/packages/manager/modules/carbon-calculator/src/index.scss +++ b/packages/manager/modules/carbon-calculator/src/index.scss @@ -3,3 +3,10 @@ @import 'bootstrap4/scss/_mixins.scss'; @import 'bootstrap4/scss/_utilities.scss'; @import 'bootstrap4/scss/_grid.scss'; + +.carbon-balance { + ul { + list-style-type: '- '; + @extend .pt-2; + } +} diff --git a/packages/manager/modules/carbon-calculator/src/module.js b/packages/manager/modules/carbon-calculator/src/module.js index 630ca1f6f19c..21eaed8d3a80 100644 --- a/packages/manager/modules/carbon-calculator/src/module.js +++ b/packages/manager/modules/carbon-calculator/src/module.js @@ -4,23 +4,23 @@ import '@ovh-ux/manager-core'; import '@ovh-ux/ng-ui-router-breadcrumb'; import '@uirouter/angularjs'; import 'angular-translate'; +import '@ovh-ux/ng-ovh-feature-flipping'; import { ListLayoutHelper } from '@ovh-ux/manager-ng-layout-helpers'; -import dashboard from './dashboard'; -import onboarding from './onboarding'; +import carbonCalculatorDashboard from './dashboard'; import routing from './routing'; const moduleName = 'ovhManagerCarbonCalculator'; angular .module(moduleName, [ + 'ngOvhFeatureFlipping', 'ngUiRouterBreadcrumb', 'ovhManagerCore', 'pascalprecht.translate', 'ui.router', - onboarding, - dashboard, + carbonCalculatorDashboard, ListLayoutHelper.moduleName, ]) .config(routing) diff --git a/packages/manager/modules/carbon-calculator/src/onboarding/constants.js b/packages/manager/modules/carbon-calculator/src/onboarding/constants.js deleted file mode 100644 index 67afef871d86..000000000000 --- a/packages/manager/modules/carbon-calculator/src/onboarding/constants.js +++ /dev/null @@ -1,3 +0,0 @@ -export const GUIDES = []; - -export default { GUIDES }; diff --git a/packages/manager/modules/carbon-calculator/src/onboarding/controller.js b/packages/manager/modules/carbon-calculator/src/onboarding/controller.js deleted file mode 100644 index c603cb348765..000000000000 --- a/packages/manager/modules/carbon-calculator/src/onboarding/controller.js +++ /dev/null @@ -1,7 +0,0 @@ -import { GUIDES } from './constants'; - -export default class CarbonCalculatorOnboardingCtrl { - constructor() { - this.GUIDES = GUIDES; - } -} diff --git a/packages/manager/modules/carbon-calculator/src/onboarding/index.js b/packages/manager/modules/carbon-calculator/src/onboarding/index.js deleted file mode 100644 index 03f6dd9612f5..000000000000 --- a/packages/manager/modules/carbon-calculator/src/onboarding/index.js +++ /dev/null @@ -1,22 +0,0 @@ -import angular from 'angular'; -import '@uirouter/angularjs'; -import 'oclazyload'; - -const moduleName = 'ovhManagerCarbonCalculatorOnboardingLazyLoading'; - -angular.module(moduleName, ['ui.router', 'oc.lazyLoad']).config( - /* @ngInject */ ($stateProvider) => { - $stateProvider.state('app.onboarding.**', { - url: '/onboarding', - lazyLoad: ($transition$) => { - const $ocLazyLoad = $transition$.injector().get('$ocLazyLoad'); - - return import('./module').then((mod) => - $ocLazyLoad.inject(mod.default || mod), - ); - }, - }); - }, -); - -export default moduleName; diff --git a/packages/manager/modules/carbon-calculator/src/onboarding/module.js b/packages/manager/modules/carbon-calculator/src/onboarding/module.js deleted file mode 100644 index d2d610edcde6..000000000000 --- a/packages/manager/modules/carbon-calculator/src/onboarding/module.js +++ /dev/null @@ -1,26 +0,0 @@ -import angular from 'angular'; -import '@ovh-ux/manager-core'; -import '@ovh-ux/ng-ui-router-breadcrumb'; -import '@uirouter/angularjs'; -import 'angular-translate'; - -import { OnboardingLayoutHelper } from '@ovh-ux/manager-ng-layout-helpers'; - -import component from './component'; -import routing from './routing'; - -const moduleName = 'ovhManagerCarbonCalculatorOnboarding'; - -angular - .module(moduleName, [ - 'ngUiRouterBreadcrumb', - 'ovhManagerCore', - 'pascalprecht.translate', - 'ui.router', - OnboardingLayoutHelper, - ]) - .config(routing) - .component('carbonCalculatorOnboarding', component) - .run(/* @ngTranslationsInject:json ./translations */); - -export default moduleName; diff --git a/packages/manager/modules/carbon-calculator/src/onboarding/routing.js b/packages/manager/modules/carbon-calculator/src/onboarding/routing.js deleted file mode 100644 index d3d62d87d846..000000000000 --- a/packages/manager/modules/carbon-calculator/src/onboarding/routing.js +++ /dev/null @@ -1,9 +0,0 @@ -export default /* @ngInject */ ($stateProvider) => { - $stateProvider.state('app.onboarding', { - url: '/onboarding', - component: 'carbonCalculatorOnboarding', - resolve: { - breadcrumb: () => null, - }, - }); -}; diff --git a/packages/manager/modules/carbon-calculator/src/onboarding/template.html b/packages/manager/modules/carbon-calculator/src/onboarding/template.html deleted file mode 100644 index d71f699a205b..000000000000 --- a/packages/manager/modules/carbon-calculator/src/onboarding/template.html +++ /dev/null @@ -1 +0,0 @@ -Carbon footprint onboarding diff --git a/packages/manager/modules/carbon-calculator/src/onboarding/translations/Messages_fr_FR.json b/packages/manager/modules/carbon-calculator/src/onboarding/translations/Messages_fr_FR.json deleted file mode 100644 index 0967ef424bce..000000000000 --- a/packages/manager/modules/carbon-calculator/src/onboarding/translations/Messages_fr_FR.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/packages/manager/modules/carbon-calculator/src/routing.js b/packages/manager/modules/carbon-calculator/src/routing.js index f4857e4dcfff..accec9e7ca04 100644 --- a/packages/manager/modules/carbon-calculator/src/routing.js +++ b/packages/manager/modules/carbon-calculator/src/routing.js @@ -1,31 +1,22 @@ export default /* @ngInject */ ($stateProvider) => { $stateProvider.state('app', { - url: '/carbon', + url: '/billing', template: `
`, - // redirectTo: (transition) => - // transition - // .injector() - // .getAsync('features') - // .then((featureAvailabilityResult) => - // featureAvailabilityResult.isFeatureAvailable('carbon-calculator') - // ? 'app.dashboard' - // : 'app.onboarding', - // ), - redirectTo: () => 'app.dashboard', + redirectTo: (transition) => + transition + .injector() + .get('ovhFeatureFlipping') // getAsync('features') throws error; + .checkFeatureAvailability('carbon-calculator') + .then((featureAvailability) => + featureAvailability.isFeatureAvailable('carbon-calculator') + ? 'app.dashboard' + : 'error', + ), resolve: { - breadcrumb: () => 'carbon calculator', // TODO translation - // apiPath: () => '/me/carbon-calculator', - // dataModel: () => 'carbonCalculator.Task', - // defaultFilterColumn: () => 'taskID', - header: () => 'carbon calculator', // TODO translation - // customizableColumns: () => true, - // getServiceNameLink: /* @ngInject */ ($state) => ({ taskID }) => { - // $state.href('app.dashboard', { - // taskID, - // }); - // }, + breadcrumb: /* @ngInject */ ($translate) => + $translate.instant('carbon_calculator_my_account'), }, }); }; diff --git a/packages/manager/modules/carbon-calculator/src/translations/Messages_fr_FR.json b/packages/manager/modules/carbon-calculator/src/translations/Messages_fr_FR.json index 0967ef424bce..3d651658a530 100644 --- a/packages/manager/modules/carbon-calculator/src/translations/Messages_fr_FR.json +++ b/packages/manager/modules/carbon-calculator/src/translations/Messages_fr_FR.json @@ -1 +1,4 @@ -{} +{ + "carbon_calculator_my_account": "Mon compte", + "carbon_calculator_my_carbon_footprint": "Mon empreinte carbone" +} From ae95daf4e21aaf5bf7ae308f5fe3ac667334e6d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ars=C3=A8ne?= Date: Thu, 15 Jun 2023 19:15:24 +0200 Subject: [PATCH 05/14] feat(carbon.dedicated): add downloading carbon footprint invoice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref: MANAGER-11513 Signed-off-by: David Arsène --- .../apps/carbon-calculator/package.json | 1 + .../modules/carbon-calculator/package.json | 1 - .../dashboard/carbon-footprint/constants.js | 11 ++++ .../dashboard/carbon-footprint/controller.js | 52 ++++++++++++++++++- .../src/dashboard/carbon-footprint/service.js | 22 +++++++- .../dashboard/carbon-footprint/template.html | 17 +++++- 6 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/constants.js diff --git a/packages/manager/apps/carbon-calculator/package.json b/packages/manager/apps/carbon-calculator/package.json index 04e22005b31b..fa825bba753a 100644 --- a/packages/manager/apps/carbon-calculator/package.json +++ b/packages/manager/apps/carbon-calculator/package.json @@ -25,6 +25,7 @@ "@ovh-ux/manager-error-page": "^2.3.1", "@ovh-ux/manager-ng-layout-helpers": "^2.6.1", "@ovh-ux/ng-ovh-api-wrappers": "^5.0.0", + "@ovh-ux/ng-ovh-feature-flipping": "^1.0.7", "@ovh-ux/ng-ovh-http": "^5.0.0", "@ovh-ux/ng-ovh-request-tagger": "^1.1.7", "@ovh-ux/ng-ovh-sso-auth": "^4.6.3", diff --git a/packages/manager/modules/carbon-calculator/package.json b/packages/manager/modules/carbon-calculator/package.json index 8028a9985023..0926f0de6308 100644 --- a/packages/manager/modules/carbon-calculator/package.json +++ b/packages/manager/modules/carbon-calculator/package.json @@ -24,7 +24,6 @@ "angular": "^1.7.5", "angular-translate": "^2.18.1", "font-awesome": "4.7.0", - "moment": "^2.24.0", "oclazyload": "^1.1.0" } } diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/constants.js b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/constants.js new file mode 100644 index 000000000000..974edf38da86 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/constants.js @@ -0,0 +1,11 @@ +export const TASK_STATUS_ENUM = { + ERROR: 'ERROR', + IN_PROGRESS: 'IN_PROGRESS', + SUCCESS: 'SUCCESS', +}; + +export const API_PATH = '/me/carbonCalculator/task'; + +export const API_FETCH_INTERVAL = 3000; + +export default { TASK_STATUS_ENUM, API_PATH, API_FETCH_INTERVAL }; diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/controller.js b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/controller.js index 71e5f4f2a548..573b502fc4a9 100644 --- a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/controller.js +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/controller.js @@ -1,6 +1,54 @@ +import { API_FETCH_INTERVAL, TASK_STATUS_ENUM } from './constants'; + export default class CarbonFootprintCtrl { /* @ngInject */ - constructor(carbonFootprintService) { - this.previousMonth = carbonFootprintService.computePreviousMonth(); + constructor($interval, $state, carbonFootprintService) { + this.$interval = $interval; + this.$state = $state; + this.carbonFootprintService = carbonFootprintService; + } + + computeBilling() { + this.carbonFootprintService.computeBilling().then((task) => { + if (this.$asyncFetching === null) { + this.fetchStatusBilling(task); + } + }); + } + + fetchStatusBilling(task) { + this.$asyncFetching = this.$interval(() => { + this.fetchCurrentTask(task); + }, API_FETCH_INTERVAL); + } + + fetchCurrentTask(task) { + this.carbonFootprintService + .getTask(task.taskID) + .then(({ status, link }) => { + if (status === TASK_STATUS_ENUM.SUCCESS) { + this.carbonFootprintService.downloadBilling(link); + this.stopAsyncFetching(); + } else if (status === TASK_STATUS_ENUM.ERROR) { + this.$state.go('error'); + } + }) + .catch(this.stopAsyncFetching); + } + + stopAsyncFetching() { + if (this.$asyncFetching !== null) { + this.$interval.cancel(this.$asyncFetching); + this.$asyncFetching = null; + } + } + + $onInit() { + this.$asyncFetching = null; + this.previousMonth = this.carbonFootprintService.computePreviousMonth(); + } + + $onDestroy() { + this.stopAsyncFetching(); } } diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/service.js b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/service.js index 49c87b8aa22e..d2054aa7348b 100644 --- a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/service.js +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/service.js @@ -1,6 +1,10 @@ +import { API_PATH } from './constants'; + export default class CarbonFootprintService { /* @ngInject */ - constructor(coreConfig) { + constructor($http, $window, coreConfig) { + this.$http = $http; + this.$window = $window; this.coreConfig = coreConfig; } @@ -17,4 +21,20 @@ export default class CarbonFootprintService { ); return dateTimeFormat.format(date); } + + getTask(taskID) { + return this.$http.get(`${API_PATH}/${taskID}`).then(({ data }) => data); + } + + computeBilling() { + const now = new Date(); + const firstDayOfMonth = new Date(now.getFullYear(), now.getMonth(), 1); + // expected API date format -> ISO iso8601 (yyyy-MM-dd) + const date = firstDayOfMonth.toISOString().substring(0, 10); + return this.$http.post(API_PATH, { date }).then(({ data }) => data); + } + + downloadBilling(url) { + this.$window.location = url; + } } diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/template.html b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/template.html index 10ffba4868e3..d86589e71937 100644 --- a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/template.html +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/template.html @@ -3,8 +3,21 @@ class="carbon-balance" data-translate="carbon_calculator_dashboard_billing_explanation" >

- -   +   From c0ddabfef05ff54fd42bb6a0747eadc0789ae477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ars=C3=A8ne?= Date: Tue, 20 Jun 2023 09:13:35 +0200 Subject: [PATCH 06/14] fix(dedicated.carbon): split image carbon footprint + mobile version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref: MANAGER-11622 Signed-off-by: David Arsène --- .../carbon-balance-composition/assets/CO2.svg | 9 +++ .../assets/carbon-balance-EN.svg | 57 -------------- .../assets/carbon-balance-FR.svg | 74 ------------------- .../carbon-balance-composition/assets/cog.svg | 8 ++ .../assets/manufacturing.svg | 9 +++ .../assets/rack.svg | 14 ++++ .../carbon-balance-composition/constants.js | 16 ++-- .../carbon-balance-composition/controller.js | 11 +-- .../carbon-balance-composition/template.html | 62 ++++++++++++++-- .../translations/Messages_fr_FR.json | 7 +- .../modules/carbon-calculator/src/index.scss | 6 ++ 11 files changed, 122 insertions(+), 151 deletions(-) create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/CO2.svg delete mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/carbon-balance-EN.svg delete mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/carbon-balance-FR.svg create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/cog.svg create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/manufacturing.svg create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/rack.svg diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/CO2.svg b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/CO2.svg new file mode 100644 index 000000000000..95cdfa48312b --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/CO2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/carbon-balance-EN.svg b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/carbon-balance-EN.svg deleted file mode 100644 index 394b1711c7f1..000000000000 --- a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/carbon-balance-EN.svg +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - Operations - - - - - - - - - - - - - Manufacturing - - - - - - - - - - - - - - - Electricity - - = - + - + - - - - - - - - - - - - GreenhouseGas Emissions - - - diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/carbon-balance-FR.svg b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/carbon-balance-FR.svg deleted file mode 100644 index ac050410ab89..000000000000 --- a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/carbon-balance-FR.svg +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - Opérations - - - - - - - - - - - - - Fabrication - - - - - - - - - - - - - - - Électricité - - = - + - + - - - - - - - - - - - - - - - - - - - Émissionsde Gaz à Effetde Serre - - - - - - - - - - - - - diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/cog.svg b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/cog.svg new file mode 100644 index 000000000000..8ff61af8517e --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/cog.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/manufacturing.svg b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/manufacturing.svg new file mode 100644 index 000000000000..e9590242b7b6 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/manufacturing.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/rack.svg b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/rack.svg new file mode 100644 index 000000000000..a038635443c4 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/assets/rack.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/constants.js b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/constants.js index 3de015ec6484..45355a0fd928 100644 --- a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/constants.js +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/constants.js @@ -1,11 +1,15 @@ -import IMG_CARBON_BALANCE_FR from './assets/carbon-balance-FR.svg'; -import IMG_CARBON_BALANCE_EN from './assets/carbon-balance-EN.svg'; +import IMG_MANUFACTURING from './assets/manufacturing.svg'; +import IMG_ELECTRICITY from './assets/rack.svg'; +import IMG_OPERATIONS from './assets/cog.svg'; +import IMG_CARBON from './assets/CO2.svg'; -export const CARBON_BALANCE_PICTURES = { - FR: IMG_CARBON_BALANCE_FR, - DEFAULT: IMG_CARBON_BALANCE_EN, +export const ASSETS = { + IMG_MANUFACTURING, + IMG_ELECTRICITY, + IMG_OPERATIONS, + IMG_CARBON, }; export default { - CARBON_BALANCE_PICTURES, + ASSETS, }; diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/controller.js b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/controller.js index a258ac27c284..63c74e668f4b 100644 --- a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/controller.js +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/controller.js @@ -1,10 +1,11 @@ -import { CARBON_BALANCE_PICTURES } from './constants'; +import { ASSETS } from './constants'; export default class CarbonBalanceCompositionCtrl { /* @ngInject */ - constructor(coreConfig) { - this.IMG_CARBON_BALANCE = - CARBON_BALANCE_PICTURES[coreConfig.getUser().ovhSubsidiary] || - CARBON_BALANCE_PICTURES.DEFAULT; + constructor() { + this.IMG_CARBON = ASSETS.IMG_CARBON; + this.IMG_ELECTRICITY = ASSETS.IMG_ELECTRICITY; + this.IMG_OPERATIONS = ASSETS.IMG_OPERATIONS; + this.IMG_MANUFACTURING = ASSETS.IMG_MANUFACTURING; } } diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/template.html b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/template.html index 24619ed82077..70cb70ff2511 100644 --- a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/template.html +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/template.html @@ -4,11 +4,59 @@

class="row-fluid" data-translate="carbon_calculator_dashboard_carbon_balance_explanation" >

- +
+
+
+
+ {{:: 'carbon_calculator_dashboard_carbon_balance_manufacturing' | translate}} +
+ +
+ + +
+
+ {{:: 'carbon_calculator_dashboard_carbon_balance_electricity' | translate}} +
+
+ + +
+
+ {{:: 'carbon_calculator_dashboard_carbon_balance_operations' | translate}} + +
+
+ = +
+
+ {{:: 'carbon_calculator_dashboard_carbon_balance_greenhouse_gas' | translate}} + +
+
+
+
+
diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_FR.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_FR.json index 4398d3892383..b81fc5907d82 100644 --- a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_FR.json +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_FR.json @@ -1,8 +1,11 @@ { "carbon_calculator_dashboard_carbon_footprint_explanation": "Retrouvez et téléchargez l'analyse des émissions des gaz à effet de serre de votre infrastructure. Suivez l'impact environnemental lié à la fabrication, à la consommation énergétique et aux opérations annexes de vos services Cloud.", "carbon_calculator_dashboard_carbon_balance_title": "Quelle est la composition du bilan carbone d'OVHcloud ?", - "carbon_calculator_dashboard_carbon_balance_img_title": "Composition bilan carbone OVHCloud", + "carbon_calculator_dashboard_carbon_balance_manufacturing": "Fabrication", + "carbon_calculator_dashboard_carbon_balance_electricity": "Électricité", + "carbon_calculator_dashboard_carbon_balance_operations": "Opérations", + "carbon_calculator_dashboard_carbon_balance_greenhouse_gas": "Émissions de gaz à effet de serre", "carbon_calculator_dashboard_carbon_balance_explanation": "OVHcloud inclut l'ensemble des sources émettrices de CO2eq, données fournies par la formule :", - "carbon_calculator_dashboard_billing_explanation": "Ce document comprend les émissions de gaz à effet se serre du mois précédent :
  • de vos services infrastructures Baremetal
dont vous êtes le contact facturation.", + "carbon_calculator_dashboard_billing_explanation": "Ce document comprend les émissions de gaz à effet de serre du mois précédent :
  • de vos services infrastructures Baremetal
dont vous êtes le contact facturation.", "carbon_calculator_dashboard_billing_download": "Télécharger mon empreinte de {{month}}" } diff --git a/packages/manager/modules/carbon-calculator/src/index.scss b/packages/manager/modules/carbon-calculator/src/index.scss index c86b5b34e8d0..1cb3d74b6f39 100644 --- a/packages/manager/modules/carbon-calculator/src/index.scss +++ b/packages/manager/modules/carbon-calculator/src/index.scss @@ -10,3 +10,9 @@ @extend .pt-2; } } + +.sign { + font-size: larger; + font-weight: bold; + color: #000; +} From 042447f79574d20768f3a07b2bf565b812a438de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ars=C3=A8ne?= Date: Thu, 22 Jun 2023 17:32:26 +0200 Subject: [PATCH 07/14] feat(dedicated.carbon): improve UI for mobile & desktop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref: MANAGER-11640 / MANAGER-11639 Signed-off-by: David Arsène --- .../carbon-balance-composition/template.html | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/template.html b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/template.html index 70cb70ff2511..41f3617ad849 100644 --- a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/template.html +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-balance-composition/template.html @@ -4,8 +4,8 @@

class="row-fluid" data-translate="carbon_calculator_dashboard_carbon_balance_explanation" >

-
-
+
+
=
- {{:: 'carbon_calculator_dashboard_carbon_balance_greenhouse_gas' | translate}} - +
+
+ {{:: 'carbon_calculator_dashboard_carbon_balance_greenhouse_gas' | translate}} +
+ +
-
+
From b69be95dff6480520a97213086da540bd46a5dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ars=C3=A8ne?= Date: Mon, 19 Jun 2023 17:33:05 +0200 Subject: [PATCH 08/14] feat(dedicated.carbon): add tracking for carbon footprint page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref: MANAGER-11291 Signed-off-by: David Arsène --- .../carbon-calculator/src/error/error.routing.js | 13 ++++--------- .../nav-reshuffle/sidebar/navigation-tree/root.ts | 2 +- .../src/dashboard/carbon-footprint/constants.js | 9 ++++++++- .../src/dashboard/carbon-footprint/controller.js | 13 +++++++++++-- .../carbon-calculator/src/dashboard/routing.js | 5 +++++ .../modules/carbon-calculator/src/routing.js | 4 +--- 6 files changed, 30 insertions(+), 16 deletions(-) diff --git a/packages/manager/apps/carbon-calculator/src/error/error.routing.js b/packages/manager/apps/carbon-calculator/src/error/error.routing.js index 00e506e59084..06397ac517b6 100644 --- a/packages/manager/apps/carbon-calculator/src/error/error.routing.js +++ b/packages/manager/apps/carbon-calculator/src/error/error.routing.js @@ -8,19 +8,14 @@ export default /* @ngInject */ ($stateProvider) => { resolve: { cancelLink: /* @ngInject */ ($state) => $state.href('app'), error: /* @ngInject */ ($transition$) => $transition$.params(), - product: /* @ngInject */ ($state, $transition$) => { - const { state, params } = $transition$.params().to; - // href will include # so split with '/' and take second element - const [, product] = $state - .href(state, params, { lossy: true }) - .split('/'); - // URI params are removed from error tracking - return product?.split('?')[0]; - }, + product: /* @ngInject */ () => 'carbon-calculator', submitAction: /* @ngInject */ ($window) => () => $window.location.reload(), translationsRefresh: /* @ngInject */ ($translate) => $translate.refresh(), breadcrumb: () => null, }, + atInternet: { + ignore: true, + }, }); }; diff --git a/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/navigation-tree/root.ts b/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/navigation-tree/root.ts index 0e5ef8339d16..fba961624ccf 100644 --- a/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/navigation-tree/root.ts +++ b/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/navigation-tree/root.ts @@ -66,7 +66,7 @@ const root: Node = { count: false, features: ['iam'], }, { - id: 'carbon_footprint', + id: 'carbon_consumption', translation: 'sidebar_carbon_footprint', routing: { application: 'carbon-calculator', diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/constants.js b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/constants.js index 974edf38da86..0e28c2880865 100644 --- a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/constants.js +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/constants.js @@ -6,6 +6,13 @@ export const TASK_STATUS_ENUM = { export const API_PATH = '/me/carbonCalculator/task'; +export const TRACKING_NAME = 'dedicated::account::carbon_consumption'; + export const API_FETCH_INTERVAL = 3000; -export default { TASK_STATUS_ENUM, API_PATH, API_FETCH_INTERVAL }; +export default { + TASK_STATUS_ENUM, + API_PATH, + API_FETCH_INTERVAL, + TRACKING_NAME, +}; diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/controller.js b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/controller.js index 573b502fc4a9..92639d7609dd 100644 --- a/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/controller.js +++ b/packages/manager/modules/carbon-calculator/src/dashboard/carbon-footprint/controller.js @@ -1,14 +1,23 @@ -import { API_FETCH_INTERVAL, TASK_STATUS_ENUM } from './constants'; +import { + API_FETCH_INTERVAL, + TASK_STATUS_ENUM, + TRACKING_NAME, +} from './constants'; export default class CarbonFootprintCtrl { /* @ngInject */ - constructor($interval, $state, carbonFootprintService) { + constructor($interval, $state, atInternet, carbonFootprintService) { this.$interval = $interval; this.$state = $state; + this.atInternet = atInternet; this.carbonFootprintService = carbonFootprintService; } computeBilling() { + this.atInternet.trackClick({ + name: `${TRACKING_NAME}::download-carbon-consumption`, + type: 'action', + }); this.carbonFootprintService.computeBilling().then((task) => { if (this.$asyncFetching === null) { this.fetchStatusBilling(task); diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/routing.js b/packages/manager/modules/carbon-calculator/src/dashboard/routing.js index 7c416f6a49ab..fbd9eae94929 100644 --- a/packages/manager/modules/carbon-calculator/src/dashboard/routing.js +++ b/packages/manager/modules/carbon-calculator/src/dashboard/routing.js @@ -1,3 +1,5 @@ +import { TRACKING_NAME } from './carbon-footprint/constants'; + export default /* @ngInject */ ($stateProvider) => { $stateProvider.state('app.dashboard', { url: '/dashboard/', @@ -9,5 +11,8 @@ export default /* @ngInject */ ($stateProvider) => { breadcrumb: /* @ngInject */ ($translate) => $translate.instant('carbon_calculator_my_carbon_footprint'), }, + atInternet: { + rename: TRACKING_NAME, + }, }); }; diff --git a/packages/manager/modules/carbon-calculator/src/routing.js b/packages/manager/modules/carbon-calculator/src/routing.js index accec9e7ca04..5e81756e88ee 100644 --- a/packages/manager/modules/carbon-calculator/src/routing.js +++ b/packages/manager/modules/carbon-calculator/src/routing.js @@ -1,9 +1,7 @@ export default /* @ngInject */ ($stateProvider) => { $stateProvider.state('app', { url: '/billing', - template: `
-
-
`, + template: `
`, redirectTo: (transition) => transition .injector() From 75c9be9f4ed0fed7ebc02e6456c51a363724c3fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ars=C3=A8ne?= Date: Fri, 7 Jul 2023 14:25:47 +0200 Subject: [PATCH 09/14] fix(dedicated): fix tracking is not enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref: MANAGER-11291 Signed-off-by: David Arsène --- packages/manager/apps/carbon-calculator/src/app.module.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/manager/apps/carbon-calculator/src/app.module.js b/packages/manager/apps/carbon-calculator/src/app.module.js index 650c16ce12f3..292bd2a39513 100644 --- a/packages/manager/apps/carbon-calculator/src/app.module.js +++ b/packages/manager/apps/carbon-calculator/src/app.module.js @@ -13,6 +13,7 @@ import CarbonCalculator from '../../../modules/carbon-calculator/src'; import errorPage from './error'; import '@ovh-ux/ui-kit/dist/css/oui.css'; +import { TRACKING } from '../../dedicated/client/app/at-internet.constants'; export default async (containerEl, shellClient) => { const moduleName = 'CarbonCalculatorApp'; @@ -126,10 +127,9 @@ export default async (containerEl, shellClient) => { ) .config(routingConfig) .config(ssoAuthConfig) - // @TODO initialize tracking configuration here - // .config(async () => { - // await shellClient.tracking.setConfig(TRACKING); - // }) + .config(async () => { + await shellClient.tracking.setConfig(TRACKING); + }) .config(calendarConfigProvider) .run(broadcastAppStarted) .run(transitionsConfig) From 6c672b598f40995d910b48098e2efd3eb2a6f186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ars=C3=A8ne?= Date: Mon, 10 Jul 2023 15:49:09 +0200 Subject: [PATCH 10/14] fix(dedicated): fix carbon calculator links MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref: MANAGER-11510 Signed-off-by: David Arsène --- packages/manager/apps/carbon-calculator/package.json | 4 ++-- packages/manager/apps/carbon-calculator/src/index.js | 4 ++-- .../container/nav-reshuffle/sidebar/navigation-tree/root.ts | 1 + .../modules/carbon-calculator/src/dashboard/routing.js | 3 +-- packages/manager/modules/carbon-calculator/src/routing.js | 3 +-- .../carbon-calculator/src/translations/Messages_fr_FR.json | 1 - 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/manager/apps/carbon-calculator/package.json b/packages/manager/apps/carbon-calculator/package.json index fa825bba753a..c5dbbe703414 100644 --- a/packages/manager/apps/carbon-calculator/package.json +++ b/packages/manager/apps/carbon-calculator/package.json @@ -20,7 +20,7 @@ }, "dependencies": { "@ovh-ux/manager-carbon-calculator": "^0.0.0 || ^1.0.0", - "@ovh-ux/manager-config": "^6.5.1", + "@ovh-ux/manager-config": "^7.0.0", "@ovh-ux/manager-core": "^12.0.0 || ^13.0.0", "@ovh-ux/manager-error-page": "^2.3.1", "@ovh-ux/manager-ng-layout-helpers": "^2.6.1", @@ -34,7 +34,7 @@ "@ovh-ux/ng-translate-async-loader": "^2.1.5", "@ovh-ux/ng-ui-router-breadcrumb": "^1.1.7", "@ovh-ux/request-tagger": "^0.1.1", - "@ovh-ux/shell": "^1.10.1", + "@ovh-ux/shell": "^2.0.0", "@ovh-ux/ui-kit": "^6.3.0", "@uirouter/angularjs": "^1.0.23", "angular": "^1.7.5", diff --git a/packages/manager/apps/carbon-calculator/src/index.js b/packages/manager/apps/carbon-calculator/src/index.js index f0b3f7877f7b..92573b02d1ee 100644 --- a/packages/manager/apps/carbon-calculator/src/index.js +++ b/packages/manager/apps/carbon-calculator/src/index.js @@ -6,11 +6,11 @@ import 'regenerator-runtime/runtime'; import { isTopLevelApplication } from '@ovh-ux/manager-config'; import { defineApplicationVersion } from '@ovh-ux/request-tagger'; -import { useShellClient } from '@ovh-ux/shell'; +import { initShellClient } from '@ovh-ux/shell'; defineApplicationVersion(__VERSION__); -useShellClient('carbon-calculator').then((shellClient) => { +initShellClient('carbon-calculator').then((shellClient) => { if (!isTopLevelApplication()) { shellClient.ux.startProgress(); } diff --git a/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/navigation-tree/root.ts b/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/navigation-tree/root.ts index fba961624ccf..6cec1ef05561 100644 --- a/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/navigation-tree/root.ts +++ b/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/navigation-tree/root.ts @@ -70,6 +70,7 @@ const root: Node = { translation: 'sidebar_carbon_footprint', routing: { application: 'carbon-calculator', + hash: '#/', }, count: false, features: ['carbon-calculator'], diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/routing.js b/packages/manager/modules/carbon-calculator/src/dashboard/routing.js index fbd9eae94929..efd27b6cf115 100644 --- a/packages/manager/modules/carbon-calculator/src/dashboard/routing.js +++ b/packages/manager/modules/carbon-calculator/src/dashboard/routing.js @@ -8,8 +8,7 @@ export default /* @ngInject */ ($stateProvider) => { currentActiveLink: /* @ngInject */ ($transition$, $state) => () => $state.href($state.current.name, $transition$.params()), dashboardLink: /* @ngInject */ ($state) => $state.href('app.dashboard'), - breadcrumb: /* @ngInject */ ($translate) => - $translate.instant('carbon_calculator_my_carbon_footprint'), + breadcrumb: () => null, }, atInternet: { rename: TRACKING_NAME, diff --git a/packages/manager/modules/carbon-calculator/src/routing.js b/packages/manager/modules/carbon-calculator/src/routing.js index 5e81756e88ee..0753dd9a2b42 100644 --- a/packages/manager/modules/carbon-calculator/src/routing.js +++ b/packages/manager/modules/carbon-calculator/src/routing.js @@ -13,8 +13,7 @@ export default /* @ngInject */ ($stateProvider) => { : 'error', ), resolve: { - breadcrumb: /* @ngInject */ ($translate) => - $translate.instant('carbon_calculator_my_account'), + breadcrumb: () => null, }, }); }; diff --git a/packages/manager/modules/carbon-calculator/src/translations/Messages_fr_FR.json b/packages/manager/modules/carbon-calculator/src/translations/Messages_fr_FR.json index 3d651658a530..a610b30bcf72 100644 --- a/packages/manager/modules/carbon-calculator/src/translations/Messages_fr_FR.json +++ b/packages/manager/modules/carbon-calculator/src/translations/Messages_fr_FR.json @@ -1,4 +1,3 @@ { - "carbon_calculator_my_account": "Mon compte", "carbon_calculator_my_carbon_footprint": "Mon empreinte carbone" } From 32ed80238699d79fb9b48fe4ca68ed02807f7442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ars=C3=A8ne?= Date: Wed, 12 Jul 2023 18:04:41 +0200 Subject: [PATCH 11/14] fix(dedicated): fix tracking page carbon consumption MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref: MANAGER-11291 Signed-off-by: David Arsène --- .../manager/apps/carbon-calculator/package.json | 1 + .../apps/carbon-calculator/src/app.module.js | 12 ++++++++++-- .../src/tracking/at-internet.constants.js | 17 +++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 packages/manager/apps/carbon-calculator/src/tracking/at-internet.constants.js diff --git a/packages/manager/apps/carbon-calculator/package.json b/packages/manager/apps/carbon-calculator/package.json index c5dbbe703414..84e3f69bf5e3 100644 --- a/packages/manager/apps/carbon-calculator/package.json +++ b/packages/manager/apps/carbon-calculator/package.json @@ -19,6 +19,7 @@ "start:watch": "lerna exec --stream --parallel --scope='@ovh-ux/manager-carbon-calculator-app' --include-dependencies -- npm run dev:watch --if-present" }, "dependencies": { + "@ovh-ux/manager-at-internet-configuration": "^1.5.0", "@ovh-ux/manager-carbon-calculator": "^0.0.0 || ^1.0.0", "@ovh-ux/manager-config": "^7.0.0", "@ovh-ux/manager-core": "^12.0.0 || ^13.0.0", diff --git a/packages/manager/apps/carbon-calculator/src/app.module.js b/packages/manager/apps/carbon-calculator/src/app.module.js index 292bd2a39513..846aa1b42373 100644 --- a/packages/manager/apps/carbon-calculator/src/app.module.js +++ b/packages/manager/apps/carbon-calculator/src/app.module.js @@ -9,11 +9,12 @@ import { registerAtInternet } from '@ovh-ux/ng-shell-tracking'; import { registerCoreModule } from '@ovh-ux/manager-core'; import ngOvhSsoAuth from '@ovh-ux/ng-ovh-sso-auth'; import ngUiRouterBreadcrumb from '@ovh-ux/ng-ui-router-breadcrumb'; +import ovhManagerAtInternetConfiguration from '@ovh-ux/manager-at-internet-configuration'; import CarbonCalculator from '../../../modules/carbon-calculator/src'; import errorPage from './error'; import '@ovh-ux/ui-kit/dist/css/oui.css'; -import { TRACKING } from '../../dedicated/client/app/at-internet.constants'; +import TRACKING from './tracking/at-internet.constants'; export default async (containerEl, shellClient) => { const moduleName = 'CarbonCalculatorApp'; @@ -31,6 +32,11 @@ export default async (containerEl, shellClient) => { }); }; + const trackingConfig = /* @ngInject */ (atInternetConfigurationProvider) => { + atInternetConfigurationProvider.setSkipInit(true); + atInternetConfigurationProvider.setPrefix('dedicated'); + }; + const broadcastAppStarted = /* @ngInject */ ($rootScope, $transitions) => { const unregisterHook = $transitions.onSuccess({}, async () => { if (!isTopLevelApplication()) { @@ -112,6 +118,7 @@ export default async (containerEl, shellClient) => { [ registerCoreModule(environment, coreCallbacks), registerAtInternet(shellClient.tracking), + ovhManagerAtInternetConfiguration, ngOvhSsoAuth, ngUiRouterBreadcrumb, 'oui', @@ -128,8 +135,9 @@ export default async (containerEl, shellClient) => { .config(routingConfig) .config(ssoAuthConfig) .config(async () => { - await shellClient.tracking.setConfig(TRACKING); + await shellClient.tracking.setConfig(environment.getRegion(), TRACKING); }) + .config(trackingConfig) .config(calendarConfigProvider) .run(broadcastAppStarted) .run(transitionsConfig) diff --git a/packages/manager/apps/carbon-calculator/src/tracking/at-internet.constants.js b/packages/manager/apps/carbon-calculator/src/tracking/at-internet.constants.js new file mode 100644 index 000000000000..dac2de7654b0 --- /dev/null +++ b/packages/manager/apps/carbon-calculator/src/tracking/at-internet.constants.js @@ -0,0 +1,17 @@ +export default { + EU: { + config: { + level2: '85', + }, + }, + CA: { + config: { + level2: '85', + }, + }, + US: { + config: { + level2: '57', + }, + }, +}; From fd395d945063ad028d2f65bdd248846359536b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ars=C3=A8ne?= Date: Thu, 13 Jul 2023 12:58:12 +0200 Subject: [PATCH 12/14] fix(dedicated): fix carbon calculator routeMatcher sidebarAccount MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref: MANAGER-11810 Signed-off-by: David Arsène --- .../container/legacy/server-sidebar/universe/AccountSidebar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/manager/apps/container/src/container/legacy/server-sidebar/universe/AccountSidebar.tsx b/packages/manager/apps/container/src/container/legacy/server-sidebar/universe/AccountSidebar.tsx index e3667e0670c1..71e101ee5d87 100644 --- a/packages/manager/apps/container/src/container/legacy/server-sidebar/universe/AccountSidebar.tsx +++ b/packages/manager/apps/container/src/container/legacy/server-sidebar/universe/AccountSidebar.tsx @@ -95,7 +95,7 @@ export default function AccountSidebar() { id: 'my-carbon-footprint', label: t('sidebar_carbon_footprint'), href: navigation.getURL('carbon-calculator', '/'), - routeMatcher: new RegExp('^/carbon-calculator'), + pathMatcher: new RegExp('^/carbon-calculator'), }); } From c4812d23d857033713aaff302ca6bd870e7ca15f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ars=C3=A8ne?= Date: Mon, 17 Jul 2023 16:40:58 +0200 Subject: [PATCH 13/14] fix(dedicated): fix missing dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref: MANAGER-11240 Signed-off-by: David Arsène --- packages/manager/apps/carbon-calculator/package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/manager/apps/carbon-calculator/package.json b/packages/manager/apps/carbon-calculator/package.json index 84e3f69bf5e3..6144090b5ca1 100644 --- a/packages/manager/apps/carbon-calculator/package.json +++ b/packages/manager/apps/carbon-calculator/package.json @@ -25,6 +25,8 @@ "@ovh-ux/manager-core": "^12.0.0 || ^13.0.0", "@ovh-ux/manager-error-page": "^2.3.1", "@ovh-ux/manager-ng-layout-helpers": "^2.6.1", + "@ovh-ux/ng-at-internet": "^5.10.2", + "@ovh-ux/ng-at-internet-ui-router-plugin": "^3.2.3", "@ovh-ux/ng-ovh-api-wrappers": "^5.0.0", "@ovh-ux/ng-ovh-feature-flipping": "^1.0.7", "@ovh-ux/ng-ovh-http": "^5.0.0", From 42464e283ac8e26da6d5dc2289e10f87e8f09d53 Mon Sep 17 00:00:00 2001 From: CDS Translator Agent Date: Wed, 26 Jul 2023 07:48:46 +0000 Subject: [PATCH 14/14] fix(i18n): add missing translations [CDS 2406] Signed-off-by: CDS Translator Agent --- .../public/translations/sidebar/Messages_de_DE.json | 3 ++- .../public/translations/sidebar/Messages_en_GB.json | 3 ++- .../public/translations/sidebar/Messages_es_ES.json | 3 ++- .../public/translations/sidebar/Messages_fr_CA.json | 1 + .../public/translations/sidebar/Messages_it_IT.json | 3 ++- .../public/translations/sidebar/Messages_pl_PL.json | 3 ++- .../public/translations/sidebar/Messages_pt_PT.json | 3 ++- .../src/dashboard/translations/Messages_de_DE.json | 11 +++++++++++ .../src/dashboard/translations/Messages_en_GB.json | 11 +++++++++++ .../src/dashboard/translations/Messages_es_ES.json | 11 +++++++++++ .../src/dashboard/translations/Messages_fr_CA.json | 11 +++++++++++ .../src/dashboard/translations/Messages_it_IT.json | 11 +++++++++++ .../src/dashboard/translations/Messages_pl_PL.json | 11 +++++++++++ .../src/dashboard/translations/Messages_pt_PT.json | 11 +++++++++++ .../src/translations/Messages_de_DE.json | 3 +++ .../src/translations/Messages_en_GB.json | 3 +++ .../src/translations/Messages_es_ES.json | 3 +++ .../src/translations/Messages_fr_CA.json | 3 +++ .../src/translations/Messages_it_IT.json | 3 +++ .../src/translations/Messages_pl_PL.json | 3 +++ .../src/translations/Messages_pt_PT.json | 3 +++ 21 files changed, 111 insertions(+), 6 deletions(-) create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_de_DE.json create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_en_GB.json create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_es_ES.json create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_CA.json create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_it_IT.json create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pl_PL.json create mode 100644 packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pt_PT.json create mode 100644 packages/manager/modules/carbon-calculator/src/translations/Messages_de_DE.json create mode 100644 packages/manager/modules/carbon-calculator/src/translations/Messages_en_GB.json create mode 100644 packages/manager/modules/carbon-calculator/src/translations/Messages_es_ES.json create mode 100644 packages/manager/modules/carbon-calculator/src/translations/Messages_fr_CA.json create mode 100644 packages/manager/modules/carbon-calculator/src/translations/Messages_it_IT.json create mode 100644 packages/manager/modules/carbon-calculator/src/translations/Messages_pl_PL.json create mode 100644 packages/manager/modules/carbon-calculator/src/translations/Messages_pt_PT.json diff --git a/packages/manager/apps/container/src/public/translations/sidebar/Messages_de_DE.json b/packages/manager/apps/container/src/public/translations/sidebar/Messages_de_DE.json index 81802690417e..d551f2c436ff 100644 --- a/packages/manager/apps/container/src/public/translations/sidebar/Messages_de_DE.json +++ b/packages/manager/apps/container/src/public/translations/sidebar/Messages_de_DE.json @@ -157,5 +157,6 @@ "sidebar_load_services": "Dienste laden", "sidebar_access_list": "Zur Liste", "sidebar_access_dashboard": "Zum Dashboard", - "sidebar_account_iam": "Identity and Access (IAM)" + "sidebar_account_iam": "Identity and Access (IAM)", + "sidebar_carbon_footprint": "Mein CO2-Fußabdruck" } diff --git a/packages/manager/apps/container/src/public/translations/sidebar/Messages_en_GB.json b/packages/manager/apps/container/src/public/translations/sidebar/Messages_en_GB.json index d0d3a2456401..0ee1daee327e 100644 --- a/packages/manager/apps/container/src/public/translations/sidebar/Messages_en_GB.json +++ b/packages/manager/apps/container/src/public/translations/sidebar/Messages_en_GB.json @@ -157,5 +157,6 @@ "sidebar_load_services": "Load services", "sidebar_access_list": "Access list", "sidebar_access_dashboard": "Access dashboard", - "sidebar_account_iam": "Identity and Access Management (IAM)" + "sidebar_account_iam": "Identity and Access Management (IAM)", + "sidebar_carbon_footprint": "My carbon footprint" } diff --git a/packages/manager/apps/container/src/public/translations/sidebar/Messages_es_ES.json b/packages/manager/apps/container/src/public/translations/sidebar/Messages_es_ES.json index 28a2103b11d9..223e09261b1e 100644 --- a/packages/manager/apps/container/src/public/translations/sidebar/Messages_es_ES.json +++ b/packages/manager/apps/container/src/public/translations/sidebar/Messages_es_ES.json @@ -157,5 +157,6 @@ "sidebar_load_services": "Cargar los servicios", "sidebar_access_list": "Acceder a la lista", "sidebar_access_dashboard": "Acceder al panel de control", - "sidebar_account_iam": "Identidades y acceso (IAM)" + "sidebar_account_iam": "Identidades y acceso (IAM)", + "sidebar_carbon_footprint": "Mi huella de carbono" } diff --git a/packages/manager/apps/container/src/public/translations/sidebar/Messages_fr_CA.json b/packages/manager/apps/container/src/public/translations/sidebar/Messages_fr_CA.json index d6c3b7bfb240..267444db6524 100644 --- a/packages/manager/apps/container/src/public/translations/sidebar/Messages_fr_CA.json +++ b/packages/manager/apps/container/src/public/translations/sidebar/Messages_fr_CA.json @@ -136,6 +136,7 @@ "sidebar_account_profile": "Mon profil", "sidebar_account_contacts": "Mes contacts", "sidebar_account_iam": "Identités et accès (IAM)", + "sidebar_carbon_footprint": "Mon empreinte carbone", "sidebar_billing_services": "Mes services", "sidebar_billing_ssh": "Mes clés SSH", "sidebar_billing_bills": "Mes factures", diff --git a/packages/manager/apps/container/src/public/translations/sidebar/Messages_it_IT.json b/packages/manager/apps/container/src/public/translations/sidebar/Messages_it_IT.json index edff0b0b114f..a364c1508a4a 100644 --- a/packages/manager/apps/container/src/public/translations/sidebar/Messages_it_IT.json +++ b/packages/manager/apps/container/src/public/translations/sidebar/Messages_it_IT.json @@ -157,5 +157,6 @@ "sidebar_load_services": "Caricare i servizi", "sidebar_access_list": "Accedere alla lista", "sidebar_access_dashboard": "Accedere alla dashboard", - "sidebar_account_iam": "Identità e accessi (IAM)" + "sidebar_account_iam": "Identità e accessi (IAM)", + "sidebar_carbon_footprint": "La mia impronta di carbonio" } diff --git a/packages/manager/apps/container/src/public/translations/sidebar/Messages_pl_PL.json b/packages/manager/apps/container/src/public/translations/sidebar/Messages_pl_PL.json index 27381c3a316b..f2e02e681d52 100644 --- a/packages/manager/apps/container/src/public/translations/sidebar/Messages_pl_PL.json +++ b/packages/manager/apps/container/src/public/translations/sidebar/Messages_pl_PL.json @@ -157,5 +157,6 @@ "sidebar_load_services": "Pobieranie usług", "sidebar_access_list": "Dostęp do listy", "sidebar_access_dashboard": "Dostęp do interfejsu", - "sidebar_account_iam": "Tożsamości i uprawnienia (IAM)" + "sidebar_account_iam": "Tożsamości i uprawnienia (IAM)", + "sidebar_carbon_footprint": "Mój ślad węglowy" } diff --git a/packages/manager/apps/container/src/public/translations/sidebar/Messages_pt_PT.json b/packages/manager/apps/container/src/public/translations/sidebar/Messages_pt_PT.json index 047bdde1258b..f071cb5854bb 100644 --- a/packages/manager/apps/container/src/public/translations/sidebar/Messages_pt_PT.json +++ b/packages/manager/apps/container/src/public/translations/sidebar/Messages_pt_PT.json @@ -157,5 +157,6 @@ "sidebar_load_services": "Carregar os serviços", "sidebar_access_list": "Aceder à lista", "sidebar_access_dashboard": "Aceder ao painel de controlo", - "sidebar_account_iam": "Identidades e acessos (IAM)" + "sidebar_account_iam": "Identidades e acessos (IAM)", + "sidebar_carbon_footprint": "A minha pegada de carbono" } diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_de_DE.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_de_DE.json new file mode 100644 index 000000000000..2c2075d8f98a --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_de_DE.json @@ -0,0 +1,11 @@ +{ + "carbon_calculator_dashboard_carbon_footprint_explanation": "Hier können Sie sich die Analyse der Treibhausgasemissionen Ihrer Infrastruktur ansehen und herunterladen. Verfolgen Sie die mit der Herstellung, dem Energieverbrauch und den zugehörigen Abläufen Ihrer Cloud-Dienste verbundenen Umweltauswirkungen.", + "carbon_calculator_dashboard_carbon_balance_title": "Wie setzt sich die CO2-Bilanz von OVHcloud zusammen?", + "carbon_calculator_dashboard_carbon_balance_manufacturing": "Herstellung", + "carbon_calculator_dashboard_carbon_balance_electricity": "Strom", + "carbon_calculator_dashboard_carbon_balance_operations": "Abläufe", + "carbon_calculator_dashboard_carbon_balance_greenhouse_gas": "Treibhausgasemissionen", + "carbon_calculator_dashboard_carbon_balance_explanation": "OVHcloud berücksichtigt alle CO2eq-emittierenden Quellen und die Daten wurden mit folgender Formel ermittelt:", + "carbon_calculator_dashboard_billing_explanation": "Dieses Dokument enthält die Treibhausgasemissionen des Vormonats:
  • für Ihre Bare-Metal-Infrastruktur-Dienste
für die Sie als Rechnungskontakt hinterlegt sind", + "carbon_calculator_dashboard_billing_download": "Meinen CO2-Fußabdruck von {{month}} herunterladen" +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_en_GB.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_en_GB.json new file mode 100644 index 000000000000..097358994602 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_en_GB.json @@ -0,0 +1,11 @@ +{ + "carbon_calculator_dashboard_carbon_footprint_explanation": "View and download an analysis of the greenhouse gas emissions in your infrastructure. Monitor the environmental impact of manufacturing, energy consumption, and other operations relating to your cloud services.", + "carbon_calculator_dashboard_carbon_balance_title": "What is the breakdown of OVHcloud’s carbon footprint?", + "carbon_calculator_dashboard_carbon_balance_manufacturing": "Manufacturing", + "carbon_calculator_dashboard_carbon_balance_electricity": "Electricity", + "carbon_calculator_dashboard_carbon_balance_operations": "Operations", + "carbon_calculator_dashboard_carbon_balance_greenhouse_gas": "Greenhouse gas emissions", + "carbon_calculator_dashboard_carbon_balance_explanation": "OVHcloud includes all sources that emit CO2eq, with data generated using the following formula:", + "carbon_calculator_dashboard_billing_explanation": "This document includes greenhouse gas emissions from the previous month:
  • from your Bare-metal infrastructure services
for which you are the billing contact.", + "carbon_calculator_dashboard_billing_download": "Download my {{month}} footprint" +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_es_ES.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_es_ES.json new file mode 100644 index 000000000000..0f409c159956 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_es_ES.json @@ -0,0 +1,11 @@ +{ + "carbon_calculator_dashboard_carbon_footprint_explanation": "Consulte y descargue el análisis de emisiones de gases de efecto invernadero de su infraestructura. Haga un seguimiento del impacto medioambiental asociado a la fabricación, el consumo energético y las operaciones anexas de sus servicios cloud.", + "carbon_calculator_dashboard_carbon_balance_title": "¿Qué contribuye a la huella de carbono de OVHcloud?", + "carbon_calculator_dashboard_carbon_balance_manufacturing": "Fabricación", + "carbon_calculator_dashboard_carbon_balance_electricity": "Suministro eléctrico", + "carbon_calculator_dashboard_carbon_balance_operations": "Operaciones", + "carbon_calculator_dashboard_carbon_balance_greenhouse_gas": "Emisión de gases de efecto invernadero", + "carbon_calculator_dashboard_carbon_balance_explanation": "OVHcloud incluye todas las fuentes emisoras de CO2 equivalente, con datos proporcionados por la fórmula:", + "carbon_calculator_dashboard_billing_explanation": "El informe incluye las emisiones de gases de efecto invernadero del mes anterior:
  • de los servicios de las infraestructuras Baremetal
de los que usted es el contacto de facturación.", + "carbon_calculator_dashboard_billing_download": "Descargar mi huella digital de {{month}}" +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_CA.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_CA.json new file mode 100644 index 000000000000..b81fc5907d82 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_fr_CA.json @@ -0,0 +1,11 @@ +{ + "carbon_calculator_dashboard_carbon_footprint_explanation": "Retrouvez et téléchargez l'analyse des émissions des gaz à effet de serre de votre infrastructure. Suivez l'impact environnemental lié à la fabrication, à la consommation énergétique et aux opérations annexes de vos services Cloud.", + "carbon_calculator_dashboard_carbon_balance_title": "Quelle est la composition du bilan carbone d'OVHcloud ?", + "carbon_calculator_dashboard_carbon_balance_manufacturing": "Fabrication", + "carbon_calculator_dashboard_carbon_balance_electricity": "Électricité", + "carbon_calculator_dashboard_carbon_balance_operations": "Opérations", + "carbon_calculator_dashboard_carbon_balance_greenhouse_gas": "Émissions de gaz à effet de serre", + "carbon_calculator_dashboard_carbon_balance_explanation": "OVHcloud inclut l'ensemble des sources émettrices de CO2eq, données fournies par la formule :", + "carbon_calculator_dashboard_billing_explanation": "Ce document comprend les émissions de gaz à effet de serre du mois précédent :
  • de vos services infrastructures Baremetal
dont vous êtes le contact facturation.", + "carbon_calculator_dashboard_billing_download": "Télécharger mon empreinte de {{month}}" +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_it_IT.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_it_IT.json new file mode 100644 index 000000000000..e1ebc468b741 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_it_IT.json @@ -0,0 +1,11 @@ +{ + "carbon_calculator_dashboard_carbon_footprint_explanation": "Consulta e scarica l'analisi delle emissioni di gas serra della tua infrastruttura. Monitora l'impatto ambientale legato alla produzione, al consumo energetico e alle operazioni associate ai tuoi servizi Cloud.", + "carbon_calculator_dashboard_carbon_balance_title": "Da cosa è composto il bilancio del carbonio di OVHcloud?", + "carbon_calculator_dashboard_carbon_balance_manufacturing": "Produzione", + "carbon_calculator_dashboard_carbon_balance_electricity": "Elettricità", + "carbon_calculator_dashboard_carbon_balance_operations": "Operazioni", + "carbon_calculator_dashboard_carbon_balance_greenhouse_gas": "Emissioni di gas a effetto serra", + "carbon_calculator_dashboard_carbon_balance_explanation": "OVHcloud include l'insieme delle fonti di CO2eqv, dati forniti dalla formula:", + "carbon_calculator_dashboard_billing_explanation": "Questo documento comprende le emissioni di gas a effetto serra del mese precedente:
  • delle infrastrutture Bare Metal
per cui risulti essere il contatto di fatturazione.", + "carbon_calculator_dashboard_billing_download": "Scarica la tua impronta di {{month}}" +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pl_PL.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pl_PL.json new file mode 100644 index 000000000000..cdbf2608b3b2 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pl_PL.json @@ -0,0 +1,11 @@ +{ + "carbon_calculator_dashboard_carbon_footprint_explanation": "Sprawdź i pobierz analizę emisji gazów cieplarnianych generowanych przez Twoją infrastrukturę. Monitoruj wpływ na środowisko związany z produkcją, zużyciem energii oraz operacjami realizowanymi w ramach usług Cloud.", + "carbon_calculator_dashboard_carbon_balance_title": "Jakie elementy wykorzystywane są do obliczenia bilansu śladu węglowego OVHcloud?", + "carbon_calculator_dashboard_carbon_balance_manufacturing": "Produkcja", + "carbon_calculator_dashboard_carbon_balance_electricity": "Energia elektryczna", + "carbon_calculator_dashboard_carbon_balance_operations": "Operacje", + "carbon_calculator_dashboard_carbon_balance_greenhouse_gas": "Emisja gazów cieplarnianych", + "carbon_calculator_dashboard_carbon_balance_explanation": "OVHcloud uwzględnia wszystkie źródła emisji CO2eq, a dane zostają podstawione do następującego wzoru:", + "carbon_calculator_dashboard_billing_explanation": "Dokument ten zawiera dane dotyczące emisji gazów cieplarnianych z poprzedniego miesiąca:
  • w odniesieniu do usług infrastruktury Bare Metal
dla których jesteś kontaktem księgowym.", + "carbon_calculator_dashboard_billing_download": "Pobierz dane dot. śladu węglowego z m-ca: {{month}}" +} diff --git a/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pt_PT.json b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pt_PT.json new file mode 100644 index 000000000000..8d8aaf49dcb6 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/dashboard/translations/Messages_pt_PT.json @@ -0,0 +1,11 @@ +{ + "carbon_calculator_dashboard_carbon_footprint_explanation": "Encontre e descarregue a análise das emissões de gases com efeito de estufa da sua infraestrutura. Siga o impacto ambiental associado à produção, ao consumo energético e às operações relacionadas com os seus serviços cloud.", + "carbon_calculator_dashboard_carbon_balance_title": "Qual é a composição do balanço de carbono da OVHcloud?", + "carbon_calculator_dashboard_carbon_balance_manufacturing": "Produção", + "carbon_calculator_dashboard_carbon_balance_electricity": "Eletricidade", + "carbon_calculator_dashboard_carbon_balance_operations": "Operações", + "carbon_calculator_dashboard_carbon_balance_greenhouse_gas": "Emissões de gases com efeito de estufa", + "carbon_calculator_dashboard_carbon_balance_explanation": "A OVHcloud inclui todas as fontes de emissão de CO2eq, dados fornecidos pela fórmula:", + "carbon_calculator_dashboard_billing_explanation": "Este documento compreende as emissões de gases com efeito de estufa do mês anterior:
  • dos seus serviços infraestruturas Bare Metal
de que é o contacto de faturação.", + "carbon_calculator_dashboard_billing_download": "Fazer download da minha pegada de {{month}}" +} diff --git a/packages/manager/modules/carbon-calculator/src/translations/Messages_de_DE.json b/packages/manager/modules/carbon-calculator/src/translations/Messages_de_DE.json new file mode 100644 index 000000000000..92449042f4c1 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/translations/Messages_de_DE.json @@ -0,0 +1,3 @@ +{ + "carbon_calculator_my_carbon_footprint": "Mein CO2-Fußabdruck" +} diff --git a/packages/manager/modules/carbon-calculator/src/translations/Messages_en_GB.json b/packages/manager/modules/carbon-calculator/src/translations/Messages_en_GB.json new file mode 100644 index 000000000000..cff3741acaf6 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/translations/Messages_en_GB.json @@ -0,0 +1,3 @@ +{ + "carbon_calculator_my_carbon_footprint": "My carbon footprint" +} diff --git a/packages/manager/modules/carbon-calculator/src/translations/Messages_es_ES.json b/packages/manager/modules/carbon-calculator/src/translations/Messages_es_ES.json new file mode 100644 index 000000000000..35786712a59f --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/translations/Messages_es_ES.json @@ -0,0 +1,3 @@ +{ + "carbon_calculator_my_carbon_footprint": "Mi huella de carbono" +} diff --git a/packages/manager/modules/carbon-calculator/src/translations/Messages_fr_CA.json b/packages/manager/modules/carbon-calculator/src/translations/Messages_fr_CA.json new file mode 100644 index 000000000000..a610b30bcf72 --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/translations/Messages_fr_CA.json @@ -0,0 +1,3 @@ +{ + "carbon_calculator_my_carbon_footprint": "Mon empreinte carbone" +} diff --git a/packages/manager/modules/carbon-calculator/src/translations/Messages_it_IT.json b/packages/manager/modules/carbon-calculator/src/translations/Messages_it_IT.json new file mode 100644 index 000000000000..40b66d12bfad --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/translations/Messages_it_IT.json @@ -0,0 +1,3 @@ +{ + "carbon_calculator_my_carbon_footprint": "La mia impronta di carbonio" +} diff --git a/packages/manager/modules/carbon-calculator/src/translations/Messages_pl_PL.json b/packages/manager/modules/carbon-calculator/src/translations/Messages_pl_PL.json new file mode 100644 index 000000000000..af4a6c10727b --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/translations/Messages_pl_PL.json @@ -0,0 +1,3 @@ +{ + "carbon_calculator_my_carbon_footprint": "Mój ślad węglowy" +} diff --git a/packages/manager/modules/carbon-calculator/src/translations/Messages_pt_PT.json b/packages/manager/modules/carbon-calculator/src/translations/Messages_pt_PT.json new file mode 100644 index 000000000000..55af11a5a6dd --- /dev/null +++ b/packages/manager/modules/carbon-calculator/src/translations/Messages_pt_PT.json @@ -0,0 +1,3 @@ +{ + "carbon_calculator_my_carbon_footprint": "A minha pegada de carbono" +}