From 65726859eada5a58dd4f0388c3799aa89ef9be62 Mon Sep 17 00:00:00 2001 From: Satont Date: Sat, 16 Sep 2023 06:24:26 +0300 Subject: [PATCH] feat: add switch to disable overlays layers update --- .../impl_protected/overlays/overlays.go | 37 ++++++++++--------- .../src/components/registry/overlays/edit.vue | 2 + .../registry/overlays/layers/html.vue | 15 ++++++-- .../registry/overlays/layers/htmlForm.vue | 7 +++- .../registry/overlays/newSelector.vue | 3 +- frontend/dashboard/src/locales/en.json | 3 +- .../overlays/src/pages/overlaysRegistry.tsx | 8 ++-- libs/gomodels/channel_overlay_layer.go | 21 ++++++----- libs/grpc/protos/api/overlays.proto | 2 + ...rlays_boolean_for_periodically_refetch.sql | 10 +++++ 10 files changed, 72 insertions(+), 36 deletions(-) create mode 100644 libs/migrations/migrations/20230916055208_overlays_boolean_for_periodically_refetch.sql diff --git a/apps/api/internal/impl_protected/overlays/overlays.go b/apps/api/internal/impl_protected/overlays/overlays.go index 941be7b57..fe465621f 100644 --- a/apps/api/internal/impl_protected/overlays/overlays.go +++ b/apps/api/internal/impl_protected/overlays/overlays.go @@ -92,13 +92,14 @@ func (c *Overlays) convertEntity(entity model.ChannelOverlay) *overlays.Overlay HtmlOverlayJs: base64ToText(l.Settings.HtmlOverlayJS), HtmlOverlayHtmlDataPollSecondsInterval: int32(l.Settings.HtmlOverlayDataPollSecondsInterval), }, - OverlayId: id, - PosX: int32(l.PosX), - PosY: int32(l.PosY), - Width: int32(l.Width), - Height: int32(l.Height), - CreatedAt: fmt.Sprint(l.CreatedAt.UnixMilli()), - UpdatedAt: fmt.Sprint(l.UpdatedAt.UnixMilli()), + OverlayId: id, + PosX: int32(l.PosX), + PosY: int32(l.PosY), + Width: int32(l.Width), + Height: int32(l.Height), + CreatedAt: fmt.Sprint(l.CreatedAt.UnixMilli()), + UpdatedAt: fmt.Sprint(l.UpdatedAt.UnixMilli()), + PeriodicallyRefetchData: l.PeriodicallyRefetchData, } } @@ -214,11 +215,12 @@ func (c *Overlays) OverlaysUpdate(ctx context.Context, req *overlays.UpdateReque HtmlOverlayJS: textToBase64(l.Settings.HtmlOverlayJs), HtmlOverlayDataPollSecondsInterval: int(l.Settings.HtmlOverlayHtmlDataPollSecondsInterval), }, - OverlayID: entity.ID, - PosX: int(l.PosX), - PosY: int(l.PosY), - Width: int(l.Width), - Height: int(l.Height), + OverlayID: entity.ID, + PosX: int(l.PosX), + PosY: int(l.PosY), + Width: int(l.Width), + Height: int(l.Height), + PeriodicallyRefetchData: l.PeriodicallyRefetchData, } if err := tx.Save(&layer).Error; err != nil { @@ -297,11 +299,12 @@ func (c *Overlays) OverlaysCreate(ctx context.Context, req *overlays.CreateReque HtmlOverlayJS: textToBase64(l.Settings.HtmlOverlayJs), HtmlOverlayDataPollSecondsInterval: int(l.Settings.HtmlOverlayHtmlDataPollSecondsInterval), }, - OverlayID: entity.ID, - PosX: int(l.PosX), - PosY: int(l.PosY), - Width: int(l.Width), - Height: int(l.Height), + OverlayID: entity.ID, + PosX: int(l.PosX), + PosY: int(l.PosY), + Width: int(l.Width), + Height: int(l.Height), + PeriodicallyRefetchData: l.PeriodicallyRefetchData, } if err := tx.Save(&layer).Error; err != nil { diff --git a/frontend/dashboard/src/components/registry/overlays/edit.vue b/frontend/dashboard/src/components/registry/overlays/edit.vue index 4254add28..89ae219a1 100644 --- a/frontend/dashboard/src/components/registry/overlays/edit.vue +++ b/frontend/dashboard/src/components/registry/overlays/edit.vue @@ -157,6 +157,7 @@ const copyUrl = async (id: string) => { :index="index" :text="layer.settings?.htmlOverlayHtml ?? ''" :css="layer.settings?.htmlOverlayCss ?? ''" + :periodicallyRefetchData="layer.periodicallyRefetchData" /> { v-model:html="formValue.layers[index].settings!.htmlOverlayHtml" v-model:css="formValue.layers[index].settings!.htmlOverlayCss" v-model:pollInterval="formValue.layers[index].settings!.htmlOverlayHtmlDataPollSecondsInterval" + v-model:periodicallyRefetchData="formValue.layers[index].periodicallyRefetchData" :isFocused="currentlyFocused === index" :layerIndex="index" :type="layer.type" diff --git a/frontend/dashboard/src/components/registry/overlays/layers/html.vue b/frontend/dashboard/src/components/registry/overlays/layers/html.vue index 634ff05f8..250b6a0ab 100644 --- a/frontend/dashboard/src/components/registry/overlays/layers/html.vue +++ b/frontend/dashboard/src/components/registry/overlays/layers/html.vue @@ -1,7 +1,8 @@ +