danyill / oscd-supervision

IEC 61850 Ed 2 supervisions for GOOSE and SV in OpenSCD
Apache License 2.0
1 stars 1 forks source link

The "New Supervision" list item isn't activated correctly #7

Closed danyill closed 7 months ago

danyill commented 8 months ago

Previously I had set:

`<mwc-list-item
        hasMeta
        class="sup-ln mitem"
        graphic="icon"
        data-ln="NEW"
        value="New ${supervisionType} Supervision"
        ?noninteractive=${this.availableSupervisionLNs === 0}
      >
        <span
          >New ${supervisionType} Supervision
          ${this.instantiatedSupervisionLNs > 0
            ? html`— ${this.availableSupervisionLNs} available</span>
                </div>`
            : nothing}
        </span>
        <mwc-icon slot="graphic">heart_plus</mwc-icon>
      </mwc-list-item>`;

However this means there are situations when deleting a used control block and then connecting a new one works once but not twice (this test: can carry out a sequence of create, disconnect, delete and connect).

To avoid this we now have:

// TODO: Could not get the following noninteractive expression to work
    // for the "NEW" mwc-list-item
    //  ?noninteractive=${(this.selectedIedSupervisedCBRefs.length ===
    //  this.selectedIedSubscribedCBRefs.length) ||
    //  this.availableSupervisionLNs === 0}

    return html`${this.getSelectedIedSupLNs(used, unused)
        .filter(supLn => this.searchUnusedSupervisionLN(supLn))
        .map(lN => html`${this.renderUnusedSupervisionNode(lN)}`)}
      <mwc-list-item
        hasMeta
        class="sup-ln mitem"
        graphic="icon"
        data-ln="NEW"
        value="New ${supervisionType} Supervision"
        ?noninteractive=${this.availableSupervisionLNs === 0}
      >
        <span
          >New ${supervisionType} Supervision
          ${this.instantiatedSupervisionLNs > 0
            ? html`— ${this.availableSupervisionLNs} available</span>
                </div>`
            : nothing}
        </span>
        <mwc-icon slot="graphic">heart_plus</mwc-icon>
      </mwc-list-item>`;

Which is not correct and means the "New LGOS Supervision" can be clicked on when it shouldn't be possible (i.e. when there are no control block references in the right hand side), see for the picture below:

image

There is something I don't understand about the reactive update or the internal state which is causing this and I will need some help to resolve it.

I thought that I should be able to rely on editCount causing a full re-render of all templates, but the this ?noninteractive attribute appears to not be correctly calculated even though within the browser debugger I don't see that it is noninteractive when I can no longer click on it (after the first delete and reconnect round). However removing / reducing the noninteractive conditions seems to improve this and I don't know why.

danyill commented 8 months ago

To trigger this, use the "GOOSE-2007B4-LGOS.scd" fixture and the issue-7-showing-issue branch with only the small change to noninteractive

  1. Select "GOOSE_Subscriber1"
  2. Delete with the delete button LGOS 2
  3. Click on "New LGOS Supervision" at the bottom left list
  4. Click on the control block on the right.
  5. Repeat steps 2,3,4. The bug is that the same supervision cannot be reallocated (the list item is either disabled or not activated or something).
danyill commented 7 months ago

The cause appears to be dynamic changing of interactivity without calling layout()

image