const map_config = function()

in source/html/js/app/mappers/nodes/ec2.js [25:106]


        const map_config = function(cache_entry) {
            const config = JSON.parse(cache_entry.data);
            const name = config.InstanceId;
            const id = cache_entry.arn;
            const nodes = model.nodes;
            const rgb = "#D5DBDB";
            let node_type = "EC2 Instance";
            if ('Tags' in config) {
                if ('MSAM-NodeType' in config.Tags) {
                    node_type = config.Tags['MSAM-NodeType'];
                }
            }
            let node_data = {
                "overlay": "informational",
                "cache_update": cache_entry.updated,
                "id": id,
                "region": cache_entry.region,
                "shape": "image",
                "image": {
                    "unselected": null,
                    "selected": null
                },
                "header": "<b>" + node_type + ":</b> " + name,
                "data": config,
                "title": node_type,
                "name": name,
                "size": 55,
                "render": {
                    normal_unselected: (function() {
                        let local_node_type = node_type;
                        let local_name = name;
                        let local_rgb = rgb;
                        let local_id = id;
                        return function() {
                            return svg_node.unselected(local_node_type, local_name, local_rgb, local_id);
                        };
                    })(),
                    normal_selected: (function() {
                        let local_node_type = node_type;
                        let local_name = name;
                        let local_rgb = rgb;
                        let local_id = id;
                        return function() {
                            return svg_node.selected(local_node_type, local_name, local_rgb, local_id);
                        };
                    })(),
                    alert_unselected: (function() {
                        let local_node_type = node_type;
                        let local_name = name;
                        let local_id = id;
                        return function() {
                            return svg_node.unselected(local_node_type, local_name, "#ff0000", local_id);
                        };
                    })(),
                    alert_selected: (function() {
                        let local_node_type = node_type;
                        let local_name = name;
                        let local_id = id;
                        return function() {
                            return svg_node.selected(local_node_type, local_name, "#ff0000", local_id);
                        };
                    })()
                },
                "console_link": (function() {
                    const region = id.split(":")[3];
                    return function() {
                        let html = `https://console.aws.amazon.com/ec2/v2/home?region=${region}#Instances:instanceId=${name}`;
                        return html;
                    };
                })(),
                "cloudwatch_link": (function() {
                    const region = id.split(":")[3];
                    return function() {
                        let html = `https://console.aws.amazon.com/cloudwatch/home?region=${region}#metricsV2:graph=~();query=~'*7bAWS*2fEC2*2cInstanceId*7d*20InstanceId*3d*22${name}*22`;
                        return html;
                    };
                })()
            };
            node_data.image.selected = node_data.render.normal_selected();
            node_data.image.unselected = node_data.render.normal_unselected();
            nodes.update(node_data);
        };