Skip to content

Commit 5f0ac2f

Browse files
just-at-ubercodemmaaliakseireact
authored
Feature/dsl graph SettingsWorkflowHistory container (Part 2) (#255)
* Pr branch (#214) * added simple route to tree graph * added new component for workflow graph * now displaying a svg circle, added some styling * added a simple line generator to display grah * moved code from js project to graph vue component, added new data in data.json * removed old file, fixed click issues by a temporay hack' * trying to integrate cytoscape graph@ * removed and changed some imports to make cytoscape graph work * updated store import * added loading of workflow to history component for testing * removed typescript files * added new test data * added demo-data * added store * added event function map but in pure js * added old tree component which will be updated * changed name of store * updated npm package of cytoscape to 3.16.0 * renamed tree vue file * changed to receive events as props@ * history now loads workflow container instead of graph * modiefied graph container to receive new props and set a small delay of displaying graph * changed with and height of graph to fix problem with zoom * now looping over events instead of workflow@ * added a new event map to get event info * changed all eventtypes to map to servers json format * updated store to receive both workflow id and child id * updated graph component to send correct data to store * added a function to set route to child * changed the way childworkflow route is set in event map * changed how parent is routed to * changed variable name for parent route * removed old function for routing * removed home btn * added a simpler way to change the route@ * added query to route to route to the graph format and not grid * renamed showGraph variable to showTimeLine * renamed variables and functions from showGraph to showTimeline * toggling with flag instead of true false variable * added a function setWorkflow which rezises the split window based on the variable graphView * removed old link to tree graph * added a refresh btn which forces a reload of the graph container * sending isworkflow running to the history component from index * refresh functioning, only on mount needs to bw fixed * removed debugging msg * Refresh btn now only shows if there is more data to reload * only sending the prop (events) to graphView if it has been fetched and has length * removed redundant code and changed variable names to better represent their functionalities * revomed debugging code * displaying graph on right side works but is hacky - needs to be fixed * added flexbox to the container when the dag graph is displayed to layout the slider on the right * added functionality which check route query to determine how to split the window@ * new name for class to match current class naming style * removed commented code and console log * changed to listen to query updates rather than store to update currently selected node * removed node list from graph and not used function * removed commented code * added new function zoomtonode which is called on mount, if a eventId exist on query * removed old console log * removed not used method in store set rendered nodes * removed functionality regarding rendered nodes (only relevant when we have a node list to the graph * removed old console logs * removed another debug console log * added omit to router query when routing from/to child to avoid trying to display a node with same eventId which doesnt exist@ * added a check to see if eventId is definied on graph mount * update route query when a node is clicked * added a watch function which watches changes in event id query and then scrolls the grid to that event * removed old on click functioanlity and added new to allow deselection of node * removed eventlist and moved childbtn to topbar * removed event list and all css linked to it and node list * added and extra if statement to check if you have already clicked on bg * removed old getters and setters in vue store * added functionality to check if a node is clicked or not * added matching top bar to canvas (same as grid) * added new btn styling to match rest of the page, using the predefinted mixins@ * added proper buttons for parent and child routes@ * removed unecessary css code * styled refresh button * added a check to enableSplitting to not do it on graph view * removed clickinfo from eventmap * updated name of event info and removed click info * removed old static workflow loading functionality and its corresponding data and props * removed old event map functions and renamed the current one * removed old code and renamed some variables * removed old demo data * changed child btn text to To Child * changed variable names for better readability. Added overflow ellipse for workflow name text * added new variables names to store for better readability regarding childworkflow * added functionality to show child btn for previous execution run id * functionality for changing the name of the parent btn, and only use run id as route * updated continued as new event to return run ID * added a new mutation to update route for new executions * Change cytoscape version * added functionality to make graph display child btn on grid click * refractored current code for better readability * removed onNodeClick function which is not necessary anymore * added an extra check to make sure refresh btn is not showed unecessarily * updated even connection functionality to not break for different chunk sizes * removed old console log * removed legend imports in graph component * added legend to graph container * added graph legend component and changed its styling a bit * small html and css fixes * moved legend to bottom of graph * removed chunckWorfklow and code that is not used * removed old graph file * fixed pr comment on this=self, and simplified zoom * removed unused import * passing eventId as prop instead of listening to changes in query * removed unnecessary async prefix for viewInit * update to check for prop and not for route query * changed from let to const for zoom lvl * added map mupations to connect to store * resolved merge conflicts * added demo data to gitignore * commented out demo data * making sure cytoscape version stays on 3.16.0 * added a new file for calculating the layout using timestamps * added a new file which keeps track of events and nodes and builds the graph * removed unused function * Order nodes by timestamp in graph visualization * Enable chrono edges * Avoid overlapping edges * Apply lint --fix * Disable chrono edges for large workflows * Fix timeline elements test * Use showGraph url parameter in tests Co-authored-by: Aliaksei Talkachou <[email protected]> * removing git ignore file * updating package-lock and updating ordering in cytoscape component * refactoring get-event-connections. fixing lint. adding missing licenses. * minor refactorings * minor refactoring * updating start date in license headers * moving files to a more logical structure. * small refactor * small refactor for legend * adding license header * fixing lint * moving constants * small rename refactor for graphView values. * adjusting line in legend * moving constants out of helper into constants file. * moving comments for constants. * moving more constants out * reordering constants * minor refactoring. removing some warnings in console. * adjusting whitespace in legend * fixing lint * minor refactoring of CytoscapeLayout for better readability. * minor refactor * minor refactoring * adjusting ordering * breaking apart cytoscape layout into smaller helpers * moving graph styles from helpers to constants. * fixed unnecessary code * moving out helper function * removing route.query * setting split direction to computed field * adjusting name for split size constant * fixing error in console * removing unused packages. * breaking apart graph helper into smaller files. * adding license headers * fixing lint * removing unused prop * moving to computed prop * moving constant. moving to computed field * simplifying code * reference helper * removing unused variables * moving out more constants * separating get event connections into smaller files. * minor refactoring * moving more constants out * fixing lint * updating comment * adding feature flag * fixing feature flag height and stopping it from hiding timeline. * fixing lint * tweaking vuex store to have graph namespace for application separation. * fixing lint * removing direct import reference to store in components. * addressing PR comments * removing unnecessary this from template * fixing lint * added container path * moving workflow history to containers folder. * fixing whitespace. removing helper moved to another location. * fixing lint * add containers shortcut * moving settings-workflow-history into containers * fixing lint * add name to settings toggle change event. * updating containers to reference new attributes of the SettingsWorkflowHistory container. * updating package to include vuex-connect * updating store with SettingsWorkflowHistory state getters mutations * settings workflow history container changes. * changes for settings workflow history component to support graphEnabled setting. Co-authored-by: Emma Tysk <[email protected]> Co-authored-by: Aliaksei Talkachou <[email protected]>
1 parent e58ec5b commit 5f0ac2f

File tree

13 files changed

+267
-6
lines changed

13 files changed

+267
-6
lines changed

client/components/settings-modal/components/settings-toggle.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ export default {
3939
},
4040
methods: {
4141
onChange(event) {
42-
this.$emit('change', event);
42+
const { name } = this;
43+
44+
this.$emit('change', { ...event, name });
4345
},
4446
},
4547
components: {

client/containers/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,10 @@
1919
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2020
// THE SOFTWARE.
2121

22-
export { component as SettingsWorkflowHistory } from './settings-workflow-history';
22+
export {
23+
container as SettingsWorkflowHistory,
24+
getDefaultState as getSettingsWorkflowHistoryDefaultState,
25+
getters as settingsWorkflowHistoryGetters,
26+
mutations as settingsWorkflowHistoryMutations,
27+
} from './settings-workflow-history';
2328
export { component as WorkflowHistory } from './workflow-history';

client/containers/settings-workflow-history/component.vue

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { ToggleButton } from 'vue-js-toggle-button';
2424
import {
2525
ButtonFill,
2626
ButtonIcon,
27+
FeatureFlag,
2728
FlexGrid,
2829
FlexGridItem,
2930
SettingsFooter,
@@ -39,6 +40,12 @@ import {
3940
export default {
4041
name: 'settings-workflow-history',
4142
props: {
43+
graphEnabled: {
44+
type: Boolean,
45+
},
46+
isSubmitEnabled: {
47+
type: Boolean,
48+
},
4249
workflowHistoryEventHighlightList: {
4350
type: Array,
4451
},
@@ -115,6 +122,9 @@ export default {
115122
onWorkflowHistoryEventHighlightListEnabledChange({ value }) {
116123
this.modalWorkflowHistoryEventHighlightListEnabled = value;
117124
},
125+
onChange({ name, value }) {
126+
this.$emit('onChange', { name, value });
127+
},
118128
onSubmit() {
119129
this.$emit('change', {
120130
...(this.isWorkflowHistoryEventHighlightListEnabledChanged && {
@@ -126,11 +136,13 @@ export default {
126136
.modalWorkflowHistoryEventHighlightList,
127137
}),
128138
});
139+
this.$emit('onSubmit');
129140
},
130141
},
131142
components: {
132143
'button-fill': ButtonFill,
133144
'button-icon': ButtonIcon,
145+
'feature-flag': FeatureFlag,
134146
'flex-grid': FlexGrid,
135147
'flex-grid-item': FlexGridItem,
136148
'settings-footer': SettingsFooter,
@@ -144,6 +156,16 @@ export default {
144156
<template>
145157
<div class="settings-workflow-history">
146158
<div class="content">
159+
<div class="content-item">
160+
<feature-flag name="workflowGraph">
161+
<settings-toggle
162+
label="Enable history graph"
163+
name="graphEnabled"
164+
:value="graphEnabled"
165+
@change="onChange"
166+
/>
167+
</feature-flag>
168+
</div>
147169
<div class="content-item">
148170
<settings-toggle
149171
label="Enable history event param highlighting"
@@ -248,7 +270,7 @@ export default {
248270
</div>
249271
</div>
250272
<settings-footer
251-
:submit-enabled="isSettingsChanged"
273+
:submit-enabled="isSubmitEnabled || isSettingsChanged"
252274
@cancel="onClose"
253275
@submit="onSubmit"
254276
/>
@@ -265,7 +287,8 @@ export default {
265287
266288
.scrollable {
267289
overflow-y: auto;
268-
height: 200px;
290+
height: 165px;
291+
margin-bottom: 10px;
269292
}
270293
}
271294
</style>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright (c) 2021 Uber Technologies Inc.
2+
//
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a copy
5+
// of this software and associated documentation files (the "Software"), to deal
6+
// in the Software without restriction, including without limitation the rights
7+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
// copies of the Software, and to permit persons to whom the Software is
9+
// furnished to do so, subject to the following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included in
12+
// all copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
// THE SOFTWARE.
21+
22+
import { connect } from 'vuex-connect';
23+
import { SETTINGS_WORKFLOW_HISTORY_IS_SUBMIT_ENABLED } from './getterTypes';
24+
import {
25+
SETTINGS_WORKFLOW_HISTORY_ON_CHANGE_VALUE,
26+
SETTINGS_WORKFLOW_HISTORY_ON_MOUNTED,
27+
SETTINGS_WORKFLOW_HISTORY_ON_SUBMIT,
28+
} from './mutationTypes';
29+
30+
const gettersToProps = {
31+
isSubmitEnabled: SETTINGS_WORKFLOW_HISTORY_IS_SUBMIT_ENABLED,
32+
};
33+
34+
const lifecycle = {
35+
mounted: ({ commit }) => commit(SETTINGS_WORKFLOW_HISTORY_ON_MOUNTED),
36+
};
37+
38+
const stateToProps = {
39+
graphEnabled: state => state.settingsWorkflowHistory.graphEnabled,
40+
};
41+
42+
const mutationsToEvents = {
43+
onChange: SETTINGS_WORKFLOW_HISTORY_ON_CHANGE_VALUE,
44+
onSubmit: SETTINGS_WORKFLOW_HISTORY_ON_SUBMIT,
45+
};
46+
47+
export default connect({
48+
gettersToProps,
49+
lifecycle,
50+
mutationsToEvents,
51+
stateToProps,
52+
});
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright (c) 2021 Uber Technologies Inc.
2+
//
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a copy
5+
// of this software and associated documentation files (the "Software"), to deal
6+
// in the Software without restriction, including without limitation the rights
7+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
// copies of the Software, and to permit persons to whom the Software is
9+
// furnished to do so, subject to the following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included in
12+
// all copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
// THE SOFTWARE.
21+
22+
export const SUBMIT_CHANGE_KEYS = ['graphEnabled'];
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright (c) 2021 Uber Technologies Inc.
2+
//
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a copy
5+
// of this software and associated documentation files (the "Software"), to deal
6+
// in the Software without restriction, including without limitation the rights
7+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
// copies of the Software, and to permit persons to whom the Software is
9+
// furnished to do so, subject to the following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included in
12+
// all copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
// THE SOFTWARE.
21+
22+
export const SETTINGS_WORKFLOW_HISTORY_IS_SUBMIT_ENABLED =
23+
'SETTINGS_WORKFLOW_HISTORY_IS_SUBMIT_ENABLED';
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright (c) 2021 Uber Technologies Inc.
2+
//
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a copy
5+
// of this software and associated documentation files (the "Software"), to deal
6+
// in the Software without restriction, including without limitation the rights
7+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
// copies of the Software, and to permit persons to whom the Software is
9+
// furnished to do so, subject to the following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included in
12+
// all copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
// THE SOFTWARE.
21+
22+
import { SUBMIT_CHANGE_KEYS } from './constants';
23+
import { SETTINGS_WORKFLOW_HISTORY_IS_SUBMIT_ENABLED } from './getterTypes';
24+
25+
const getters = {
26+
[SETTINGS_WORKFLOW_HISTORY_IS_SUBMIT_ENABLED]: ({
27+
settingsWorkflowHistory,
28+
workflowHistory,
29+
}) =>
30+
SUBMIT_CHANGE_KEYS.reduce(
31+
(accumulator, key) =>
32+
accumulator || settingsWorkflowHistory[key] !== workflowHistory[key],
33+
false
34+
),
35+
};
36+
37+
export default getters;

client/containers/settings-workflow-history/index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,14 @@
2020
// THE SOFTWARE.
2121

2222
import Component from './component';
23+
import Connector from './connector';
24+
import getters from './getters';
25+
import mutations from './mutations';
2326

24-
const component = Component;
27+
const getDefaultState = () => ({
28+
graphEnabled: true,
29+
});
2530

26-
export { component };
31+
const container = Connector('SettingsWorkflowHistory', Component);
32+
33+
export { container, getDefaultState, getters, mutations };
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright (c) 2021 Uber Technologies Inc.
2+
//
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a copy
5+
// of this software and associated documentation files (the "Software"), to deal
6+
// in the Software without restriction, including without limitation the rights
7+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
// copies of the Software, and to permit persons to whom the Software is
9+
// furnished to do so, subject to the following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included in
12+
// all copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
// THE SOFTWARE.
21+
22+
export const SETTINGS_WORKFLOW_HISTORY_ON_CHANGE_VALUE =
23+
'SETTINGS_WORKFLOW_HISTORY_ON_CHANGE_VALUE';
24+
export const SETTINGS_WORKFLOW_HISTORY_ON_MOUNTED =
25+
'SETTINGS_WORKFLOW_HISTORY_ON_MOUNTED';
26+
export const SETTINGS_WORKFLOW_HISTORY_ON_SUBMIT =
27+
'SETTINGS_WORKFLOW_HISTORY_ON_SUBMIT';
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright (c) 2021 Uber Technologies Inc.
2+
//
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a copy
5+
// of this software and associated documentation files (the "Software"), to deal
6+
// in the Software without restriction, including without limitation the rights
7+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
// copies of the Software, and to permit persons to whom the Software is
9+
// furnished to do so, subject to the following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included in
12+
// all copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
// THE SOFTWARE.
21+
22+
import {
23+
SETTINGS_WORKFLOW_HISTORY_ON_CHANGE_VALUE,
24+
SETTINGS_WORKFLOW_HISTORY_ON_MOUNTED,
25+
SETTINGS_WORKFLOW_HISTORY_ON_SUBMIT,
26+
} from './mutationTypes';
27+
28+
const mutations = {
29+
[SETTINGS_WORKFLOW_HISTORY_ON_CHANGE_VALUE]: (state, { name, value }) => {
30+
state.settingsWorkflowHistory = {
31+
...state.settingsWorkflowHistory,
32+
[name]: value,
33+
};
34+
},
35+
[SETTINGS_WORKFLOW_HISTORY_ON_MOUNTED]: state => {
36+
state.settingsWorkflowHistory = {
37+
...state.settingsWorkflowHistory,
38+
graphEnabled: state.workflowHistory.graphEnabled,
39+
};
40+
},
41+
[SETTINGS_WORKFLOW_HISTORY_ON_SUBMIT]: state => {
42+
state.workflowHistory = {
43+
...state.workflowHistory,
44+
...state.settingsWorkflowHistory,
45+
};
46+
},
47+
};
48+
49+
export default mutations;

0 commit comments

Comments
 (0)