Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 1 | <template> |
| 2 | <b-container fluid="xl"> |
| 3 | <page-title /> |
| 4 | |
| 5 | <!-- System table --> |
| 6 | <table-system /> |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame^] | 7 | |
| 8 | <!-- Power supplies table --> |
| 9 | <table-power-supplies /> |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 10 | </b-container> |
| 11 | </template> |
| 12 | |
| 13 | <script> |
| 14 | import PageTitle from '@/components/Global/PageTitle'; |
| 15 | import TableSystem from './HardwareStatusTableStystem'; |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame^] | 16 | import TablePowerSupplies from './HardwareStatusTablePowerSupplies'; |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 17 | import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin'; |
| 18 | |
| 19 | export default { |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame^] | 20 | components: { PageTitle, TablePowerSupplies, TableSystem }, |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 21 | mixins: [LoadingBarMixin], |
| 22 | created() { |
| 23 | this.startLoader(); |
| 24 | const systemTablePromise = new Promise(resolve => { |
| 25 | this.$root.$on('hardwareStatus::system::complete', () => resolve()); |
| 26 | }); |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame^] | 27 | const powerSuppliesTablePromise = new Promise(resolve => { |
| 28 | this.$root.$on('hardwareStatus::powerSupplies::complete', () => |
| 29 | resolve() |
| 30 | ); |
| 31 | }); |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 32 | // Combine all child component Promises to indicate |
| 33 | // when page data load complete |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame^] | 34 | Promise.all([systemTablePromise, powerSuppliesTablePromise]).finally(() => |
| 35 | this.endLoader() |
| 36 | ); |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 37 | }, |
| 38 | beforeRouteLeave(to, from, next) { |
| 39 | // Hide loader if user navigates away from page |
| 40 | // before requests complete |
| 41 | this.hideLoader(); |
| 42 | next(); |
| 43 | } |
| 44 | }; |
| 45 | </script> |