From 55af6f42607ebc59defae28d09e42d3a16701d76 Mon Sep 17 00:00:00 2001 From: Maciej Barelkowski Date: Mon, 23 Sep 2019 14:44:57 +0200 Subject: [PATCH] chore(deploy): remove old deployment tool Closes #1488 --- app/lib/deployer.js | 178 ----- app/lib/index.js | 44 +- app/test/helper/mock/fetch.js | 20 - app/test/helper/mock/form-data.js | 19 - app/test/helper/mock/fs.js | 13 - app/test/spec/deployer-spec.js | 381 ---------- client/src/app/App.js | 30 - client/src/app/AppParent.js | 3 - client/src/app/__tests__/AppSpec.js | 96 --- .../app/modals/deploy-diagram/AuthTypes.js | 17 - .../deploy-diagram/DeployDiagramModal.js | 255 ------- client/src/app/modals/deploy-diagram/View.js | 307 -------- .../src/app/modals/deploy-diagram/View.less | 144 ---- .../__tests__/DeployDiagramModalSpec.js | 664 ------------------ .../getCamundaBpmErrorMessage.js | 20 - .../error-messages/getNetworkErrorMessage.js | 23 - .../getStatusCodeErrorMessage.js | 33 - .../deploy-diagram/error-messages/index.js | 19 - .../app/modals/deploy-diagram/getEditMenu.js | 42 -- client/src/app/modals/deploy-diagram/index.js | 11 - client/src/app/modals/index.js | 1 - client/src/app/tabs/bpmn/BpmnEditor.js | 9 - client/src/app/tabs/dmn/DmnEditor.js | 13 - .../plugins/deployment-tool/DeploymentTool.js | 2 +- 24 files changed, 6 insertions(+), 2338 deletions(-) delete mode 100644 app/lib/deployer.js delete mode 100644 app/test/helper/mock/fetch.js delete mode 100644 app/test/helper/mock/form-data.js delete mode 100644 app/test/helper/mock/fs.js delete mode 100644 app/test/spec/deployer-spec.js delete mode 100644 client/src/app/modals/deploy-diagram/AuthTypes.js delete mode 100644 client/src/app/modals/deploy-diagram/DeployDiagramModal.js delete mode 100644 client/src/app/modals/deploy-diagram/View.js delete mode 100644 client/src/app/modals/deploy-diagram/View.less delete mode 100644 client/src/app/modals/deploy-diagram/__tests__/DeployDiagramModalSpec.js delete mode 100644 client/src/app/modals/deploy-diagram/error-messages/getCamundaBpmErrorMessage.js delete mode 100644 client/src/app/modals/deploy-diagram/error-messages/getNetworkErrorMessage.js delete mode 100644 client/src/app/modals/deploy-diagram/error-messages/getStatusCodeErrorMessage.js delete mode 100644 client/src/app/modals/deploy-diagram/error-messages/index.js delete mode 100644 client/src/app/modals/deploy-diagram/getEditMenu.js delete mode 100644 client/src/app/modals/deploy-diagram/index.js diff --git a/app/lib/deployer.js b/app/lib/deployer.js deleted file mode 100644 index bd2c53d307..0000000000 --- a/app/lib/deployer.js +++ /dev/null @@ -1,178 +0,0 @@ -/** - * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH - * under one or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information regarding copyright - * ownership. - * - * Camunda licenses this file to you under the MIT; you may not use this file - * except in compliance with the MIT License. - */ - -'use strict'; - -class Deployer { - constructor({ fetch, fs, FormData }) { - this.fetch = fetch; - this.fs = fs; - this.formDataConstructor = FormData; - } - - /** - * Deploy diagram to the given endpoint URL. - */ - async deploy(url, options, cb = noop) { - try { - this.validateDeployParams(url, options); - - const requestParams = this.getRequestParams(options); - - const serverResponse = await this.fetch(url, requestParams); - - if (!serverResponse.ok) { - const error = await getErrorFromResponse(serverResponse); - throw error; - } - - let response; - - try { - response = await serverResponse.json(); - } catch (error) { - response = serverResponse.statusText; - } - - return cb(null, response); - } catch (error) { - error.deploymentName = options.deploymentName; - - return cb(error); - } - } - - validateDeployParams(url, { deploymentName, file }) { - if (!deploymentName) { - throw new Error('Failed to deploy process, deployment name must be provided.'); - } - - if (!file || !file.name || !file.path) { - throw new Error('Failed to deploy process, file name and path must be provided.'); - } - - if (!url) { - throw new Error('Failed to deploy process, endpoint url must not be empty.'); - } - } - - getRequestParams(options) { - const body = this.getBody(options); - const headers = this.getHeaders(options); - - return { - body, - headers, - method: 'POST' - }; - } - - getBody({ deploymentName, tenantId, file = {} }) { - const form = this.getFormData(); - - form.append('deployment-name', deploymentName); - - if (tenantId) { - form.append('tenant-id', tenantId); - } - - form.append('deployment-source', 'Camunda Modeler'); - - form.append('deploy-changed-only', 'true'); - - form.append(file.name, this.fs.createReadStream(file.path)); - - return form; - } - - getHeaders({ auth }) { - const headers = {}; - - if (auth) { - headers['Authorization'] = this.getAuthHeader(auth); - } - - return headers; - } - - getAuthHeader(auth) { - const authHeaderBuilder = new AuthHeaderBuilder(auth); - - return authHeaderBuilder.build(); - } - - getFormData() { - return new this.formDataConstructor(); - } -} - - -module.exports = Deployer; - - - -// helpers ////// -class AuthHeaderBuilder { - constructor(options) { - this.options = options; - } - - build() { - const { - bearer, - password, - username - } = this.options; - - if (bearer) { - return this.getBearerHeader(bearer); - } - - if (username && password) { - return this.getBasicHeader(username, password); - } - - throw new Error('Unknown auth options.'); - } - - getBearerHeader(bearer) { - return `Bearer ${bearer}`; - } - - getBasicHeader(username, password) { - const credentials = btoa(`${username}:${password}`); - - return `Basic ${credentials}`; - } -} - -function btoa(input) { - return Buffer.from(input, 'utf8').toString('base64'); -} - -function noop() { } - - -async function getErrorFromResponse(response) { - const error = new Error(); - - try { - const body = await response.json(); - error.message = body.message; - } catch (_) { - error.message = response.statusText; - } - - error.status = response.status; - error.statusText = response.statusText; - error.url = response.url; - - return error; -} diff --git a/app/lib/index.js b/app/lib/index.js index 9a6f63286a..a1479614aa 100644 --- a/app/lib/index.js +++ b/app/lib/index.js @@ -17,10 +17,6 @@ const { const path = require('path'); -const fetch = require('node-fetch'); -const fs = require('fs'); -const FormData = require('form-data'); - /** * Report crashes. * @@ -31,7 +27,6 @@ const FormData = require('form-data'); const Cli = require('./cli'); const Config = require('./config'); -const Deployer = require('./deployer'); const Dialog = require('./dialog'); const Flags = require('./flags'); const Log = require('./log'); @@ -67,7 +62,6 @@ const { const { config, - deployer, dialog, files, flags, @@ -168,11 +162,6 @@ renderer.on('dialog:show', async function(options, done) { done(null, response); }); -// deploying ////////// -// TODO: remove and add as plugin instead - -renderer.on('deploy', handleDeployment); - // filesystem ////////// renderer.on('file:read', function(filePath, options = {}, done) { @@ -460,21 +449,6 @@ app.on('ready', function() { }); -function handleDeployment(data, done) { - const { endpointUrl } = data; - - deployer.deploy(endpointUrl, data, function(error, result) { - - if (error) { - log.error('failed to deploy', error); - - return done(error); - } - - done(null, result); - }); -} - function bootstrapLogging() { let logPath; @@ -531,35 +505,28 @@ function bootstrap() { userPath }); - // (2) deployer - const deployer = new Deployer({ - fetch, - FormData, - fs - }); - - // (3) flags + // (2) flags const flags = new Flags({ paths: resourcesPaths, overrides: flagOverrides }); - // (4) menu + // (3) menu const menu = new Menu({ platform }); - // (5) dialog + // (4) dialog const dialog = new Dialog({ config, electronDialog, userDesktopPath }); - // (6) workspace + // (5) workspace new Workspace(config); - // (7) plugins + // (6) plugins const pluginsDisabled = flags.get('disable-plugins'); let paths; @@ -582,7 +549,6 @@ function bootstrap() { return { config, - deployer, dialog, files, flags, diff --git a/app/test/helper/mock/fetch.js b/app/test/helper/mock/fetch.js deleted file mode 100644 index fd07477ba2..0000000000 --- a/app/test/helper/mock/fetch.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH - * under one or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information regarding copyright - * ownership. - * - * Camunda licenses this file to you under the MIT; you may not use this file - * except in compliance with the MIT License. - */ - -var RESPONSE_OK = { mocked: true }; - -module.exports = function(url, options) { - return Promise.resolve({ - ok: true, - json: () => Promise.resolve(RESPONSE_OK) - }); -}; - -module.exports.RESPONSE_OK = RESPONSE_OK; \ No newline at end of file diff --git a/app/test/helper/mock/form-data.js b/app/test/helper/mock/form-data.js deleted file mode 100644 index ca55f34f9f..0000000000 --- a/app/test/helper/mock/form-data.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH - * under one or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information regarding copyright - * ownership. - * - * Camunda licenses this file to you under the MIT; you may not use this file - * except in compliance with the MIT License. - */ - -function FormData() { - this.data = {}; -} - -FormData.prototype.append = function(key, value) { - this[key] = value; -}; - -module.exports = FormData; \ No newline at end of file diff --git a/app/test/helper/mock/fs.js b/app/test/helper/mock/fs.js deleted file mode 100644 index b38b54962d..0000000000 --- a/app/test/helper/mock/fs.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH - * under one or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information regarding copyright - * ownership. - * - * Camunda licenses this file to you under the MIT; you may not use this file - * except in compliance with the MIT License. - */ - -module.exports = { - createReadStream: () => '' -}; \ No newline at end of file diff --git a/app/test/spec/deployer-spec.js b/app/test/spec/deployer-spec.js deleted file mode 100644 index d5e79d0562..0000000000 --- a/app/test/spec/deployer-spec.js +++ /dev/null @@ -1,381 +0,0 @@ -/** - * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH - * under one or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information regarding copyright - * ownership. - * - * Camunda licenses this file to you under the MIT; you may not use this file - * except in compliance with the MIT License. - */ - -'use strict'; - -const sinon = require('sinon'); - -const Deployer = require('../../lib/deployer'); - -const fetch = require('../helper/mock/fetch'), - fs = require('../helper/mock/fs'), - FormData = require('../helper/mock/form-data'); - - -describe('Deployer', function() { - - let fetchSpy; - - beforeEach(() => { - fetchSpy = sinon.spy(fetch); - }); - - afterEach(sinon.restore); - - - it('should deploy with provided parameters', async function() { - - // given - const deployer = createDeployer(fetchSpy); - - const data = getDeploymentData({ tenantId: 'someTenantId' }); - - const url = 'some/url'; - - const expectedForm = new FormData(); - - expectedForm.append(data.file.name, fs.createReadStream(data.file.path)); - - expectedForm.append('deployment-name', data.deploymentName); - expectedForm.append('deploy-changed-only', 'true'); - expectedForm.append('deployment-source', 'Camunda Modeler'); - expectedForm.append('tenant-id', data.tenantId); - - // when - await deployer.deploy(url, data, (err, data) => { - - // then - expect(err).not.to.exist; - expect(data).to.eql(fetch.RESPONSE_OK); - }); - - // then - expect(fetchSpy).to.have.been.calledOnce; - - const [ usedUrl, requestParams ] = fetchSpy.getCall(0).args; - - expect(usedUrl).to.eql(url); - expect(requestParams).to.deep.contain({ - body: expectedForm, - method: 'POST' - }); - - }); - - - it('should deploy even without tenant id provided', async function() { - - // given - const deployer = createDeployer(fetchSpy); - - const data = getDeploymentData(); - - const url = 'some/url'; - - const expectedForm = new FormData(); - - expectedForm.append(data.file.name, fs.createReadStream(data.file.path)); - - expectedForm.append('deployment-name', data.deploymentName); - expectedForm.append('deploy-changed-only', 'true'); - expectedForm.append('deployment-source', 'Camunda Modeler'); - - // when - await deployer.deploy(url, data, (err, data) => { - - // then - expect(err).not.to.exist; - expect(data).to.eql(fetch.RESPONSE_OK); - }); - - // then - expect(fetchSpy).to.have.been.calledOnce; - - const [ usedUrl, requestParams ] = fetchSpy.getCall(0).args; - - expect(usedUrl).to.eql(url); - expect(requestParams).to.deep.contain({ - body: expectedForm, - method: 'POST' - }); - - }); - - - it('should NOT throw error when response is OK but not a JSON', function(done) { - - // given - const okResponse = 'OK'; - - function fetchResolvingToText() { - return Promise.resolve({ - ok: true, - statusText: okResponse, - json() { - return Promise.reject(new Error('fail on json parse')); - } - }); - } - - // given - const deployer = createDeployer(fetchResolvingToText); - - const data = getDeploymentData(); - - // when - deployer.deploy('some/url', data, (err, data) => { - - // then - expect(err).to.not.exist; - expect(data).to.eql(okResponse); - - done(); - }); - }); - - - it('should handle fetch error', function(done) { - - // given - const fetchError = 'FETCH_ERROR'; - - function failingFetch() { - return Promise.reject(new Error(fetchError)); - } - - // given - const deployer = createDeployer(failingFetch); - - const data = getDeploymentData(); - - // when - deployer.deploy('some/url', data, (err, data) => { - - // then - expect(err).to.exist; - expect(err.message).to.eql(fetchError); - - expect(data).not.to.exist; - - done(); - }); - }); - - - it('should return error with proper code for backend error', function(done) { - - // given - const errorStatus = 500, - errorStatusText = 'INTERNAL SERVER ERROR'; - - function failingFetch() { - return Promise.resolve({ - ok: false, - status: errorStatus, - statusText: errorStatusText, - json() { - return Promise.reject(new Error('fail on json parse')); - } - }); - } - - // given - const deployer = createDeployer(failingFetch); - - const data = getDeploymentData(); - - // when - deployer.deploy('some/url', data, (err, data) => { - - // then - expect(err).to.exist; - expect(err.status).to.eql(errorStatus); - - expect(data).not.to.exist; - - done(); - }); - - - it('should attach deployment name to error', function(done) { - - // given - const deploymentName = 'deploymentName'; - - function failingFetch() { - return Promise.reject(new Error()); - } - - const deploy = createDeployer(failingFetch); - - const data = getDeploymentData({ deploymentName }); - - // when - deploy('some/url', data, (err, data) => { - - // then - expect(err).to.exist; - expect(err.deploymentName).to.eql(deploymentName); - - expect(data).not.to.exist; - - done(); - }); - }); - }); - - - describe('authentication', function() { - - it('should deploy without auth', async function() { - - // given - const deployer = createDeployer(fetchSpy); - - const data = getDeploymentData({ tenantId: 'someTenantId' }); - - const url = 'some/url'; - - // when - await deployer.deploy(url, data); - - // then - expect(fetchSpy).to.be.calledOnce; - - const requestParams = fetchSpy.getCall(0).args[1]; - - expect(requestParams).to.satisfy(function(params) { - return !params.headers || !params.headers.Authorization; - }); - - }); - - - it('should throw error for unknown auth', async function() { - - // given - const deployer = createDeployer(fetchSpy); - - const data = getDeploymentData({ - tenantId: 'someTenantId', - auth: {} - }); - - const url = 'some/url'; - - // when - await deployer.deploy(url, data, (err, data) => { - - // then - expect(err).to.exist; - expect(data).not.to.exist; - }); - - expect(fetchSpy).to.not.be.called; - - }); - - - it('should deploy with basic auth', async function() { - - // given - const username = 'username', - password = 'password', - credentials = btoa(`${username}:${password}`), - basicHeader = `Basic ${credentials}`; - - const deployer = createDeployer(fetchSpy); - - const data = getDeploymentData({ - tenantId: 'someTenantId', - auth: { - username, - password - } - }); - - const url = 'some/url'; - - // when - await deployer.deploy(url, data); - - // then - expect(fetchSpy).to.be.calledOnce; - - const requestParams = fetchSpy.getCall(0).args[1]; - - expect(requestParams).to.have.property('headers') - .which.has.property('Authorization').eql(basicHeader); - - }); - - - it('should deploy with bearer token', async function() { - - // given - const bearerToken = 'bearerToken', - bearerHeader = `Bearer ${bearerToken}`; - - const deployer = createDeployer(fetchSpy); - - const data = getDeploymentData({ - tenantId: 'someTenantId', - auth: { - bearer: bearerToken - } - }); - - const url = 'some/url'; - - // when - await deployer.deploy(url, data); - - // then - expect(fetchSpy).to.be.calledOnce; - - const requestParams = fetchSpy.getCall(0).args[1]; - - expect(requestParams).to.have.property('headers') - .which.has.property('Authorization').eql(bearerHeader); - - }); - - }); - -}); - - - -// helpers ///////// -function createDeployer(fetch) { - return new Deployer({ - fetch, - fs, - FormData - }); -} - -function getDeploymentData(options = {}) { - return Object.assign({ - deploymentName: 'some deployment name', - file: { - name: 'some name', - path: 'some/path' - } - }, options); -} - -/** - * @returns {string} base64 encoded content - * @param {string} text - */ -function btoa(text) { - return Buffer.from(text, 'utf8').toString('base64'); -} diff --git a/client/src/app/App.js b/client/src/app/App.js index 24341f4b5c..192744f578 100644 --- a/client/src/app/App.js +++ b/client/src/app/App.js @@ -41,7 +41,6 @@ import Log from './Log'; import { - DeployDiagramModal, KeyboardShortcutsModal } from './modals'; @@ -1652,24 +1651,6 @@ export class App extends PureComponent { setModal = currentModal => this.setState({ currentModal }); - setEndpoints = endpoints => this.setState({ endpoints }); - - handleDeploy = async (options) => { - await this.triggerAction('save'); - - const { file } = this.state.activeTab; - - if (!file || !file.path) { - return false; - } - - return this.getGlobal('backend').send('deploy', { ...options, file }); - }; - - handleDeployError = (error) => { - this.logEntry(`Deploy error: ${JSON.stringify(error)}`, 'deploy-error'); - } - handleCloseTab = (tab) => { this.triggerAction('close-tab', { tabId: tab.id }).catch(console.error); } @@ -1909,17 +1890,6 @@ export class App extends PureComponent { - { this.state.currentModal === 'DEPLOY_DIAGRAM' ? - : null } - { this.state.currentModal === 'KEYBOARD_SHORTCUTS' ? batch restore workspace files + files opened // via command line diff --git a/client/src/app/__tests__/AppSpec.js b/client/src/app/__tests__/AppSpec.js index 75119afbeb..a738100ccc 100644 --- a/client/src/app/__tests__/AppSpec.js +++ b/client/src/app/__tests__/AppSpec.js @@ -2203,102 +2203,6 @@ describe('', function() { }); - describe('deployment handling', function() { - - afterEach(sinon.restore); - - - it('should handle deployment', async function() { - - // given - const sendSpy = spy(); - - const backend = new Backend({ - send: sendSpy - }); - - const { app } = createApp({ - globals: { - backend - } - }); - - const file = createFile('1.bpmn'); - await app.openFiles([ file ]); - - const saveStub = sinon.stub(app, 'saveTab').resolves(); - - // when - await app.handleDeploy({}); - - // then - expect(saveStub).to.be.calledOnce; - expect(sendSpy).to.be.calledOnceWith('deploy', { file }); - }); - - - it('should save tab before deployment', async function() { - - // given - const fakeFile = createFile('saved.bpmn'); - const sendSpy = spy(); - - const backend = new Backend({ - send: sendSpy - }); - - const { app } = createApp({ - globals: { - backend - } - }); - - const saveStub = sinon.stub(app, 'saveTab').callsFake(() => { - app.tabSaved(app.state.activeTab, fakeFile); - - return Promise.resolve(); - }); - - // when - await app.createDiagram(); - await app.handleDeploy({}); - - // then - expect(saveStub).to.be.calledOnce; - expect(sendSpy).to.be.calledOnce; - }); - - - it('should throw error when tab is not saved before deployment', async function() { - - // given - const sendSpy = spy(); - - const backend = new Backend({ - send: sendSpy - }); - - const { app } = createApp({ - globals: { - backend - } - }); - - const saveStub = sinon.stub(app, 'saveTab').resolves(); - - - // when - await app.createDiagram(); - await app.handleDeploy({}); - - // then - expect(saveStub).to.be.calledOnce; - expect(sendSpy).to.not.be.called; - }); - - }); - - describe('#getConfig', function() { afterEach(sinon.restore); diff --git a/client/src/app/modals/deploy-diagram/AuthTypes.js b/client/src/app/modals/deploy-diagram/AuthTypes.js deleted file mode 100644 index 7c2ed30eb0..0000000000 --- a/client/src/app/modals/deploy-diagram/AuthTypes.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH - * under one or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information regarding copyright - * ownership. - * - * Camunda licenses this file to you under the MIT; you may not use this file - * except in compliance with the MIT License. - */ - -const AuthTypes = { - none: 'none', - basic: 'basic', - bearer: 'bearer' -}; - -export default AuthTypes; diff --git a/client/src/app/modals/deploy-diagram/DeployDiagramModal.js b/client/src/app/modals/deploy-diagram/DeployDiagramModal.js deleted file mode 100644 index f35392b8f4..0000000000 --- a/client/src/app/modals/deploy-diagram/DeployDiagramModal.js +++ /dev/null @@ -1,255 +0,0 @@ -/** - * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH - * under one or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information regarding copyright - * ownership. - * - * Camunda licenses this file to you under the MIT; you may not use this file - * except in compliance with the MIT License. - */ - -import React, { PureComponent } from 'react'; - -import View from './View'; -import AuthTypes from './AuthTypes'; - -import errorMessageFunctions from './error-messages'; -import getEditMenu from './getEditMenu'; - - -const ENDPOINT_URL_PATTERN = /^https?:\/\/.+/; - -const ENDPOINT_URL_SUFFIX = '/deployment/create'; - - -const defaultState = { - success: '', - error: '' -}; - -const initialFormValues = { - endpointUrl: 'http://localhost:8080/engine-rest', - tenantId: '', - deploymentName: 'diagram', - authType: 'none', - username: '', - password: '', - bearer: '' -}; - - -class DeployDiagramModal extends PureComponent { - constructor(props) { - super(props); - - this.state = defaultState; - } - - componentDidMount() { - this.updateMenu(); - } - - handleDeploy = async (values, { setSubmitting }) => { - const payload = this.getDeploymentPayload(values); - - this.saveEndpoint(values.endpointUrl); - - try { - const deployResult = await this.props.onDeploy(payload); - - if (!deployResult) { - setSubmitting(false); - - return; - } - - this.setState({ - success: `Successfully deployed diagram to ${payload.endpointUrl}`, - error: '' - }); - } catch (error) { - this.props.onDeployError(error); - const errorMessage = this.getErrorMessage(error); - - this.setState({ - success: '', - error: errorMessage - }); - } - - setSubmitting(false); - } - - handleFocusChange = event => { - const isFocusedOnInput = this.isFocusedOnInput(event); - - this.updateMenu(isFocusedOnInput); - } - - validateEndpointUrl = url => { - if (!url.length) { - return 'Endpoint URL must not be void.'; - } - - if (!ENDPOINT_URL_PATTERN.test(url)) { - return 'Endpoint URL must start with "http://" or "https://".'; - } - } - - validateDeploymentName = name => { - if (!name.length) { - return 'Deployment name must not be void.'; - } - } - - validateUsername = username => { - if (!username.length) { - return 'Username must not be void.'; - } - } - - validatePassword = password => { - if (!password.length) { - return 'Password must not be void.'; - } - } - - validateBearer = bearer => { - if (!bearer.length) { - return 'Token must not be void.'; - } - } - - render() { - const { - endpoints, - tab - } = this.props; - - const deploymentName = tab.name ? withoutExtension(tab.name) : initialFormValues.deploymentName; - - const validators = { - endpointUrl: this.validateEndpointUrl, - deploymentName: this.validateDeploymentName, - username: this.validateUsername, - password: this.validatePassword, - bearer: this.validateBearer - }; - - return ; - } - - updateMenu(enabled = false) { - const editMenu = getEditMenu(enabled); - - this.props.onMenuUpdate({ editMenu }); - } - - saveEndpoint(endpointUrl) { - this.props.onEndpointsUpdate([ endpointUrl ]); - } - - getDeploymentPayload(values) { - const endpointUrl = this.getSanitizedEndpointUrl(values.endpointUrl); - - const payload = { - endpointUrl, - deploymentName: values.deploymentName, - tenantId: values.tenantId - }; - - const auth = this.getAuth(values); - - if (auth) { - payload.auth = auth; - } - - return payload; - } - - /** - * Appends `/deployment/create` at the end of the url if necessary - * @param {string} url - */ - getSanitizedEndpointUrl(url) { - if (url[url.length - 1] === '/') { - url = url.slice(0, -1); - } - - if (url.search(`${ENDPOINT_URL_SUFFIX}$`) === -1) { - return `${url}${ENDPOINT_URL_SUFFIX}`; - } - - return url; - } - - getAuth({ authType, username, password, bearer }) { - switch (authType) { - case AuthTypes.basic: - return { - username, - password - }; - case AuthTypes.bearer: { - return { - bearer - }; - } - } - } - - getErrorMessage(error) { - for (const getMessage of errorMessageFunctions) { - const errorMessage = getMessage(error); - - if (errorMessage) { - return errorMessage; - } - } - - return 'Unknown error occurred. Check log for details.'; - } - - /** - * @param {FocusEvent} event - * @returns {Boolean} - */ - isFocusedOnInput(event) { - return event.type === 'focus' && ['INPUT', 'TEXTAREA'].includes(event.target.tagName); - } -} - -DeployDiagramModal.defaultProps = { - endpoints: [], - tab: {}, - onEndpointsUpdate: () => {}, - onDeployError: console.error, - onMenuUpdate: () => {} -}; - -export default DeployDiagramModal; - - - -// helper //// -/** - * Remove extension from filename - * @param {string} filename - */ -function withoutExtension(filename) { - return filename.replace(/^(.+)\.[^.]*$/, '$1'); -} diff --git a/client/src/app/modals/deploy-diagram/View.js b/client/src/app/modals/deploy-diagram/View.js deleted file mode 100644 index 9a214f5a92..0000000000 --- a/client/src/app/modals/deploy-diagram/View.js +++ /dev/null @@ -1,307 +0,0 @@ -/** - * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH - * under one or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information regarding copyright - * ownership. - * - * Camunda licenses this file to you under the MIT; you may not use this file - * except in compliance with the MIT License. - */ - -import React, { PureComponent } from 'react'; - -import classnames from 'classnames'; - -import { - Formik, - Form, - Field -} from 'formik'; - -import { - Icon, - Modal -} from '../../primitives'; - -import AuthTypes from './AuthTypes'; - -import css from './View.less'; - - -const SUCCESS_HEADING = 'Deployment successful'; -const ERROR_HEADING = 'Deployment failed'; - - -class View extends PureComponent { - - constructor(props) { - super(props); - - this.state = {}; - } - - toggleDetails = () => { - this.setState({ - deployOpen: !this.state.deployOpen - }); - } - - render() { - const { - error, - success, - initialValues, - onClose, - onDeploy, - validators, - onFocusChange = noop - } = this.props; - - const deployOpen = this.state.deployOpen; - - return ( - -

