예제 #1
0
    def swimlanes(team_id=None, channel=None, params=None):
        (go_js, graph_data) = Go_Js_Views._get_graph_data(params, "swimlanes")

        nodes = [{
            'key': "Pool1",
            'text': "By Risk",
            'isGroup': True,
            'category': "Pool"
        }]
        edges = []
        groups = []
        colors = ["lightblue", "lightgreen", "lightyellow", "orange"]
        for key, issue in graph_data.get('nodes').items():
            if issue:
                group = Misc.array_add(groups, issue.get('Rating'))
                nodes.append({
                    'key': key,
                    'group': group
                })  #issue.get('Summary')
        for group in list(set(groups)):
            nodes.append({
                'key': group,
                'text': group,
                'isGroup': True,
                'group': "Pool1",
                'color': Misc.array_pop(colors)
            })

        for edge in graph_data.get('edges'):
            edges.append({'from': edge[0], 'to': edge[2]})

        js_code = 'relayoutLanes()'
        return go_js.render(nodes,
                            edges,
                            js_code=js_code,
                            width=2400,
                            team_id=team_id,
                            channel=channel)
예제 #2
0
 def test_array_add(self):
     array = ['aaa']
     self.assertEqual(Misc.array_add(array, 'abc'), 'abc')
     self.assertIsNone(Misc.array_add(array, None))
     self.assertEqual(array, ['aaa', 'abc'])