Example #1
0
        def format_node(node):
            issue = graph_data.get('nodes').get(node.get('id'))
            if issue:
                node['label'] = Misc.word_wrap(issue.get('Summary'), 20)
                #node['label'] = issue.get('Rating')
                labels = issue.get('Labels')
                if 'R0' in labels:
                    #node['label'] = issue.get('Summary')
                    node['color'] = '#FF0000'
                    node['font'] = {'color': 'white', 'size': 25}
                    node['mass'] = 2
                    return node

                if 'R1' in labels:
                    node['color'] = '#FF6666'
                    node['font'] = {'size': 20}
                    node['mass'] = 3
                    return node

                if 'R2' in labels:
                    node['color'] = '#FFAAAA'
                    node['font'] = {'size': 15}
                    #node['mass'] = 1
                    return node

                if 'R3' in labels:
                    node['color'] = '#FFDDDD'

                    return node

                if 'R4' in labels:
                    node['color'] = '#00DDDD'

                    return node
Example #2
0
    def node_label(team_id=None, channel=None, params=None):
        if len(params) < 2:
            return "':red_circle: Hi, for the `node_label` view, you need to provide the label field name. Try: `Key`, `Summary`, `Rating`, `Status`"

        label_key = ' '.join(params[1:])

        (graph_name, nodes, edges, graph_data,
         vis_js) = Vis_Js_Views.default(params=params, no_render=True)
        graph_name += ' | node_label | ' + label_key

        issues = graph_data.get('nodes')
        for node in nodes:
            issue = issues.get(node['label'])
            if issue:
                value = str(issue.get(label_key))
                node['label'] = Misc.word_wrap(value, 40)

        for edge in edges:
            del edge['label']

        options = {'nodes': {'shape': 'box'}, 'edges': {'arrows': 'to'}}
        options = None
        return vis_js.create_graph_and_send_screenshot_to_slack(
            graph_name, nodes, edges, options, team_id, channel)
 def set_label(node, issue, key):
     if issue:
         node['label'] = Misc.word_wrap(issue.get(key), 20)
     return Node_Format