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

[CCI] Fix type errors in Saved Object Management #3987

Closed

Conversation

Nicksqain
Copy link
Contributor

Description

Issues Resolved

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
    • yarn test:ftr
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Signed-off-by: Alexei Karikov <karikov.alist.ru@gmail.com>
Signed-off-by: Alexei Karikov <karikov.alist.ru@gmail.com>
Signed-off-by: Alexei Karikov <karikov.alist.ru@gmail.com>
Signed-off-by: Alexei Karikov <karikov.alist.ru@gmail.com>
@Nicksqain
Copy link
Contributor Author

I've fixed most of the errors, could you check? Could you suggest how best to fix the errors in

src\plugins\saved_objects_management\server\routes\scroll_count.ts

@joshuarrrr
Copy link
Member

@Nicksqain Some of the unit test snapshots need to be updated. You can do that via yarn test:jest -u. See failures: https://github.com/opensearch-project/OpenSearch-Dashboards/actions/runs/4900693983/jobs/8751525045?pr=3987

@joshuarrrr joshuarrrr added the OSCI Open Source Contributor Initiative label May 12, 2023
Signed-off-by: Alexei Karikov <karikov.alist.ru@gmail.com>
Signed-off-by: Alexei Karikov <karikov.alist.ru@gmail.com>
@Nicksqain
Copy link
Contributor Author

@Nicksqain Some of the unit test snapshots need to be updated. You can do that via yarn test:jest -u. See failures: https://github.com/opensearch-project/OpenSearch-Dashboards/actions/runs/4900693983/jobs/8751525045?pr=3987

I have updated the snapshot, which should solve the problem

Signed-off-by: Alexei Karikov <karikov.alist.ru@gmail.com>
Signed-off-by: Alexei Karikov <karikov.alist.ru@gmail.com>
onTableChange: (table: any) => void;
isSearching: boolean;
onShowRelationships: (object: SavedObjectWithMetadata) => void;
canGoInApp: (obj: SavedObjectWithMetadata) => boolean;
dateFormat: string;
dateFormat?: string;
Copy link
Contributor Author

@Nicksqain Nicksqain May 13, 2023

Choose a reason for hiding this comment

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

I'm not sure about the optional dateFormat props because it's not used in the defaultProps

 src\plugins\saved_objects_management\public\management_section\objects_table\components\table.test.tsx test 

Copy link
Member

Choose a reason for hiding this comment

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

I think making it optional is probably fine - moment will accept undefined as an input on L251. Alternatively you could just update the test defaultProps to include it, like in

@@ -161,6 +161,7 @@ describe('SavedObjectsTable', () => {
goInspectObject: () => {},
canGoInApp: () => true,
search,
dateFormat: 'YYYY-MM-DD',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you tell me what value the dateFormat should take? In

src\plugins\saved_objects_management\public\management_section\saved_objects_table_page.tsx 

the value is

const dateFormat = coreStart.uiSettings.get<string>('dateFormat');

Copy link
Member

Choose a reason for hiding this comment

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

That's a good question. It's a little hard to tell, but to be consistent with the ui_settings test, I'd use Browser as the default test string:

const { defaults = { dateFormat: { value: 'Browser' } }, initialSettings = {} } = options;

@codecov
Copy link

codecov bot commented May 13, 2023

Codecov Report

Merging #3987 (025d6e1) into main (5c5de03) will decrease coverage by 0.06%.
The diff coverage is 33.33%.

@@            Coverage Diff             @@
##             main    #3987      +/-   ##
==========================================
- Coverage   66.36%   66.30%   -0.06%     
==========================================
  Files        3229     3229              
  Lines       62145    62147       +2     
  Branches     9622     9623       +1     
==========================================
- Hits        41240    41205      -35     
- Misses      18584    18615      +31     
- Partials     2321     2327       +6     
Flag Coverage Δ
Linux ?
Windows 66.30% <33.33%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...objects_management/public/lib/get_relationships.ts 75.00% <ø> (ø)
...saved_objects_management/public/lib/parse_query.ts 88.88% <ø> (ø)
...agement_section/objects_table/components/table.tsx 64.91% <ø> (ø)
...ins/saved_objects_management/server/routes/find.ts 6.66% <0.00%> (-0.23%) ⬇️
...d_objects_management/server/routes/scroll_count.ts 6.25% <0.00%> (ø)
...ment_section/objects_table/saved_objects_table.tsx 67.98% <33.33%> (ø)
...ts_management/public/services/namespace_service.ts 25.00% <100.00%> (+6.81%) ⬆️

... and 7 files with indirect coverage changes

@joshuarrrr joshuarrrr changed the title [CCI] Fix type errors som changes [CCI] Fix type errors in Saved Object Management Jun 6, 2023
Signed-off-by: Josh Romero <rmerqg@amazon.com>
@joshuarrrr
Copy link
Member

(I resolved CHANGELOG conflicts)

Copy link
Member

@joshuarrrr joshuarrrr left a comment

Choose a reason for hiding this comment

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

Mostly looking good, a couple minor questions.

Comment on lines +50 to 51
} catch (respError: any) {
const respBody = get(respError, 'data', {}) as any;
Copy link
Member

Choose a reason for hiding this comment

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

nit - in general, prefer unknown to any.

private readonly alias;
private alias: string = '';
Copy link
Member

Choose a reason for hiding this comment

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

This changes the behavior a bit. Is there any error cases or edge case handling that needs to be changed to handle '' vs undefined as the default value?

Copy link
Member

@zhongnansu zhongnansu left a comment

Choose a reason for hiding this comment

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

PR lgtm. There's a snapshot test failed from CI. Can you update snapshots?

@joshuarrrr joshuarrrr added the needs more info Requires more information from poster label Jun 20, 2023
@abbyhu2000 abbyhu2000 marked this pull request as draft July 25, 2023 19:12
@zhongnansu
Copy link
Member

PR has been stale for 10 months. Closing. Feel free to re-open if you plan to work on it again. @Nicksqain
cc: @abbyhu2000

@zhongnansu zhongnansu closed this May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info Requires more information from poster OSCI Open Source Contributor Initiative repeat-contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix type errors from Saved Object Management changes
3 participants