Derick Montague | e080a1a | 2019-12-04 16:30:08 -0600 | [diff] [blame] | 1 | <template> |
Yoshie Muranaka | 74f8687 | 2020-02-10 12:28:37 -0800 | [diff] [blame] | 2 | <div class="app-container"> |
kennyneedsmilky | 14172d7 | 2021-11-10 15:26:07 -0600 | [diff] [blame] | 3 | <app-header |
| 4 | ref="focusTarget" |
| 5 | class="app-header" |
| 6 | :router-key="routerKey" |
| 7 | @refresh="refresh" |
| 8 | /> |
Yoshie Muranaka | 74f8687 | 2020-02-10 12:28:37 -0800 | [diff] [blame] | 9 | <app-navigation class="app-navigation" /> |
| 10 | <page-container class="app-content"> |
| 11 | <router-view ref="routerView" :key="routerKey" /> |
Dixsie Wolmers | 970ea7d | 2020-11-16 16:46:01 -0600 | [diff] [blame] | 12 | <!-- Scroll to top button --> |
| 13 | <button-back-to-top /> |
Yoshie Muranaka | 74f8687 | 2020-02-10 12:28:37 -0800 | [diff] [blame] | 14 | </page-container> |
Derick Montague | e080a1a | 2019-12-04 16:30:08 -0600 | [diff] [blame] | 15 | </div> |
| 16 | </template> |
| 17 | |
| 18 | <script> |
Derick Montague | e2fd156 | 2019-12-20 13:26:53 -0600 | [diff] [blame] | 19 | import AppHeader from '@/components/AppHeader'; |
| 20 | import AppNavigation from '@/components/AppNavigation'; |
SurenNeware | 6185909 | 2020-10-01 09:37:32 +0530 | [diff] [blame] | 21 | import PageContainer from '@/components/Global/PageContainer'; |
Dixsie Wolmers | 970ea7d | 2020-11-16 16:46:01 -0600 | [diff] [blame] | 22 | import ButtonBackToTop from '@/components/Global/ButtonBackToTop'; |
Dixsie Wolmers | dc6b3cd | 2021-05-20 19:01:42 -0500 | [diff] [blame] | 23 | import JumpLinkMixin from '@/components/Mixins/JumpLinkMixin'; |
Dixsie Wolmers | 970ea7d | 2020-11-16 16:46:01 -0600 | [diff] [blame] | 24 | |
Derick Montague | e080a1a | 2019-12-04 16:30:08 -0600 | [diff] [blame] | 25 | export default { |
Derick Montague | e2fd156 | 2019-12-20 13:26:53 -0600 | [diff] [blame] | 26 | name: 'App', |
Derick Montague | e080a1a | 2019-12-04 16:30:08 -0600 | [diff] [blame] | 27 | components: { |
| 28 | AppHeader, |
Yoshie Muranaka | 8d12910 | 2019-12-19 09:51:55 -0800 | [diff] [blame] | 29 | AppNavigation, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 30 | PageContainer, |
Dixsie Wolmers | 970ea7d | 2020-11-16 16:46:01 -0600 | [diff] [blame] | 31 | ButtonBackToTop, |
Derick Montague | 75b4832 | 2019-12-06 01:24:41 -0600 | [diff] [blame] | 32 | }, |
Dixsie Wolmers | dc6b3cd | 2021-05-20 19:01:42 -0500 | [diff] [blame] | 33 | mixins: [JumpLinkMixin], |
Yoshie Muranaka | eb154bb | 2020-02-07 12:18:45 -0800 | [diff] [blame] | 34 | data() { |
| 35 | return { |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 36 | routerKey: 0, |
Yoshie Muranaka | eb154bb | 2020-02-07 12:18:45 -0800 | [diff] [blame] | 37 | }; |
| 38 | }, |
Derick Montague | 75b4832 | 2019-12-06 01:24:41 -0600 | [diff] [blame] | 39 | watch: { |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 40 | $route: function () { |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 41 | this.$nextTick(function () { |
Derick Montague | 8026797 | 2021-02-16 09:47:03 -0600 | [diff] [blame] | 42 | this.setFocus(this.$refs.focusTarget.$el); |
Derick Montague | 75b4832 | 2019-12-06 01:24:41 -0600 | [diff] [blame] | 43 | }); |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 44 | }, |
Yoshie Muranaka | eb154bb | 2020-02-07 12:18:45 -0800 | [diff] [blame] | 45 | }, |
Yoshie Muranaka | 6f71284 | 2021-02-04 11:23:03 -0800 | [diff] [blame] | 46 | mounted() { |
| 47 | this.$root.$on('refresh-application', () => this.refresh()); |
BlueSnake00 | 248d5bc | 2024-02-01 16:55:54 +0300 | [diff] [blame] | 48 | setInterval(() => { |
| 49 | if (!localStorage.getItem('storedUsername')) { |
Ed Tanous | 883a0d5 | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 50 | this.$eventBus.$consoleWindow?.close(); |
BlueSnake00 | 248d5bc | 2024-02-01 16:55:54 +0300 | [diff] [blame] | 51 | this.refresh(); |
| 52 | } |
| 53 | }, 10000); |
Yoshie Muranaka | 6f71284 | 2021-02-04 11:23:03 -0800 | [diff] [blame] | 54 | }, |
Yoshie Muranaka | eb154bb | 2020-02-07 12:18:45 -0800 | [diff] [blame] | 55 | methods: { |
| 56 | refresh() { |
Shubhi Garg | 20ce44a | 2024-12-02 14:56:48 +0530 | [diff] [blame] | 57 | // Clear all toast messages |
| 58 | document.querySelectorAll('.toast').forEach((toast) => { |
| 59 | const toastId = toast.id; |
| 60 | if (toastId) { |
| 61 | this.$bvToast.hide(toastId); |
| 62 | } |
| 63 | }); |
Yoshie Muranaka | eb154bb | 2020-02-07 12:18:45 -0800 | [diff] [blame] | 64 | // Changing the component :key value will trigger |
| 65 | // a component re-rendering and 'refresh' the view |
| 66 | this.routerKey += 1; |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 67 | }, |
| 68 | }, |
Derick Montague | e080a1a | 2019-12-04 16:30:08 -0600 | [diff] [blame] | 69 | }; |
| 70 | </script> |
| 71 | |
| 72 | <style lang="scss" scoped> |
Ed Tanous | 7d6b44c | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 73 | @import '@/assets/styles/bmc/helpers/_index.scss'; |
| 74 | @import '@/assets/styles/bootstrap/_helpers.scss'; |
| 75 | |
Yoshie Muranaka | 74f8687 | 2020-02-10 12:28:37 -0800 | [diff] [blame] | 76 | .app-container { |
| 77 | display: grid; |
| 78 | grid-template-columns: 100%; |
| 79 | grid-template-rows: auto; |
| 80 | grid-template-areas: |
| 81 | 'header' |
| 82 | 'content'; |
| 83 | |
| 84 | @include media-breakpoint-up($responsive-layout-bp) { |
| 85 | grid-template-columns: $navigation-width 1fr; |
| 86 | grid-template-areas: |
| 87 | 'header header' |
| 88 | 'navigation content'; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | .app-header { |
| 93 | grid-area: header; |
| 94 | position: sticky; |
| 95 | top: 0; |
| 96 | z-index: $zindex-fixed + 1; |
| 97 | } |
| 98 | |
| 99 | .app-navigation { |
| 100 | grid-area: navigation; |
| 101 | } |
| 102 | |
| 103 | .app-content { |
| 104 | grid-area: content; |
| 105 | background-color: $white; |
Derick Montague | e080a1a | 2019-12-04 16:30:08 -0600 | [diff] [blame] | 106 | } |
| 107 | </style> |