Skip to content

Commit 64e735a

Browse files
Merge pull request #1665 from rocket-admin/signals-migration
Signals migration
2 parents b8764be + 5a7c813 commit 64e735a

7 files changed

Lines changed: 41 additions & 36 deletions

File tree

frontend/src/app/components/dashboard/dashboard.component.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,6 @@ export class DashboardComponent implements OnInit, OnDestroy {
160160
console.log('getData');
161161

162162
this._tables.fetchTablesFolders(this.connectionID).subscribe((res) => {
163-
console.log('getTables folders');
164-
console.log(res);
165-
166163
const tables = res.find((item) => item.category_id === 'all-tables-kitten')?.tables || [];
167164

168165
this.tableFolders = res;
@@ -215,6 +212,12 @@ export class DashboardComponent implements OnInit, OnDestroy {
215212
}
216213
});
217214
}
215+
},
216+
(err) => {
217+
this.isServerError = true;
218+
this.serverError = { abstract: err.error?.message || err.message, details: err.error?.originalMessage };
219+
this.loading = false;
220+
this.title.setTitle(`Error | ${this._company.companyTabTitle || 'Rocketadmin'}`);
218221
});
219222
}
220223

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="banner-wrapper">
2-
<div class="banner-box banner_{{type}}">
2+
<div class="banner-box banner_{{type()}}">
33
<ng-content></ng-content>
44
</div>
55
</div>
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Input, OnInit } from '@angular/core';
1+
import { Component, input } from '@angular/core';
22

33
import { AlertType } from 'src/app/models/alert';
44

@@ -7,8 +7,6 @@ import { AlertType } from 'src/app/models/alert';
77
templateUrl: './banner.component.html',
88
styleUrls: ['./banner.component.css'],
99
})
10-
export class BannerComponent implements OnInit {
11-
@Input() type: AlertType;
12-
13-
ngOnInit(): void {}
10+
export class BannerComponent {
11+
type = input<AlertType>();
1412
}
Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
<div class="breadcrumbs">
2-
<ng-container *ngFor="let crumb of crumbs; let i = index">
3-
<a mat-button *ngIf="crumb.link; else staticCrumb"
4-
[routerLink]="crumb.link"
5-
[queryParams]="crumb.queryParams"
6-
class="breadcrumb">
7-
{{crumb.label}}
8-
</a>
9-
<ng-template #staticCrumb>
10-
<strong class="mat-body-1 static-crumb">{{crumb.label}}</strong>
11-
</ng-template>
12-
<mat-icon *ngIf="crumbs.length !== i + 1" class="breadcrumbDivider">chevron_right</mat-icon>
13-
</ng-container>
2+
@for (crumb of crumbs(); track crumb.label; let i = $index) {
3+
@if (crumb.link) {
4+
<a mat-button
5+
[routerLink]="crumb.link"
6+
[queryParams]="crumb.queryParams"
7+
class="breadcrumb">
8+
{{crumb.label}}
9+
</a>
10+
} @else {
11+
<strong class="static-crumb">{{crumb.label}}</strong>
12+
}
13+
@if (crumbs().length !== i + 1) {
14+
<mat-icon class="breadcrumbDivider">chevron_right</mat-icon>
15+
}
16+
}
1417
</div>
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
import { CommonModule } from '@angular/common';
2-
import { Component, Input, OnInit } from '@angular/core';
1+
import { Component, input } from '@angular/core';
32
import { MatButtonModule } from '@angular/material/button';
43
import { MatIconModule } from '@angular/material/icon';
54
import { RouterModule } from '@angular/router';
65

6+
interface Breadcrumb {
7+
label: string;
8+
link?: string | null;
9+
queryParams?: Record<string, string>;
10+
}
11+
712
@Component({
813
selector: 'app-breadcrumbs',
914
templateUrl: './breadcrumbs.component.html',
1015
styleUrls: ['./breadcrumbs.component.css'],
1116
standalone: true,
12-
imports: [CommonModule, RouterModule, MatIconModule, MatButtonModule],
17+
imports: [RouterModule, MatIconModule, MatButtonModule],
1318
})
14-
export class BreadcrumbsComponent implements OnInit {
15-
@Input() crumbs;
16-
17-
ngOnInit(): void {}
19+
export class BreadcrumbsComponent {
20+
crumbs = input<Breadcrumb[]>([]);
1821
}

frontend/src/app/components/ui-components/ip-address-button/ip-address-button.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
class="ip-copy-button"
33
matTooltip="Copy IP address"
44
cdkCopyToClipboard="18.221.81.73/32"
5-
(cdkCopyToClipboardCopied)="showCopyNotification(ip + ' IP address was copied to clipboard.')">
6-
<strong>{{ ip }}</strong>
5+
(cdkCopyToClipboardCopied)="showCopyNotification(ip() + ' IP address was copied to clipboard.')">
6+
<strong>{{ ip() }}</strong>
77
</button>

frontend/src/app/components/ui-components/ip-address-button/ip-address-button.component.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CdkCopyToClipboard } from '@angular/cdk/clipboard';
2-
import { Component, Input, OnInit } from '@angular/core';
2+
import { Component, inject, input } from '@angular/core';
33
import { NotificationsService } from 'src/app/services/notifications.service';
44

55
@Component({
@@ -8,12 +8,10 @@ import { NotificationsService } from 'src/app/services/notifications.service';
88
styleUrls: ['./ip-address-button.component.css'],
99
imports: [CdkCopyToClipboard],
1010
})
11-
export class IpAddressButtonComponent implements OnInit {
12-
@Input() ip: string;
11+
export class IpAddressButtonComponent {
12+
private _notifications = inject(NotificationsService);
1313

14-
constructor(private _notifications: NotificationsService) {}
15-
16-
ngOnInit(): void {}
14+
ip = input<string>('');
1715

1816
showCopyNotification(message: string) {
1917
this._notifications.showSuccessSnackbar(message);

0 commit comments

Comments
 (0)