styles.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. import { GRAPH_VIEW_MODE, RESOURCE_VIEW_MODE } from './naming';
  2. export const DETAILS_PANEL_WIDTH = 620;
  3. export const DETAILS_PANEL_OFFSET = 8;
  4. export const DETAILS_PANEL_MARGINS = {
  5. bottom: 48,
  6. right: 36,
  7. top: 24
  8. };
  9. // Resource view
  10. export const RESOURCES_LAYER_TITLE_WIDTH = 200;
  11. export const RESOURCES_LAYER_HEIGHT = 150;
  12. export const RESOURCES_LAYER_PADDING = 10;
  13. export const RESOURCES_LABEL_MIN_SIZE = 50;
  14. export const RESOURCES_LABEL_PADDING = 10;
  15. // Node shapes
  16. export const UNIT_CLOUD_PATH = 'M-1.25 0.233Q-1.25 0.44-1.104 0.587-0.957 0.733-0.75 0.733H0.667Q'
  17. + '0.908 0.733 1.079 0.562 1.25 0.391 1.25 0.15 1.25-0.022 1.158-0.164 1.065-0.307 0.914-0.377q'
  18. + '0.003-0.036 0.003-0.056 0-0.276-0.196-0.472-0.195-0.195-0.471-0.195-0.206 0-0.373 0.115-0.167'
  19. + ' 0.115-0.244 0.299-0.091-0.081-0.216-0.081-0.138 0-0.236 0.098-0.098 0.098-0.098 0.236 0 0.098'
  20. + ' 0.054 0.179-0.168 0.039-0.278 0.175-0.109 0.136-0.109 0.312z';
  21. // Node Cylinder shape
  22. export const UNIT_CYLINDER_PATH = 'm -1 -1.25' // this line is responsible for adjusting place of the shape with respect to dot
  23. + 'a 1 0.4 0 0 0 2 0'
  24. + 'm -2 0'
  25. + 'v 1.8'
  26. + 'a 1 0.4 0 0 0 2 0'
  27. + 'v -1.8'
  28. + 'a 1 0.4 0 0 0 -2 0';
  29. // Node Storage Sheet Shape
  30. export const SHEET = 'm -1.2 -1.6 m 0.4 0 v 2.4 m -0.4 -2.4 v 2.4 h 2 v -2.4 z m 0 0.4 h 2';
  31. // NOTE: This value represents the node unit radius (in pixels). Since zooming is
  32. // controlled at the top level now, this renormalization would be obsolete (i.e.
  33. // value 1 could be used instead), if it wasn't for the following factors:
  34. // 1. `dagre` library only works with integer coordinates,
  35. // so >> 1 value is used to increase layout precision.
  36. // 2. Fonts don't behave nicely (especially on Firefox) if they
  37. // are given on a small unit scale as foreign objects in SVG.
  38. export const NODE_BASE_SIZE = 200; //系统默认100
  39. // This value represents the upper bound on the number of control points along the graph edge
  40. // curve. Any integer value >= 6 should result in valid edges, but generally the greater this
  41. // value is, the nicer the edge bundling will be. On the other hand, big values would result
  42. // in slower rendering of the graph.
  43. export const EDGE_WAYPOINTS_CAP = 10;
  44. export const CANVAS_MARGINS = {
  45. [GRAPH_VIEW_MODE]: {
  46. bottom: 150, left: 80, right: 80, top: 220
  47. },
  48. [RESOURCE_VIEW_MODE]: {
  49. bottom: 150, left: 210, right: 40, top: 200
  50. },
  51. };
  52. // Node details table constants
  53. export const NODE_DETAILS_TABLE_CW = {
  54. L: '85px',
  55. M: '70px',
  56. // 6 chars wide with our current font choices, (pids can be 6, ports only 5).
  57. S: '56px',
  58. XL: '120px',
  59. XS: '32px',
  60. XXL: '140px',
  61. XXXL: '170px',
  62. };
  63. export const NODE_DETAILS_TABLE_COLUMN_WIDTHS = {
  64. container: NODE_DETAILS_TABLE_CW.XS,
  65. count: NODE_DETAILS_TABLE_CW.XS,
  66. docker_container_created: NODE_DETAILS_TABLE_CW.XXXL,
  67. docker_container_restart_count: NODE_DETAILS_TABLE_CW.M,
  68. docker_container_state_human: NODE_DETAILS_TABLE_CW.XXXL,
  69. docker_container_uptime: NODE_DETAILS_TABLE_CW.L,
  70. docker_cpu_total_usage: NODE_DETAILS_TABLE_CW.M,
  71. docker_memory_usage: NODE_DETAILS_TABLE_CW.M,
  72. // e.g. details panel > pods
  73. kubernetes_ip: NODE_DETAILS_TABLE_CW.XL,
  74. kubernetes_state: NODE_DETAILS_TABLE_CW.M,
  75. open_files_count: NODE_DETAILS_TABLE_CW.M,
  76. pid: NODE_DETAILS_TABLE_CW.S,
  77. port: NODE_DETAILS_TABLE_CW.S,
  78. // Label "Parent PID" needs more space
  79. ppid: NODE_DETAILS_TABLE_CW.M,
  80. process_cpu_usage_percent: NODE_DETAILS_TABLE_CW.M,
  81. process_memory_usage_bytes: NODE_DETAILS_TABLE_CW.M,
  82. threads: NODE_DETAILS_TABLE_CW.M,
  83. // weave connections
  84. weave_connection_connection: NODE_DETAILS_TABLE_CW.XXL,
  85. weave_connection_info: NODE_DETAILS_TABLE_CW.XL,
  86. weave_connection_state: NODE_DETAILS_TABLE_CW.L,
  87. };
  88. export const NODE_DETAILS_TABLE_XS_LABEL = {
  89. // TODO: consider changing the name of this field on the BE
  90. container: '#',
  91. count: '#',
  92. };