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';
|
import { buildOption } from '@/portainer/components/box-selector';
|
||||||
class KubernetesDeployController {
|
class KubernetesDeployController {
|
||||||
/* @ngInject */
|
/* @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.$async = $async;
|
||||||
this.$state = $state;
|
this.$state = $state;
|
||||||
this.$window = $window;
|
this.$window = $window;
|
||||||
this.$analytics = $analytics;
|
this.Authentication = Authentication;
|
||||||
this.ModalService = ModalService;
|
this.ModalService = ModalService;
|
||||||
this.Notifications = Notifications;
|
this.Notifications = Notifications;
|
||||||
this.EndpointProvider = EndpointProvider;
|
this.EndpointProvider = EndpointProvider;
|
||||||
|
@ -72,6 +72,7 @@ class KubernetesDeployController {
|
||||||
type: buildLabel(this.state.BuildMethod),
|
type: buildLabel(this.state.BuildMethod),
|
||||||
format: formatLabel(this.state.DeployType),
|
format: formatLabel(this.state.DeployType),
|
||||||
role: roleLabel(this.Authentication.isAdmin()),
|
role: roleLabel(this.Authentication.isAdmin()),
|
||||||
|
'automatic-updates': automaticUpdatesLabel(this.formValues.RepositoryAutomaticUpdates, this.formValues.RepositoryMechanism),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.state.BuildMethod === KubernetesDeployBuildMethods.GIT) {
|
if (this.state.BuildMethod === KubernetesDeployBuildMethods.GIT) {
|
||||||
|
@ -80,6 +81,17 @@ class KubernetesDeployController {
|
||||||
|
|
||||||
return { metadata };
|
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) {
|
function roleLabel(isAdmin) {
|
||||||
if (isAdmin) {
|
if (isAdmin) {
|
||||||
return 'admin';
|
return 'admin';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import uuidv4 from 'uuid/v4';
|
||||||
import { RepositoryMechanismTypes } from 'Kubernetes/models/deploy';
|
import { RepositoryMechanismTypes } from 'Kubernetes/models/deploy';
|
||||||
class KubernetesRedeployAppGitFormController {
|
class KubernetesRedeployAppGitFormController {
|
||||||
/* @ngInject */
|
/* @ngInject */
|
||||||
constructor($async, $state, $analytics, StackService, ModalService, Notifications, WebhookHelper) {
|
constructor($async, $state, StackService, ModalService, Notifications, WebhookHelper) {
|
||||||
this.$async = $async;
|
this.$async = $async;
|
||||||
this.$state = $state;
|
this.$state = $state;
|
||||||
this.StackService = StackService;
|
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() {
|
async pullAndRedeployApplication() {
|
||||||
return this.$async(async () => {
|
return this.$async(async () => {
|
||||||
try {
|
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({
|
const confirmed = await this.ModalService.confirmAsync({
|
||||||
title: 'Are you sure?',
|
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?',
|
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"
|
ng-disabled="$ctrl.isSubmitButtonDisabled() || !$ctrl.redeployGitForm.$valid"
|
||||||
style="margin-top: 7px; margin-left: 0;"
|
style="margin-top: 7px; margin-left: 0;"
|
||||||
button-spinner="$ctrl.state.saveGitSettingsInProgress"
|
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"> Save settings </span>
|
||||||
<span ng-show="$ctrl.state.saveGitSettingsInProgress">In progress...</span>
|
<span ng-show="$ctrl.state.saveGitSettingsInProgress">In progress...</span>
|
||||||
|
|
Loading…
Reference in New Issue