return this.connectors.size === 0 && this.evses.size > 0
}
- private get wsConnectionUrl (): URL {
+ public get wsConnectionUrl (): URL {
return new URL(
`${
this.stationInfo?.supervisionUrlOcppConfiguration === true &&
if (this.isWebSocketConnectionOpened()) {
logger.warn(
- `${this.logPrefix()} OCPP connection to URL ${this.wsConnectionUrl.toString()} is already opened`
+ `${this.logPrefix()} OCPP connection to URL ${this.wsConnectionUrl.href} is already opened`
)
return
}
- logger.info(
- `${this.logPrefix()} Open OCPP connection to URL ${this.wsConnectionUrl.toString()}`
- )
+ logger.info(`${this.logPrefix()} Open OCPP connection to URL ${this.wsConnectionUrl.href}`)
this.wsConnection = new WebSocket(
this.wsConnectionUrl,
private async onOpen (): Promise<void> {
if (this.isWebSocketConnectionOpened()) {
logger.info(
- `${this.logPrefix()} Connection to OCPP server through ${this.wsConnectionUrl.toString()} succeeded`
+ `${this.logPrefix()} Connection to OCPP server through ${this.wsConnectionUrl.href} succeeded`
)
let registrationRetryCount = 0
if (!this.isRegistered()) {
this.emit(ChargingStationEvents.updated)
} else {
logger.warn(
- `${this.logPrefix()} Connection to OCPP server through ${this.wsConnectionUrl.toString()} failed`
+ `${this.logPrefix()} Connection to OCPP server through ${this.wsConnectionUrl.href} failed`
)
}
}
connectors: ConnectorStatus[]
evses: EvseStatusWorkerType[]
ocppConfiguration: ChargingStationOcppConfiguration
+ supervisionUrl: string
wsState?:
| typeof WebSocket.CONNECTING
| typeof WebSocket.OPEN
evses: buildEvsesStatus(chargingStation, OutputFormat.worker),
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
ocppConfiguration: chargingStation.ocppConfiguration!,
+ supervisionUrl: chargingStation.wsConnectionUrl.href,
wsState: chargingStation.wsConnection?.readyState,
bootNotificationResponse: chargingStation.bootNotificationResponse,
...(chargingStation.automaticTransactionGenerator != null && {
<style>
#app {
- height: 100%;
- width: 100%;
+ height: fit-content;
+ width: fit-content;
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body {
- margin: 0;
- padding: 0;
- height: 100vh;
- width: 100vw;
+ height: fit-content;
+ width: fit-content;
+ margin: 0.05%;
+ padding: 0.05%;
background-color: rgb(233, 227, 227);
}
</style>
<style>
.container {
- display: flex;
- box-sizing: border-box;
- max-height: 100%;
- max-width: 100%;
+ flex: auto;
}
</style>
<template>
- <td class="cs-table__action-col">
+ <td class="cs-table__column">
<Button @click="startChargingStation()">Start Charging Station</Button>
<Button @click="stopChargingStation()">Stop Charging Station</Button>
<Button @click="openConnection()">Open Connection</Button>
<Button @click="startAutomaticTransactionGenerator()">Start ATG</Button>
<Button @click="stopAutomaticTransactionGenerator()">Stop ATG</Button>
</td>
- <td class="cs-table__connector-col">{{ connectorId }}</td>
- <td class="cs-table__status-col">{{ connector.status }}</td>
- <td class="cs-table__transaction-col">{{ connector.transactionStarted ? 'Yes' : 'No' }}</td>
+ <td class="cs-table__column">{{ connectorId }}</td>
+ <td class="cs-table__column">{{ connector.status ?? 'Ø' }}</td>
+ <td class="cs-table__column">{{ connector.transactionStarted === true ? 'Yes' : 'No' }}</td>
</template>
<script setup lang="ts">
:transaction-id="connector.transactionId"
:id-tag="props.idTag"
/>
- <td class="cs-table__name-col">{{ getId() }}</td>
- <td class="cs-table__started-col">{{ getStarted() }}</td>
- <td class="cs-table__wsState-col">{{ getWsState() }}</td>
- <td class="cs-table__registration-status-col">{{ getRegistrationStatus() }}</td>
- <td class="cs-table__template-col">{{ getInfo().templateName }}</td>
- <td class="cs-table__vendor-col">{{ getVendor() }}</td>
- <td class="cs-table__model-col">{{ getModel() }}</td>
- <td class="cs-table__firmware-col">{{ getFirmwareVersion() }}</td>
+ <td class="cs-table__column">{{ getId() }}</td>
+ <td class="cs-table__column">{{ getStarted() }}</td>
+ <td class="cs-table__column">{{ getSupervisionUrl() }}</td>
+ <td class="cs-table__column">{{ getWsState() }}</td>
+ <td class="cs-table__column">{{ getRegistrationStatus() }}</td>
+ <td class="cs-table__column">{{ getInfo().templateName }}</td>
+ <td class="cs-table__column">{{ getVendor() }}</td>
+ <td class="cs-table__column">{{ getModel() }}</td>
+ <td class="cs-table__column">{{ getFirmwareVersion() }}</td>
</tr>
</template>
// import { reactive } from 'vue'
import CSConnector from './CSConnector.vue'
import type { ChargingStationData, ChargingStationInfo, ConnectorStatus } from '@/types'
-import { ifUndefined } from '@/composables/Utils'
const props = defineProps<{
chargingStation: ChargingStationData
return getInfo().hashId
}
function getId(): string {
- return ifUndefined<string>(getInfo().chargingStationId, 'Ø')
+ return getInfo().chargingStationId ?? 'Ø'
}
function getModel(): string {
return getInfo().chargePointModel
return getInfo().chargePointVendor
}
function getFirmwareVersion(): string {
- return ifUndefined<string>(getInfo().firmwareVersion, 'Ø')
+ return getInfo().firmwareVersion ?? 'Ø'
}
function getStarted(): string {
return props.chargingStation.started === true ? 'Yes' : 'No'
}
+function getSupervisionUrl(): string {
+ const supervisionUrl = new URL(props.chargingStation.supervisionUrl)
+ return `${supervisionUrl.protocol}//${supervisionUrl.host.split('.').join('.\u200b')}`
+}
function getWsState(): string {
switch (props.chargingStation?.wsState) {
case WebSocket.CONNECTING:
<style>
.card-info {
background-color: white;
- padding: 0.2%;
}
</style>
</caption>
<thead id="cs-table__head">
<tr class="cs-table__row">
- <th scope="col" class="cs-table__action-col">Action</th>
- <th scope="col" class="cs-table__connector-col">Connector</th>
- <th scope="col" class="cs-table__status-col">Status</th>
- <th scope="col" class="cs-table__transaction-col">Transaction</th>
- <th scope="col" class="cs-table__name-col">Name</th>
- <th scope="col" class="cs-table__started-col">Started</th>
- <th scope="col" class="cs-table__wsState-col">WebSocket State</th>
- <th scope="col" class="cs-table__registration-status-col">Registration Status</th>
- <th scope="col" class="cs-table__template-col">Template</th>
- <th scope="col" class="cs-table__vendor-col">Vendor</th>
- <th scope="col" class="cs-table__model-col">Model</th>
- <th scope="col" class="cs-table__firmware-col">Firmware Version</th>
+ <th scope="col" class="cs-table__column">Action</th>
+ <th scope="col" class="cs-table__column">Connector</th>
+ <th scope="col" class="cs-table__column">Status</th>
+ <th scope="col" class="cs-table__column">Transaction</th>
+ <th scope="col" class="cs-table__column">Name</th>
+ <th scope="col" class="cs-table__column">Started</th>
+ <th scope="col" class="cs-table__column">Supervision Url</th>
+ <th scope="col" class="cs-table__column">WebSocket State</th>
+ <th scope="col" class="cs-table__column">Registration Status</th>
+ <th scope="col" class="cs-table__column">Template</th>
+ <th scope="col" class="cs-table__column">Vendor</th>
+ <th scope="col" class="cs-table__column">Model</th>
+ <th scope="col" class="cs-table__column">Firmware Version</th>
</tr>
</thead>
<tbody id="cs-table__body">
<style>
#cs-table {
- height: 100%;
+ height: fit-content;
width: 100%;
background-color: white;
display: flex;
- flex-grow: 1;
flex-direction: column;
overflow: auto hidden;
border-collapse: collapse;
#cs-table__body {
height: fit-content;
width: 100%;
- min-width: 100%;
- display: block;
+ display: flex;
+ flex-direction: column;
}
#cs-table__body {
overflow: visible overlay;
- flex-grow: 1;
}
.cs-table__row {
+ height: fit-content;
width: 100%;
display: flex;
justify-content: center;
background-color: rgb(223, 217, 217);
}
-.cs-table__action-col,
-.cs-table__connector-col,
-.cs-table__status-col,
-.cs-table__transaction-col,
-.cs-table__name-col,
-.cs-table__started-col,
-.cs-table__wsState-col,
-.cs-table__registration-status-col,
-.cs-table__template-col,
-.cs-table__model-col,
-.cs-table__vendor-col,
-.cs-table__firmware-col {
- height: 0.1%;
- width: 20%;
- padding-top: 0.2%;
- padding-bottom: 0.2%;
+.cs-table__column {
+ height: fit-content;
+ width: calc(100% / 13);
text-align: center;
}
</style>
-export const ifUndefined = <T>(value: T | undefined, isValue: T): T => {
- if (value === undefined) return isValue
- return value as T
-}
-
// export const compose = <T>(...fns: ((arg: T) => T)[]): ((x: T) => T) => {
// return (x: T) => fns.reduceRight((y, fn) => fn(y), x)
// }
connectors: ConnectorStatus[]
evses: EvseStatus[]
ocppConfiguration: ChargingStationOcppConfiguration
+ supervisionUrl: string
wsState?:
| typeof WebSocket.CONNECTING
| typeof WebSocket.OPEN
<style>
#charging-stations {
- height: 100%;
+ height: fit-content;
width: 100%;
- padding: 0.5%;
background-color: rgb(233, 227, 227);
display: flex;
flex-direction: column;
#idtag-field {
flex: auto;
+ text-align: center;
}
</style>
expect(wrapper.text()).to.include('Transaction')
expect(wrapper.text()).to.include('Name')
expect(wrapper.text()).to.include('Started')
+ expect(wrapper.text()).to.include('Supervision Url')
expect(wrapper.text()).to.include('WebSocket State')
expect(wrapper.text()).to.include('Registration Status')
expect(wrapper.text()).to.include('Template')