Move-up/down buttons should not work on new camera entry.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
// TODO editor: should not be able to move up a new camera before it's not new.
|
||||
// TODO reconsider card_id, and using entity (which is unique) as that id
|
||||
// TODO rename card_id to id?
|
||||
// TODO webrtc entities in camera section?
|
||||
|
||||
+6
-4
@@ -342,11 +342,12 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor
|
||||
<ha-icon-button
|
||||
class="button"
|
||||
.label=${localize('editor.move_up')}
|
||||
.disabled=${!this._config ||
|
||||
.disabled=${addNewCamera ||
|
||||
!this._config ||
|
||||
!Array.isArray(this._config.cameras) ||
|
||||
cameraIndex <= 0}
|
||||
@click=${() =>
|
||||
modifyConfig((config: RawFrigateCardConfig): boolean => {
|
||||
!addNewCamera && modifyConfig((config: RawFrigateCardConfig): boolean => {
|
||||
if (Array.isArray(config.cameras) && cameraIndex > 0) {
|
||||
arrayMove(config.cameras, cameraIndex, cameraIndex - 1);
|
||||
this._expandedCameraIndex = cameraIndex - 1;
|
||||
@@ -360,11 +361,12 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor
|
||||
<ha-icon-button
|
||||
class="button"
|
||||
.label=${localize('editor.move_down')}
|
||||
.disabled=${!this._config ||
|
||||
.disabled=${addNewCamera ||
|
||||
!this._config ||
|
||||
!Array.isArray(this._config.cameras) ||
|
||||
cameraIndex >= this._config.cameras.length - 1}
|
||||
@click=${() =>
|
||||
modifyConfig((config: RawFrigateCardConfig): boolean => {
|
||||
!addNewCamera && modifyConfig((config: RawFrigateCardConfig): boolean => {
|
||||
if (
|
||||
Array.isArray(config.cameras) &&
|
||||
cameraIndex < config.cameras.length - 1
|
||||
|
||||
Reference in New Issue
Block a user