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