webapp: create interface for DevInfoStatus

This commit is contained in:
Thomas Basler 2022-10-17 20:56:52 +02:00
parent 2682ca8dec
commit 4775f34f5b
3 changed files with 15 additions and 14 deletions

View File

@ -38,19 +38,10 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue'; import { defineComponent, type PropType } from 'vue';
import { BIconInfoSquare } from 'bootstrap-icons-vue'; import { BIconInfoSquare } from 'bootstrap-icons-vue';
import BootstrapAlert from '@/components/BootstrapAlert.vue'; import BootstrapAlert from '@/components/BootstrapAlert.vue';
import type { DevInfoStatus } from "@/types/DevInfoStatus";
declare interface DevInfoData {
valid_data: boolean,
fw_bootloader_version: number,
fw_build_version: number,
fw_build_datetime: Date,
hw_part_number: number,
hw_version: number,
hw_model_name: string,
}
export default defineComponent({ export default defineComponent({
components: { components: {
@ -58,7 +49,7 @@ export default defineComponent({
BootstrapAlert, BootstrapAlert,
}, },
props: { props: {
devInfoList: { type: Object as () => DevInfoData, required: true }, devInfoList: { type: Object as PropType<DevInfoStatus>, required: true },
}, },
computed: { computed: {
formatVersion() { formatVersion() {

View File

@ -0,0 +1,9 @@
export interface DevInfoStatus {
valid_data: boolean,
fw_bootloader_version: number,
fw_build_version: number,
fw_build_datetime: Date,
hw_part_number: number,
hw_version: number,
hw_model_name: string
}

View File

@ -154,7 +154,7 @@
</div> </div>
</div> </div>
<DevInfo v-if="!devInfoLoading" :devInfoList="(devInfoList as any)" /> <DevInfo v-if="!devInfoLoading" :devInfoList="devInfoList" />
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@ -341,6 +341,7 @@ import EventLog from '@/components/EventLog.vue';
import DevInfo from '@/components/DevInfo.vue'; import DevInfo from '@/components/DevInfo.vue';
import BootstrapAlert from '@/components/BootstrapAlert.vue'; import BootstrapAlert from '@/components/BootstrapAlert.vue';
import InverterChannelInfo from "@/components/InverterChannelInfo.vue"; import InverterChannelInfo from "@/components/InverterChannelInfo.vue";
import type { DevInfoStatus } from '@/types/DevInfoStatus';
declare interface Inverter { declare interface Inverter {
serial: number, serial: number,
@ -383,7 +384,7 @@ export default defineComponent({
eventLogList: {}, eventLogList: {},
eventLogLoading: true, eventLogLoading: true,
devInfoView: {} as bootstrap.Modal, devInfoView: {} as bootstrap.Modal,
devInfoList: {}, devInfoList: {} as DevInfoStatus,
devInfoLoading: true, devInfoLoading: true,
limitSettingView: {} as bootstrap.Modal, limitSettingView: {} as bootstrap.Modal,