Repository navigation
[#603][8] Add result panel component - #623
Conversation
…ined function in html
… the new ExecutionResult type / interface defined
…modify some comments in result panel component
|
|
||
| import { | ||
| getMockOperatorMetaData, getMockOperatorGroup, getMockOperatorSchemaList | ||
| mockOperatorMetaData, mockOperatorGroup, mockOperatorSchemaList |
There was a problem hiding this comment.
Haven't these changes already gone through? #619
| * @param content | ||
| */ | ||
| public open(content: any): void { | ||
| this.modalService.open(content).result.then((result) => { |
There was a problem hiding this comment.
How can this function accept an argument which is in constructor but wasn't assigned to any local data member?
There was a problem hiding this comment.
content is a TemplateRef defined by the line <ng-template #content let-c="close" let-d="dismiss">, as described in the ng-bootstrap library: https://ng-bootstrap.github.io/#/components/modal/api.
| * @param row | ||
| * @param content | ||
| */ | ||
| public getRowDetails(row: any, content: any): void { |
There was a problem hiding this comment.
Didn't we disallow the use of 'any'?
There was a problem hiding this comment.
Same comment, we do not allow any unless there's absolutely no workaround. This is a strict rule. Please change this function and the function open above with proper type signature.
There was a problem hiding this comment.
I have edited the type for content to TemplateRef<any> as described in this article, https://blog.angular-university.io/angular-ng-template-ng-container-ngtemplateoutlet/.
As for the row, it represents each of the result instance fetched from backend, which have no defined format. Therefore, I kept it as type any.
|
|
||
| if (resultData !== undefined) { | ||
| // generate columnDef from first row, column definition is in order | ||
| this.currentDisplayColumns = Object.keys(resultData[0]).filter(x => x !== '_id'); |
There was a problem hiding this comment.
Please provide a brief overview in comments about what is being done here. An example of what comes as response and the transformation done would be great.
There was a problem hiding this comment.
Some additional comments have been added in the new commits.
| /** | ||
| * Class for holding the properties for each column | ||
| */ | ||
| export class TableColumn { |
There was a problem hiding this comment.
This should go in the folder holding all the interfaces. I think it's types.
There was a problem hiding this comment.
New commit has implemented TableColumn as interface as suggested.
| </ng-container> | ||
| <mat-header-row *matHeaderRowDef="currentDisplayColumns"></mat-header-row> | ||
| <mat-row class="result-table-row" *matRowDef="let row; columns: currentDisplayColumns;" | ||
| (click)="getRowDetails(row, content)"></mat-row> |
There was a problem hiding this comment.
Where does this content in (row, content) come from? I don't see it being initialized anywhere above. Is it some standard variable that Angular understands?
There was a problem hiding this comment.
content is defined at the line <ng-template #content let-c="close" let-d="dismiss">.
This part of the code is straightly provided by the ng-bootstrap library.
There was a problem hiding this comment.
In this article, https://blog.angular-university.io/angular-ng-template-ng-container-ngtemplateoutlet/, under The ng-template directive and ngIf section, it demonstrates that the syntax of using #content is equivalent to referencing the ng-template (the popup window) we created.
There was a problem hiding this comment.
@henrychen0220 Is it possible to re-write the modal to use the second suggest way - Component as a content. https://ng-bootstrap.github.io/#/components/modal/examples#component
You can write the component in the same file, but write the HTML template in another file (instead of directly write the template in the ts file). So we have 3 files: result-panel.component.ts (containing the base component and the modal component), result-panel.component.html, and result-panel-modal.component.html.
I think the first way - directly writing an HTML is harder to understand, especially these lines: <ng-template #content let-c="close" let-d="dismiss">. The NgBootstrap also didn't provide any documentation saying what does they mean. And these angular template syntax is also hard to read. The Component as a content is easier to understand. And I think Issac also uses this method in his code. So we have a uniform way to deal with modals.
avinash0161
left a comment
There was a problem hiding this comment.
Please check the comments
…n `result-table.interface.ts`. Use better type instead of any as parameters. Add new css for paginator.
There was a problem hiding this comment.
@henrychen0220 I have done one round of reviews:
- I directly changed some of the comments, and remove some console.logs. We need to remove all these console logs in the production code.
- Please see the comment about readonly array
- Please see the comment about refactor the modal using the "component as content" way https://ng-bootstrap.github.io/#/components/modal/examples#component
- Please also add comments in the
result-table.interface.ts. I suggest we remove this file and move the interface in the component ts file. I don't think this interface would be used in any other components, so we can just create it locally. - Please also add comments in what does each local variable do in the main component: how are they used in the template.
@henrychen0220 I'll do another round of reviews after you fix them. Thanks a lot.
| * | ||
| */ | ||
| private changeResultTableProperty(response: SuccessExecutionResult) { | ||
| const resultData: ReadonlyArray<object> | undefined = response.result; |
There was a problem hiding this comment.
- Why is this variable declared as undefined?
response.resultis not undefined. - There's also no need to write the type information
- Related to the comment below when casting the
resultData as Array<object>:
make a copy of this immutable list: const resultData = response.result.slice(), slice() is JS way to copy a list, resultData type will become object[]
|
|
||
|
|
||
| // create a new DataSource object based on the new result data | ||
| this.currentDataSource = new MatTableDataSource<object> (resultData as Array<object>); |
There was a problem hiding this comment.
Don't ever do this -> resultData as Array<object>. This force casts the type from an immutable list to a normal list. This code effectively ruins the immutability that we wanted.
response.result is immutable and it should stay immutable, if cast it to Array<object>, it gives MatTableDataSource the ability to mutate the array, and we don't know if it will change the array or not. When it finally compiles to Javascript, there is no immutable array, they are all plain arrays.
The correct way to do it is to make a shallow copy of the array, and then pass it. See the comment above.
@avinash0161 force cast: <SomeType>variable and variable as SomeType is also dangerous. Sometimes it is necessary. Please pay attention to this usage in the future.
|
|
||
| type TableCellMethod = (row: any) => any; | ||
|
|
||
| export interface TableColumn extends Readonly<{ |
There was a problem hiding this comment.
- What does this interface do? Please write comments.
- What's the meaning of the 3 properties? Please also write comments.
Although I can guess what do they represent, it's good to write down the comments to explain.
| */ | ||
|
|
||
|
|
||
| type TableCellMethod = (row: any) => any; |
There was a problem hiding this comment.
please don't use any, change it to object or something.
I guess it should be (row: object) => object | string | number | boolean
And please also add the comment, such as (if I understand it correctly): Given a row, extract the value of a column
| public currentDataSource: MatTableDataSource<object> | undefined; | ||
| public currentDisplayRow: string = ''; | ||
|
|
||
| @ViewChild(MatPaginator) paginator: MatPaginator | null = null; |
There was a problem hiding this comment.
don't use null, use undefined instead
@avinash0161 In pretty much all other languages, there's only null, but in JS, there's null and undefined that represent similar concepts, this is just a bad thing about JS. There are stackoverflow questions about the difference of null and undefined, but IMO they are just made up concepts because of the design mistake of the JS language.
We use undefined uniformly.
There was a problem hiding this comment.
Then there's nothing we can do... Sadly someone in the Angular team who wrote this code doesn't agree with me on the null and undefined thing
| </ng-container> | ||
| <mat-header-row *matHeaderRowDef="currentDisplayColumns"></mat-header-row> | ||
| <mat-row class="result-table-row" *matRowDef="let row; columns: currentDisplayColumns;" | ||
| (click)="getRowDetails(row, content)"></mat-row> |
There was a problem hiding this comment.
@henrychen0220 Is it possible to re-write the modal to use the second suggest way - Component as a content. https://ng-bootstrap.github.io/#/components/modal/examples#component
You can write the component in the same file, but write the HTML template in another file (instead of directly write the template in the ts file). So we have 3 files: result-panel.component.ts (containing the base component and the modal component), result-panel.component.html, and result-panel-modal.component.html.
I think the first way - directly writing an HTML is harder to understand, especially these lines: <ng-template #content let-c="close" let-d="dismiss">. The NgBootstrap also didn't provide any documentation saying what does they mean. And these angular template syntax is also hard to read. The Component as a content is easier to understand. And I think Issac also uses this method in his code. So we have a uniform way to deal with modals.
…adable, fix minor issue with pagination, add new interface to remomve using type any
|
New changes have been pushed to this PR. Changes such as:
|
|
@henrychen0220 the new changes look great! Good job. I think using the component with the modal makes the code look less magic and more readable. Here's my second round of review:
Previously, when the backend returns an error, only
Therefore it's still better to use |
|
@zuozhiw To reproduce the problem I saw, for your first query, set the limit for ResultOperator to be 20. You will see that the paginator is not paginated unless you click run again. |
|
@henrychen0220 I'm able to reproduce the problem. I think one potential way to deal with this is that we manually call Angular's change detection function after we initialize the table variables and display the table, and then the child component will initialize and then we can pass in the paginator. But I think that solution again adds unnecessarily complications to the code. So think twice I feel that BTW can you please add another test case: when the component is first created, before receiving any data, it shouldn't have anything displayed in it: the |
…test if displayResultTable() method can capture the edge case where the execution result has a size of 0
| @@ -1,5 +1,5 @@ | |||
| <div class="texera-workspace-result-panel-body texera-workflow-component-body"> | |||
| <div *ngIf="showMessage"> | |||
| <div class="error-message" *ngIf="showMessage"> | |||
There was a problem hiding this comment.
change the class name to be a more specific name, prefix it with texera-, such as texera-result-panel-message
This is to minimize the conflict of name of our component with other library's name. Another library could also have a class name called "error-message".
|
@henrychen0220 one more minor comment about HTML class name, after that I approve this PR |
### What changes were proposed in this PR?
Patch-level alignment of all Angular packages in `frontend/`, across the
two Angular release lines:
| Line | Packages | Before | After |
| --- | --- | --- | --- |
| CLI toolchain | `@angular/cli`, `@angular-devkit/build-angular`,
`@angular-devkit/core`, `@angular-devkit/schematics`,
`@schematics/angular` | 21.2.8 | 21.2.18 |
| Framework | `@angular/{core,common,compiler,compiler-cli,localize}` |
21.2.17 | 21.2.17 (unchanged) |
| Framework |
`@angular/{animations,forms,router,platform-browser,platform-browser-dynamic}`
| 21.2.10 | 21.2.17 |
| CDK | `@angular/cdk` | 21.2.8 | 21.2.14 |
(The framework line has no 21.2.18 — 21.2.17 is its latest; CLI and
framework version independently.)
The toolchain bump is security-motivated: 21.2.8 exact-pins several
build-time dependencies with open advisories, which a plain lockfile
refresh cannot move. 21.2.18 re-pins them all to patched versions:
| Pinned dep | Before | After | Dependabot alerts resolved |
| --- | --- | --- | --- |
| undici | 7.24.4 | 7.28.0 |
[#617](https://github.com/apache/texera/security/dependabot/617) (high),
[#614](https://github.com/apache/texera/security/dependabot/614) (high),
[#621](https://github.com/apache/texera/security/dependabot/621),
[#613](https://github.com/apache/texera/security/dependabot/613),
[#623](https://github.com/apache/texera/security/dependabot/623),
[#616](https://github.com/apache/texera/security/dependabot/616) |
| vite | 7.3.2 | 7.3.6 |
[#591](https://github.com/apache/texera/security/dependabot/591) (high),
[#594](https://github.com/apache/texera/security/dependabot/594) |
| piscina | 5.1.4 | 5.2.0 |
[#610](https://github.com/apache/texera/security/dependabot/610) (high)
|
| webpack-dev-server | 5.2.3 | 5.2.5 |
[#609](https://github.com/apache/texera/security/dependabot/609),
[#518](https://github.com/apache/texera/security/dependabot/518) |
| esbuild | 0.27.3 | 0.28.1 |
[#555](https://github.com/apache/texera/security/dependabot/555) |
| postcss | 8.5.6 | 8.5.12 |
[#474](https://github.com/apache/texera/security/dependabot/474) |
13 alerts total (4 high). Not covered here (separate lockfile copies of
the same packages, planned as a follow-up refresh): undici `^6.25.0`
([#622](https://github.com/apache/texera/security/dependabot/622),
[#620](https://github.com/apache/texera/security/dependabot/620),
[#615](https://github.com/apache/texera/security/dependabot/615)) and
vite 8.x
([#593](https://github.com/apache/texera/security/dependabot/593),
[#590](https://github.com/apache/texera/security/dependabot/590)).
The framework/CDK alignment additionally clears the `YN0060`
incorrect-peer-dependency warnings printed on every `yarn install` (the
tree previously mixed 21.2.10 and 21.2.17).
Diff is `frontend/package.json` + the corresponding `yarn.lock`
re-resolution; no config or code changes.
### Any related issues, documentation, discussions?
Closes #6154
### How was this PR tested?
Existing test cases; no behavior change expected.
- `yarn build` (production `ng build`) — succeeds, only pre-existing
CommonJS warnings.
- `yarn test:ci` — all suites pass (`NX Successfully ran target test for
project gui`).
Both were run after each of the two commits (toolchain bump;
framework/CDK alignment).
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Fable 5)
---------
(backported from commit fd79073)
Co-authored-by: Claude Fable 5 <[email protected]>
…#6155) ### What changes were proposed in this PR? Patch-level alignment of all Angular packages in `frontend/`, across the two Angular release lines: | Line | Packages | Before | After | | --- | --- | --- | --- | | CLI toolchain | `@angular/cli`, `@angular-devkit/build-angular`, `@angular-devkit/core`, `@angular-devkit/schematics`, `@schematics/angular` | 21.2.8 | 21.2.18 | | Framework | `@angular/{core,common,compiler,compiler-cli,localize}` | 21.2.17 | 21.2.17 (unchanged) | | Framework | `@angular/{animations,forms,router,platform-browser,platform-browser-dynamic}` | 21.2.10 | 21.2.17 | | CDK | `@angular/cdk` | 21.2.8 | 21.2.14 | (The framework line has no 21.2.18 — 21.2.17 is its latest; CLI and framework version independently.) The toolchain bump is security-motivated: 21.2.8 exact-pins several build-time dependencies with open advisories, which a plain lockfile refresh cannot move. 21.2.18 re-pins them all to patched versions: | Pinned dep | Before | After | Dependabot alerts resolved | | --- | --- | --- | --- | | undici | 7.24.4 | 7.28.0 | [apache#617](https://github.com/apache/texera/security/dependabot/617) (high), [apache#614](https://github.com/apache/texera/security/dependabot/614) (high), [apache#621](https://github.com/apache/texera/security/dependabot/621), [apache#613](https://github.com/apache/texera/security/dependabot/613), [apache#623](https://github.com/apache/texera/security/dependabot/623), [apache#616](https://github.com/apache/texera/security/dependabot/616) | | vite | 7.3.2 | 7.3.6 | [apache#591](https://github.com/apache/texera/security/dependabot/591) (high), [apache#594](https://github.com/apache/texera/security/dependabot/594) | | piscina | 5.1.4 | 5.2.0 | [apache#610](https://github.com/apache/texera/security/dependabot/610) (high) | | webpack-dev-server | 5.2.3 | 5.2.5 | [apache#609](https://github.com/apache/texera/security/dependabot/609), [apache#518](https://github.com/apache/texera/security/dependabot/518) | | esbuild | 0.27.3 | 0.28.1 | [apache#555](https://github.com/apache/texera/security/dependabot/555) | | postcss | 8.5.6 | 8.5.12 | [apache#474](https://github.com/apache/texera/security/dependabot/474) | 13 alerts total (4 high). Not covered here (separate lockfile copies of the same packages, planned as a follow-up refresh): undici `^6.25.0` ([apache#622](https://github.com/apache/texera/security/dependabot/622), [apache#620](https://github.com/apache/texera/security/dependabot/620), [apache#615](https://github.com/apache/texera/security/dependabot/615)) and vite 8.x ([apache#593](https://github.com/apache/texera/security/dependabot/593), [apache#590](https://github.com/apache/texera/security/dependabot/590)). The framework/CDK alignment additionally clears the `YN0060` incorrect-peer-dependency warnings printed on every `yarn install` (the tree previously mixed 21.2.10 and 21.2.17). Diff is `frontend/package.json` + the corresponding `yarn.lock` re-resolution; no config or code changes. ### Any related issues, documentation, discussions? Closes apache#6154 ### How was this PR tested? Existing test cases; no behavior change expected. - `yarn build` (production `ng build`) — succeeds, only pre-existing CommonJS warnings. - `yarn test:ci` — all suites pass (`NX Successfully ran target test for project gui`). Both were run after each of the two commits (toolchain bump; framework/CDK alignment). ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Fable 5) --------- Co-authored-by: Claude Fable 5 <[email protected]>
This PR adds a new functionality to display workflow results after execution to the new GUI.
Whenever an execution finishes,
ResultPanelComponentwill fetch the execution result and display it onto the bottom area of the new GUI. If the execution result shows that the workflow graph executes correctly, a new data table showing the execution result in excel table format will be displayed. Otherwise, when a error message is returned instead, the result panel will show the corresponding error message on the result panel.Clicking on each row of the result table will create a pop-up window and display the detail of that row in the pretty json format. The pop-up window is implemented using the
modalcomponent provided by theng-bootstraplibrary.A
paginatoris also added to the new GUI to prevent displaying too many results all at once in the small area used by the result panel.New result panel data table:
New result panel error message:
New result panel row detail:
ng-bootstrap: https://github.com/ng-bootstrap/ng-bootstrapThis PR adds 5 new test cases.