mirror of https://github.com/portainer/portainer
updated analytics functions
parent
3a066d0cd8
commit
042a66d15c
|
@ -8,11 +8,11 @@ import { KubernetesDeployManifestTypes, KubernetesDeployBuildMethods, Kubernetes
|
|||
import { buildOption } from '@/portainer/components/box-selector';
|
||||
class KubernetesDeployController {
|
||||
/* @ngInject */
|
||||
constructor($async, $state, $window, $analytics, ModalService, Notifications, EndpointProvider, KubernetesResourcePoolService, StackService, WebhookHelper) {
|
||||
constructor($async, $state, $window, Authentication, ModalService, Notifications, EndpointProvider, KubernetesResourcePoolService, StackService, WebhookHelper) {
|
||||
this.$async = $async;
|
||||
this.$state = $state;
|
||||
this.$window = $window;
|
||||
this.$analytics = $analytics;
|
||||
this.Authentication = Authentication;
|
||||
this.ModalService = ModalService;
|
||||
this.Notifications = Notifications;
|
||||
this.EndpointProvider = EndpointProvider;
|
||||
|
@ -72,6 +72,7 @@ class KubernetesDeployController {
|
|||
type: buildLabel(this.state.BuildMethod),
|
||||
format: formatLabel(this.state.DeployType),
|
||||
role: roleLabel(this.Authentication.isAdmin()),
|
||||
'automatic-updates': automaticUpdatesLabel(this.formValues.RepositoryAutomaticUpdates, this.formValues.RepositoryMechanism),
|
||||
};
|
||||
|
||||
if (this.state.BuildMethod === KubernetesDeployBuildMethods.GIT) {
|
||||
|
@ -80,6 +81,17 @@ class KubernetesDeployController {
|
|||
|
||||
return { metadata };
|
||||
|
||||
function automaticUpdatesLabel(repositoryAutomaticUpdates, repositoryMechanism) {
|
||||
switch (repositoryAutomaticUpdates && repositoryMechanism) {
|
||||
case RepositoryMechanismTypes.INTERVAL:
|
||||
return 'polling';
|
||||
case RepositoryMechanismTypes.WEBHOOK:
|
||||
return 'webhook';
|
||||
default:
|
||||
return 'off';
|
||||
}
|
||||
}
|
||||
|
||||
function roleLabel(isAdmin) {
|
||||
if (isAdmin) {
|
||||
return 'admin';
|
||||
|
|
|
@ -2,7 +2,7 @@ import uuidv4 from 'uuid/v4';
|
|||
import { RepositoryMechanismTypes } from 'Kubernetes/models/deploy';
|
||||
class KubernetesRedeployAppGitFormController {
|
||||
/* @ngInject */
|
||||
constructor($async, $state, $analytics, StackService, ModalService, Notifications, WebhookHelper) {
|
||||
constructor($async, $state, StackService, ModalService, Notifications, WebhookHelper) {
|
||||
this.$async = $async;
|
||||
this.$state = $state;
|
||||
this.StackService = StackService;
|
||||
|
@ -46,23 +46,28 @@ class KubernetesRedeployAppGitFormController {
|
|||
};
|
||||
}
|
||||
|
||||
buildAnalyticsProperties() {
|
||||
const metadata = {
|
||||
'automatic-updates': automaticUpdatesLabel(this.formValues.AutoUpdate.RepositoryAutomaticUpdates, this.formValues.AutoUpdate.RepositoryMechanism),
|
||||
};
|
||||
|
||||
return { metadata };
|
||||
|
||||
function automaticUpdatesLabel(repositoryAutomaticUpdates, repositoryMechanism) {
|
||||
switch (repositoryAutomaticUpdates && repositoryMechanism) {
|
||||
case RepositoryMechanismTypes.INTERVAL:
|
||||
return 'polling';
|
||||
case RepositoryMechanismTypes.WEBHOOK:
|
||||
return 'webhook';
|
||||
default:
|
||||
return 'off';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async pullAndRedeployApplication() {
|
||||
return this.$async(async () => {
|
||||
try {
|
||||
//Analytics
|
||||
const metadata = {};
|
||||
|
||||
if (this.formValues.AutoUpdate.RepositoryAutomaticUpdates) {
|
||||
if (this.formValues.AutoUpdate.RepositoryMechanism === `Interval`) {
|
||||
metadata['automatic-updates'] = 'polling';
|
||||
} else if (this.formValues.AutoUpdate.RepositoryMechanism === `Webhook`) {
|
||||
metadata['automatic-updates'] = 'webhook';
|
||||
}
|
||||
} else {
|
||||
metadata['automatic-updates'] = 'off';
|
||||
}
|
||||
this.$analytics.eventTrack('kubernetes-application-edit', { category: 'kubernetes', metadata: metadata });
|
||||
|
||||
const confirmed = await this.ModalService.confirmAsync({
|
||||
title: 'Are you sure?',
|
||||
message: 'Any changes to this application will be overriden by the definition in git and may cause a service interruption. Do you wish to continue?',
|
||||
|
|
|
@ -53,6 +53,10 @@
|
|||
ng-disabled="$ctrl.isSubmitButtonDisabled() || !$ctrl.redeployGitForm.$valid"
|
||||
style="margin-top: 7px; margin-left: 0;"
|
||||
button-spinner="$ctrl.state.saveGitSettingsInProgress"
|
||||
analytics-on
|
||||
analytics-category="kubernetes"
|
||||
analytics-event="kubernetes-application-edit"
|
||||
analytics-properties="$ctrl.buildAnalyticsProperties()"
|
||||
>
|
||||
<span ng-show="!$ctrl.state.saveGitSettingsInProgress"> Save settings </span>
|
||||
<span ng-show="$ctrl.state.saveGitSettingsInProgress">In progress...</span>
|
||||
|
|
Loading…
Reference in New Issue