mirror of https://github.com/portainer/portainer
added RepositoryMechanismTypes constant
parent
f3b8a9dc85
commit
3a066d0cd8
|
@ -15,3 +15,8 @@ export const KubernetesDeployRequestMethods = Object.freeze({
|
|||
STRING: 'string',
|
||||
URL: 'url',
|
||||
});
|
||||
|
||||
export const RepositoryMechanismTypes = Object.freeze({
|
||||
WEBHOOK: 'Webhook',
|
||||
INTERVAL: 'Interval',
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@ import stripAnsi from 'strip-ansi';
|
|||
import uuidv4 from 'uuid/v4';
|
||||
import PortainerError from 'Portainer/error';
|
||||
|
||||
import { KubernetesDeployManifestTypes, KubernetesDeployBuildMethods, KubernetesDeployRequestMethods } from 'Kubernetes/models/deploy';
|
||||
import { KubernetesDeployManifestTypes, KubernetesDeployBuildMethods, KubernetesDeployRequestMethods, RepositoryMechanismTypes } from 'Kubernetes/models/deploy';
|
||||
import { buildOption } from '@/portainer/components/box-selector';
|
||||
class KubernetesDeployController {
|
||||
/* @ngInject */
|
||||
|
@ -51,7 +51,7 @@ class KubernetesDeployController {
|
|||
AdditionalFiles: [],
|
||||
ComposeFilePathInRepository: 'deployment.yml',
|
||||
RepositoryAutomaticUpdates: true,
|
||||
RepositoryMechanism: 'Interval',
|
||||
RepositoryMechanism: RepositoryMechanismTypes.INTERVAL,
|
||||
RepositoryFetchInterval: '5m',
|
||||
RepositoryWebhookURL: this.WebhookHelper.returnStackWebhookUrl(uuidv4()),
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import uuidv4 from 'uuid/v4';
|
||||
import { RepositoryMechanismTypes } from 'Kubernetes/models/deploy';
|
||||
class KubernetesRedeployAppGitFormController {
|
||||
/* @ngInject */
|
||||
constructor($async, $state, $analytics, StackService, ModalService, Notifications, WebhookHelper) {
|
||||
|
@ -24,7 +25,7 @@ class KubernetesRedeployAppGitFormController {
|
|||
// auto upadte
|
||||
AutoUpdate: {
|
||||
RepositoryAutomaticUpdates: false,
|
||||
RepositoryMechanism: 'Interval',
|
||||
RepositoryMechanism: RepositoryMechanismTypes.INTERVAL,
|
||||
RepositoryFetchInterval: '5m',
|
||||
RepositoryWebhookURL: '',
|
||||
},
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import uuidv4 from 'uuid/v4';
|
||||
|
||||
import { RepositoryMechanismTypes } from 'Kubernetes/models/deploy';
|
||||
class StackRedeployGitFormController {
|
||||
/* @ngInject */
|
||||
constructor($async, $state, StackService, ModalService, Notifications, WebhookHelper, FormHelper) {
|
||||
|
@ -28,7 +28,7 @@ class StackRedeployGitFormController {
|
|||
// auto update
|
||||
AutoUpdate: {
|
||||
RepositoryAutomaticUpdates: false,
|
||||
RepositoryMechanism: 'Interval',
|
||||
RepositoryMechanism: RepositoryMechanismTypes.INTERVAL,
|
||||
RepositoryFetchInterval: '5m',
|
||||
RepositoryWebhookURL: '',
|
||||
},
|
||||
|
@ -51,9 +51,9 @@ class StackRedeployGitFormController {
|
|||
|
||||
function autoSyncLabel(type) {
|
||||
switch (type) {
|
||||
case 'Interval':
|
||||
case RepositoryMechanismTypes.INTERVAL:
|
||||
return 'polling';
|
||||
case 'Webhook':
|
||||
case RepositoryMechanismTypes.WEBHOOK:
|
||||
return 'webhook';
|
||||
}
|
||||
return 'off';
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import _ from 'lodash-es';
|
||||
import { RepositoryMechanismTypes } from 'Kubernetes/models/deploy';
|
||||
import { StackViewModel, OrphanedStackViewModel } from '../../models/stack';
|
||||
|
||||
angular.module('portainer.app').factory('StackService', [
|
||||
|
@ -279,9 +280,9 @@ angular.module('portainer.app').factory('StackService', [
|
|||
} else {
|
||||
const autoUpdate = {};
|
||||
if (gitConfig.AutoUpdate && gitConfig.AutoUpdate.RepositoryAutomaticUpdates) {
|
||||
if (gitConfig.AutoUpdate.RepositoryMechanism === 'Interval') {
|
||||
if (gitConfig.AutoUpdate.RepositoryMechanism === RepositoryMechanismTypes.INTERVAL) {
|
||||
autoUpdate.Interval = gitConfig.AutoUpdate.RepositoryFetchInterval;
|
||||
} else if (gitConfig.AutoUpdate.RepositoryMechanism === 'Webhook') {
|
||||
} else if (gitConfig.AutoUpdate.RepositoryMechanism === RepositoryMechanismTypes.WEBHOOK) {
|
||||
autoUpdate.Webhook = gitConfig.AutoUpdate.RepositoryWebhookURL.split('/').reverse()[0];
|
||||
}
|
||||
}
|
||||
|
@ -465,9 +466,9 @@ angular.module('portainer.app').factory('StackService', [
|
|||
const autoUpdate = {};
|
||||
|
||||
if (gitConfig.AutoUpdate.RepositoryAutomaticUpdates) {
|
||||
if (gitConfig.AutoUpdate.RepositoryMechanism === 'Interval') {
|
||||
if (gitConfig.AutoUpdate.RepositoryMechanism === RepositoryMechanismTypes.INTERVAL) {
|
||||
autoUpdate.Interval = gitConfig.AutoUpdate.RepositoryFetchInterval;
|
||||
} else if (gitConfig.AutoUpdate.RepositoryMechanism === 'Webhook') {
|
||||
} else if (gitConfig.AutoUpdate.RepositoryMechanism === RepositoryMechanismTypes.WEBHOOK) {
|
||||
autoUpdate.Webhook = gitConfig.AutoUpdate.RepositoryWebhookURL.split('/').reverse()[0];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import angular from 'angular';
|
||||
import uuidv4 from 'uuid/v4';
|
||||
|
||||
import { RepositoryMechanismTypes } from 'Kubernetes/models/deploy';
|
||||
import { AccessControlFormData } from '../../../components/accessControlForm/porAccessControlFormModel';
|
||||
|
||||
angular
|
||||
|
@ -42,7 +42,7 @@ angular
|
|||
ComposeFilePathInRepository: 'docker-compose.yml',
|
||||
AccessControlData: new AccessControlFormData(),
|
||||
RepositoryAutomaticUpdates: true,
|
||||
RepositoryMechanism: 'Interval',
|
||||
RepositoryMechanism: RepositoryMechanismTypes.INTERVAL,
|
||||
RepositoryFetchInterval: '5m',
|
||||
RepositoryWebhookURL: WebhookHelper.returnStackWebhookUrl(uuidv4()),
|
||||
};
|
||||
|
@ -111,9 +111,9 @@ angular
|
|||
|
||||
function autoSyncLabel(type) {
|
||||
switch (type) {
|
||||
case 'Interval':
|
||||
case RepositoryMechanismTypes.INTERVAL:
|
||||
return 'polling';
|
||||
case 'Webhook':
|
||||
case RepositoryMechanismTypes.WEBHOOK:
|
||||
return 'webhook';
|
||||
}
|
||||
return 'off';
|
||||
|
@ -166,9 +166,9 @@ angular
|
|||
function getAutoUpdatesProperty(repositoryOptions) {
|
||||
if ($scope.formValues.RepositoryAutomaticUpdates) {
|
||||
repositoryOptions.AutoUpdate = {};
|
||||
if ($scope.formValues.RepositoryMechanism === 'Interval') {
|
||||
if ($scope.formValues.RepositoryMechanism === RepositoryMechanismTypes.INTERVAL) {
|
||||
repositoryOptions.AutoUpdate.Interval = $scope.formValues.RepositoryFetchInterval;
|
||||
} else if ($scope.formValues.RepositoryMechanism === 'Webhook') {
|
||||
} else if ($scope.formValues.RepositoryMechanism === RepositoryMechanismTypes.WEBHOOK) {
|
||||
repositoryOptions.AutoUpdate.Webhook = $scope.formValues.RepositoryWebhookURL.split('/').reverse()[0];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue