Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ const menuActions = [
label: 'Remove Subscription...',
callback: () => createDisableApplicationModal({k8sKill, k8sGet, k8sPatch, subscription: obj}),
}),
(kind, obj) => ({
label: `View ${ClusterServiceVersionModel.kind}...`,
href: `/k8s/ns/${obj.metadata.namespace}/${ClusterServiceVersionModel.plural}/${_.get(obj.status, 'installedCSV')}`,
}),
(kind, obj) => {
const installedCSV = _.get(obj, 'status.installedCSV');
return {
label: `View ${ClusterServiceVersionModel.kind}...`,
href: `/k8s/ns/${obj.metadata.namespace}/${ClusterServiceVersionModel.plural}/${installedCSV}`,
hidden: !installedCSV,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, I didn't realize we had a hidden argument for kebab actions.

};
},
];

export const SubscriptionRow: React.SFC<SubscriptionRowProps> = (props) => {
Expand All @@ -62,7 +66,7 @@ export const SubscriptionRow: React.SFC<SubscriptionRowProps> = (props) => {
{props.obj.spec.installPlanApproval || 'Automatic'}
</div>
<div className="dropdown-kebab-pf">
<ResourceKebab actions={_.get(props.obj.status, 'installedCSV') ? menuActions : menuActions.slice(0, -1)} kind={referenceForModel(SubscriptionModel)} resource={props.obj} />
<ResourceKebab actions={menuActions} kind={referenceForModel(SubscriptionModel)} resource={props.obj} />
</div>
</div>;
};
Expand Down
2 changes: 1 addition & 1 deletion frontend/public/components/utils/dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ Dropdown.propTypes = {

export const ActionsMenu = (props) => {
const {actions, title = undefined, menuClassName = undefined, buttonClassName = undefined} = props;
const shownActions = _.reject(actions, o => _.get(o, 'hidden', false));
const shownActions = _.reject(actions, 'hidden');
const items = _.fromPairs(_.map(shownActions, (v, k) => [k, v.label]));
const btnTitle = title || <span id="action-dropdown">Actions</span>;
const onChange = (key, e) => {
Expand Down
3 changes: 2 additions & 1 deletion frontend/public/components/utils/kebab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ export const ResourceKebab = connectToModel((props: ResourceKebabProps) => {
if (!kindObj) {
return null;
}
const options = _.reject(actions.map(a => a(kindObj, resource)), 'hidden');
return <Kebab
options={actions.map(a => a(kindObj, resource))}
options={options}
key={resource.metadata.uid}
isDisabled={isDisabled !== undefined ? isDisabled : _.get(resource.metadata, 'deletionTimestamp')}
/>;
Expand Down