Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): smart start view improvements #3684

Merged
merged 6 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion api/lib/ZwaveClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4928,7 +4928,15 @@ class ZwaveClient extends TypedEventEmitter<ZwaveClientEventCallbacks> {
const result = this.driver.controller.getProvisioningEntries()

for (const entry of result) {
if (
const node = this.nodes.get(entry.nodeId)
if (node) {
if (node.deviceConfig) {
entry.manufacturer = node.deviceConfig.manufacturer
entry.label = node.deviceConfig.label
entry.description = node.deviceConfig.description
}
entry.protocol = node.protocol
} else if (
typeof entry.manufacturerId === 'number' &&
typeof entry.productType === 'number' &&
typeof entry.productId === 'number' &&
Expand Down
43 changes: 43 additions & 0 deletions src/components/custom/MissingKeysAlert.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<template>
<v-alert
max-width="600px"
dense
border="left"
type="warning"
v-if="missingKeys.length > 0"
>
Some security keys are missing:
<strong>{{ missingKeys.join(', ') }}</strong
>. Please check your zwave settings.
robertsLando marked this conversation as resolved.
Show resolved Hide resolved
</v-alert>
</template>

<script>
import { mapState } from 'pinia'
import useBaseStore from '../../stores/base'

export default {
computed: {
...mapState(useBaseStore, ['zwave']),
missingKeys() {
const keys = this.zwave.securityKeys || {}

const requiredKeys = [
'S2_Unauthenticated',
'S2_Authenticated',
'S2_AccessControl',
'S0_Legacy',
]
const missing = []
for (const key of requiredKeys) {
if (!keys[key] || keys[key].length !== 32) {
missing.push(key)
}
}
return missing
},
},
}
</script>

<style></style>
2 changes: 1 addition & 1 deletion src/components/dialogs/DialogHealthCheck.vue
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
justify="space-around"
>
<v-col
v-if="averages.numNeighbors && !isLR()"
v-if="averages.numNeighbors && !isLR"
class="text-center"
>
<p class="mb-1 subtitle-1 font-weight-bold">
Expand Down
33 changes: 4 additions & 29 deletions src/components/dialogs/DialogNodesManager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,7 @@
v-model="s.values.inclusionMode"
mandatory
>
<v-alert
dense
border="left"
type="warning"
v-if="missingKeys.length > 0"
>
Some security keys are missing:
<strong>{{
missingKeys.join(', ')
}}</strong
>. Please check your zwave settings.
</v-alert>
<missing-keys-alert />
<v-radio
:value="InclusionStrategy.Default"
>
Expand Down Expand Up @@ -697,6 +686,9 @@ export default {
props: {
socket: Object,
},
components: {
MissingKeysAlert: () => import('../custom/MissingKeysAlert.vue'),
},
mixins: [InstancesMixin],
data() {
return {
Expand Down Expand Up @@ -799,23 +791,6 @@ export default {
controllerStatus() {
return this.appInfo.controllerStatus?.status
},
missingKeys() {
const keys = this.zwave.securityKeys || {}

const requiredKeys = [
'S2_Unauthenticated',
'S2_Authenticated',
'S2_AccessControl',
'S0_Legacy',
]
const missing = []
for (const key of requiredKeys) {
if (!keys[key] || keys[key].length !== 32) {
missing.push(key)
}
}
return missing
},
},
watch: {
commandEndDate(newVal) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/nodes-table/AssociationGroups.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export default {
async getAssociations(ask = false) {
let refresh = false
if (ask && this.node.status !== 'Dead') {
refresh = await this.$listeners.showConfirm(
refresh = await this.app.confirm(
'Info',
`Do you want to force query associations?${
this.node.status === 'Alive'
Expand Down Expand Up @@ -218,7 +218,7 @@ export default {
const args = [this.node.id]

if (
!(await this.$listeners.showConfirm(
!(await this.app.confirm(
'Attention',
`Are you sure you want to remove all associations from this node? This will also remove lifeline association if it exists.`,
'alert',
Expand Down
22 changes: 9 additions & 13 deletions src/components/nodes-table/ExpandedNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,12 @@
key="homeassistant"
transition="slide-y-transition"
>
<home-assistant
:node="node"
:socket="socket"
v-on="$listeners"
/>
<home-assistant :node="node" :socket="socket" />
</v-tab-item>

<!-- TAB GROUPS -->
<v-tab-item key="groups" transition="slide-y-transition">
<association-groups :node="node" v-on="$listeners" />
<association-groups :node="node" />
</v-tab-item>

<!-- TAB USERS -->
Expand All @@ -201,11 +197,7 @@
key="ota"
transition="slide-y-transition"
>
<OTAUpdates
:node="node"
:socket="socket"
v-on="$listeners"
/>
<OTAUpdates :node="node" :socket="socket" />
</v-tab-item>

<!-- TAB EVENTS -->
Expand Down Expand Up @@ -715,14 +707,18 @@ export default {
}
},
exportNode() {
this.$listeners.export(this.node, 'node_' + this.node.id, 'json')
this.app.exportConfiguration(
this.node,
'node_' + this.node.id,
'json',
)
},
async sendMqttAction(action, confirmMessage) {
if (this.node) {
let ok = true

if (confirmMessage) {
ok = await this.$listeners.showConfirm(
ok = await this.app.confirm(
'Info',
confirmMessage,
'info',
Expand Down
10 changes: 6 additions & 4 deletions src/components/nodes-table/HomeAssistant.vue
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,14 @@
import { inboundEvents as socketActions } from '@server/lib/SocketEvents'
import { mapActions, mapState } from 'pinia'
import useBaseStore from '../../stores/base'
import InstancesMixin from '../../mixins/InstancesMixin'

export default {
props: {
node: Object,
socket: Object,
},
mixins: [InstancesMixin],
data() {
return {
deviceJSON: '',
Expand Down Expand Up @@ -289,7 +291,7 @@ export default {
const device = this.selectedDevice
if (
device &&
(await this.$listeners.showConfirm(
(await this.app.confirm(
'Attention',
'Are you sure you want to delete selected device?',
'alert',
Expand All @@ -309,7 +311,7 @@ export default {
async disableDiscovery() {
if (
this.node &&
(await this.$listeners.showConfirm(
(await this.app.confirm(
'Rediscover node',
'Are you sure you want to disable discovery of all values? In order to make this persistent remember to click on Store',
))
Expand All @@ -331,7 +333,7 @@ export default {
const device = this.selectedDevice
if (
device &&
(await this.$listeners.showConfirm(
(await this.app.confirm(
'Rediscover Device',
'Are you sure you want to re-discover selected device?',
))
Expand All @@ -353,7 +355,7 @@ export default {
async rediscoverNode() {
if (
this.node &&
(await this.$listeners.showConfirm(
(await this.app.confirm(
'Rediscover node',
'Are you sure you want to re-discover all node values?',
))
Expand Down
2 changes: 1 addition & 1 deletion src/components/nodes-table/OTAUpdates.vue
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export default {
},
async updateFirmware(update) {
if (
await this.$listeners.showConfirm(
await this.app.confirm(
`OTA ${update.downgrade ? 'Downgrade' : 'Upgrade'}`,
`<p>Are you sure you want to ${
update.downgrade ? 'downgrade' : 'upgrade'
Expand Down
7 changes: 1 addition & 6 deletions src/components/nodes-table/SmartView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@

<reinterview-badge
:node="item"
v-on="$listeners"
:b-style="{
position: 'absolute',
top: '0',
Expand Down Expand Up @@ -322,11 +321,7 @@
<v-icon>close</v-icon>
</v-btn>
<v-card-text class="pt-3">
<expanded-node
:node="expandedNode"
:socket="socket"
v-on="$listeners"
/>
<expanded-node :node="expandedNode" :socket="socket" />
</v-card-text>
</v-card>
</v-dialog>
Expand Down
6 changes: 1 addition & 5 deletions src/components/nodes-table/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,7 @@
<div class="d-flex">
<v-chip>{{ item.id.toString().padStart(3, '0') }}</v-chip>

<reinterview-badge
:node="item"
v-on="$listeners"
></reinterview-badge>
<reinterview-badge :node="item"></reinterview-badge>
</div>
</template>
<template v-slot:[`item.minBatteryLevel`]="{ item }">
Expand Down Expand Up @@ -326,7 +323,6 @@
:isMobile="isMobile"
:node="item"
:socket="socket"
v-on="$listeners"
/>
</td>
</template>
Expand Down
Loading
Loading