From 2270cff5d7c271571f40a7ace05f1182a7aefbb8 Mon Sep 17 00:00:00 2001 From: LUCCA DUKIC <109136188+LuccaBitfly@users.noreply.github.com> Date: Tue, 1 Oct 2024 13:34:05 +0200 Subject: [PATCH 1/3] (BEDS-510) adapt structs to design --- backend/pkg/api/data_access/dummy.go | 2 +- backend/pkg/api/data_access/notifications.go | 6 +-- backend/pkg/api/handlers/public.go | 14 ++++--- backend/pkg/api/types/notifications.go | 44 ++++++++++---------- frontend/types/api/notifications.ts | 21 +++++----- 5 files changed, 44 insertions(+), 43 deletions(-) diff --git a/backend/pkg/api/data_access/dummy.go b/backend/pkg/api/data_access/dummy.go index b82c03e47..2d667417b 100644 --- a/backend/pkg/api/data_access/dummy.go +++ b/backend/pkg/api/data_access/dummy.go @@ -480,7 +480,7 @@ func (d *DummyService) GetClientNotifications(ctx context.Context, userId uint64 func (d *DummyService) GetRocketPoolNotifications(ctx context.Context, userId uint64, cursor string, colSort t.Sort[enums.NotificationRocketPoolColumn], search string, limit uint64) ([]t.NotificationRocketPoolTableRow, *t.Paging, error) { return getDummyWithPaging[t.NotificationRocketPoolTableRow]() } -func (d *DummyService) GetNetworkNotifications(ctx context.Context, userId uint64, cursor string, colSort t.Sort[enums.NotificationNetworksColumn], search string, limit uint64) ([]t.NotificationNetworksTableRow, *t.Paging, error) { +func (d *DummyService) GetNetworkNotifications(ctx context.Context, userId uint64, cursor string, colSort t.Sort[enums.NotificationNetworksColumn], limit uint64) ([]t.NotificationNetworksTableRow, *t.Paging, error) { return getDummyWithPaging[t.NotificationNetworksTableRow]() } diff --git a/backend/pkg/api/data_access/notifications.go b/backend/pkg/api/data_access/notifications.go index d8e637244..813caca74 100644 --- a/backend/pkg/api/data_access/notifications.go +++ b/backend/pkg/api/data_access/notifications.go @@ -18,7 +18,7 @@ type NotificationsRepository interface { GetMachineNotifications(ctx context.Context, userId uint64, cursor string, colSort t.Sort[enums.NotificationMachinesColumn], search string, limit uint64) ([]t.NotificationMachinesTableRow, *t.Paging, error) GetClientNotifications(ctx context.Context, userId uint64, cursor string, colSort t.Sort[enums.NotificationClientsColumn], search string, limit uint64) ([]t.NotificationClientsTableRow, *t.Paging, error) GetRocketPoolNotifications(ctx context.Context, userId uint64, cursor string, colSort t.Sort[enums.NotificationRocketPoolColumn], search string, limit uint64) ([]t.NotificationRocketPoolTableRow, *t.Paging, error) - GetNetworkNotifications(ctx context.Context, userId uint64, cursor string, colSort t.Sort[enums.NotificationNetworksColumn], search string, limit uint64) ([]t.NotificationNetworksTableRow, *t.Paging, error) + GetNetworkNotifications(ctx context.Context, userId uint64, cursor string, colSort t.Sort[enums.NotificationNetworksColumn], limit uint64) ([]t.NotificationNetworksTableRow, *t.Paging, error) GetNotificationSettings(ctx context.Context, userId uint64) (*t.NotificationSettings, error) UpdateNotificationSettingsGeneral(ctx context.Context, userId uint64, settings t.NotificationSettingsGeneral) error @@ -55,8 +55,8 @@ func (d *DataAccessService) GetClientNotifications(ctx context.Context, userId u func (d *DataAccessService) GetRocketPoolNotifications(ctx context.Context, userId uint64, cursor string, colSort t.Sort[enums.NotificationRocketPoolColumn], search string, limit uint64) ([]t.NotificationRocketPoolTableRow, *t.Paging, error) { return d.dummy.GetRocketPoolNotifications(ctx, userId, cursor, colSort, search, limit) } -func (d *DataAccessService) GetNetworkNotifications(ctx context.Context, userId uint64, cursor string, colSort t.Sort[enums.NotificationNetworksColumn], search string, limit uint64) ([]t.NotificationNetworksTableRow, *t.Paging, error) { - return d.dummy.GetNetworkNotifications(ctx, userId, cursor, colSort, search, limit) +func (d *DataAccessService) GetNetworkNotifications(ctx context.Context, userId uint64, cursor string, colSort t.Sort[enums.NotificationNetworksColumn], limit uint64) ([]t.NotificationNetworksTableRow, *t.Paging, error) { + return d.dummy.GetNetworkNotifications(ctx, userId, cursor, colSort, limit) } func (d *DataAccessService) GetNotificationSettings(ctx context.Context, userId uint64) (*t.NotificationSettings, error) { return d.dummy.GetNotificationSettings(ctx, userId) diff --git a/backend/pkg/api/handlers/public.go b/backend/pkg/api/handlers/public.go index 30fb5a8ca..c579ccbd6 100644 --- a/backend/pkg/api/handlers/public.go +++ b/backend/pkg/api/handlers/public.go @@ -2099,7 +2099,7 @@ func (h *HandlerService) PublicGetUserNotificationClients(w http.ResponseWriter, // @Param cursor query string false "Return data for the given cursor value. Pass the `paging.next_cursor`` value of the previous response to navigate to forward, or pass the `paging.prev_cursor`` value of the previous response to navigate to backward." // @Param limit query integer false "The maximum number of results that may be returned." // @Param sort query string false "The field you want to sort by. Append with `:desc` for descending order." Enums(timestamp, event_type, node_address) -// @Param search query string false "Search for TODO" +// @Param search query string false "Search for Node Address" // @Success 200 {object} types.InternalGetUserNotificationRocketPoolResponse // @Failure 400 {object} types.ApiErrorResponse // @Router /users/me/notifications/rocket-pool [get] @@ -2138,7 +2138,6 @@ func (h *HandlerService) PublicGetUserNotificationRocketPool(w http.ResponseWrit // @Param cursor query string false "Return data for the given cursor value. Pass the `paging.next_cursor`` value of the previous response to navigate to forward, or pass the `paging.prev_cursor`` value of the previous response to navigate to backward." // @Param limit query integer false "The maximum number of results that may be returned." // @Param sort query string false "The field you want to sort by. Append with `:desc` for descending order." Enums(timestamp, event_type) -// @Param search query string false "Search for TODO" // @Success 200 {object} types.InternalGetUserNotificationNetworksResponse // @Failure 400 {object} types.ApiErrorResponse // @Router /users/me/notifications/networks [get] @@ -2156,7 +2155,7 @@ func (h *HandlerService) PublicGetUserNotificationNetworks(w http.ResponseWriter handleErr(w, r, v) return } - data, paging, err := h.dai.GetNetworkNotifications(r.Context(), userId, pagingParams.cursor, *sort, pagingParams.search, pagingParams.limit) + data, paging, err := h.dai.GetNetworkNotifications(r.Context(), userId, pagingParams.cursor, *sort, pagingParams.limit) if err != nil { handleErr(w, r, err) return @@ -2219,8 +2218,6 @@ func (h *HandlerService) PublicPutUserNotificationSettingsGeneral(w http.Respons checkMinMax(&v, req.MachineStorageUsageThreshold, 0, 1, "machine_storage_usage_threshold") checkMinMax(&v, req.MachineCpuUsageThreshold, 0, 1, "machine_cpu_usage_threshold") checkMinMax(&v, req.MachineMemoryUsageThreshold, 0, 1, "machine_memory_usage_threshold") - checkMinMax(&v, req.RocketPoolMaxCollateralThreshold, 0, 1, "rocket_pool_max_collateral_threshold") - checkMinMax(&v, req.RocketPoolMinCollateralThreshold, 0, 1, "rocket_pool_min_collateral_threshold") if v.hasErrors() { handleErr(w, r, v) return @@ -2261,7 +2258,8 @@ func (h *HandlerService) PublicPutUserNotificationSettingsNetworks(w http.Respon IsGasBelowSubscribed bool `json:"is_gas_below_subscribed"` GasBelowThreshold string `json:"gas_below_threshold" ` IsParticipationRateSubscribed bool `json:"is_participation_rate_subscribed"` - ParticipationRateThreshold float64 `json:"participation_rate_threshold" faker:"boundary_start=0, boundary_end=1"` + ParticipationRateThreshold float64 `json:"participation_rate_threshold"` + IsNewRewardRoundSubscribed bool `json:"is_new_reward_round_subscribed"` } var req request if err := v.checkBody(&req, r); err != nil { @@ -2286,6 +2284,7 @@ func (h *HandlerService) PublicPutUserNotificationSettingsNetworks(w http.Respon GasBelowThreshold: gasBelowThreshold, IsParticipationRateSubscribed: req.IsParticipationRateSubscribed, ParticipationRateThreshold: req.ParticipationRateThreshold, + IsNewRewardRoundSubscribed: req.IsNewRewardRoundSubscribed, } err = h.dai.UpdateNotificationSettingsNetworks(r.Context(), userId, chainId, settings) @@ -2491,6 +2490,9 @@ func (h *HandlerService) PublicPutUserNotificationSettingsValidatorDashboard(w h vars := mux.Vars(r) dashboardId := v.checkPrimaryDashboardId(vars["dashboard_id"]) groupId := v.checkExistingGroupId(vars["group_id"]) + + checkMinMax(&v, req.MaxCollateralThreshold, 0, 1, "max_collateral_threshold") + checkMinMax(&v, req.MinCollateralThreshold, 0, 1, "min_collateral_threshold") if v.hasErrors() { handleErr(w, r, v) return diff --git a/backend/pkg/api/types/notifications.go b/backend/pkg/api/types/notifications.go index d67bbdaed..275b4517b 100644 --- a/backend/pkg/api/types/notifications.go +++ b/backend/pkg/api/types/notifications.go @@ -17,12 +17,11 @@ type NotificationOverviewData struct { Last24hWebhookCount uint64 `json:"last_24h_webhook_count"` // counts are shown in their respective tables - VDBSubscriptionsCount uint64 `json:"vdb_subscriptions_count"` - ADBSubscriptionsCount uint64 `json:"adb_subscriptions_count"` - MachinesSubscriptionCount uint64 `json:"machines_subscription_count"` - ClientsSubscriptionCount uint64 `json:"clients_subscription_count"` - RocketPoolSubscriptionCount uint64 `json:"rocket_pool_subscription_count"` - NetworksSubscriptionCount uint64 `json:"networks_subscription_count"` + VDBSubscriptionsCount uint64 `json:"vdb_subscriptions_count"` + ADBSubscriptionsCount uint64 `json:"adb_subscriptions_count"` + MachinesSubscriptionCount uint64 `json:"machines_subscription_count"` + ClientsSubscriptionCount uint64 `json:"clients_subscription_count"` + NetworksSubscriptionCount uint64 `json:"networks_subscription_count"` } type InternalGetUserNotificationsResponse ApiDataResponse[NotificationOverviewData] @@ -37,7 +36,7 @@ type NotificationDashboardsTableRow struct { GroupName string `json:"group_name"` NotificationId uint64 `json:"notification_id"` // may be string? db schema is not defined afaik EntityCount uint64 `json:"entity_count"` - EventTypes []string `json:"event_types" tstype:"('validator_online' | 'validator_offline' | 'group_online' | 'group_offline' | 'attestation_missed' | 'proposal_success' | 'proposal_missed' | 'proposal_upcoming' | 'sync' | 'withdrawal' | 'got_slashed' | 'has_slashed' | 'incoming_tx' | 'outgoing_tx' | 'transfer_erc20' | 'transfer_erc721' | 'transfer_erc1155')[]" faker:"oneof: validator_offline, group_offline, attestation_missed, proposal_success, proposal_missed, proposal_upcoming, sync, withdrawal, slashed_own, incoming_tx, outgoing_tx, transfer_erc20, transfer_erc721, transfer_erc1155"` + EventTypes []string `json:"event_types" tstype:"('validator_online' | 'validator_offline' | 'group_online' | 'group_offline' | 'attestation_missed' | 'proposal_success' | 'proposal_missed' | 'proposal_upcoming' | 'max_collateral' | 'min_collateral' | 'sync' | 'withdrawal' | 'got_slashed' | 'has_slashed' | 'incoming_tx' | 'outgoing_tx' | 'transfer_erc20' | 'transfer_erc721' | 'transfer_erc1155')[]" faker:"oneof: validator_offline, group_offline, attestation_missed, proposal_success, proposal_missed, proposal_upcoming, max_collateral, min_collateral, sync, withdrawal, slashed_own, incoming_tx, outgoing_tx, transfer_erc20, transfer_erc721, transfer_erc1155"` } type InternalGetUserNotificationDashboardsResponse ApiPagingResponse[NotificationDashboardsTableRow] @@ -74,6 +73,7 @@ type NotificationValidatorDashboardDetail struct { GroupOfflineReminder []NotificationEventGroup `json:"group_offline_reminder"` ValidatorBackOnline []NotificationEventValidatorBackOnline `json:"validator_back_online"` GroupBackOnline []NotificationEventGroupBackOnline `json:"group_back_online"` + // TODO min and max collateral events } type InternalGetUserNotificationsValidatorDashboardResponse ApiDataResponse[NotificationValidatorDashboardDetail] @@ -99,7 +99,7 @@ type InternalGetUserNotificationsAccountDashboardResponse ApiDataResponse[Notifi // Machines Table type NotificationMachinesTableRow struct { MachineName string `json:"machine_name"` - Threshold float64 `json:"threshold" faker:"boundary_start=0, boundary_end=1"` + Threshold float64 `json:"threshold,omitempty" faker:"boundary_start=0, boundary_end=1"` EventType string `json:"event_type" tstype:"'offline' | 'storage' | 'cpu' | 'memory'" faker:"oneof: offline, storage, cpu, memory"` Timestamp int64 `json:"timestamp"` } @@ -120,10 +120,10 @@ type InternalGetUserNotificationClientsResponse ApiPagingResponse[NotificationCl // ------------------------------------------------------------ // Rocket Pool Table type NotificationRocketPoolTableRow struct { - Timestamp int64 `json:"timestamp"` - EventType string `json:"event_type" tstype:"'reward_round' | 'collateral_max' | 'collateral_min'" faker:"oneof: reward_round, collateral_max, collateral_min"` - AlertValue float64 `json:"alert_value,omitempty"` // only for some notification types, e.g. max collateral - Node Address `json:"node"` + Timestamp int64 `json:"timestamp"` + EventType string `json:"event_type" tstype:"'reward_round' | 'collateral_max' | 'collateral_min'" faker:"oneof: reward_round, collateral_max, collateral_min"` + Threshold float64 `json:"threshold,omitempty"` // only for some notification types, e.g. max collateral + Node Address `json:"node"` } type InternalGetUserNotificationRocketPoolResponse ApiPagingResponse[NotificationRocketPoolTableRow] @@ -131,10 +131,10 @@ type InternalGetUserNotificationRocketPoolResponse ApiPagingResponse[Notificatio // ------------------------------------------------------------ // Networks Table type NotificationNetworksTableRow struct { - ChainId uint64 `json:"chain_id"` - Timestamp int64 `json:"timestamp"` - EventType string `json:"event_type" tstype:"'gas_above' | 'gas_below' | 'participation_rate'" faker:"oneof: gas_above, gas_below, participation_rate"` - AlertValue decimal.Decimal `json:"alert_value"` // wei string for gas alerts, otherwise percentage (0-1) for participation rate + ChainId uint64 `json:"chain_id"` + Timestamp int64 `json:"timestamp"` + EventType string `json:"event_type" tstype:"'new_reward_round' | 'gas_above' | 'gas_below' | 'participation_rate'" faker:"oneof: new_reward_round, gas_above, gas_below, participation_rate"` + Threshold decimal.Decimal `json:"threshold,omitempty"` // participation rate threshold should also be passed as decimal string } type InternalGetUserNotificationNetworksResponse ApiPagingResponse[NotificationNetworksTableRow] @@ -148,6 +148,7 @@ type NotificationSettingsNetwork struct { GasBelowThreshold decimal.Decimal `json:"gas_below_threshold" faker:"eth"` IsParticipationRateSubscribed bool `json:"is_participation_rate_subscribed"` ParticipationRateThreshold float64 `json:"participation_rate_threshold" faker:"boundary_start=0, boundary_end=1"` + IsNewRewardRoundSubscribed bool `json:"is_new_reward_round_subscribed"` } type NotificationNetwork struct { ChainId uint64 `json:"chain_id"` @@ -184,12 +185,6 @@ type NotificationSettingsGeneral struct { MachineCpuUsageThreshold float64 `json:"machine_cpu_usage_threshold" faker:"boundary_start=0, boundary_end=1"` IsMachineMemoryUsageSubscribed bool `json:"is_machine_memory_usage_subscribed"` MachineMemoryUsageThreshold float64 `json:"machine_memory_usage_threshold" faker:"boundary_start=0, boundary_end=1"` - - IsRocketPoolNewRewardRoundSubscribed bool `json:"is_rocket_pool_new_reward_round_subscribed"` - IsRocketPoolMaxCollateralSubscribed bool `json:"is_rocket_pool_max_collateral_subscribed"` - RocketPoolMaxCollateralThreshold float64 `json:"rocket_pool_max_collateral_threshold" faker:"boundary_start=0, boundary_end=1"` - IsRocketPoolMinCollateralSubscribed bool `json:"is_rocket_pool_min_collateral_subscribed"` - RocketPoolMinCollateralThreshold float64 `json:"rocket_pool_min_collateral_threshold" faker:"boundary_start=0, boundary_end=1"` } type InternalPutUserNotificationSettingsGeneralResponse ApiDataResponse[NotificationSettingsGeneral] type NotificationSettings struct { @@ -215,6 +210,11 @@ type NotificationSettingsValidatorDashboard struct { IsSyncSubscribed bool `json:"is_sync_subscribed"` IsWithdrawalProcessedSubscribed bool `json:"is_withdrawal_processed_subscribed"` IsSlashedSubscribed bool `json:"is_slashed_subscribed"` + + IsMaxCollateralSubscribed bool `json:"is__max_collateral_subscribed"` + MaxCollateralThreshold float64 `json:"_max_collateral_threshold" faker:"boundary_start=0, boundary_end=1"` + IsMinCollateralSubscribed bool `json:"is__min_collateral_subscribed"` + MinCollateralThreshold float64 `json:"_min_collateral_threshold" faker:"boundary_start=0, boundary_end=1"` } type InternalPutUserNotificationSettingsValidatorDashboardResponse ApiDataResponse[NotificationSettingsValidatorDashboard] diff --git a/frontend/types/api/notifications.ts b/frontend/types/api/notifications.ts index c798f1d00..6009f64f2 100644 --- a/frontend/types/api/notifications.ts +++ b/frontend/types/api/notifications.ts @@ -27,7 +27,6 @@ export interface NotificationOverviewData { adb_subscriptions_count: number /* uint64 */; machines_subscription_count: number /* uint64 */; clients_subscription_count: number /* uint64 */; - rocket_pool_subscription_count: number /* uint64 */; networks_subscription_count: number /* uint64 */; } export type InternalGetUserNotificationsResponse = ApiDataResponse; @@ -43,7 +42,7 @@ export interface NotificationDashboardsTableRow { group_name: string; notification_id: number /* uint64 */; // may be string? db schema is not defined afaik entity_count: number /* uint64 */; - event_types: ('validator_online' | 'validator_offline' | 'group_online' | 'group_offline' | 'attestation_missed' | 'proposal_success' | 'proposal_missed' | 'proposal_upcoming' | 'sync' | 'withdrawal' | 'got_slashed' | 'has_slashed' | 'incoming_tx' | 'outgoing_tx' | 'transfer_erc20' | 'transfer_erc721' | 'transfer_erc1155')[]; + event_types: ('validator_online' | 'validator_offline' | 'group_online' | 'group_offline' | 'attestation_missed' | 'proposal_success' | 'proposal_missed' | 'proposal_upcoming' | 'max_collateral' | 'min_collateral' | 'sync' | 'withdrawal' | 'got_slashed' | 'has_slashed' | 'incoming_tx' | 'outgoing_tx' | 'transfer_erc20' | 'transfer_erc721' | 'transfer_erc1155')[]; } export type InternalGetUserNotificationDashboardsResponse = ApiPagingResponse; export interface NotificationEventGroup { @@ -95,7 +94,7 @@ export type InternalGetUserNotificationsAccountDashboardResponse = ApiDataRespon */ export interface NotificationMachinesTableRow { machine_name: string; - threshold: number /* float64 */; + threshold?: number /* float64 */; event_type: 'offline' | 'storage' | 'cpu' | 'memory'; timestamp: number /* int64 */; } @@ -118,7 +117,7 @@ export type InternalGetUserNotificationClientsResponse = ApiPagingResponse; @@ -129,8 +128,8 @@ export type InternalGetUserNotificationRocketPoolResponse = ApiPagingResponse; /** @@ -144,6 +143,7 @@ export interface NotificationSettingsNetwork { gas_below_threshold: string /* decimal.Decimal */; is_participation_rate_subscribed: boolean; participation_rate_threshold: number /* float64 */; + is_new_reward_round_subscribed: boolean; } export interface NotificationNetwork { chain_id: number /* uint64 */; @@ -175,11 +175,6 @@ export interface NotificationSettingsGeneral { machine_cpu_usage_threshold: number /* float64 */; is_machine_memory_usage_subscribed: boolean; machine_memory_usage_threshold: number /* float64 */; - is_rocket_pool_new_reward_round_subscribed: boolean; - is_rocket_pool_max_collateral_subscribed: boolean; - rocket_pool_max_collateral_threshold: number /* float64 */; - is_rocket_pool_min_collateral_subscribed: boolean; - rocket_pool_min_collateral_threshold: number /* float64 */; } export type InternalPutUserNotificationSettingsGeneralResponse = ApiDataResponse; export interface NotificationSettings { @@ -203,6 +198,10 @@ export interface NotificationSettingsValidatorDashboard { is_sync_subscribed: boolean; is_withdrawal_processed_subscribed: boolean; is_slashed_subscribed: boolean; + is__max_collateral_subscribed: boolean; + _max_collateral_threshold: number /* float64 */; + is__min_collateral_subscribed: boolean; + _min_collateral_threshold: number /* float64 */; } export type InternalPutUserNotificationSettingsValidatorDashboardResponse = ApiDataResponse; export interface NotificationSettingsAccountDashboard { From dc1ee12d92ba22480155947874cb7ce46c219f5a Mon Sep 17 00:00:00 2001 From: LUCCA DUKIC <109136188+LuccaBitfly@users.noreply.github.com> Date: Tue, 1 Oct 2024 13:40:11 +0200 Subject: [PATCH 2/3] (BEDS-510) fix field typos --- backend/pkg/api/types/notifications.go | 8 ++++---- frontend/types/api/notifications.ts | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/pkg/api/types/notifications.go b/backend/pkg/api/types/notifications.go index 275b4517b..971af2ec1 100644 --- a/backend/pkg/api/types/notifications.go +++ b/backend/pkg/api/types/notifications.go @@ -211,10 +211,10 @@ type NotificationSettingsValidatorDashboard struct { IsWithdrawalProcessedSubscribed bool `json:"is_withdrawal_processed_subscribed"` IsSlashedSubscribed bool `json:"is_slashed_subscribed"` - IsMaxCollateralSubscribed bool `json:"is__max_collateral_subscribed"` - MaxCollateralThreshold float64 `json:"_max_collateral_threshold" faker:"boundary_start=0, boundary_end=1"` - IsMinCollateralSubscribed bool `json:"is__min_collateral_subscribed"` - MinCollateralThreshold float64 `json:"_min_collateral_threshold" faker:"boundary_start=0, boundary_end=1"` + IsMaxCollateralSubscribed bool `json:"is_max_collateral_subscribed"` + MaxCollateralThreshold float64 `json:"max_collateral_threshold" faker:"boundary_start=0, boundary_end=1"` + IsMinCollateralSubscribed bool `json:"is_min_collateral_subscribed"` + MinCollateralThreshold float64 `json:"min_collateral_threshold" faker:"boundary_start=0, boundary_end=1"` } type InternalPutUserNotificationSettingsValidatorDashboardResponse ApiDataResponse[NotificationSettingsValidatorDashboard] diff --git a/frontend/types/api/notifications.ts b/frontend/types/api/notifications.ts index 6009f64f2..742d60a07 100644 --- a/frontend/types/api/notifications.ts +++ b/frontend/types/api/notifications.ts @@ -129,7 +129,7 @@ export interface NotificationNetworksTableRow { chain_id: number /* uint64 */; timestamp: number /* int64 */; event_type: 'new_reward_round' | 'gas_above' | 'gas_below' | 'participation_rate'; - threshold?: string /* decimal.Decimal */; + threshold?: string /* decimal.Decimal */; // participation rate threshold should also be passed as decimal string } export type InternalGetUserNotificationNetworksResponse = ApiPagingResponse; /** @@ -198,10 +198,10 @@ export interface NotificationSettingsValidatorDashboard { is_sync_subscribed: boolean; is_withdrawal_processed_subscribed: boolean; is_slashed_subscribed: boolean; - is__max_collateral_subscribed: boolean; - _max_collateral_threshold: number /* float64 */; - is__min_collateral_subscribed: boolean; - _min_collateral_threshold: number /* float64 */; + is_max_collateral_subscribed: boolean; + max_collateral_threshold: number /* float64 */; + is_min_collateral_subscribed: boolean; + min_collateral_threshold: number /* float64 */; } export type InternalPutUserNotificationSettingsValidatorDashboardResponse = ApiDataResponse; export interface NotificationSettingsAccountDashboard { From a025375c90dd025ad407c177772fef5ea0f20484 Mon Sep 17 00:00:00 2001 From: benji-bitfly Date: Tue, 1 Oct 2024 14:14:32 +0200 Subject: [PATCH 3/3] refactor: adapt for `api` changes --- .../notifications/NotificationsRocketPoolTable.vue | 8 -------- frontend/components/playground/PlaygroundDialog.vue | 4 ++++ .../notifications/useNotificationsManagementStore.ts | 5 ----- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/frontend/components/notifications/NotificationsRocketPoolTable.vue b/frontend/components/notifications/NotificationsRocketPoolTable.vue index 7529f839d..00ee0388a 100644 --- a/frontend/components/notifications/NotificationsRocketPoolTable.vue +++ b/frontend/components/notifications/NotificationsRocketPoolTable.vue @@ -16,8 +16,6 @@ const { setSearch, } = useNotificationsRocketpoolStore() -const { overview } = useNotificationsDashboardOverviewStore() - const { width } = useWindowSize() const colsVisible = computed(() => { return { @@ -118,12 +116,6 @@ const getEventTypeName = (eventType: NotificationRocketPoolTableRow['event_type' @open-dialog="$emit('openDialog')" /> - diff --git a/frontend/components/playground/PlaygroundDialog.vue b/frontend/components/playground/PlaygroundDialog.vue index b9d2c3c35..a5746f24a 100644 --- a/frontend/components/playground/PlaygroundDialog.vue +++ b/frontend/components/playground/PlaygroundDialog.vue @@ -35,6 +35,8 @@ const validatorSub: NotificationSettingsValidatorDashboard = { is_attestations_missed_subscribed: true, is_block_proposal_subscribed: true, is_group_offline_subscribed: true, + is_max_collateral_subscribed: false, + is_min_collateral_subscribed: false, is_real_time_mode_enabled: false, is_slashed_subscribed: false, is_sync_subscribed: true, @@ -42,6 +44,8 @@ const validatorSub: NotificationSettingsValidatorDashboard = { is_validator_offline_subscribed: true, is_webhook_discord_enabled: true, is_withdrawal_processed_subscribed: true, + max_collateral_threshold: 0, + min_collateral_threshold: 0, webhook_url: 'http://bablabla', } diff --git a/frontend/stores/notifications/useNotificationsManagementStore.ts b/frontend/stores/notifications/useNotificationsManagementStore.ts index cea154e3a..68784b81b 100644 --- a/frontend/stores/notifications/useNotificationsManagementStore.ts +++ b/frontend/stores/notifications/useNotificationsManagementStore.ts @@ -21,14 +21,9 @@ export const useNotificationsManagementStore = defineStore('notifications-manage is_machine_offline_subscribed: false, is_machine_storage_usage_subscribed: false, is_push_notifications_enabled: false, - is_rocket_pool_max_collateral_subscribed: false, - is_rocket_pool_min_collateral_subscribed: false, - is_rocket_pool_new_reward_round_subscribed: false, machine_cpu_usage_threshold: 0.0, machine_memory_usage_threshold: 0.0, machine_storage_usage_threshold: 0.0, - rocket_pool_max_collateral_threshold: 0, - rocket_pool_min_collateral_threshold: 0, }, has_machines: true, networks: [],