dashboard.constants.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*
  2. Copyright (C) 2025 QuantumNous
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Affero General Public License as
  5. published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Affero General Public License for more details.
  11. You should have received a copy of the GNU Affero General Public License
  12. along with this program. If not, see <https://www.gnu.org/licenses/>.
  13. For commercial licensing, please contact support@quantumnous.com
  14. */
  15. // ========== UI 配置常量 ==========
  16. export const CHART_CONFIG = { mode: 'desktop-browser' };
  17. export const CARD_PROPS = {
  18. shadows: '',
  19. bordered: true,
  20. headerLine: true,
  21. };
  22. export const FORM_FIELD_PROPS = {
  23. className: 'w-full mb-2 !rounded-lg',
  24. size: 'large',
  25. };
  26. export const ICON_BUTTON_CLASS = 'text-white hover:bg-opacity-80 !rounded-full';
  27. export const FLEX_CENTER_GAP2 = 'flex items-center gap-2';
  28. export const ILLUSTRATION_SIZE = { width: 96, height: 96 };
  29. // ========== 时间相关常量 ==========
  30. export const TIME_OPTIONS = [
  31. { label: '小时', value: 'hour' },
  32. { label: '天', value: 'day' },
  33. { label: '周', value: 'week' },
  34. ];
  35. export const DEFAULT_TIME_INTERVALS = {
  36. hour: { seconds: 3600, minutes: 60 },
  37. day: { seconds: 86400, minutes: 1440 },
  38. week: { seconds: 604800, minutes: 10080 },
  39. };
  40. // ========== 默认时间设置 ==========
  41. export const DEFAULT_TIME_RANGE = {
  42. HOUR: 'hour',
  43. DAY: 'day',
  44. WEEK: 'week',
  45. };
  46. // ========== 图表默认配置 ==========
  47. export const DEFAULT_CHART_SPECS = {
  48. PIE: {
  49. type: 'pie',
  50. outerRadius: 0.8,
  51. innerRadius: 0.5,
  52. padAngle: 0.6,
  53. valueField: 'value',
  54. categoryField: 'type',
  55. pie: {
  56. style: {
  57. cornerRadius: 10,
  58. },
  59. state: {
  60. hover: {
  61. outerRadius: 0.85,
  62. stroke: '#000',
  63. lineWidth: 1,
  64. },
  65. selected: {
  66. outerRadius: 0.85,
  67. stroke: '#000',
  68. lineWidth: 1,
  69. },
  70. },
  71. },
  72. legends: {
  73. visible: true,
  74. orient: 'left',
  75. },
  76. label: {
  77. visible: true,
  78. },
  79. },
  80. BAR: {
  81. type: 'bar',
  82. stack: true,
  83. legends: {
  84. visible: true,
  85. selectMode: 'single',
  86. },
  87. bar: {
  88. state: {
  89. hover: {
  90. stroke: '#000',
  91. lineWidth: 1,
  92. },
  93. },
  94. },
  95. },
  96. LINE: {
  97. type: 'line',
  98. legends: {
  99. visible: true,
  100. selectMode: 'single',
  101. },
  102. },
  103. };
  104. // ========== 公告图例数据 ==========
  105. export const ANNOUNCEMENT_LEGEND_DATA = [
  106. { color: 'grey', label: '默认', type: 'default' },
  107. { color: 'blue', label: '进行中', type: 'ongoing' },
  108. { color: 'green', label: '成功', type: 'success' },
  109. { color: 'orange', label: '警告', type: 'warning' },
  110. { color: 'red', label: '异常', type: 'error' },
  111. ];
  112. // ========== Uptime 状态映射 ==========
  113. export const UPTIME_STATUS_MAP = {
  114. 1: { color: '#10b981', label: '正常', text: '可用率' }, // UP
  115. 0: { color: '#ef4444', label: '异常', text: '有异常' }, // DOWN
  116. 2: { color: '#f59e0b', label: '高延迟', text: '高延迟' }, // PENDING
  117. 3: { color: '#3b82f6', label: '维护中', text: '维护中' }, // MAINTENANCE
  118. };
  119. // ========== 本地存储键名 ==========
  120. export const STORAGE_KEYS = {
  121. DATA_EXPORT_DEFAULT_TIME: 'data_export_default_time',
  122. MJ_NOTIFY_ENABLED: 'mj_notify_enabled',
  123. };
  124. // ========== 默认值 ==========
  125. export const DEFAULTS = {
  126. PAGE_SIZE: 20,
  127. CHART_HEIGHT: 96,
  128. MODEL_TABLE_PAGE_SIZE: 10,
  129. MAX_TREND_POINTS: 7,
  130. };