-
+
+
- { errors.endpointUrl && touched.endpointUrl ? (
-
{errors.endpointUrl}
- ) : null}
+ { (deployOpen || values['tenantId']) &&
}
+
-
- Should point to a running Camunda Engine REST API endpoint.
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
- { errors.deploymentName && touched.deploymentName ? (
-
{errors.deploymentName}
- ) : null}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- )}
-
-
-
+
+
+
+ )}
+
+
+
+ );
+ }
+
+}
+
+function FormControl({
+ field,
+ hint,
+ label,
+ validated,
+ autoFocus,
+ form: { touched, errors, submitCount, isSubmitting },
+ ...props
+}) {
+ const { name } = field;
+
+ return (
+
+
+
+
+
+
+
+
+ { errors[name] && touched[name] ? (
+
{errors[name]}
+ ) : null}
+
+ { hint ? (
+
{ hint }
+ ) : null }
+
+
);
-};
+}
function DeployError({ message }) {
return (
@@ -153,4 +229,42 @@ function DeploySuccess({ message }) {
);
}
+function AuthBasic({ validators, ...props }) {
+ return (
+
+
+
+
+
+ );
+}
+
+function AuthBearer({ validators, ...props }) {
+ return (
+
+ );
+}
+
export default View;
diff --git a/client/src/app/modals/deploy-diagram/View.less b/client/src/app/modals/deploy-diagram/View.less
index a959ec5fd..005e2168e 100644
--- a/client/src/app/modals/deploy-diagram/View.less
+++ b/client/src/app/modals/deploy-diagram/View.less
@@ -51,30 +51,53 @@
}
form {
- font-size: 13.3333px;
- margin: 15px 0;
+ font-size: 1.1em;
+
+ fieldset {
+ border: solid 1px #E3E3E3;
+ border-radius: 5px;
+ margin: 20px auto;
+ padding: 15px;
+
+ legend {
+ font-weight: bolder;
+ background: #EEEEEE;
+ border-radius: 5px;
+ padding: 5px 10px;
+ }
+ }
- display: grid;
- grid-template-columns: max-content auto;
+ .fields {
- grid-column-gap: 10px;
- grid-row-gap: 15px;
+ display: grid;
+ grid-template-columns: 85px auto;
- align-items: baseline;
+ grid-column-gap: 10px;
+ grid-row-gap: 15px;
+
+ align-items: baseline;
+ }
.form-submit {
- grid-column-start: 2;
+ text-align: right;
+ }
+
+ .toggle-details {
+ padding: 0;
+ background: none;
+ border: none;
+ margin: auto 0 0 5px;
+ width: 10px;
}
label {
- font-weight: bolder;
- line-height: 30px;
text-align: right;
width: 100%;
display: inline-block;
}
- input {
+ input,
+ select {
width: 100%;
padding: 6px;
@@ -108,7 +131,8 @@
}
button:disabled,
- input:disabled {
+ input:disabled,
+ select:disabled {
color: #808080;
}
diff --git a/client/src/app/modals/deploy-diagram/__tests__/DeployDiagramModalSpec.js b/client/src/app/modals/deploy-diagram/__tests__/DeployDiagramModalSpec.js
index e6db0d29a..7b4959f48 100644
--- a/client/src/app/modals/deploy-diagram/__tests__/DeployDiagramModalSpec.js
+++ b/client/src/app/modals/deploy-diagram/__tests__/DeployDiagramModalSpec.js
@@ -9,6 +9,7 @@ import {
import { DeployDiagramModal } from '..';
import View from '../View';
+import AuthTypes from '../AuthTypes';
const MOCK_ENDPOINT_URL = 'http://example.com/deployment/create';
@@ -337,6 +338,116 @@ describe('
', function() {
});
+ describe('authentication', function() {
+
+ it('should not pass auth option when no auth method was chosen', async function() {
+ // given
+ const endpointUrl = 'http://example.com/',
+ deploymentName = 'deploymentName';
+
+ const onDeployStub = sinon.stub().resolves();
+
+ const wrapper = shallow(
+
+ );
+ const instance = wrapper.instance();
+
+ // when
+ await instance.handleDeploy({
+ endpointUrl,
+ deploymentName
+ }, {
+ setSubmitting: sinon.spy()
+ });
+
+ // expect
+ expect(onDeployStub).to.be.calledOnce;
+
+ const payload = onDeployStub.getCall(0).args[0];
+
+ expect(payload).to.not.have.property('auth');
+ });
+
+
+ it('should pass username and password when authenticating with Basic', async function() {
+ // given
+ const endpointUrl = 'http://example.com/',
+ deploymentName = 'deploymentName',
+ username = 'username',
+ password = 'password',
+ authType = AuthTypes.basic;
+
+ const onDeployStub = sinon.stub().resolves();
+
+ const wrapper = shallow(
+
+ );
+ const instance = wrapper.instance();
+
+ // when
+ await instance.handleDeploy({
+ endpointUrl,
+ deploymentName,
+ username,
+ password,
+ authType
+ }, {
+ setSubmitting: sinon.spy()
+ });
+
+ // expect
+ expect(onDeployStub).to.be.calledOnce;
+
+ const payload = onDeployStub.getCall(0).args[0];
+
+ expect(payload).to.have.property('auth');
+ expect(payload.auth).to.have.property('username').eql(username);
+ expect(payload.auth).to.have.property('password').eql(password);
+ });
+
+
+ it('should pass token when authenticating with Bearer', async function() {
+ // given
+ const endpointUrl = 'http://example.com/',
+ deploymentName = 'deploymentName',
+ bearer = 'bearer',
+ authType = AuthTypes.bearer;
+
+ const onDeployStub = sinon.stub().resolves();
+
+ const wrapper = shallow(
+
+ );
+ const instance = wrapper.instance();
+
+ // when
+ await instance.handleDeploy({
+ endpointUrl,
+ deploymentName,
+ bearer,
+ authType
+ }, {
+ setSubmitting: sinon.spy()
+ });
+
+ // expect
+ expect(onDeployStub).to.be.calledOnce;
+
+ const payload = onDeployStub.getCall(0).args[0];
+
+ expect(payload).to.have.property('auth');
+ expect(payload.auth).to.have.property('bearer').eql(bearer);
+ });
+
+ });
+
+
describe('', function() {
it('should render', function() {
@@ -346,7 +457,7 @@ describe('', function() {
it('should render error message', function() {
// given
- const wrapper = mount();
+ const wrapper = mount();
// then
expect(wrapper.find('.deploy-message.error')).to.have.lengthOf(1);
@@ -357,7 +468,7 @@ describe('', function() {
it('should render success message', function() {
// given
- const wrapper = mount();
+ const wrapper = mount();
// then
expect(wrapper.find('.deploy-message.success')).to.have.lengthOf(1);