-
Notifications
You must be signed in to change notification settings - Fork 993
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #37675 - Change All Hosts kebab menu to match design
Refs #37675 - Add registry for table row kebab actions
- Loading branch information
1 parent
175b5f2
commit cf38a35
Showing
6 changed files
with
166 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
continue | ||
cve.content_view.label | ||
cve.environment.label | ||
cve | ||
continue | ||
::Katello::ContentViewEnvironment.where(:content_view_id => @cv4.id, :environment_id => @dev.id).first | ||
@cv4 = katello_content_views(:library_dev_view) | ||
::Katello::ContentViewEnvironment.where(:content_view_id => @cv4.id, :environment_id => @dev.id).first | ||
@cv4 = content_view_environments(:library_dev_view) | ||
::Katello::ContentViewEnvironment.where(:content_view_id => @cv4.id, :environment_id => @dev.id).first | ||
::Katello::ContentViewEnvironment.where(:content_view_id => @cv3.id, :environment_id => @dev.id).first | ||
::Katello::ContentViewEnvironment.where(:content_view_id => @cv2.id, :environment_id => @dev.id).first | ||
@cv3 | ||
@cv2 | ||
continue | ||
@cv2 = katello_content_views(:library_view_no_version) | ||
models | ||
@dev | ||
@cv2 | ||
::Katello::ContentViewEnvironment.where(:content_view_id => @cv2.id, :environment_id => @dev.id).first | ||
::Katello::ContentViewEnvironment.where(:content_view_id => @cv2.id, | ||
93: :environment_id => @dev.id).first | ||
target_cvs_ids | ||
next | ||
continue | ||
host.content_facet.content_view_environments.reload.ids | ||
host.content_facet.content_view_environments.ids | ||
host.content_facet.content_view_environments |
41 changes: 24 additions & 17 deletions
41
webpack/assets/javascripts/react_app/components/HostsIndex/ActionKebab.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
webpack/assets/javascripts/react_app/components/HostsIndex/ActionKebab.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#hosts-index-actions-kebab { | ||
position: absolute; | ||
top: 3.1em; | ||
} |
45 changes: 45 additions & 0 deletions
45
webpack/assets/javascripts/react_app/components/HostsIndex/TableRowActions/core.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import forceSingleton from '../../../common/forceSingleton'; | ||
|
||
const coreTableRowActionsRegistry = forceSingleton( | ||
'coreTableRowActionsRegistry', | ||
() => ({}) | ||
); | ||
|
||
// Unlike the column registry which is collecting objects that describe table columns, | ||
// here we collect an object containing a single getActions funtion, which returns an array of kebab action items. | ||
export const registerGetActions = ({ | ||
pluginName, | ||
getActionsFunc, | ||
tableName = 'hosts', | ||
}) => { | ||
if (!coreTableRowActionsRegistry[pluginName]) | ||
coreTableRowActionsRegistry[pluginName] = {}; | ||
coreTableRowActionsRegistry[pluginName][tableName] = { | ||
getActions: getActionsFunc, | ||
}; | ||
}; | ||
|
||
export const registeredTableRowActions = ({ tableName = 'hosts' }) => { | ||
const result = {}; | ||
Object.keys(coreTableRowActionsRegistry).forEach(pluginName => { | ||
if (coreTableRowActionsRegistry[pluginName]?.[tableName]) { | ||
result[pluginName] = coreTableRowActionsRegistry[pluginName][tableName]; | ||
} | ||
}); | ||
// { katello: { getActions: [Function: getActions] } } | ||
return result; | ||
}; | ||
|
||
export const getActions = (hostDetailsResult, { tableName = 'hosts' } = {}) => { | ||
const result = []; | ||
const allGetActionsFuncs = registeredTableRowActions({ tableName }); | ||
Object.values(allGetActionsFuncs).forEach( | ||
({ getActions: getActionsFunc }) => { | ||
if (typeof getActionsFunc !== 'function') return; | ||
result.push(...getActionsFunc(hostDetailsResult)); | ||
} | ||
); | ||
return result; | ||
}; | ||
|
||
export default getActions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters