Guest User

Untitled

a guest
May 30th, 2022
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.78 KB | None | 0 0
  1. <template>
  2. <v-container>
  3. <v-card
  4. elevation="2"
  5. class="mt-3 pa-3 pt-0">
  6.  
  7. <v-card-title class="pl-0"> View sensor </v-card-title>
  8.  
  9. <!--<SensorDetails :scopes="scopes" :sensor="entity"></SensorDetails>-->
  10.  
  11. <v-divider class="mt-2 mb-2"></v-divider>
  12.  
  13. <div class="text-h5"> Configuration </div>
  14. <v-expansion-panels>
  15. <v-expansion-panel>
  16. <v-expansion-panel-header> Trigger </v-expansion-panel-header>
  17. <v-expansion-panel-content>
  18. <!--<Trigger :entity="entity" :scopes="scopes"></Trigger>-->
  19. </v-expansion-panel-content>
  20. </v-expansion-panel>
  21.  
  22. <v-expansion-panel
  23. v-if="hasScope(scopes, 'ListSensorAlerts')">
  24. <v-expansion-panel-header> Alerts </v-expansion-panel-header>
  25. <v-expansion-panel-content>
  26. <!--<Alerts :scopes="scopes" :entity="entity"></Alerts>-->
  27. </v-expansion-panel-content>
  28. </v-expansion-panel>
  29. </v-expansion-panels>
  30.  
  31. <v-card-actions>
  32. <v-btn
  33. @click="$router.back()"
  34. v-if="this.$route.query.canReturn != null && this.$route.query.canReturn == 'true'">
  35. Return
  36. </v-btn>
  37. </v-card-actions>
  38. </v-card>
  39. </v-container>
  40. </template>
  41.  
  42. <script lang="ts">
  43. //import { ApiError } from '@/commonApi'
  44. //import { ERR_TEXT, SERVER } from '@/main'
  45. import Vue from 'vue'
  46. import { DataTableHeader, InputValidationRules } from 'vuetify'
  47. //import {Entity, Scope} from "@/api";
  48. //import SensorDetails from "@/views/sensors/view/SensorDetails.vue";
  49. //import Trigger from "@/views/sensors/view/Trigger.vue";
  50. //import Alerts from "@/views/sensors/view/Alerts.vue";
  51.  
  52. interface Data {
  53. snackbar: boolean,
  54. snackbarText: string,
  55. scopes: Scope[],
  56. entity: Entity | null,
  57. }
  58.  
  59. enum Scope {
  60.  
  61. }
  62.  
  63. class Entity {
  64.  
  65. }
  66.  
  67. export default Vue.extend({
  68. //components: {Alerts, Trigger, SensorDetails},
  69. props: {
  70. orgId: String,
  71. locationId: String,
  72. roomId: String,
  73. controllerId: String,
  74. id: String,
  75. },
  76. data(): Data {
  77. return {
  78. snackbar: false,
  79. snackbarText: '',
  80. scopes: [],
  81. entity: null,
  82. }
  83. },
  84. async mounted() {
  85. //this.scopes = (await this.getScopes())!
  86.  
  87. //if(Scope.hasScope(this.scopes, Scope.LIST_SENSORS)) {
  88.  
  89. // This line throws the error
  90. this.entity = (await this.getEntity())!
  91. //}
  92. },
  93. methods: {
  94. hasScope: Scope.hasScope,
  95. async getEntity(): Promise<Entity | null> {
  96. /*let entity = await Entity.getSensor(Number.parseInt(this.orgId!), Number.parseInt(this.locationId!), Number.parseInt(this.roomId!), Number.parseInt(this.controllerId!), Number.parseInt(this.id!))
  97. if(entity instanceof ApiError) {
  98. this.snackbarText = ERR_TEXT
  99. return null
  100. }*/
  101.  
  102. //return entity
  103. return new Entity
  104. },
  105. async getScopes(): Promise<Scope[] | null> {
  106. /*let org = await Entity.getOrganization(Number.parseInt(this.orgId!))
  107. if(org instanceof ApiError) {
  108. this.snackbarText = ERR_TEXT
  109. return null
  110. }
  111.  
  112. let scopes = await org.getScopes()
  113. if(scopes.isFail()) {
  114. this.snackbarText = ERR_TEXT
  115. return null
  116. }
  117.  
  118. return scopes.getData()*/
  119. return []
  120. },
  121. }
  122. })
  123. </script>
Advertisement
Add Comment
Please, Sign In to add comment