Skip to content

Commit

Permalink
Bug 1801584: Fixed Inconsistency in kebab and actions menu for storag…
Browse files Browse the repository at this point in the history
…e cluster instance`
  • Loading branch information
gnehapk committed Feb 26, 2020
1 parent c30a98f commit e3c4fc1
Showing 1 changed file with 10 additions and 5 deletions.
Expand Up @@ -36,8 +36,9 @@ import {
K8sResourceKind,
OwnerReference,
apiVersionForReference,
groupVersionFor,
apiGroupForReference,
kindForReference,
K8sResourceKindReference,
modelFor,
referenceFor,
referenceForModel,
Expand All @@ -63,13 +64,13 @@ const csvName = () =>
allParts[i - 1] === ClusterServiceVersionModel.plural,
);

const getActions = (selectedObj: any) => {
const getActions = (ref: K8sResourceKindReference) => {
const actions = plugins.registry
.getClusterServiceVersionActions()
.filter(
(action) =>
action.properties.kind === selectedObj.kind &&
groupVersionFor(selectedObj.apiVersion).group === action.properties.apiGroup,
action.properties.kind === kindForReference(ref) &&
apiGroupForReference(ref) === action.properties.apiGroup,
);
const pluginActions = actions.map((action) => (kind, ocsObj) => ({
label: action.properties.label,
Expand Down Expand Up @@ -269,7 +270,11 @@ export const OperandTableRow: React.FC<OperandTableRowProps> = ({ obj, index, ke
<Timestamp timestamp={obj.metadata.creationTimestamp} />
</TableData>
<TableData className={tableColumnClasses[6]}>
<ResourceKebab actions={getActions(obj)} kind={referenceFor(obj)} resource={obj} />
<ResourceKebab
actions={getActions(referenceFor(obj))}
kind={referenceFor(obj)}
resource={obj}
/>
</TableData>
</TableRow>
);
Expand Down

0 comments on commit e3c4fc1

Please sign in to comment.