-
Notifications
You must be signed in to change notification settings - Fork 805
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
[Workspace] Support feature quantities in workspace list page #6627
base: main
Are you sure you want to change the base?
Conversation
07c8db0
to
fa9affc
Compare
const defaultProps = ({ | ||
workspaceConfigurableApps$: of(undefined), | ||
} as unknown) as WorkspaceListProps; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const defaultProps = ({ | |
workspaceConfigurableApps$: of(undefined), | |
} as unknown) as WorkspaceListProps; | |
const workspaceConfigurableApps: PublicAppInfo[] = []; | |
const defaultProps: WorkspaceListProps = { | |
workspaceConfigurableApps$: new BehaviorSubject(workspaceConfigurableApps), | |
}; |
Can we do this? The cast as WorksapaceListProps
is not necessary and safe here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The suggested change will also throw type error. I'm open to if we use type assertion in test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- It seems unnecessary, we can just mock an object that matches the WorkspaceListProps.
- WorkspaceListProps may have more field in the future and if we use type assertion, the type error will be swallowed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So do you mean if there is type error in test file we can ignore? Seems your suggested change will throw type error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I mean we should not use type assertion here. Could you please try the latest version of the suggestions? It should work without type error as long as you import type PublicAppInfo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, that's fine.
const [queryInput, setQueryInput] = useState<string>(''); | ||
const [pagination, setPagination] = useState({ | ||
pageIndex: 0, | ||
pageSize: 5, | ||
pageSizeOptions: [5, 10, 20], | ||
}); | ||
const [deletedWorkspace, setDeletedWorkspace] = useState<WorkspaceAttribute | null>(null); | ||
const configurableApps = useObservable(props.workspaceConfigurableApps$ ?? of(undefined)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious why don't we use of([])
as default value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a missed change, updated.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6627 +/- ##
==========================================
- Coverage 67.79% 67.49% -0.30%
==========================================
Files 3413 2655 -758
Lines 66755 50623 -16132
Branches 10861 9170 -1691
==========================================
- Hits 45254 34170 -11084
+ Misses 18857 14206 -4651
+ Partials 2644 2247 -397
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
❌ Invalid Prefix For Manual Changeset CreationInvalid description prefix. Found "feat". Only "skip" entry option is permitted for manual commit of changeset files. If you were trying to skip the changelog entry, please use the "skip" entry option in the ##Changelog section of your PR description. |
@raintygao https://github.com/apps/opensearch-changeset-bot could you please install the app into your forked repo? I think this PR deserves a changelog. |
❌ Invalid Prefix For Manual Changeset CreationInvalid description prefix. Found "feat". Only "skip" entry option is permitted for manual commit of changeset files. If you were trying to skip the changelog entry, please use the "skip" entry option in the ##Changelog section of your PR description. |
const featureFilter = featureMatchesConfig(featuresConfig); | ||
const selectedApplications = configurableApps.filter((app) => featureFilter(app)); | ||
return { | ||
total: configurableApps.length, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DEFAULT_SELECTED_FEATURES_IDS
is not exists in configurable apps. Shall we add them to the total and selected list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Here we need to make features consistent with create page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the featureConfig will includes these two feature ids, which means it may return {total: 0, selected: 2}
. Do we need to filter out these two feature ids?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SelectedFeatures are filtered from workspaceConfigurableApps, workspaceConfigurableApps will filter out default selected features.
@@ -106,6 +117,10 @@ export const WorkspaceList = () => { | |||
name: 'Features', | |||
isExpander: true, | |||
hasActions: true, | |||
render: (features: string[]) => { | |||
const { total, selected } = getSelectedFeatureQuantities(features, configurableApps || []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we render "-" for configurableApps is undefined or empty? 0/0
may looks strange.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. Usually -
represents null or missed data, 0/0
represent 0 features selected, I think that's how it should be.
efa079a
to
1007e63
Compare
workspaceConfigurableApps$?: BehaviorSubject<PublicAppInfo[]>; | ||
} | ||
|
||
const WORKSPACE_LIST_PAGE_DESCRIPTION = i18n.translate('workspace.list.description', { | ||
defaultMessage: | ||
'Workspace allow you to save and organize library items, such as index patterns, visualizations, dashboards, saved searches, and share them with other OpenSearch Dashboards users. You can control which features are visible in each workspace, and which users and groups have read and write access to the library items in the workspace.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: is it A workspace allows
or Workspaces allow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it would be cool to make the #/# a tool tip, and it displays the names of the selected apps
Signed-off-by: tygao <tygao@amazon.com>
Signed-off-by: tygao <tygao@amazon.com>
e8ee342
to
a89f35c
Compare
Thanks for your suggestion. That's cool. I will discuss this with designer. |
Hi @kavilla , could you help approve again? Seems your approval was dismissed because of my commit to update description. |
Hi @raintygao, is this PR targeting 2.15 or 2.16? |
Hi @BionIT , there will be some new UX design updates in this part, we convert this PR to draft for now. |
Description
Support feature selection quantities in workspace list page
Screenshot
Changelog
Check List
yarn test:jest
yarn test:jest_integration