Skip to content

Commit

Permalink
feat(cloud-bpmn): add variable outline tab
Browse files Browse the repository at this point in the history
related to #4267
  • Loading branch information
marstamm authored Aug 22, 2024
1 parent 1e96185 commit 131f00c
Show file tree
Hide file tree
Showing 8 changed files with 1,008 additions and 675 deletions.
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@bpmn-io/form-js": "^1.9.0",
"@bpmn-io/properties-panel": "^3.23.0",
"@bpmn-io/replace-ids": "^0.2.0",
"@bpmn-io/variable-outline": "1.0.0",
"@camunda/execution-platform": "^0.3.2",
"@camunda/form-linting": "^0.16.0",
"@camunda/form-playground": "^0.15.0",
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/panel/tabs/linting/LintingTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default function LintingTab(props) {
id="linting"
label="Problems"
layout={ layout }
priority={ 1 }>
priority={ 10 }>
{ reports.length
? null
: (
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/panel/tabs/log/LogTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default class LogTab extends PureComponent {
<Fill slot="bottom-panel"
id="log"
label="Output"
priority={ 2 }
priority={ 20 }
actions={
[
{
Expand Down
37 changes: 37 additions & 0 deletions client/src/app/panel/tabs/variable-outline/VariableOutlineTab.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* 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 from 'react';

import VariableOutline from '@bpmn-io/variable-outline';
import '@bpmn-io/variable-outline/dist/style.css';

import { Fill } from '../../../slot-fill';


export default function VariableTab(props) {
const {
layout = {},
injector,
id
} = props;

return <>
<Fill slot="bottom-panel"
id="variable-outline"
label="Variables"
layout={ layout }
priority={ 5 }>
<div className="cds--g10" style={ { height: '100%' } }>
<VariableOutline injector={ injector } key={ id } />
</div>
</Fill>
</>;
}
11 changes: 10 additions & 1 deletion client/src/app/tabs/cloud-bpmn/BpmnEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import {

import PropertiesPanelContainer, { DEFAULT_LAYOUT as PROPERTIES_PANEL_DEFAULT_LAYOUT } from '../../resizable-container/PropertiesPanelContainer';

import VariableTab from '../../panel/tabs/variable-outline/VariableOutlineTab';

import BpmnModeler from './modeler';

import { active as isInputActive } from '../../../util/dom/isInput';
Expand Down Expand Up @@ -758,7 +760,9 @@ export class BpmnEditor extends CachedComponent {

const { layout } = this.props;

const imported = this.getModeler().getDefinitions();
const modeler = this.getModeler();
const imported = modeler.getDefinitions();
const injector = modeler.get('injector');

const {
importing
Expand Down Expand Up @@ -788,6 +792,11 @@ export class BpmnEditor extends CachedComponent {
engineProfile={ engineProfile }
onChange={ (engineProfile) => this.engineProfile.set(engineProfile) } />
}

<VariableTab
id={ this.props.id }
layout={ layout }
injector={ injector } />
</div>
);
}
Expand Down
14 changes: 14 additions & 0 deletions client/src/app/tabs/cloud-bpmn/__tests__/BpmnEditorSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import {
} from '../../getEditMenu';

import { SlotFillRoot } from '../../../slot-fill';
import Panel from '../../../panel/Panel';

import Flags, { ENABLE_NEW_CONTEXT_PAD } from '../../../../util/Flags';

Expand Down Expand Up @@ -2052,6 +2053,18 @@ describe('cloud-bpmn - <BpmnEditor>', function() {

});


describe('Bottom Panel', function() {

it('should show variable tab', async function() {
const { wrapper } = await renderEditor(diagramXML);

// then
expect(wrapper.find('.panel__link').at(0).find('.panel__link-label').text()).to.equal('Variables');
});

});

});


Expand Down Expand Up @@ -2147,6 +2160,7 @@ function WrappedEditor(props) {
return (
<SlotFillRoot>
<TestEditor { ...props } />
<Panel layout={ props.layout } />
</SlotFillRoot>
);
}
3 changes: 3 additions & 0 deletions client/test/mocks/bpmn-js/Modeler.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ export default class Modeler {

_getDefaultModules(options = {}) {
return {
injector: {
get() {}
},
eventBus: {
fire() {}
},
Expand Down
Loading

0 comments on commit 131f00c

Please sign in to comment.