Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACA-3368] Update datatable columns when presetColumn schema changes #5732

Merged
merged 4 commits into from May 29, 2020

Conversation

arditdomi
Copy link
Contributor

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (check one with "x")

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation
  • Other... Please describe:

What is the current behaviour? (You can also link to an open issue here)
https://issues.alfresco.com/jira/browse/ACA-3368

What is the new behaviour?
The columns are updating when the schema changes

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

@codecov-commenter
Copy link

codecov-commenter commented May 27, 2020

Codecov Report

Merging #5732 into develop will increase coverage by 0.05%.
The diff coverage is 96.15%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #5732      +/-   ##
===========================================
+ Coverage    83.73%   83.79%   +0.05%     
===========================================
  Files          943      943              
  Lines        26759    26774      +15     
  Branches      3765     3768       +3     
===========================================
+ Hits         22407    22434      +27     
+ Misses        3229     3214      -15     
- Partials      1123     1126       +3     
Impacted Files Coverage Δ
...rc/lib/mock/process/process-instances-list.mock.ts 100.00% <ø> (ø)
...ocess-services/src/lib/mock/task/task-list.mock.ts 100.00% <ø> (ø)
...atable/components/datatable/datatable.component.ts 88.09% <95.00%> (+0.08%) ⬆️
.../process-list/components/process-list.component.ts 88.61% <100.00%> (+0.28%) ⬆️
...rc/lib/task-list/components/task-list.component.ts 84.71% <100.00%> (+0.29%) ⬆️
...atable/components/datatable/json-cell.component.ts
...le/components/datatable/location-cell.component.ts
.../datatable/components/datatable/data-cell.event.ts
...able/components/datatable/data-row-action.event.ts
...le/components/datatable/datatable-row.component.ts
... and 17 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 75f2165...f0a6c64. Read the comment docs.

it('should update data columns when columns input changes', () => {
dataTable.data = new ObjectDataTableAdapter(
[{ id: 'fake-data' }],
[new ObjectDataColumn({ key: 'id' })]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use column-1 column-2 to make clear what we are testing?

@@ -244,6 +245,15 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
return;
}

if (this.isPropertyChanged(changes['columns'])) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rewrite it like

if (this.isPropertyChanged(changes['rows'] || this.isPropertyChanged(changes['columns'])) {
           if (this.isTableEmpty()) {
               this.initTable();
           } 
           if (this.isPropertyChanged(changes['rows']) {
               this.setTableRows(changes['rows'].currentValue);
           } else {
              this.setTableColumns(changes['columns'].currentValue);
           }
           return;
       }

component.columns = [];
const presetColumnChange = new SimpleChange(null, 'fakeProcessCustomSchema', false);
component.ngOnChanges({ 'presetColumn': presetColumnChange });
expect(component.columns).toEqual(component.mergeJsonAndHtmlSchema());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't get it.
can we have a column preset, i.e. col-1 col-2
we change it and we expect to have col-3 col-4 ?

component.columns = [];
const presetColumnChange = new SimpleChange(null, 'fakeCustomSchema', false);
component.ngOnChanges({ 'presetColumn': presetColumnChange });
expect(component.columns).toEqual(component.mergeJsonAndHtmlSchema());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as before

Copy link
Contributor

@mauriziovitale mauriziovitale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments

@mauriziovitale mauriziovitale merged commit 3649e92 into develop May 29, 2020
@mauriziovitale mauriziovitale deleted the dev-adomi-ACA-3368 branch May 29, 2020 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants