@zklogic/draw.io
Version:
Draw.IO - Graph Editor integration in Angular-cli
1 lines • 11.9 kB
JavaScript
function mxShapeGCP2DoubleRect(e,a,t,l){mxShape.call(this),this.bounds=e,this.fill=a,this.stroke=t,this.strokewidth=null!=l?l:1}function mxShapeGCP2HexIcon(e,a,t,l){mxShape.call(this),this.bounds=e,this.fill=a,this.stroke=t,this.strokewidth=null!=l?l:1}mxUtils.extend(mxShapeGCP2DoubleRect,mxShape),mxShapeGCP2DoubleRect.prototype.cst={SHAPE_DOUBLE_RECT:"mxgraph.gcp2.doubleRect"},mxShapeGCP2DoubleRect.prototype.paintVertexShape=function(e,a,t,l,o){l-=8,o-=8,e.translate(a,t),e.begin(),e.roundrect(8,8,l,o,1,1),e.fillAndStroke(),e.roundrect(0,0,l,o,1,1),e.fillAndStroke()},mxCellRenderer.registerShape(mxShapeGCP2DoubleRect.prototype.cst.SHAPE_DOUBLE_RECT,mxShapeGCP2DoubleRect),mxShapeGCP2DoubleRect.prototype.constraints=mxRectangleShape.prototype.constraints,mxUtils.extend(mxShapeGCP2HexIcon,mxShape),mxShapeGCP2HexIcon.prototype.cst={HEX_ICON:"mxgraph.gcp2.hexIcon"},mxShapeGCP2HexIcon.prototype.customProperties=[{name:"instNum",dispName:"Number of instances",type:"int",min:0,defVal:0},{name:"prType",dispName:"Instance Type",defVal:"standard",type:"enum",enumList:[{val:"standard",dispName:"Standard"},{val:"dynamic",dispName:"Dynamic"},{val:"multiple",dispName:"Multiple"},{val:"shared",dispName:"Shared"},{val:"replica",dispName:"Replica"},{val:"dynamic2",dispName:"Dynamic 2"},{val:"dynamic3",dispName:"Dynamic 3"},{val:"highmem",dispName:"High-Mem"},{val:"highcomp",dispName:"High-Comp"},{val:"backend",dispName:"Backend"},{val:"input",dispName:"Input"}]},{name:"prIcon",dispName:"Instance Icon",defVal:"compute_engine",type:"enum",enumList:[{val:"compute_engine",dispName:"Compute Engine"},{val:"gpu",dispName:"GPU"},{val:"app_engine",dispName:"App Engine"},{val:"cloud_functions",dispName:"Cloud Functions"},{val:"container_engine",dispName:"Kubernetes Engine"},{val:"container_optimized_os",dispName:"Container-Optimized OS"},{val:"api_analytics",dispName:"API Analytics"},{val:"apigee_sense",dispName:"Apigee Sense"},{val:"api_monetization",dispName:"API Monetization"},{val:"cloud_endpoints",dispName:"Cloud Endpoints"},{val:"apigee_api_platform",dispName:"Apigee API Platform"},{val:"developer_portal",dispName:"Developer Portal"},{val:"cloud_iam",dispName:"Cloud IAM"},{val:"beyondcorp",dispName:"BeyondCorp"},{val:"cloud_iam",dispName:"Cloud Resource Manager"},{val:"data_loss_prevention_api",dispName:"Data Loss Prevention API"},{val:"cloud_security_scanner",dispName:"Cloud Security Scanner"},{val:"key_management_service",dispName:"Key Management Service"},{val:"identity_aware_proxy",dispName:"Identity-Aware Proxy"},{val:"security_key_enforcement",dispName:"Security Key Enforcement"},{val:"bigquery",dispName:"BigQuery"},{val:"cloud_datalab",dispName:"Cloud Datalab"},{val:"cloud_dataflow",dispName:"Cloud Dataflow"},{val:"cloud_pubsub",dispName:"Cloud Pub/Sub"},{val:"cloud_dataproc",dispName:"Cloud Dataproc"},{val:"genomics",dispName:"Genomics"},{val:"cloud_dataprep",dispName:"Cloud Dataprep"},{val:"data_studio",dispName:"Data Studio"},{val:"transfer_appliance",dispName:"Transfer Appliance"},{val:"cloud_machine_learning",dispName:"Cloud Machine Learning"},{val:"cloud_natural_language_api",dispName:"Cloud Natural Language API"},{val:"cloud_vision_api",dispName:"Vision API"},{val:"cloud_translation_api",dispName:"Translation API"},{val:"cloud_speech_api",dispName:"Speech API"},{val:"cloud_jobs_api",dispName:"Jobs API"},{val:"cloud_video_intelligence_api",dispName:"Cloud Video Intelligence API"},{val:"advanced_solutions_lab",dispName:"Advanced Solutions Lab"},{val:"cloud_iot_core",dispName:"Cloud IoT Core"},{val:"cloud_storage",dispName:"Cloud Storage"},{val:"cloud_sql",dispName:"Cloud SQL"},{val:"cloud_bigtable",dispName:"Cloud Bigtable"},{val:"cloud_spanner",dispName:"Cloud Spanner"},{val:"cloud_datastore",dispName:"Cloud Datastore"},{val:"persistent_disk",dispName:"Persistent Disk"},{val:"cloud_memorystore",dispName:"Cloud Memorystore"},{val:"cloud_filestore",dispName:"Cloud Filestore"},{val:"stackdriver",dispName:"Stackdriver"},{val:"cloud_deployment_manager",dispName:"Monitoring"},{val:"cloud_deployment_manager",dispName:"Deployment Manager"},{val:"logging",dispName:"Logging"},{val:"placeholder",dispName:"Cloud Console"},{val:"error_reporting",dispName:"Error Reporting"},{val:"placeholder",dispName:"Cloud Shell"},{val:"trace",dispName:"Trace"},{val:"placeholder",dispName:"Cloud Mobile App"},{val:"profiler",dispName:"Profiler"},{val:"placeholder",dispName:"Billing API"},{val:"cloud_apis",dispName:"Cloud APIs"},{val:"virtual_private_cloud",dispName:"Virtual Private Cloud"},{val:"dedicated_interconnect",dispName:"Dedicated Interconnect"},{val:"cloud_load_balancing",dispName:"Cloud Load Balancing"},{val:"cloud_dns",dispName:"Cloud DNS"},{val:"cloud_cdn",dispName:"Cloud CDN"},{val:"cloud_network",dispName:"Cloud Network"},{val:"cloud_external_ip_addresses",dispName:"Cloud External IP Addresses"},{val:"cloud_routes",dispName:"Cloud Routes"},{val:"cloud_firewall_rules",dispName:"Cloud Firewall Rules"},{val:"cloud_vpn",dispName:"Cloud VPN"},{val:"cloud_router",dispName:"Cloud Router"},{val:"cloud_armor",dispName:"Cloud Armor"},{val:"standard_network_tier",dispName:"Standard Network Tier"},{val:"premium_network_tier",dispName:"Premium Network Tier"},{val:"partner_interconnect",dispName:"Partner Interconnect"},{val:"placeholder",dispName:"Cloud SDK"},{val:"container_builder",dispName:"Cloud Build"},{val:"cloud_tools_for_powershell",dispName:"Cloud Tools for Visual Studio"},{val:"placeholder",dispName:"Cloud Source Repositories"},{val:"placeholder",dispName:"Maven App Engine Plugin"},{val:"placeholder",dispName:"Cloud Tools for Eclipse"},{val:"placeholder",dispName:"Cloud Tools for IntelliJ"},{val:"placeholder",dispName:"Cloud Test Lab"},{val:"cloud_tools_for_powershell",dispName:"Cloud Tools for PowerShell"},{val:"cloud_tools_for_powershell",dispName:"IDE Plugins"},{val:"container_registry",dispName:"Container Registry"},{val:"cloud_iot_edge",dispName:"Cloud IoT Edge"},{val:"cloud_firestore",dispName:"Cloud Firestore"},{val:"cloud_run",dispName:"Cloud Run"},{val:"gke_on_prem",dispName:"GKE-on-Prem"},{val:"cloud_data_catalog",dispName:"Cloud Data Catalog"},{val:"cloud_data_fusion",dispName:"Cloud Data Fusion"},{val:"ai_hub",dispName:"AI Hub"},{val:"automl_video_intelligence",dispName:"AutoML Video Intelligence"},{val:"automl_natural_language",dispName:"AutoML Natural Language"},{val:"automl_tables",dispName:"AutoML Tables"},{val:"automl_translation",dispName:"AutoML Translation"},{val:"automl_vision",dispName:"AutoML Vision"},{val:"recommendations_ai",dispName:"Recommendations AI"},{val:"cloud_inference_api",dispName:"Cloud Inference API"},{val:"cloud_service_mesh",dispName:"Cloud Service Mesh"},{val:"cloud_nat",dispName:"Cloud NAT"},{val:"traffic_director",dispName:"Traffic Director"},{val:"cloud_test_lab",dispName:"Cloud Test Lab"},{val:"cloud_code",dispName:"Cloud Code"},{val:"cloud_tasks",dispName:"Cloud Tasks"},{val:"placeholder",dispName:"Gradle App Engine Plugin"}]}],mxShapeGCP2HexIcon.prototype.paintVertexShape=function(e,a,t,l,o){e.translate(a,t);var i=mxUtils.getValue(this.state.style,"prIcon","compute_engine"),n=mxUtils.getValue(this.state.style,"prType",""),s=parseInt(mxUtils.getValue(this.state.style,"instNum",0)),p=mxUtils.getValue(this.state.style,"fillColor","#ffffff"),r=mxUtils.getValue(this.state.style,"opacity","100"),d=(mxUtils.getValue(this.state.style,"strokeColor","none"),mxUtils.getValue(this.state.style,"strokeWidth",1)),m=Math.min(l,o);switch(n){case"dynamic":var c=mxStencilRegistry.getStencil("mxgraph.gcp2.outline_blank_2");e.setAlpha(.5*r/100),e.setStrokeColor("none"),c.drawShape(e,this,.21*l,.12*o,.58*l,.76*o);break;case"multiple":c=mxStencilRegistry.getStencil("mxgraph.gcp2.outline_blank_2"),e.setAlpha(.5*r/100),e.setStrokeColor("none"),c.drawShape(e,this,.21*l,.12*o,.58*l,.76*o);var u=mxStencilRegistry.getStencil("mxgraph.gcp2.outline_blank_3");e.setAlpha(.7*r/100),e.setStrokeColor("none"),u.drawShape(e,this,.17*l,.13*o,.66*l,.74*o);break;case"shared":c=mxStencilRegistry.getStencil("mxgraph.gcp2.outline_blank_1"),this.style[mxConstants.STYLE_STROKEWIDTH]=.038*m,e.setAlpha(.4*r/100),e.setStrokeColor(p),e.setFillColor("none"),c.drawShape(e,this,.02*l,0*o,.96*l,o),u=mxStencilRegistry.getStencil("mxgraph.gcp2.outline_blank_2"),e.setAlpha(.7*r/100),u.drawShape(e,this,.14*l,.01*o,.72*l,.98*o),e.setAlpha(r/100),e.setFillColor("#ffffff"),c.drawShape(e,this,.13*l,.12*o,.74*l,.76*o),this.style[mxConstants.STYLE_STROKEWIDTH]=d;break;case"replica":c=mxStencilRegistry.getStencil("mxgraph.gcp2.outline_blank_1"),this.style[mxConstants.STYLE_STROKEWIDTH]=.038*m,e.setAlpha(.4*r/100),e.setStrokeColor(p),e.setFillColor("none"),c.drawShape(e,this,.02*l,0*o,.96*l,o),e.setAlpha(.7*r/100),c.drawShape(e,this,.075*l,.06*o,.85*l,.88*o),e.setAlpha(r/100),e.setFillColor("#ffffff"),c.drawShape(e,this,.13*l,.12*o,.74*l,.76*o),this.style[mxConstants.STYLE_STROKEWIDTH]=d;break;case"dynamic2":c=mxStencilRegistry.getStencil("mxgraph.gcp2.outline_blank_2"),e.setAlpha(.5*r/100),e.setStrokeColor("none"),c.drawShape(e,this,.14*l,.01*o,.72*l,.98*o),u=mxStencilRegistry.getStencil("mxgraph.gcp2.outline_blank_1"),this.style[mxConstants.STYLE_STROKEWIDTH]=.01*m,e.setStrokeColor(p),e.setAlpha(r/100),e.setFillColor("#ffffff"),u.drawShape(e,this,.13*l,.12*o,.74*l,.76*o),this.style[mxConstants.STYLE_STROKEWIDTH]=d;break;case"dynamic3":c=mxStencilRegistry.getStencil("mxgraph.gcp2.outline_blank_2"),e.setStrokeColor("none"),c.drawShape(e,this,.14*l,.01*o,.72*l,.98*o),u=mxStencilRegistry.getStencil("mxgraph.gcp2.outline_blank_1"),this.style[mxConstants.STYLE_STROKEWIDTH]=.01*m,e.setStrokeColor(p),e.setAlpha(r/100),e.setFillColor("#ffffff"),u.drawShape(e,this,.13*l,.12*o,.74*l,.76*o),this.style[mxConstants.STYLE_STROKEWIDTH]=d;break;case"highmem":c=mxStencilRegistry.getStencil("mxgraph.gcp2.outline_highmem"),e.setAlpha(.5*r/100),e.setStrokeColor("none"),c.drawShape(e,this,0,.56*o,l,.28*o);break;case"highcomp":c=mxStencilRegistry.getStencil("mxgraph.gcp2.outline_highcomp"),e.setAlpha(.5*r/100),e.setStrokeColor("none"),c.drawShape(e,this,0,.16*o,l,.28*o);break;case"backend":c=mxStencilRegistry.getStencil("mxgraph.gcp2.outline_blank_1"),e.setFillColor("#FCC64D"),c.drawShape(e,this,.12*l,.11*o,.76*l,.78*o);break;case"input":c=mxStencilRegistry.getStencil("mxgraph.gcp2.outline_blank_1"),e.setFillColor("#A5DA40"),c.drawShape(e,this,.12*l,.11*o,.76*l,.78*o)}e.setAlpha(r/100);var h=mxStencilRegistry.getStencil("mxgraph.gcp2."+i);null!=h&&(e.setFillColor(p),e.setStrokeColor("none"),h.drawShape(e,this,.17*l,.16*o,.66*l,.68*o)),s>0&&(e.setFillColor("#ffffff"),e.setStrokeColor("#ffffff"),e.setStrokeWidth(.038*m),e.ellipse(.2*l,0,.18*l,.22*o),e.fillAndStroke(),e.setAlpha(.5*r/100),e.setStrokeColor(p),e.ellipse(.2*l,0,.18*l,.22*o),e.stroke(),e.setAlpha(r/100),e.setFontColor("#4E6B89"),e.setFontStyle(1),e.setFontSize(.1*Math.min(l,o)),e.text(.29*l,.11*o+1,0,0,s.toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0))},mxCellRenderer.registerShape(mxShapeGCP2HexIcon.prototype.cst.HEX_ICON,mxShapeGCP2HexIcon),mxShapeGCP2HexIcon.prototype.getConstraints=function(e,a,t){var l=[];return l.push(new mxConnectionConstraint(new mxPoint(.825,.5),!1)),l.push(new mxConnectionConstraint(new mxPoint(.175,.5),!1)),l.push(new mxConnectionConstraint(new mxPoint(.5,.16),!1)),l.push(new mxConnectionConstraint(new mxPoint(.5,.84),!1)),l.push(new mxConnectionConstraint(new mxPoint(.66,.17),!1)),l.push(new mxConnectionConstraint(new mxPoint(.66,.83),!1)),l.push(new mxConnectionConstraint(new mxPoint(.34,.17),!1)),l.push(new mxConnectionConstraint(new mxPoint(.34,.83),!1)),l.push(new mxConnectionConstraint(new mxPoint(.75,.33),!1)),l.push(new mxConnectionConstraint(new mxPoint(.75,.67),!1)),l.push(new mxConnectionConstraint(new mxPoint(.25,.33),!1)),l.push(new mxConnectionConstraint(new mxPoint(.25,.67),!1)),l};