Skip to content

Commit

Permalink
Update TestScriptor page when manually adding a GIVEN/THEN #48
Browse files Browse the repository at this point in the history
  • Loading branch information
martonsagi committed Mar 15, 2023
1 parent 098e639 commit a5ca337
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 15 deletions.
16 changes: 8 additions & 8 deletions web-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
"bootstrap": "^5.2.3",
"dragula": "^3.7.3",
"jquery": "^3.6.1",
"jsonc-parser": "^3.2.0",
"linq": "^4.0.1",
"lodash": "^4.17.21",
"redux": "^4.2.0",
"requirejs": "^2.3.6",
"split.js": "^1.6.5",
"jsonc-parser": "^3.2.0",
"redux": "^4.2.0"
"split.js": "^1.6.5"
},
"devDependencies": {
"@fortawesome/fontawesome-free": "^6.2.1",
"@babel/eslint-parser": "^7.19.1",
"@babel/types": "^7.6.1",
"@fortawesome/fontawesome-free": "^6.3.0",
"@types/jest": "^29.2.3",
"@types/jquery": "^3.5.14",
"@types/node": "^14.14.37",
"@babel/eslint-parser": "^7.19.1",
"@babel/types": "^7.6.1",
"aurelia-cli": "^3.0.1",
"aurelia-loader-nodejs": "^1.1.0",
"aurelia-pal-nodejs": "^1.2.0",
Expand All @@ -41,6 +41,7 @@
"connect-history-api-fallback": "^2.0.0",
"cssnano": "^5.1.14",
"debounce": "^1.2.1",
"eslint": "^7.5.0",
"gulp": "^4.0.2",
"gulp-htmlmin": "^5.0.1",
"gulp-less": "^5.0.0",
Expand All @@ -61,8 +62,7 @@
"ts-jest": "^29.0.3",
"tslint": "^6.1.3",
"typescript": "^4.4.2",
"vinyl-fs": "3.0.3",
"eslint": "^7.5.0"
"vinyl-fs": "3.0.3"
},
"browserslist": [
"defaults"
Expand Down
17 changes: 13 additions & 4 deletions web-ui/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ export class App {
this.sidebarLinks = this.appService.sidebarLinks;
}));

this.subscriptions.push(this.eventAggregator.subscribe(AppEventPublisher.refresh, response => {
this.init();
}));

this.subscriptions.push(this.eventAggregator.subscribe(AppEventPublisher.saveChanges, async (message: MessageUpdate) => {
let result = await this.backendService.send({ Command: 'SaveChanges', Data: message });
let userCancelledSaving: boolean = result.success === false;
Expand All @@ -57,10 +61,7 @@ export class App {
}

async attached() {
this.entries = await this.backendService.send({ Command: 'LoadTests' });

this.appService.updateSidebarLinks(this.entries);
this.appService.entries = this.entries;
await this.init();

Split(['#test-col-1', '#test-col-2'], {
sizes: [60, 40],
Expand All @@ -87,6 +88,14 @@ export class App {
});
}

async init() {
this.entries = await this.backendService.send({ Command: 'LoadTests' });

this.appService.updateSidebarLinks(this.entries);
this.appService.entries = this.entries;
}


detached() {
}
}
3 changes: 2 additions & 1 deletion web-ui/src/resources/elements/test-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export class TestList {

console.log('saveChangesOK', message);
if (message.Type == TypeChanged.ScenarioName && message.State == MessageState.Deleted) {
this.entries.splice(message.ArrayIndex, 1);
this.entries.splice(message.ArrayIndex, 1);
this.appService.updateSidebarLinks(this.entries);
this.focusRow(message.ArrayIndex - 1);
} else {
let entry = this.entries[message.ArrayIndex];
Expand Down
6 changes: 5 additions & 1 deletion web-ui/src/resources/elements/toolbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
<input class="form-control" value.bind="searchValue" type="search" placeholder="Search" aria-label="Search">
</div>
</li>
<li>
<button class="btn btn-outline-info my-2 my-sm-0" click.delegate="sendCommand('Refresh')" title="Refresh">
<i class="fa-solid fa-rotate"></i> <span class="d-none d-lg-inline">Refresh</span></button>
</li>
<li>
<button class="btn btn-outline-success my-2 my-sm-0" click.delegate="sendCommand('NewFeature')" title="Manage Features"><i
class="fas fa-list"></i> <span class="d-none d-lg-inline">Features</span></button>
Expand All @@ -34,7 +38,7 @@
<li>
<button class="btn btn-outline-secondary my-2 my-sm-0" click.delegate="sendCommand('Export')" title="Export to Excel">
<i class="fas fa-file-excel"></i> <span class="d-none d-lg-inline">Export</span></button>
</li>
</li>
<li>
<div class="btn-group-toggle my-2 my-sm-0" data-toggle="buttons" title="No Confirmation">
<label class="btn ${(noConfirmations ? 'btn-outline-success' : 'btn-outline-secondary')}">
Expand Down
3 changes: 2 additions & 1 deletion web-ui/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export enum AppEventPublisher {
saveChanges = 'saveChanges',
saveChangesOK = 'saveChangesOK',
saveChangesCancelled = 'saveChangesCancelled',
onDeleteScenario = 'onDeleteScenario'
onDeleteScenario = 'onDeleteScenario',
refresh = 'refresh'
}

export class Message {
Expand Down

0 comments on commit a5ca337

Please sign in to comment.