Aller au contenu principal

Dashboard Widget Development

Create custom dashboard widgets for the Gauzy dashboard.

Overview

Dashboard widgets provide at-a-glance metrics and data visualizations on the main dashboard.

Widget Architecture

interface IDashboardWidget {
id: string;
name: string;
component: Type<any>;
defaultWidth: number; // Grid columns (1-12)
defaultHeight: number; // Grid rows
permissions?: string[];
}

Creating a Widget

1. Create the Component

@Component({
selector: "ga-my-widget",
template: `
<nb-card>
<nb-card-header>My Widget</nb-card-header>
<nb-card-body>
<div class="widget-content">
<span class="metric">{{ value }}</span>
<span class="label">Active Tasks</span>
</div>
</nb-card-body>
</nb-card>
`,
})
export class MyWidgetComponent implements OnInit {
value: number;

ngOnInit() {
this.loadData();
}

async loadData() {
this.value = await this.dashboardService.getActiveTaskCount();
}
}

2. Register the Widget

@NgModule({
declarations: [MyWidgetComponent],
providers: [
{
provide: DASHBOARD_WIDGETS,
useValue: {
id: "my-widget",
name: "Active Tasks",
component: MyWidgetComponent,
defaultWidth: 4,
defaultHeight: 2,
},
multi: true,
},
],
})
export class MyWidgetModule {}

Built-in Widgets

WidgetDescriptionDefault Size
Today's LogCurrent day time log4 × 2
Active TasksTasks in progress4 × 2
Team ActivityTeam member status4 × 3
Income/ExpenseFinancial summary6 × 3
Project ProgressProject completion6 × 3

API Reference