Skip to content

Commit

Permalink
remove group name
Browse files Browse the repository at this point in the history
  • Loading branch information
remoterami committed Oct 15, 2024
1 parent 7938169 commit e06bcb7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 25 deletions.
18 changes: 9 additions & 9 deletions backend/pkg/api/data_access/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,8 @@ func (d *DataAccessService) GetDashboardNotifications(ctx context.Context, userI
}

func (d *DataAccessService) GetValidatorDashboardNotificationDetails(ctx context.Context, dashboardId t.VDBIdPrimary, groupId uint64, epoch uint64, search string) (*t.NotificationValidatorDashboardDetail, error) {
// dev hack; TODO remove
if dashboardId == 5426 || dashboardId == 5334 {
return d.dummy.GetValidatorDashboardNotificationDetails(ctx, dashboardId, groupId, epoch, search)
}
notificationDetails := t.NotificationValidatorDashboardDetail{
ValidatorOffline: []uint64{},
GroupOffline: []string{},
ProposalMissed: []t.IndexSlots{},
ProposalDone: []t.IndexBlocks{},
UpcomingProposals: []t.IndexSlots{},
Expand All @@ -404,9 +399,7 @@ func (d *DataAccessService) GetValidatorDashboardNotificationDetails(ctx context
AttestationMissed: []t.IndexEpoch{},
Withdrawal: []t.IndexBlocks{},
ValidatorOfflineReminder: []uint64{},
GroupOfflineReminder: []string{},
ValidatorBackOnline: []t.NotificationEventValidatorBackOnline{},
GroupBackOnline: []t.NotificationEventGroupBackOnline{},
MinimumCollateralReached: []t.Address{},
MaximumCollateralReached: []t.Address{},
}
Expand All @@ -427,8 +420,15 @@ func (d *DataAccessService) GetValidatorDashboardNotificationDetails(ctx context
searchIndexSet[searchIndex] = true
}

query := `SELECT name FROM users_val_dashboards WHERE id = $1`
err := d.alloyReader.GetContext(ctx, &notificationDetails.DashboardName, query, dashboardId)
query := `SELECT
uvd.name AS dashboard_name,
uvdg.name AS group_name
FROM
users_val_dashboards uvd
INNER JOIN
users_val_dashboards_groups uvdg ON uvdg.dashboard_id = uvd.id
WHERE uvd.id = $1 AND uvdg.id = $2`
err := d.alloyReader.GetContext(ctx, &notificationDetails, query, dashboardId, groupId)
if err != nil {
if err == sql.ErrNoRows {
return &notificationDetails, nil
Expand Down
14 changes: 5 additions & 9 deletions backend/pkg/api/types/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,16 @@ type InternalGetUserNotificationDashboardsResponse ApiPagingResponse[Notificatio
// ------------------------------------------------------------
// Validator Dashboard Notification Detail

type NotificationEventGroupBackOnline struct {
GroupName string `json:"group_name"`
EpochCount uint64 `json:"epoch_count"`
}

type NotificationEventValidatorBackOnline struct {
Index uint64 `json:"index"`
EpochCount uint64 `json:"epoch_count"`
}

type NotificationValidatorDashboardDetail struct {
DashboardName string `json:"dashboard_name"`
DashboardName string `db:"dashboard_name" json:"dashboard_name"`
GroupName string `db:"group_name" json:"group_name"`
ValidatorOffline []uint64 `json:"validator_offline"` // validator indices
GroupOffline []string `json:"group_offline"` // TODO not filled yet
GroupOffline bool `json:"group_offline"` // TODO not filled yet
ProposalMissed []IndexSlots `json:"proposal_missed"`
ProposalDone []IndexBlocks `json:"proposal_done"`
UpcomingProposals []IndexSlots `json:"upcoming_proposals"`
Expand All @@ -70,9 +66,9 @@ type NotificationValidatorDashboardDetail struct {
AttestationMissed []IndexEpoch `json:"attestation_missed"` // index (epoch)
Withdrawal []IndexBlocks `json:"withdrawal"`
ValidatorOfflineReminder []uint64 `json:"validator_offline_reminder"` // validator indices; TODO not filled yet
GroupOfflineReminder []string `json:"group_offline_reminder"` // TODO not filled yet
GroupOfflineReminder bool `json:"group_offline_reminder"` // TODO not filled yet
ValidatorBackOnline []NotificationEventValidatorBackOnline `json:"validator_back_online"`
GroupBackOnline []NotificationEventGroupBackOnline `json:"group_back_online"` // TODO not filled yet
GroupBackOnline uint64 `json:"group_back_online"` // TODO not filled yet
MinimumCollateralReached []Address `json:"min_collateral_reached"` // node addresses
MaximumCollateralReached []Address `json:"max_collateral_reached"` // node addresses
}
Expand Down
11 changes: 4 additions & 7 deletions frontend/types/api/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,15 @@ export interface NotificationDashboardsTableRow {
event_types: ('validator_online' | 'validator_offline' | 'group_online' | 'group_offline' | 'attestation_missed' | 'proposal_success' | 'proposal_missed' | 'proposal_upcoming' | 'max_collateral' | 'min_collateral' | 'sync' | 'withdrawal' | 'validator_got_slashed' | 'validator_has_slashed' | 'incoming_tx' | 'outgoing_tx' | 'transfer_erc20' | 'transfer_erc721' | 'transfer_erc1155')[];
}
export type InternalGetUserNotificationDashboardsResponse = ApiPagingResponse<NotificationDashboardsTableRow>;
export interface NotificationEventGroupBackOnline {
group_name: string;
epoch_count: number /* uint64 */;
}
export interface NotificationEventValidatorBackOnline {
index: number /* uint64 */;
epoch_count: number /* uint64 */;
}
export interface NotificationValidatorDashboardDetail {
dashboard_name: string;
group_name: string;
validator_offline: number /* uint64 */[]; // validator indices
group_offline: string[]; // TODO not filled yet
group_offline: boolean; // TODO not filled yet
proposal_missed: IndexSlots[];
proposal_done: IndexBlocks[];
upcoming_proposals: IndexSlots[];
Expand All @@ -65,9 +62,9 @@ export interface NotificationValidatorDashboardDetail {
attestation_missed: IndexEpoch[]; // index (epoch)
withdrawal: IndexBlocks[];
validator_offline_reminder: number /* uint64 */[]; // validator indices; TODO not filled yet
group_offline_reminder: string[]; // TODO not filled yet
group_offline_reminder: boolean; // TODO not filled yet
validator_back_online: NotificationEventValidatorBackOnline[];
group_back_online: NotificationEventGroupBackOnline[]; // TODO not filled yet
group_back_online: number /* uint64 */; // TODO not filled yet
min_collateral_reached: Address[]; // node addresses
max_collateral_reached: Address[]; // node addresses
}
Expand Down

0 comments on commit e06bcb7

Please sign in to comment.