-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathdb-tables-list.component.html
More file actions
205 lines (186 loc) · 11.7 KB
/
db-tables-list.component.html
File metadata and controls
205 lines (186 loc) · 11.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<app-content-loader *ngIf="tableFolders === null; else tablesList"></app-content-loader>
<ng-template #tablesList>
<div *ngIf="allTables && allTables.length; else noTables" class="tables-list">
<!-- Collapsed content when sidebar is collapsed -->
<div *ngIf="collapsed" class="collapsed-content">
<!-- Top section with search and folders -->
<div class="collapsed-top-section">
<!-- Search button -->
<div class="collapsed-search-button"
(click)="toggleCollapsedSearch()"
matTooltip="Search"
matTooltipPosition="right">
<mat-icon class="collapsed-action-icon">search</mat-icon>
</div>
<!-- Show folders in collapsed state -->
<div *ngIf="folders.length > 0" class="collapsed-folders">
<div *ngFor="let folder of folders"
class="collapsed-folder-item"
[class.collapsed-folder-item_active]="currentCollapsedFolder?.id === folder.id"
[matTooltip]="folder.name"
matTooltipPosition="right"
(click)="onCollapsedFolderClick(folder)">
<span *ngIf="folder.id === 'all-tables-kitten'"
class="material-symbols-outlined collapsed-folder-icon">dehaze</span>
<span *ngIf="folder.id !== 'all-tables-kitten'"
class="material-symbols-outlined collapsed-folder-icon"
[style.color]="folder.iconColor || null">folder</span>
</div>
</div>
<!-- Fallback to dehaze if no folders -->
<span *ngIf="folders.length === 0"
class="material-symbols-outlined collapsed-folder-icon"
matTooltip="All Tables"
matTooltipPosition="right">dehaze</span>
<!-- Collapsed table list for any folder -->
<div *ngIf="showCollapsedTableList" class="collapsed-tables-list">
<div *ngFor="let tableItem of getCollapsedTableList()"
[matTooltip]="getTableName(tableItem)"
matTooltipPosition="right">
<a class="collapsed-table-item"
routerLink="/dashboard/{{connectionID}}/{{tableItem.table}}"
[queryParams]="{page_index: 0, page_size: 30}"
[ngClass]="{'collapsed-table-item_active': selectedTable === tableItem.table}"
(click)="closeSidebar()">
<!-- Show icon if available, otherwise show initials -->
<mat-icon *ngIf="tableItem.icon; else tableNameInitials" class="table-list-icon">
{{tableItem.icon}}
</mat-icon>
<ng-template #tableNameInitials>
{{tableItem.initials}}
</ng-template>
</a>
</div>
</div>
</div>
<!-- Bottom section with add folder button (fixed at bottom) -->
<div class="collapsed-bottom-section" *ngIf="canEditConnection()">
<!-- Add folder button -->
<div class="collapsed-add-button"
(click)="onAddFolder()"
matTooltip="Add folder"
matTooltipPosition="right">
<mat-icon class="collapsed-action-icon">add</mat-icon>
</div>
</div>
</div>
<!-- Expanded state container -->
<div *ngIf="!collapsed" class="expanded-container" [class.has-custom-folders]="hasCustomFolders()">
<!-- Search field always at the top -->
<mat-form-field appearance="fill" class="search-input">
<input matInput name="search" #search="ngModel"
placeholder="Search"
[(ngModel)]="substringToSearch"
(keyup)="searchSubstring()">
<mat-error *ngIf="foundTables.length === 0">Nothing found.</mat-error>
</mat-form-field>
<!-- Add Folder button (position controlled by CSS order) -->
<div *ngIf="canEditConnection()" class="add-folder-button-container">
<button type="button" mat-stroked-button color="primary" class="add-folder-button" (click)="onAddFolder()">
<mat-icon>add</mat-icon>
Add folder
</button>
</div>
<!-- Collections Section -->
<div *ngIf="folders && folders.length > 0" class="folders-section">
<ng-container *ngFor="let folder of folders; trackBy: trackByFolderId">
<div *ngIf="shouldShowFolder(folder)"
class="folder-item"
[class.expanded]="folder.expanded"
[class.drag-over]="canEditConnection() && dragOverFolder !== 'all-tables-kitten' && dragOverFolder === folder.id"
(dragover)="canEditConnection() && onFolderDragOver($event, folder.id)"
(dragleave)="canEditConnection() && onFolderDragLeave($event, folder.id)"
(drop)="canEditConnection() && onFolderDrop($event, folder)">
<div class="folder-header"
[class.expanded]="folder.expanded"
(click)="toggleFolder(folder.id)">
<!-- Folder icon on the left -->
<span *ngIf="folder.id === 'all-tables-kitten'"
class="material-symbols-outlined folder-icon"
[style.color]="folder.iconColor || null">dehaze</span>
<span *ngIf="folder.id !== 'all-tables-kitten'"
class="material-symbols-outlined folder-icon"
[style.color]="folder.iconColor || null">folder</span>
<div class="folder-name"
[matTooltip]="folder.name"
[matTooltipDisabled]="folder.name.length <= 18">
{{folder.name}}
</div>
<div class="folder-actions">
<button type="button" *ngIf="folder.id !== 'all-tables-kitten' && canEditConnection()"
mat-icon-button class="more-folder-button"
[matMenuTriggerFor]="folderMenu"
(click)="$event.stopPropagation()"
matTooltip="Folder options">
<mat-icon>more_vert</mat-icon>
</button>
<!-- Expand/collapse icon on the right -->
<mat-icon *ngIf="folder.id !== 'all-tables-kitten' || hasCustomFolders()"
class="folder-expand-icon" [class.expanded]="folder.expanded">
chevron_right
</mat-icon>
<mat-menu #folderMenu="matMenu">
<button type="button" mat-menu-item (click)="showEditTablesDialog(folder)">
<mat-icon fontSet="material-symbols-outlined">edit_note</mat-icon>
<span>Edit</span>
</button>
<button type="button" mat-menu-item (click)="deleteFolder(folder)">
<mat-icon fontSet="material-symbols-outlined">delete</mat-icon>
<span>Delete</span>
</button>
</mat-menu>
</div>
</div>
<div *ngIf="folder.expanded" class="folder-tables">
<div *ngIf="getFolderTables(folder).length > 0; else noTablesInCollection"
class="selected-tables-list"
cdkDropList
[cdkDropListDisabled]="!isReorderingEnabled(folder)"
(cdkDropListDropped)="onTableReorder($event, folder)">
<div *ngFor="let table of getFolderTables(folder)"
class="selected-table-item"
[matTooltip]="getTableName(table)"
[matTooltipDisabled]="getTableNameLength(getTableName(table)) <= 18"
cdkDrag
[cdkDragDisabled]="!isReorderingEnabled(folder)">
<mat-icon *ngIf="isReorderingEnabled(folder)"
class="table-drag-handle"
cdkDragHandle>drag_indicator</mat-icon>
<a class="table-link"
routerLink="/dashboard/{{connectionID}}/{{table.table}}"
[queryParams]="{page_index: 0, page_size: 30}"
[ngClass]="{'table-link_active': selectedTable === table.table}"
[draggable]="canEditConnection()"
(dragstart)="canEditConnection() && onTableDragStart($event, table)"
(dragend)="canEditConnection() && onTableDragEnd($event)"
(click)="closeSidebar()">
<span class="table-name">{{getTableName(table)}}</span>
</a>
</div>
</div>
<ng-template #noTablesInCollection>
<div class="no-tables-message" [class.empty-folder-message]="folder.isEmpty">
<p *ngIf="!folder.isEmpty">No tables in this folder</p>
<button type="button" mat-stroked-button
color="primary"
[class.empty-folder-button]="folder.isEmpty"
(click)="showEditTablesDialog(folder)">
{{folder.isEmpty ? 'Add or drag and drop tables' : 'Add table'}}
</button>
</div>
</ng-template>
</div>
</div>
</ng-container>
</div>
</div>
</div>
<ng-template #noTables>
<p class="mat-body-1 empty-message">
No tables in this connection.
</p>
<p class="mat-body-1 empty-message">
Rocketadmin do not provide adding and deleting database tables, only editing ones. You can add a table with SQL editor.
</p>
</ng-template>
</ng-template>