Skip to content

Commit

Permalink
fix(#3163): Nodes are only reloaded with a full configuration (#3164)
Browse files Browse the repository at this point in the history
  • Loading branch information
tenthe authored Aug 21, 2024
1 parent 6b35759 commit ada9657
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
4 changes: 4 additions & 0 deletions ui/cypress/support/utils/ErrorMessageUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
*/

export class ErrorMessageUtils {
public static getExceptionComponent() {
return cy.dataCy('display-exception');
}

/**
* Validates that an error message is displayed and that this message contains the @param message
*/
Expand Down
14 changes: 10 additions & 4 deletions ui/cypress/tests/connect/opcua/opcAdapterConfiguration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ describe('Test OPC-UA Adapter Configuration', () => {
const getAdapterBuilder = () => {
const host: string = ParameterUtils.get('localhost', 'opcua');

const builder = AdapterBuilder.create('OPC_UA')
return AdapterBuilder.create('OPC_UA')
.setName('OPC UA Configuration Test')
.addInput('radio', 'adapter_type-pull_mode', '')
.addInput('input', 'undefined-PULLING_INTERVAL-0', '1000')
Expand All @@ -164,15 +164,21 @@ const getAdapterBuilder = () => {
'undefined-OPC_SERVER_URL-0',
'opc.tcp://' + host + ':50000',
)

.setAutoAddTimestampPropery();

return builder;
};

const setUpInitialConfiguration = (adapterInput: AdapterInput) => {
ConnectUtils.goToConnect();
ConnectUtils.goToNewAdapterPage();
ConnectUtils.selectAdapter(adapterInput.adapterType);

// Wait for the first static property to be rendered
cy.dataCy(adapterInput.adapterConfiguration[0].selector).should(
'be.visible',
);
// Validate that no error is not shown when nothing is configured
cy.dataCy('reloading-nodes', { timeout: 3000 }).should('not.exist');
ErrorMessageUtils.getExceptionComponent().should('not.exist');

StaticPropertyUtils.input(adapterInput.adapterConfiguration);
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@
~
-->

<div fxLayout="column" fxFlex="100" class="error-panel error">
<div
fxLayout="column"
fxFlex="100"
class="error-panel error"
data-cy="display-exception"
>
<div fxLayout="row">
<div fxFlex="100" fxLayoutAlign="start center">
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export class StaticRuntimeResolvableTreeInputComponent
}

ngOnInit(): void {
this.resetStaticPropertyStateAndReload();
this.resetStaticPropertyState();

if (
this.staticProperty.nodes.length === 0 &&
(!this.staticProperty.dependsOn ||
Expand Down Expand Up @@ -168,8 +169,12 @@ export class StaticRuntimeResolvableTreeInputComponent
* this state should be reset
*/
private resetStaticPropertyStateAndReload() {
this.resetStaticPropertyState();
this.reload();
}

private resetStaticPropertyState(): void {
this.staticProperty.latestFetchedNodes = [];
this.staticProperty.nextBaseNodeToResolve = undefined;
this.reload();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
fxLayout="row"
*ngIf="loading && editorMode === 'tree'"
fxLayoutAlign="start center"
data-cy="reloading-nodes"
>
<mat-spinner
color="accent"
Expand Down

0 comments on commit ada9657

Please sign in to comment.