Skip to content

Commit

Permalink
feat(web): tracking actions on git
Browse files Browse the repository at this point in the history
ref: MANAGER-14582

Signed-off-by: Antony MARION <[email protected]>
  • Loading branch information
Antony MARION committed Nov 5, 2024
1 parent 629967e commit b874fe0
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import {
GIT_ASSOCIATION_GUIDE_LINK,
GIT_WEBHOOK_GUIDE_LINK,
} from './git-association.constants';
import { TRACKING_MULTISITE_PREFIX } from '../git-integration.constants';

export default class HostingMultisiteGitAssociationController {
/* @ngInject */
constructor(
HostingMultisiteGitAssociationService,
coreURLBuilder,
coreConfig,
atInternet,
$translate,
) {
this.REPOSITORY_PLACEHOLDER = REPOSITORY_PLACEHOLDER;
Expand All @@ -26,6 +28,7 @@ export default class HostingMultisiteGitAssociationController {
this.HostingMultisiteGitAssociationService = HostingMultisiteGitAssociationService;
this.coreURLBuilder = coreURLBuilder;
this.$translate = $translate;
this.atInternet = atInternet;
const { ovhSubsidiary } = coreConfig.getUser();
this.GIT_ASSOCIATION_GUIDE_LINK =
GIT_ASSOCIATION_GUIDE_LINK[ovhSubsidiary] ||
Expand Down Expand Up @@ -56,6 +59,10 @@ export default class HostingMultisiteGitAssociationController {
}

applyConfiguration() {
this.atInternet.trackClick({
name: `${TRACKING_MULTISITE_PREFIX}::git-association::confirm`,
type: 'action',
});
const promise = this.isConfiguration
? this.HostingMultisiteGitAssociationService.putWebsiteAssociated(
this.serviceName,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import { TRACKING_MULTISITE_PREFIX } from '../git-integration.constants';

export default class HostingMultisiteGitDeploymentController {
/* @ngInject */
constructor(
HostingMultisiteGitDeploymentService,
HostingDomain,
coreURLBuilder,
$translate,
atInternet,
) {
this.HostingMultisiteGitDeploymentService = HostingMultisiteGitDeploymentService;
this.HostingDomain = HostingDomain;
this.coreURLBuilder = coreURLBuilder;
this.$translate = $translate;
this.atInternet = atInternet;
this.gitForcePush = false;
}

Expand All @@ -25,6 +29,10 @@ export default class HostingMultisiteGitDeploymentController {
}

deployment() {
this.atInternet.trackClick({
name: `${TRACKING_MULTISITE_PREFIX}::git-deployment::confirm`,
type: 'action',
});
this.isDeploying = true;
this.HostingMultisiteGitDeploymentService.postWebsiteDeploy(
this.serviceName,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const TRACKING_MULTISITE_PREFIX = 'web::hosting::dashboard::multisite';

export default {
TRACKING_MULTISITE_PREFIX,
};
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import { TRACKING_MULTISITE_PREFIX } from '../git-integration.constants';

export default class HostingMultisiteGitDeploymentController {
/* @ngInject */
constructor($translate, HostingDomain, HostingMultisiteGitRemovalService) {
constructor(
$translate,
atInternet,
HostingDomain,
HostingMultisiteGitRemovalService,
) {
this.isConfirmationStep = false;
this.$translate = $translate;
this.atInternet = atInternet;
this.HostingMultisiteGitRemovalService = HostingMultisiteGitRemovalService;
this.HostingDomain = HostingDomain;
}
Expand All @@ -22,6 +30,10 @@ export default class HostingMultisiteGitDeploymentController {
}

deleteGitAssociation(deleteFiles) {
this.atInternet.trackClick({
name: `${TRACKING_MULTISITE_PREFIX}::git-removal::confirm`,
type: 'action',
});
this.isDeleting = true;
this.HostingDomain.getWebsitesAssociated(this.serviceName, this.path)
.then(([websiteId]) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
HOSTING_TAB_DOMAINS,
RECORD_TYPE_TO_IP_TYPE,
} from './hosting-multisite.constants';
import { TRACKING_MULTISITE_PREFIX } from './git-integration/git-integration.constants';

const CDN_STATISTICS_PERIOD = {
DAY: 'day',
Expand Down Expand Up @@ -443,26 +444,42 @@ angular
$scope.setAction('multisite/update/hosting-multisite-update', domain);
};

$scope.goToRemoveRepository = (domain) =>
$scope.goToRemoveRepository = (domain) => {
sendTrackClick(`${TRACKING_MULTISITE_PREFIX}::git-removal`);
$scope.$resolve.goToRemoveRepository(
$scope.hosting.serviceName,
domain.path,
);
};

$scope.goToAssociateRepository = (domain) =>
$scope.goToAssociateRepository = (domain) => {
sendTrackClick(`${TRACKING_MULTISITE_PREFIX}::add-git`);
$scope.$resolve.goToAssociateRepository(
$scope.hosting.serviceName,
domain,
);
};

$scope.goToConfigureGit = (domain) =>
$scope.$resolve.goToConfigureGit($scope.hosting.serviceName, domain);

$scope.goToDeployWebSite = (domain) =>
$scope.$resolve.goToDeployWebSite($scope.hosting.serviceName, domain);
$scope.goToDeployWebSite = (domain) => {
sendTrackClick(`${TRACKING_MULTISITE_PREFIX}::git-deployment`);
return $scope.$resolve.goToDeployWebSite(
$scope.hosting.serviceName,
domain,
);
};

$scope.goToViewLastDeploy = (domain) =>
$scope.$resolve.goToViewLastDeploy($scope.hosting.serviceName, domain);
$scope.goToViewLastDeploy = (domain) => {
sendTrackClick(
`${TRACKING_MULTISITE_PREFIX}::git-view-last-deployment`,
);
return $scope.$resolve.goToViewLastDeploy(
$scope.hosting.serviceName,
domain,
);
};

$scope.restartDomain = (domain) =>
HostingDomain.restartVirtualHostOfAttachedDomain(
Expand Down

0 comments on commit b874fe0

Please sign in to comment.