database-nav.ts 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. // @ts-nocheck
  2. import { SHORTCUT_REFERENCE_GROUPS } from '../referenceGroups'
  3. import { RegistryDefinations } from '../types'
  4. /**
  5. * Contextual chords for jumping between Database sub-pages — `D + <letter>`.
  6. *
  7. * Active only while DatabaseLayout is mounted (i.e. the user is somewhere
  8. * under `/project/<ref>/database/*`). The chord intentionally lives on the
  9. * page rather than globally so the leading `D` doesn't burn a global key for
  10. * a destination most users only care about while already in the section.
  11. *
  12. */
  13. export const DATABASE_NAV_SHORTCUT_IDS = {
  14. NAV_DATABASE_TABLES: 'nav.database-tables',
  15. NAV_DATABASE_FUNCTIONS: 'nav.database-functions',
  16. NAV_DATABASE_TRIGGERS: 'nav.database-triggers',
  17. NAV_DATABASE_INDEXES: 'nav.database-indexes',
  18. NAV_DATABASE_EXTENSIONS: 'nav.database-extensions',
  19. NAV_DATABASE_SCHEMA_VISUALIZER: 'nav.database-schema-visualizer',
  20. NAV_DATABASE_ROLES: 'nav.database-roles',
  21. NAV_DATABASE_BACKUPS: 'nav.database-backups',
  22. NAV_DATABASE_MIGRATIONS: 'nav.database-migrations',
  23. NAV_DATABASE_TYPES: 'nav.database-types',
  24. NAV_DATABASE_PUBLICATIONS: 'nav.database-publications',
  25. NAV_DATABASE_COLUMN_PRIVILEGES: 'nav.database-column-privileges',
  26. NAV_DATABASE_SETTINGS: 'nav.database-settings',
  27. NAV_DATABASE_REPLICATION: 'nav.database-replication',
  28. }
  29. export type DatabaseNavShortcutId =
  30. (typeof DATABASE_NAV_SHORTCUT_IDS)[keyof typeof DATABASE_NAV_SHORTCUT_IDS]
  31. export const databaseNavRegistry: RegistryDefinations<DatabaseNavShortcutId> = {
  32. [DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_TABLES]: {
  33. id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_TABLES,
  34. label: 'Go to Tables',
  35. sequence: ['D', 'T'],
  36. showInSettings: false,
  37. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,
  38. },
  39. [DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_FUNCTIONS]: {
  40. id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_FUNCTIONS,
  41. label: 'Go to Functions',
  42. sequence: ['D', 'F'],
  43. showInSettings: false,
  44. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,
  45. },
  46. [DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_TRIGGERS]: {
  47. id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_TRIGGERS,
  48. label: 'Go to Triggers',
  49. sequence: ['D', 'R'],
  50. showInSettings: false,
  51. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,
  52. },
  53. [DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_INDEXES]: {
  54. id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_INDEXES,
  55. label: 'Go to Indexes',
  56. sequence: ['D', 'I'],
  57. showInSettings: false,
  58. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,
  59. },
  60. [DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_EXTENSIONS]: {
  61. id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_EXTENSIONS,
  62. label: 'Go to Extensions',
  63. sequence: ['D', 'X'],
  64. showInSettings: false,
  65. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,
  66. },
  67. [DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_SCHEMA_VISUALIZER]: {
  68. id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_SCHEMA_VISUALIZER,
  69. label: 'Go to Schema Visualizer',
  70. sequence: ['D', 'V'],
  71. showInSettings: false,
  72. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,
  73. },
  74. [DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_ROLES]: {
  75. id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_ROLES,
  76. label: 'Go to Roles',
  77. sequence: ['D', 'O'],
  78. showInSettings: false,
  79. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,
  80. },
  81. [DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_BACKUPS]: {
  82. id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_BACKUPS,
  83. label: 'Go to Backups',
  84. sequence: ['D', 'B'],
  85. showInSettings: false,
  86. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,
  87. },
  88. [DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_MIGRATIONS]: {
  89. id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_MIGRATIONS,
  90. label: 'Go to Migrations',
  91. sequence: ['D', 'M'],
  92. showInSettings: false,
  93. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,
  94. },
  95. [DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_TYPES]: {
  96. id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_TYPES,
  97. label: 'Go to Enumerated Types',
  98. sequence: ['D', 'E'],
  99. showInSettings: false,
  100. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,
  101. },
  102. [DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_PUBLICATIONS]: {
  103. id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_PUBLICATIONS,
  104. label: 'Go to Publications',
  105. sequence: ['D', 'U'],
  106. showInSettings: false,
  107. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,
  108. },
  109. [DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_COLUMN_PRIVILEGES]: {
  110. id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_COLUMN_PRIVILEGES,
  111. label: 'Go to Column Privileges',
  112. sequence: ['D', 'C'],
  113. showInSettings: false,
  114. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,
  115. },
  116. [DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_SETTINGS]: {
  117. id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_SETTINGS,
  118. label: 'Go to Database Settings',
  119. sequence: ['D', ','],
  120. showInSettings: false,
  121. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,
  122. },
  123. [DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_REPLICATION]: {
  124. id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_REPLICATION,
  125. label: 'Go to Replication',
  126. sequence: ['D', 'L'],
  127. showInSettings: false,
  128. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,
  129. },
  130. }