From 00194f54a289b740f1e1bd34091a6c43c9b624e3 Mon Sep 17 00:00:00 2001 From: Jeremy Wharton Date: Wed, 23 Aug 2023 21:09:41 -0500 Subject: [PATCH] web/satellite: show limit notifications to paid tier users This change causes paid tier users to see notifications in the project dashboard when their usage is approaching or has reached their maximum or custom usage limits. Change-Id: I7b68fcdd7d62797b6b26869e109cfb0b193fdddb --- web/satellite/.eslintrc.js | 2 +- web/satellite/src/App.vue | 2 +- .../src/components/common/VBanner.vue | 71 ++++-- .../components/modals/LimitWarningModal.vue | 132 +++++++++-- .../notifications/ProjectLimitBanner.vue | 19 +- .../UpdateSessionTimeoutBanner.vue | 55 ----- web/satellite/src/router/index.ts | 4 +- .../src/store/modules/projectsStore.ts | 33 +-- web/satellite/src/types/projects.ts | 15 ++ web/satellite/src/utils/strings.ts | 16 +- .../views/all-dashboard/AllDashboardArea.vue | 125 +--------- .../AllProjectsDashboardBanners.vue | 148 ++---------- .../all-dashboard/components/Heading.vue | 2 +- .../all-dashboard/components/MyProjects.vue | 10 +- .../components/ProjectsTable.vue | 2 +- .../views/{ => dashboard}/DashboardArea.vue | 220 ++++++++---------- .../components/LimitWarningBanners.vue | 127 ++++++++++ 17 files changed, 459 insertions(+), 524 deletions(-) delete mode 100644 web/satellite/src/components/notifications/UpdateSessionTimeoutBanner.vue rename web/satellite/src/views/{ => dashboard}/DashboardArea.vue (74%) create mode 100644 web/satellite/src/views/dashboard/components/LimitWarningBanners.vue diff --git a/web/satellite/.eslintrc.js b/web/satellite/.eslintrc.js index 477c19ae5..aa9d9ef3c 100644 --- a/web/satellite/.eslintrc.js +++ b/web/satellite/.eslintrc.js @@ -45,7 +45,7 @@ module.exports = { }, { 'group': 'internal', - 'pattern': '@?(poc)/components/**', + 'pattern': '@?(poc)/{components,views}/**', 'position': 'after', }, { diff --git a/web/satellite/src/App.vue b/web/satellite/src/App.vue index afaac2794..eabb9a597 100644 --- a/web/satellite/src/App.vue +++ b/web/satellite/src/App.vue @@ -17,8 +17,8 @@ import { computed, onBeforeUnmount, onMounted, ref } from 'vue'; import { useNotify } from '@/utils/hooks'; import { useAppStore } from '@/store/modules/appStore'; import { useConfigStore } from '@/store/modules/configStore'; -import ErrorPage from '@/views/ErrorPage.vue'; +import ErrorPage from '@/views/ErrorPage.vue'; import BrandedLoader from '@/components/common/BrandedLoader.vue'; import NotificationArea from '@/components/notifications/NotificationArea.vue'; diff --git a/web/satellite/src/components/common/VBanner.vue b/web/satellite/src/components/common/VBanner.vue index 7fd77fa93..22f01566e 100644 --- a/web/satellite/src/components/common/VBanner.vue +++ b/web/satellite/src/components/common/VBanner.vue @@ -10,9 +10,25 @@ >
- +

+ {{ title }} + {{ message }} +

+
- + @@ -24,13 +40,23 @@ import CloseIcon from '@/../static/images/notifications/closeSmall.svg'; const props = withDefaults(defineProps<{ severity?: 'info' | 'warning' | 'critical'; + title?: string; + message?: string; + linkText?: string; + href?: string; onClick?: () => void; + onLinkClick?: () => void; onClose?: () => void; dashboardRef: HTMLElement; }>(), { severity: 'info', - onClick: () => () => {}, - onClose: () => () => {}, + title: '', + message: '', + linkText: '', + href: '', + onClick: () => {}, + onLinkClick: () => {}, + onClose: () => {}, }); const isShown = ref(true); @@ -39,9 +65,7 @@ const resizeObserver = ref(); function closeClicked(): void { isShown.value = false; - if (props.onClose) { - props.onClose(); - } + props.onClose(); } function onBannerResize(): void { @@ -104,7 +128,7 @@ watch(() => props.dashboardRef, () => { border: 1px solid var(--c-yellow-2); :deep(.icon-path) { - fill: var(--c-yellow-3) !important; + fill: var(--c-yellow-5) !important; } } @@ -126,7 +150,22 @@ watch(() => props.dashboardRef, () => { display: flex; align-items: center; justify-content: space-between; - column-gap: 10px; + gap: 10px; + + @media screen and (width <= 500px) { + flex-direction: column; + } + + &__title { + font-family: 'font_medium', sans-serif; + } + + &__link { + color: black; + text-decoration: underline !important; + white-space: nowrap; + cursor: pointer; + } } &__close { @@ -143,18 +182,4 @@ watch(() => props.dashboardRef, () => { } } } - -.bold { - font-family: 'font_bold', sans-serif; -} - -.medium { - font-family: 'font_medium', sans-serif; -} - -.link { - color: black; - text-decoration: underline !important; - cursor: pointer; -} diff --git a/web/satellite/src/components/modals/LimitWarningModal.vue b/web/satellite/src/components/modals/LimitWarningModal.vue index 5a1e2829d..c471b5db2 100644 --- a/web/satellite/src/components/modals/LimitWarningModal.vue +++ b/web/satellite/src/components/modals/LimitWarningModal.vue @@ -5,9 +5,29 @@