Deploy Diagram

- -

- Specify deployment details and deploy this diagram to Camunda. -

- - - - {({ isSubmitting, values }) => ( - - - { isSubmitting && } - - { success && } - - { error && } - -
- -
- - - Deployment Details - - - -
- - - { (deployOpen || values['tenantId']) && } -
- -
- -
- - Endpoint Configuration - -
- - -
- -
- -
- - - - - -
- - { values.authType === AuthTypes.basic && ( - ) } - - { values.authType === AuthTypes.bearer && ( - ) } -
-
- -
- - - -
-
- -
- )} -
- -
- ); - } - -} - -function FormControl({ - field, - hint, - label, - onFocusChange, - validated, - form: { touched, errors, isSubmitting, submitCount }, - ...props -}) { - const { name } = field; - - return ( - -
- -
- -
- - - { errors[name] && touched[name] && submitCount ? ( -
{errors[name]}
- ) : null} - - { hint ? ( -
{ hint }
- ) : null } -
-
- ); -} - -function DeployError({ message }) { - return ( -
-

- { ERROR_HEADING } -

-

- { message } -

-
- ); -} - -function DeploySuccess({ message }) { - return ( -
-

- { SUCCESS_HEADING } -

-

- { message } -

-
- ); -} - -function AuthBasic({ onFocusChange, validators, ...props }) { - return ( - - - - - - ); -} - -function AuthBearer({ onFocusChange, validators, ...props }) { - return ( - - ); -} - -export default View; - - - -// helpers ////// -function compose(...handlers) { - return function(...args) { - handlers.forEach(handler => handler(...args)); - }; -} - -function noop() {} diff --git a/client/src/app/modals/deploy-diagram/View.less b/client/src/app/modals/deploy-diagram/View.less deleted file mode 100644 index 60951fbf19..0000000000 --- a/client/src/app/modals/deploy-diagram/View.less +++ /dev/null @@ -1,144 +0,0 @@ -:local(.View) { - user-select: none; - - h2 { - font-weight: normal; - } - - .intro { - margin-bottom: 30px; - } - - .loading { - animation: spin 2s infinite linear; - display: inline-block; - - @keyframes spin { - 0% { - transform: rotate(0deg); - } - - 100% { - transform: rotate(359deg); - } - } - } - - .deploy-message { - border: solid 1px; - border-radius: 4px; - padding: 8px 10px; - - p { - margin: .5em; - } - - &.success { - color: #155724; - background-color: #d4edda; - border-color: #c3e6cb; - } - - &.error { - color: #721c24; - background-color: #f8d7da; - border-color: #f5c6cb; - } - } - - form { - 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; - } - } - - .fields { - - display: grid; - grid-template-columns: 85px auto; - - grid-column-gap: 10px; - grid-row-gap: 15px; - - align-items: baseline; - } - - .form-submit { - text-align: right; - } - - .toggle-details { - padding: 0; - background: none; - border: none; - margin: auto 0 0 5px; - width: 10px; - } - - label { - text-align: right; - width: 100%; - display: inline-block; - } - - input, - select { - width: 100%; - padding: 6px; - - font-size: inherit; - - border: 1px solid rgb(204, 204, 204); - } - - input.valid { - &:not(:focus) { - border: 1px solid rgb(82, 178, 21); - } - - outline-color: rgb(82, 178, 21); - } - - input.invalid { - &:not(:focus) { - border: 1px solid rgb(255, 0, 0); - } - - outline-color: rgb(255, 0, 0); - } - - button + button { - margin-left: 10px; - } - - button { - padding: 6px 10px; - } - - button:disabled, - input:disabled, - select:disabled { - color: #808080; - } - - .hint { - margin-top: 5px; - color: rgb(102, 102, 102); - } - - .hint.error { - color: #ff0000; - } - } -} diff --git a/client/src/app/modals/deploy-diagram/__tests__/DeployDiagramModalSpec.js b/client/src/app/modals/deploy-diagram/__tests__/DeployDiagramModalSpec.js deleted file mode 100644 index 66978c9bab..0000000000 --- a/client/src/app/modals/deploy-diagram/__tests__/DeployDiagramModalSpec.js +++ /dev/null @@ -1,664 +0,0 @@ -/** - * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH - * under one or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information regarding copyright - * ownership. - * - * Camunda licenses this file to you under the MIT; you may not use this file - * except in compliance with the MIT License. - */ - -/* global sinon */ - -import React from 'react'; - -import { - mount, - shallow -} from 'enzyme'; - -import { DeployDiagramModal } from '..'; -import View from '../View'; -import AuthTypes from '../AuthTypes'; - -const MOCK_ENDPOINT_URL = 'http://example.com/deployment/create'; -const DEFAULT_ENDPOINT = 'http://localhost:8080/engine-rest'; - - -describe('', function() { - - it('should render', function() { - shallow(); - }); - - - describe('deployment', function() { - - it('should set state.error when onDeploy throws error', async function() { - - // given - const endpointUrl = MOCK_ENDPOINT_URL, - deploymentName = 'deploymentName'; - - const onDeployStub = sinon.stub().rejects(new Error('errorMessage')); - const setSubmittingSpy = sinon.spy(); - - const wrapper = shallow(); - const instance = wrapper.instance(); - - // when - await instance.handleDeploy({ - endpointUrl, - deploymentName - }, { - setSubmitting: setSubmittingSpy - }); - - // expect - expect(instance.state.error).to.be.a('string').not.eql(''); - expect(instance.state.success).to.eql(''); - expect(setSubmittingSpy).to.be.calledOnceWithExactly(false); - }); - - - it('should set state.success when onDeploy succeeds', async function() { - - // given - const endpointUrl = MOCK_ENDPOINT_URL, - deploymentName = 'deploymentName'; - - const onDeployStub = sinon.stub().resolves(true); - const setSubmittingSpy = sinon.spy(); - - const wrapper = shallow(); - const instance = wrapper.instance(); - - // when - await instance.handleDeploy({ - endpointUrl, - deploymentName - }, { - setSubmitting: setSubmittingSpy - }); - - // expect - expect(instance.state.success).to.be.a('string').not.eql(''); - expect(instance.state.error).to.eql(''); - expect(setSubmittingSpy).to.be.calledOnceWithExactly(false); - }); - - - it('should unset isLoading when deployment is canceled', async function() { - - // given - const endpointUrl = MOCK_ENDPOINT_URL, - deploymentName = 'deploymentName'; - - const onDeployStub = sinon.stub().resolves(false); - const setSubmittingSpy = sinon.spy(); - - const wrapper = shallow(); - const instance = wrapper.instance(); - - // when - await instance.handleDeploy({ - endpointUrl, - deploymentName - }, { - setSubmitting: setSubmittingSpy - }); - - // expect - expect(instance.state.success).to.eql(''); - expect(instance.state.error).to.eql(''); - expect(setSubmittingSpy).to.be.calledOnceWithExactly(false); - }); - - - it('should save endpoint used to deploy', async function() { - - // given - const endpointUrl = MOCK_ENDPOINT_URL, - deploymentName = 'deploymentName'; - - const onDeployStub = sinon.stub().resolves(); - const onEndpointsUpdateSpy = sinon.spy(); - - const wrapper = shallow( - - ); - const instance = wrapper.instance(); - - // when - await instance.handleDeploy({ - endpointUrl, - deploymentName - }, { - setSubmitting: sinon.spy() - }); - - // expect - expect(onEndpointsUpdateSpy).to.be.calledWith([ endpointUrl ]); - }); - - - it('should save exactly the endpoint provided by the user', async function() { - - // given - const endpointUrl = 'http://example.com', - deploymentName = 'deploymentName'; - - const onDeployStub = sinon.stub().resolves(); - const onEndpointsUpdateSpy = sinon.spy(); - - const wrapper = shallow( - - ); - const instance = wrapper.instance(); - - // when - await instance.handleDeploy({ - endpointUrl, - deploymentName - }, { - setSubmitting: sinon.spy() - }); - - // expect - expect(onEndpointsUpdateSpy).to.be.calledWith([ endpointUrl ]); - }); - - }); - - - describe('defaults', function() { - - it('should set deployment name based on filename', function() { - - // given - const wrapper = shallow(); - - // expect - expect(wrapper.find(View).prop('initialValues')).to.have.property('deploymentName').eql('simple.diagram'); - }); - - - it('should set deployment name based on filename for hidden files', function() { - - // given - const wrapper = shallow(); - - // expect - expect(wrapper.find(View).prop('initialValues')).to.have.property('deploymentName').eql('.bpmn'); - }); - - - it(`should set endpointUrl to ${DEFAULT_ENDPOINT} when none is provided`, function() { - - // given - const wrapper = shallow(); - - // expect - expect(wrapper.find(View).prop('initialValues')).to.have.property('endpointUrl').eql(DEFAULT_ENDPOINT); - }); - - }); - - - describe('reusing endpoint url', function() { - - it('should set endpointUrl to last one provided in props', function() { - - // given - const endpointUrl = MOCK_ENDPOINT_URL; - - // when - const wrapper = shallow(); - - // expect - expect(wrapper.find(View).prop('initialValues')).to.have.property('endpointUrl').eql(endpointUrl); - }); - }); - - - describe('endpoint URL suffix', function() { - - it('should add "/deployment/create" suffix if user does not provide it', async function() { - - // given - const endpointUrl = 'http://example.com', - deploymentName = 'deploymentName', - expectedEndpointUrl = `${endpointUrl}/deployment/create`; - - 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.have.property('endpointUrl').eql(expectedEndpointUrl); - }); - - - it('should not add excessive "/" before "/deployment/create" suffix', async function() { - - // given - const endpointUrl = 'http://example.com/', - deploymentName = 'deploymentName', - expectedEndpointUrl = `${endpointUrl}deployment/create`; - - 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.have.property('endpointUrl').eql(expectedEndpointUrl); - }); - - }); - - - describe('form validation', function() { - - let wrapper, - instance; - - beforeEach(function() { - wrapper = shallow(); - instance = wrapper.instance(); - }); - - - describe('endpointUrl', function() { - - it('should not accept void endpoint url', function() { - - // given - const endpointUrl = ''; - - // then - expect(instance.validateEndpointUrl(endpointUrl)).to.not.be.undefined; - }); - - - it('should not accept endpoint url without protocol', function() { - - // given - const endpointUrl = 'localhost'; - - // then - expect(instance.validateEndpointUrl(endpointUrl)).to.not.be.undefined; - }); - - - it('should not accept ftp protocol for endpoint url', function() { - - // given - const endpointUrl = 'ftp://localhost'; - - // then - expect(instance.validateEndpointUrl(endpointUrl)).to.not.be.undefined; - }); - - - it('should accept endpoint url starting with "https://"', function() { - - // given - const endpointUrl = 'https://localhost'; - - // then - expect(instance.validateEndpointUrl(endpointUrl)).to.be.undefined; - }); - - - it('should accept endpoint url starting with "http://"', function() { - - // given - const endpointUrl = 'http://localhost'; - - // then - expect(instance.validateEndpointUrl(endpointUrl)).to.be.undefined; - }); - - }); - - - describe('deployment name', function() { - - it('should not accept void deployment name', function() { - - // given - const deploymentName = ''; - - // then - expect(instance.validateDeploymentName(deploymentName)).to.not.be.undefined; - }); - - - it('should accept not void deployment name', function() { - - // given - const deploymentName = 'deploymentName'; - - // then - expect(instance.validateDeploymentName(deploymentName)).to.be.undefined; - }); - - }); - - }); - - - 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('menu updates', function() { - - it('should update menu on mount', function() { - - // given - const onMenuUpdateSpy = sinon.spy(); - - // when - shallow( - - ); - - // then - expect(onMenuUpdateSpy).to.be.calledOnce; - }); - - - it('should enable editing actions on input focus', function() { - - // given - const wrapper = mount( - - ); - const modal = wrapper.instance(); - const updateMenuSpy = sinon.spy(modal, 'updateMenu'); - - // when - const input = wrapper.find('input').first(); - - input.simulate('focus'); - - // then - expect(updateMenuSpy).to.be.calledOnceWithExactly(true); - - wrapper.unmount(); - }); - - - it('should disable editing actions on input blur', function() { - - // given - const wrapper = mount( - - ); - const modal = wrapper.instance(); - const updateMenuSpy = sinon.spy(modal, 'updateMenu'); - - // when - const input = wrapper.find('input').first(); - - input.simulate('blur'); - - // then - expect(updateMenuSpy).to.be.calledOnceWithExactly(false); - - wrapper.unmount(); - }); - - }); - - - describe('', function() { - - let wrapper; - - afterEach(function() { - wrapper && wrapper.unmount(); - }); - - it('should render', function() { - shallow(); - }); - - - it('should render error message', function() { - - // given - wrapper = mount(); - - // then - expect(wrapper.find('.deploy-message.error')).to.have.lengthOf(1); - }); - - - it('should render success message', function() { - - // given - wrapper = mount(); - - // then - expect(wrapper.find('.deploy-message.success')).to.have.lengthOf(1); - }); - - - it('should not display validation error before first submit', function(done) { - - // given - wrapper = mount( 'Error', auth: {} } } - />); - - // when - const input = wrapper.find('input[name="deploymentName"]'); - input.simulate('change', { - target: { - name: 'deploymentName', - value: '' - } - }); - - // then - nextTickExpect(done, () => expect(wrapper.find('.invalid')).to.have.lengthOf(0)); - }); - - - it('should display validation error after first submit', function(done) { - - // given - wrapper = mount( 'Error', auth: {} } } - />); - - const input = wrapper.find('input[name="deploymentName"]'); - input.simulate('change', { - target: { - name: 'deploymentName', - value: '' - } - }); - - // when - wrapper.find('form').simulate('submit'); - - // then - nextTickExpect(done, () =>{ - expect(wrapper.find('.valid')).to.have.lengthOf(1); - }); - }); - - }); - -}); - - - -// helper -function nextTickExpect(done, fn) { - process.nextTick(() => { - try { - fn(); - } catch (error) { - return done(error); - } - - done(); - }); -} diff --git a/client/src/app/modals/deploy-diagram/error-messages/getCamundaBpmErrorMessage.js b/client/src/app/modals/deploy-diagram/error-messages/getCamundaBpmErrorMessage.js deleted file mode 100644 index 119b49e622..0000000000 --- a/client/src/app/modals/deploy-diagram/error-messages/getCamundaBpmErrorMessage.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH - * under one or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information regarding copyright - * ownership. - * - * Camunda licenses this file to you under the MIT; you may not use this file - * except in compliance with the MIT License. - */ - -const ERROR_MESSAGE = { - BPMN_PARSING_ERROR: 'Server could not parse the diagram. Please check log for errors.' -}; - - -export default function getCamundaBpmErrorMessage(error) { - if (/^ENGINE-09005/.test(error.message)) { - return ERROR_MESSAGE.BPMN_PARSING_ERROR; - } -} diff --git a/client/src/app/modals/deploy-diagram/error-messages/getNetworkErrorMessage.js b/client/src/app/modals/deploy-diagram/error-messages/getNetworkErrorMessage.js deleted file mode 100644 index f2da42757c..0000000000 --- a/client/src/app/modals/deploy-diagram/error-messages/getNetworkErrorMessage.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH - * under one or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information regarding copyright - * ownership. - * - * Camunda licenses this file to you under the MIT; you may not use this file - * except in compliance with the MIT License. - */ - -const ERROR_MESSAGE = { - NO_INTERNET_CONNECTION: 'Could not connect to the server. Please verify the endpoint URL.' -}; - - -export default function getNetworkErrorMessage(error) { - switch (error.code) { - case 'ECONNRESET': - case 'ECONNREFUSED': - case 'ENOTFOUND': - return ERROR_MESSAGE.NO_INTERNET_CONNECTION; - } -} \ No newline at end of file diff --git a/client/src/app/modals/deploy-diagram/error-messages/getStatusCodeErrorMessage.js b/client/src/app/modals/deploy-diagram/error-messages/getStatusCodeErrorMessage.js deleted file mode 100644 index 9aba04aeed..0000000000 --- a/client/src/app/modals/deploy-diagram/error-messages/getStatusCodeErrorMessage.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH - * under one or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information regarding copyright - * ownership. - * - * Camunda licenses this file to you under the MIT; you may not use this file - * except in compliance with the MIT License. - */ - -const ERROR_MESSAGE = { - UNAUTHORIZED: 'The deployment was unauthorized. Please use valid credentials.', - FORBIDDEN: 'The deployment was not permitted for your credentials. Please check your credentials.', - NOT_FOUND: 'Could not connect to Camunda. Please check the endpoint URL.', - INTERNAL_SERVER_ERROR: 'Camunda reported an unknown error. Please check the server status.', - SERVER_UNAVAILABLE: 'Camunda is currently unavailable. Please try again later.' -}; - - -export default function getStatusCodeErrorMessage(error) { - switch (error.status) { - case 401: - return ERROR_MESSAGE.UNAUTHORIZED; - case 403: - return ERROR_MESSAGE.FORBIDDEN; - case 404: - return ERROR_MESSAGE.NOT_FOUND; - case 500: - return ERROR_MESSAGE.INTERNAL_SERVER_ERROR; - case 503: - return ERROR_MESSAGE.SERVER_UNAVAILABLE; - } -} \ No newline at end of file diff --git a/client/src/app/modals/deploy-diagram/error-messages/index.js b/client/src/app/modals/deploy-diagram/error-messages/index.js deleted file mode 100644 index ed8a264098..0000000000 --- a/client/src/app/modals/deploy-diagram/error-messages/index.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH - * under one or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information regarding copyright - * ownership. - * - * Camunda licenses this file to you under the MIT; you may not use this file - * except in compliance with the MIT License. - */ - -import getCamundaBpmErrorMessage from './getCamundaBpmErrorMessage'; -import getNetworkErrorMessage from './getNetworkErrorMessage'; -import getStatusCodeErrorMessage from './getStatusCodeErrorMessage'; - -export default [ - getCamundaBpmErrorMessage, - getNetworkErrorMessage, - getStatusCodeErrorMessage -]; diff --git a/client/src/app/modals/deploy-diagram/getEditMenu.js b/client/src/app/modals/deploy-diagram/getEditMenu.js deleted file mode 100644 index 2a20173be1..0000000000 --- a/client/src/app/modals/deploy-diagram/getEditMenu.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH - * under one or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information regarding copyright - * ownership. - * - * Camunda licenses this file to you under the MIT; you may not use this file - * except in compliance with the MIT License. - */ - -export default function getEditMenu(enabled) { - return [ - [ - { - role: 'undo', - enabled - }, - { - role: 'redo', - enabled - }, - ], - [ - { - role: 'copy', - enabled - }, - { - role: 'cut', - enabled - }, - { - role: 'paste', - enabled - }, - { - role: 'selectAll', - enabled - } - ] - ]; -} diff --git a/client/src/app/modals/deploy-diagram/index.js b/client/src/app/modals/deploy-diagram/index.js deleted file mode 100644 index 1e97657d2c..0000000000 --- a/client/src/app/modals/deploy-diagram/index.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH - * under one or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information regarding copyright - * ownership. - * - * Camunda licenses this file to you under the MIT; you may not use this file - * except in compliance with the MIT License. - */ - -export { default as DeployDiagramModal } from './DeployDiagramModal'; diff --git a/client/src/app/modals/index.js b/client/src/app/modals/index.js index d29fdbd4a6..960540f2b2 100644 --- a/client/src/app/modals/index.js +++ b/client/src/app/modals/index.js @@ -8,5 +8,4 @@ * except in compliance with the MIT License. */ -export { DeployDiagramModal } from './deploy-diagram'; export { KeyboardShortcutsModal } from './keyboard-shortcuts'; diff --git a/client/src/app/tabs/bpmn/BpmnEditor.js b/client/src/app/tabs/bpmn/BpmnEditor.js index e3846e131d..a67b85a289 100644 --- a/client/src/app/tabs/bpmn/BpmnEditor.js +++ b/client/src/app/tabs/bpmn/BpmnEditor.js @@ -759,15 +759,6 @@ export class BpmnEditor extends CachedComponent { - - - -