Skip to content

Commit

Permalink
chore(client): rename targetType to type
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme committed May 6, 2024
1 parent eab01d9 commit aa5f4d3
Show file tree
Hide file tree
Showing 15 changed files with 90 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export default class DeploymentTool extends PureComponent {
type: 'deployment.done',
payload: {
deployment,
targetType: SELF_HOSTED,
type: SELF_HOSTED,
deployedTo: {
executionPlatformVersion: version,
executionPlatform: ENGINES.PLATFORM
Expand Down Expand Up @@ -264,7 +264,7 @@ export default class DeploymentTool extends PureComponent {
type: 'deployment.error',
payload: {
error,
targetType: SELF_HOSTED,
type: SELF_HOSTED,
context: 'deploymentTool',
...(deployedTo && { deployedTo: deployedTo })
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -630,11 +630,12 @@ describe('<DeploymentTool>', () => {
onClose: () => { }
}));

const targetType = actionSpy.getCall(0).args[0].payload.targetType;

// then
expect(actionSpy).to.have.been.calledOnce;
expect(targetType).to.eql('selfHosted');

const { type } = actionSpy.getCall(0).args[0].payload;

expect(type).to.eql('selfHosted');
});


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default class DeploymentEventHandler {
const {
context,
deployedTo,
targetType,
type,
error,
tab
} = event;
Expand Down Expand Up @@ -91,10 +91,11 @@ export default class DeploymentEventHandler {
...engineProfile
};

if (targetType) {
if (type) {
payload = {
...payload,
targetType
targetType: type, // legacy
type
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,17 +575,21 @@ describe('<DeploymentEventHandler>', () => {
type: 'cloud-bpmn'
});

const cloudTargetType = 'camundaCloud';
const CAMUNDA_CLOUD = 'camundaCloud';

const handleDeploymentDone = subscribe.getCall(0).args[1];

// when
await handleDeploymentDone({ tab, targetType: cloudTargetType });
await handleDeploymentDone({ tab, type: CAMUNDA_CLOUD });

const { targetType } = track.getCall(0).args[1];
const {
targetType, // legacy
type
} = track.getCall(0).args[1];

// then
expect(targetType).to.eql(cloudTargetType);
expect(targetType).to.eql(CAMUNDA_CLOUD);
expect(type).to.eql(CAMUNDA_CLOUD);
});


Expand Down Expand Up @@ -618,7 +622,6 @@ describe('<DeploymentEventHandler>', () => {
expect(templateIds).to.have.length(2);
});


});


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {

import { AUTH_TYPES } from './../shared/ZeebeAuthTypes';

import { CAMUNDA_CLOUD, SELF_HOSTED } from '../shared/ZeebeTargetTypes';
import { CAMUNDA_CLOUD, SELF_HOSTED } from '../shared/ZeebeEndpointTypes';

import DeploymentPluginOverlay from './DeploymentPluginOverlay';

Expand Down Expand Up @@ -382,7 +382,7 @@ export default class DeploymentPlugin extends PureComponent {

let endpoint = {
id: generateId(),
targetType: CAMUNDA_CLOUD,
type: CAMUNDA_CLOUD,
authType: AUTH_TYPES.NONE,
contactPoint: '',
oauthURL: '',
Expand Down Expand Up @@ -473,7 +473,7 @@ export default class DeploymentPlugin extends PureComponent {
gatewayVersion
} = options;

const content = endpoint.targetType === CAMUNDA_CLOUD ?
const content = endpoint.type === CAMUNDA_CLOUD ?
<CloudLink endpoint={ endpoint } response={ response } />
: null;

Expand All @@ -492,7 +492,7 @@ export default class DeploymentPlugin extends PureComponent {
payload: {
deployment: response,
context: isStart ? 'startInstanceTool' : 'deploymentTool',
targetType: endpoint && endpoint.targetType,
type: endpoint && endpoint.type,
deployedTo: {
executionPlatformVersion: gatewayVersion,
executionPlatform: ENGINES.CLOUD
Expand Down Expand Up @@ -570,7 +570,7 @@ export default class DeploymentPlugin extends PureComponent {
},
context: isStart ? 'startInstanceTool' : 'deploymentTool',
...(deployedTo && { deployedTo: deployedTo }),
targetType: endpoint && endpoint.targetType
type: endpoint && endpoint.type
}
});
}
Expand Down Expand Up @@ -724,7 +724,7 @@ function patchWithProtocol(config = {}) {
return config;
}

if (endpoint.targetType !== SELF_HOSTED) {
if (endpoint.type !== SELF_HOSTED) {
return config;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import { AUTH_TYPES } from './../shared/ZeebeAuthTypes';
import {
SELF_HOSTED,
CAMUNDA_CLOUD
} from '../shared/ZeebeTargetTypes';
} from '../shared/ZeebeEndpointTypes';

import {
Formik,
Expand Down Expand Up @@ -175,7 +175,7 @@ export default class DeploymentPluginOverlay extends React.PureComponent {
}

// Extract clusterId and clusterRegion as required by zeebeAPI for camundaCloud
if (endpoint.targetType === CAMUNDA_CLOUD && endpoint.camundaCloudClusterUrl) {
if (endpoint.type === CAMUNDA_CLOUD && endpoint.camundaCloudClusterUrl) {
endpoint.camundaCloudClusterId = extractClusterId(endpoint.camundaCloudClusterUrl);
endpoint.camundaCloudClusterRegion = extractClusterRegion(endpoint.camundaCloudClusterUrl);
}
Expand Down Expand Up @@ -213,7 +213,7 @@ export default class DeploymentPluginOverlay extends React.PureComponent {
} = values;

// Extract clusterId and clusterRegion as required by zeebeAPI for camundaCloud
if (endpoint.targetType === CAMUNDA_CLOUD && endpoint.camundaCloudClusterUrl) {
if (endpoint.type === CAMUNDA_CLOUD && endpoint.camundaCloudClusterUrl) {
endpoint.camundaCloudClusterId = extractClusterId(endpoint.camundaCloudClusterUrl);
endpoint.camundaCloudClusterRegion = extractClusterRegion(endpoint.camundaCloudClusterUrl);
}
Expand Down Expand Up @@ -275,7 +275,7 @@ export default class DeploymentPluginOverlay extends React.PureComponent {
autoFocus
/>
<Field
name="endpoint.targetType"
name="endpoint.type"
component={ Radio }
label={ 'Target' }
className="target_radio"
Expand All @@ -287,7 +287,7 @@ export default class DeploymentPluginOverlay extends React.PureComponent {
}
/>
{
form.values.endpoint.targetType === SELF_HOSTED && (
form.values.endpoint.type === SELF_HOSTED && (
<React.Fragment>
<Field
name="endpoint.contactPoint"
Expand All @@ -299,7 +299,7 @@ export default class DeploymentPluginOverlay extends React.PureComponent {
autoFocus
/>
{
form.values.endpoint.targetType === SELF_HOSTED &&
form.values.endpoint.type === SELF_HOSTED &&
form.values.endpoint.authType === AUTH_TYPES.OAUTH && (
<Field
name="deployment.tenantId"
Expand All @@ -325,7 +325,7 @@ export default class DeploymentPluginOverlay extends React.PureComponent {
)
}
{
form.values.endpoint.targetType === SELF_HOSTED &&
form.values.endpoint.type === SELF_HOSTED &&
form.values.endpoint.authType === AUTH_TYPES.BASIC && (
<React.Fragment>
<Field
Expand All @@ -347,7 +347,7 @@ export default class DeploymentPluginOverlay extends React.PureComponent {
)
}
{
form.values.endpoint.targetType === SELF_HOSTED &&
form.values.endpoint.type === SELF_HOSTED &&
form.values.endpoint.authType === AUTH_TYPES.OAUTH && (
<React.Fragment>
<Field
Expand Down Expand Up @@ -390,7 +390,7 @@ export default class DeploymentPluginOverlay extends React.PureComponent {
)
}
{
form.values.endpoint.targetType === CAMUNDA_CLOUD && (
form.values.endpoint.type === CAMUNDA_CLOUD && (
<React.Fragment>
<Field
name="endpoint.camundaCloudClusterUrl"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {

import { AUTH_TYPES } from '../shared/ZeebeAuthTypes';

import { CAMUNDA_CLOUD, SELF_HOSTED } from '../shared/ZeebeTargetTypes';
import { CAMUNDA_CLOUD, SELF_HOSTED } from '../shared/ZeebeEndpointTypes';

import pDefer from 'p-defer';

Expand Down Expand Up @@ -96,17 +96,17 @@ export default class DeploymentPluginValidator {
};

validateEndpoint = endpoint => {
const { authType, targetType } = endpoint;
const { authType, type } = endpoint;

let validators = {};

if (targetType === CAMUNDA_CLOUD) {
if (type === CAMUNDA_CLOUD) {
validators = {
camundaCloudClientId: this.validateClientId,
camundaCloudClientSecret: this.validateClientSecret,
camundaCloudClusterUrl: this.validateClusterUrl
};
} else if (targetType === SELF_HOSTED) {
} else if (type === SELF_HOSTED) {
if (endpoint.authType === AUTH_TYPES.NONE) {
validators = {
contactPoint: this.validateZeebeContactPoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { AUTH_TYPES } from '../../shared/ZeebeAuthTypes';
import {
SELF_HOSTED,
CAMUNDA_CLOUD
} from '../../shared/ZeebeTargetTypes';
} from '../../shared/ZeebeEndpointTypes';

describe('<DeploymentPluginModal> (Zeebe)', () => {

Expand Down Expand Up @@ -82,7 +82,7 @@ describe('<DeploymentPluginModal> (Zeebe)', () => {
validator,
config: {
endpoint: {
targetType: CAMUNDA_CLOUD,
type: CAMUNDA_CLOUD,
camundaCloudClusterUrl: '7edda473-891c-4978-aa27-2e727d8560ff.ber-5.zeebe.camunda.io:443'
}
}
Expand Down Expand Up @@ -116,7 +116,7 @@ describe('<DeploymentPluginModal> (Zeebe)', () => {
anchor,
config: {
endpoint: {
targetType: SELF_HOSTED,
type: SELF_HOSTED,
authType: AUTH_TYPES.NONE,
contactPoint: 'https://google.com'
},
Expand All @@ -141,7 +141,7 @@ describe('<DeploymentPluginModal> (Zeebe)', () => {
anchor,
config: {
endpoint: {
targetType: SELF_HOSTED,
type: SELF_HOSTED,
authType: AUTH_TYPES.OAUTH,
contactPoint: 'https://google.com'
},
Expand All @@ -168,7 +168,7 @@ describe('<DeploymentPluginModal> (Zeebe)', () => {
onDeploy,
config: {
endpoint: {
targetType: SELF_HOSTED,
type: SELF_HOSTED,
authType: AUTH_TYPES.NONE,
contactPoint: 'https://google.com',
},
Expand Down Expand Up @@ -200,7 +200,7 @@ describe('<DeploymentPluginModal> (Zeebe)', () => {
onDeploy,
config: {
endpoint: {
targetType: SELF_HOSTED,
type: SELF_HOSTED,
authType: AUTH_TYPES.OAUTH,
contactPoint: 'https://google.com'
},
Expand Down Expand Up @@ -231,7 +231,7 @@ describe('<DeploymentPluginModal> (Zeebe)', () => {
anchor,
config: {
endpoint: {
targetType: CAMUNDA_CLOUD,
type: CAMUNDA_CLOUD,
camundaCloudClusterUrl: '7edda473-891c-4978-aa27-2e727d8560ff.ber-5.zeebe.camunda.io:443'
}
}
Expand All @@ -257,7 +257,7 @@ describe('<DeploymentPluginModal> (Zeebe)', () => {
onDeploy,
config: {
endpoint: {
targetType: SELF_HOSTED,
type: SELF_HOSTED,
authType: AUTH_TYPES.BASIC,
basicAuthUsername: 'username',
basicAuthPassword: 'password'
Expand Down Expand Up @@ -293,7 +293,7 @@ describe('<DeploymentPluginModal> (Zeebe)', () => {
onDeploy,
config: {
endpoint: {
targetType: SELF_HOSTED,
type: SELF_HOSTED,
authType: AUTH_TYPES.OAUTH,
contactPoint: 'https://google.com',
audience: 'audience'
Expand Down Expand Up @@ -325,7 +325,7 @@ describe('<DeploymentPluginModal> (Zeebe)', () => {
onDeploy,
config: {
endpoint: {
targetType: SELF_HOSTED,
type: SELF_HOSTED,
authType: AUTH_TYPES.OAUTH,
contactPoint: 'https://google.com',
audience: 'audience',
Expand Down Expand Up @@ -360,7 +360,7 @@ describe('<DeploymentPluginModal> (Zeebe)', () => {
onDeploy,
config: {
endpoint: {
targetType: CAMUNDA_CLOUD,
type: CAMUNDA_CLOUD,
camundaCloudClusterUrl: '7edda473-891c-4978-aa27-2e727d8560ff.ber-5.zeebe.camunda.io:443'
}
} });
Expand All @@ -387,7 +387,7 @@ describe('<DeploymentPluginModal> (Zeebe)', () => {
onDeploy,
config: {
endpoint: {
targetType: CAMUNDA_CLOUD,
type: CAMUNDA_CLOUD,
camundaCloudClusterUrl: 'https://7edda473-891c-4978-aa27-2e727d8560ff.ber-5.zeebe.camunda.io:443'
}
} });
Expand Down Expand Up @@ -438,7 +438,7 @@ function createConfig({ endpoint = {}, deployment = {} } = {}) {
...deployment
},
endpoint: {
targetType: SELF_HOSTED,
type: SELF_HOSTED,
authType: AUTH_TYPES.NONE,
contactPoint: 'https://google.com',
...endpoint
Expand Down
Loading

0 comments on commit aa5f4d3

Please sign in to comment.