Skip to content

Commit

Permalink
UI improvements for conflict channels
Browse files Browse the repository at this point in the history
  • Loading branch information
fracz committed Jun 19, 2024
1 parent ef9fc9a commit 9d73c49
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 9 deletions.
17 changes: 15 additions & 2 deletions src/SuplaBundle/Resources/translations/messages.pl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -842,8 +842,6 @@ Selected: Wybrane
Selected device has been logged out.: Wybrane urządzenie zostało wylogowane
Send a notification: Wyślij powiadomienie
Send notification: Wyślij powiadomienie
Sensor (normal closed): Czujnik (normalnie zamknięty)
Sensor (normal open): Czujnik (normalnie otwarty)
Sensor disconnected: Brak czujnika
Sensors: Czujniki
Server address: Adres serwera
Expand Down Expand Up @@ -1539,6 +1537,8 @@ Remove: Usuń
Requests limit: Limit żądań
Schedule cannot be enabled: Nie udało się włączyć harmonogramu
Schedules below will be deleted: Poniższe harmonogramy zostaną usunięte
Sensor (normal closed): Czujnik (normalnie zamknięty)
Sensor (normal open): Czujnik (normalnie otwarty)
Set initial values: Ustaw wartości początkowe
Show days with issues only: Pokaż tylko dni, w których odnotowano naruszenia
Sources available from: Źródła dostępne w
Expand All @@ -1565,5 +1565,18 @@ suffix: sufiks
#</editor-fold>
#<editor-fold desc="Missing translations">
# Translations below are missing. You want to translate them.
Alarm armament sensor: Czujnik uzbrojenia alarmu
Binary sensor: Czujnik binarny
Conflict: Konflikt
Remove this item: Usuń ten element
The device has channel conflict and cannot work.: Urządzenie wygenerowało konflikt kanałów i nie może aktualnie pracować.
This channel was missing during last device registration attempt.: Tego kanału brakuje na urządzeniu.
This is the list of our configured reactions. If you want to add a new reaction, go to the channel details that should trigger it.: To jest lista reakcji działających na Twoim koncie. Jeśli chcesz dodać nową reakcję, przejdź do szczegółów kanału, który powinien ją wyzwalać.
When the alarm is armed: Gdy alarm zostanie uzbrojony
When the alarm is armed or disarmed: Gdy alarm zostanie wyłączony lub uzbrojony
When the alarm is disarmed: Gdy alarm zostanie wyłączony
When the hotel card has been taken: Gdy karta hotelowa zostanie zabrana
When the hotel card is put in: Gdy karta hotelowa zostanie włożona
When the hotel card is put in or has been taken: Gdy karta hotelowa zostanie włożona lub zabrana

#</editor-fold>
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<template>
<div class="alert alert-danger" v-if="channel.conflictDetails">
<span v-if="channel.conflictDetails.missing">{{ $t('The device skipped this channel during registration.') }}</span>
<span>{{ $t('Conflict') }}:{{ ' ' }}</span>
<span v-if="channel.conflictDetails.missing">{{ $t('This channel was missing during last device registration attempt.') }}</span>
<span v-else-if="channel.conflictDetails.type">
{{
$t(
'The device is trying to register a channel with type {typeCaption} instead of the current one.',
{typeCaption: typeCaption}
'Invalid channel type ({typeCaption} - {typeId}) received in registration.',
{typeCaption: typeCaption, typeId: channel.conflictDetails.type}
)
}}
</span>
<span v-else>{{ $t('The device has conflict and cannot work.') }}</span>
<span v-else>{{ $t('The device has channel conflict and cannot work.') }}</span>
</div>
</template>

Expand Down
9 changes: 8 additions & 1 deletion src/frontend/src/channels/channel-tile.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<square-link :class="`clearfix pointer with-label ${model.functionId == 0 ? 'yellow' : 'grey'}`"
<square-link :class="`clearfix pointer with-label ${backgroundColor}`"
@click="$emit('click')">
<router-link :to="linkSpec">
<div class="clearfix">
Expand Down Expand Up @@ -61,4 +61,11 @@
const caption = computed(() => props.model.caption || i18n.t(props.model.function.caption));
const linkSpec = computed(() => props.noLink ? {} : {name: 'channel', params: {id: props.model.id}});
const hasActionTrigger = computed(() => props.model?.relationsCount?.actionTriggers > 0);
const backgroundColor = computed(() => {
if (props.model.conflictDetails || props.model.functionId === 0) {
return 'yellow';
} else {
return 'grey';
}
});
</script>
13 changes: 11 additions & 2 deletions src/frontend/src/devices/list/device-tile.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<square-link :class="'clearfix pointer with-label ' + (device.enabled && !device.locked ? 'green' : 'grey')">
<square-link :class="`clearfix pointer with-label ${backgroundColor}`">
<router-link :to="linkSpec">
<h3>{{ caption }}</h3>
<dl>
Expand Down Expand Up @@ -43,7 +43,16 @@
},
linkSpec() {
return this.noLink ? {} : {name: 'device', params: {id: this.device.id}};
}
},
backgroundColor() {
if (this.device.relationsCount?.channelsWithConflict > 0) {
return 'yellow';
} else if (!this.device.enabled || this.device.locked) {
return 'grey';
} else {
return 'green';
}
},
}
};
</script>

0 comments on commit 9d73c49

Please sign in to comment.