Skip to content

Commit 85089df

Browse files
authored
Feature/pending tasks (#280)
* moving workflow into containers * fixing lint * fixing license * changes to the workflow component * more container changes * more container changes * updating containers with workflow container * adding PENDING_TASK_TYPE constants * fixed lint * adding tests for getDefaultState * hooked up initGetters helper method to help initialize getters for unit tests. * finished rest of tests for getters * mutation unit tests * fix lint * fix merge conflict * workflow pending tasks * add test for actions * adding tests for getters * adding tests for getters * fixed map pending task list where the case of runID would be added as undefined if not on the item. Adding tests for getters. * fixing lint * fixed constant value to match key
1 parent d3fbc09 commit 85089df

21 files changed

+918
-2
lines changed

client/containers/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,8 @@ export {
4646
container as WorkflowHistory,
4747
getDefaultState as getWorkflowHistoryDefaultState,
4848
} from './workflow-history';
49+
export {
50+
actions as workflowPendingActions,
51+
container as WorkflowPending,
52+
getters as workflowPendingGetters,
53+
} from './workflow-pending';
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 WORKFLOW_PENDING_FILTER_CHANGED =
23+
'WORKFLOW_PENDING_FILTER_CHANGED';
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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 { ROUTE_UPDATE_QUERY } from '../route/action-types';
23+
import { WORKFLOW_PENDING_FILTER_CHANGED } from './action-types';
24+
25+
const actions = {
26+
[WORKFLOW_PENDING_FILTER_CHANGED]: ({ dispatch }, filter) =>
27+
dispatch(ROUTE_UPDATE_QUERY, { filter }),
28+
};
29+
30+
export default actions;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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 { ROUTE_UPDATE_QUERY } from '../route/action-types';
23+
import actions from './actions';
24+
import { WORKFLOW_PENDING_FILTER_CHANGED } from './action-types';
25+
26+
describe('workflow pending actions', () => {
27+
describe('when actions[WORKFLOW_PENDING_FILTER_CHANGED] is called', () => {
28+
it('should dispatch ROUTE_UPDATE_QUERY with the filter that is changed.', () => {
29+
const dispatch = jest.fn();
30+
const filter = 'activity';
31+
32+
actions[WORKFLOW_PENDING_FILTER_CHANGED]({ dispatch }, filter);
33+
expect(dispatch).toHaveBeenCalledWith(ROUTE_UPDATE_QUERY, {
34+
filter: 'activity',
35+
});
36+
});
37+
});
38+
});
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<script>
2+
// Copyright (c) 2021 Uber Technologies Inc.
3+
//
4+
//
5+
// Permission is hereby granted, free of charge, to any person obtaining a copy
6+
// of this software and associated documentation files (the "Software"), to deal
7+
// in the Software without restriction, including without limitation the rights
8+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
// copies of the Software, and to permit persons to whom the Software is
10+
// furnished to do so, subject to the following conditions:
11+
//
12+
// The above copyright notice and this permission notice shall be included in
13+
// all copies or substantial portions of the Software.
14+
//
15+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
// THE SOFTWARE.
22+
23+
import { DynamicScroller, DynamicScrollerItem } from 'vue-virtual-scroller';
24+
import { PendingTaskListItem } from './components';
25+
import { ButtonGroup, NoResults } from '~components';
26+
27+
export default {
28+
name: 'workflow-pending',
29+
props: {
30+
filter: {
31+
type: String,
32+
default: 'all',
33+
},
34+
emptyMessage: {
35+
type: String,
36+
default: 'No results',
37+
},
38+
isLoading: {
39+
type: Boolean,
40+
default: false,
41+
},
42+
pendingTaskList: {
43+
type: Array,
44+
default: () => [],
45+
},
46+
},
47+
components: {
48+
'button-group': ButtonGroup,
49+
DynamicScroller,
50+
DynamicScrollerItem,
51+
'no-results': NoResults,
52+
'pending-task-list-item': PendingTaskListItem,
53+
},
54+
};
55+
</script>
56+
57+
<template>
58+
<div class="workflow-pending">
59+
<div class="top-navigation">
60+
<button-group
61+
:items="['all', 'activities', 'children']"
62+
label="Filters"
63+
uppercase
64+
:value="filter"
65+
@change="$emit('filterChanged', $event)"
66+
/>
67+
</div>
68+
<no-results
69+
:is-loading="isLoading"
70+
:message="emptyMessage"
71+
:results="pendingTaskList"
72+
/>
73+
<div class="pending-task-list" v-if="pendingTaskList.length">
74+
<DynamicScroller
75+
key-field="pendingTaskId"
76+
:items="pendingTaskList"
77+
:min-item-size="38"
78+
>
79+
<template v-slot="{ item, index, active }">
80+
<DynamicScrollerItem
81+
class="scroller-item"
82+
:active="active"
83+
:data-active="active"
84+
:data-index="index"
85+
:item="item"
86+
>
87+
<pending-task-list-item :index="index" :item="item" />
88+
</DynamicScrollerItem>
89+
</template>
90+
</DynamicScroller>
91+
</div>
92+
</div>
93+
</template>
94+
95+
<style lang="stylus">
96+
.workflow-pending {
97+
.top-navigation {
98+
border-bottom: 1px solid #c6c6c6;
99+
box-shadow: 0 2px 2px rgba(0,0,0,0.2);
100+
padding: 24px;
101+
}
102+
103+
.pending-task-list {
104+
max-height: calc(100vh - 191px);
105+
overflow-y: auto;
106+
}
107+
}
108+
</style>
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 { default as PendingTaskListItem } from './pending-task-list-item';
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<script>
2+
// Copyright (c) 2021 Uber Technologies Inc.
3+
//
4+
//
5+
// Permission is hereby granted, free of charge, to any person obtaining a copy
6+
// of this software and associated documentation files (the "Software"), to deal
7+
// in the Software without restriction, including without limitation the rights
8+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
// copies of the Software, and to permit persons to whom the Software is
10+
// furnished to do so, subject to the following conditions:
11+
//
12+
// The above copyright notice and this permission notice shall be included in
13+
// all copies or substantial portions of the Software.
14+
//
15+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
// THE SOFTWARE.
22+
23+
import { DetailList } from '~components';
24+
25+
export default {
26+
name: 'pending-task-list-item',
27+
props: {
28+
index: {
29+
type: Number,
30+
default: 0,
31+
},
32+
item: {
33+
type: Object,
34+
default: () => ({
35+
kvps: [],
36+
pendingTaskTypeDisplay: '',
37+
}),
38+
},
39+
},
40+
components: {
41+
'detail-list': DetailList,
42+
},
43+
};
44+
</script>
45+
46+
<template>
47+
<div class="pending-task-list-item" :class="{ odd: index % 2 === 1 }">
48+
<div class="col type">{{ item.pendingTaskTypeDisplay }}</div>
49+
<div class="col detail">
50+
<detail-list :item="item" />
51+
</div>
52+
</div>
53+
</template>
54+
55+
<style lang="stylus">
56+
.pending-task-list-item {
57+
display: flex;
58+
59+
&.odd {
60+
background-color: #f8f8f9;
61+
}
62+
63+
.col {
64+
padding: 8px;
65+
66+
&.type {
67+
width: 200px;
68+
}
69+
70+
&.detail {
71+
flex: 1;
72+
}
73+
}
74+
}
75+
</style>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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 { WORKFLOW_EXECUTION_IS_LOADING } from '../workflow/getter-types';
24+
import { WORKFLOW_PENDING_FILTER_CHANGED } from './action-types';
25+
import {
26+
WORKFLOW_PENDING_ACTIVE_FILTER,
27+
WORKFLOW_PENDING_ACTIVE_FILTER_EMPTY_MESSAGE,
28+
WORKFLOW_PENDING_ACTIVE_PENDING_TASK_LIST,
29+
} from './getter-types';
30+
31+
const actionsToEvents = {
32+
filterChanged: WORKFLOW_PENDING_FILTER_CHANGED,
33+
};
34+
35+
const gettersToProps = {
36+
emptyMessage: WORKFLOW_PENDING_ACTIVE_FILTER_EMPTY_MESSAGE,
37+
filter: WORKFLOW_PENDING_ACTIVE_FILTER,
38+
isLoading: WORKFLOW_EXECUTION_IS_LOADING,
39+
pendingTaskList: WORKFLOW_PENDING_ACTIVE_PENDING_TASK_LIST,
40+
};
41+
42+
export default connect({
43+
actionsToEvents,
44+
gettersToProps,
45+
});

0 commit comments

Comments
 (0)