-
Notifications
You must be signed in to change notification settings - Fork 43
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
🐛 Refactor dependencies, select row by name and provider #1554
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1554 +/- ##
=======================================
Coverage 40.49% 40.49%
=======================================
Files 145 145
Lines 4638 4638
Branches 1087 1087
=======================================
Hits 1878 1878
Misses 2746 2746
Partials 14 14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
LGTM but an abstraction jumped out at me, take it or leave it.
const result = useMemo(() => { | ||
if (!data) { | ||
return { data: [], total: 0, params }; | ||
} | ||
|
||
const syntheticData: WithUiId<AnalysisDependency>[] = data.data.map( | ||
(dep) => ({ | ||
...dep, | ||
_ui_unique_id: `${dep.name}/${dep.provider}`, | ||
}) | ||
); | ||
|
||
return { | ||
data: syntheticData, | ||
total: data.total, | ||
params: data.params, | ||
}; | ||
}, [data, params]); |
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 wonder if we can abstract out something like:
useWithUiId(data, (dep) => `${dep.name}/${dep.provider}`);
This indicates to me that maybe internally the table-controls/batteries/helpers could just take a getItemId
callback in the first place if you don't have a usable idProperty
. Will factor that into thinking on current refactors over there.
LGTM as-is though if you want to merge.
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.
idProperty: string | (item: TItem) -> string
?
;-)
…#1552) Changes: - Refactor the header and layout of tabs for the dependencies detail drawer following the changes in #1542. - Show the dependency name and provider in the header since those two fields together are the row unique key (see #1554). - Update the filter for the dependency applications to include both the name and the provider to match the row unique key (see #1554). Signed-off-by: Scott J Dickerson <sdickers@redhat.com>
Resolves: konveyor#1509 The Dependencies table was setup to use the `AnalysisDependency` `.name` as the selected row key. Since the `.name` field is not unique across all rows multiple rows would be erroneously selected at the same time. To solve the problem, a UI only unique id is generated after fetching and used for the table selection itemId. Change details: - Dependencies fetch query updated to inject a UI uid and return `WithUiId<AnalysisDependency>[]`. This transform is done outside the react-query `useQuery()` handling. - Updated the table to use the `WithUiId<>` key `_ui_unique_id` for selection. - Since the button rendered in the "Found in" column had no function, the button was removed. - "Found in" column moved to the last column to match the placement of matching columns on the Archetypes and Issues tables. Signed-off-by: Scott J Dickerson <sdickers@redhat.com>
12476d6
to
af060d7
Compare
Following up on konveyor#1554, create hook `useWithUiId()` to handle injecting UI id to objects. Any object `T` going will to the hook will come out as a `WithUiId<T>` object. Tables using the UI id have been adjusted to use the Constant `UI_UNIQUE_ID` as the `WithUiId<T>` table data `idProperty`. All uses of `WithUiId<T>` are now handled the same way. Signed-off-by: Scott J Dickerson <sdickers@redhat.com>
Following up on konveyor#1554, create hook `useWithUiId()` to handle injecting UI id to objects. Any object `T` going will to the hook will come out as a `WithUiId<T>` object. Tables using the UI id have been adjusted to use the Constant `UI_UNIQUE_ID` as the `WithUiId<T>` table data `idProperty`. All uses of `WithUiId<T>` are now handled the same way. Signed-off-by: Scott J Dickerson <sdickers@redhat.com>
Following up on konveyor#1554, create hook `useWithUiId()` to handle injecting UI id to objects. Any object `T` going will to the hook will come out as a `WithUiId<T>` object. Tables using the UI id have been adjusted to use the Constant `UI_UNIQUE_ID` as the `WithUiId<T>` table data `idProperty`. All uses of `WithUiId<T>` are now handled the same way. Signed-off-by: Scott J Dickerson <sdickers@redhat.com>
Following up on konveyor#1554, create hook `useWithUiId()` to handle injecting UI id to objects. Any object `T` going will to the hook will come out as a `WithUiId<T>` object. Tables using the UI id have been adjusted to use the Constant `UI_UNIQUE_ID` as the `WithUiId<T>` table data `idProperty`. All uses of `WithUiId<T>` are now handled the same way. Signed-off-by: Scott J Dickerson <sdickers@redhat.com>
Following up on konveyor#1554, create hook `useWithUiId()` to handle injecting UI id to objects. Any object `T` going will to the hook will come out as a `WithUiId<T>` object. Tables using the UI id have been adjusted to use the Constant `UI_UNIQUE_ID` as the `WithUiId<T>` table data `idProperty`. All uses of `WithUiId<T>` are now handled the same way. Signed-off-by: Scott J Dickerson <sdickers@redhat.com>
Following up on konveyor#1554, create hook `useWithUiId()` to handle injecting UI id to objects. Any object `T` going will to the hook will come out as a `WithUiId<T>` object. Tables using the UI id have been adjusted to use the Constant `UI_UNIQUE_ID` as the `WithUiId<T>` table data `idProperty`. All uses of `WithUiId<T>` are now handled the same way. Signed-off-by: Scott J Dickerson <sdickers@redhat.com>
Following up on konveyor#1554, create hook `useWithUiId()` to handle injecting UI id to objects. Any object `T` going will to the hook will come out as a `WithUiId<T>` object. Tables using the UI id have been adjusted to use the Constant `UI_UNIQUE_ID` as the `WithUiId<T>` table data `idProperty`. All uses of `WithUiId<T>` are now handled the same way. Signed-off-by: Scott J Dickerson <sdickers@redhat.com>
Following up on #1554, create hook `useWithUiId()` to handle injecting UI id to objects. Any object `T` going will to the hook will come out as a `WithUiId<T>` object. Tables using the UI id have been adjusted to use the Constant `UI_UNIQUE_ID` as the `WithUiId<T>` table data `idProperty`. All uses of `WithUiId<T>` are now handled the same way. --------- Signed-off-by: Scott J Dickerson <sdickers@redhat.com>
Resolves: #1509
The Dependencies table was setup to use the
AnalysisDependency.name
as the selected row key. Since the.name
field is not unique across all rows multiple rows would be erroneously selected at the same time. To solve the problem, a UI only unique id is generated after fetching and used for the table selection itemId.Change details:
Dependencies fetch query updated to inject a UI uid and return
WithUiId<AnalysisDependency>[]
. This transform is done outside the react-queryuseQuery()
handling.Updated the table to use the
WithUiId<>
key_ui_unique_id
for selection.Since the button rendered in the "Found in" column had no function, the button was removed.
"Found in" column moved to the last column to match the placement of matching columns on the Archetypes and Issues tables.
Use i18next plural aware keys for the "Found in" text to avoid the "(s)" suffix.
Fixed the
id
andaria-label
on the table.Added
key
to the label columnLabel
s.