Skip to content
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

fix: disable rollback button for apps with multiple sources #11785

Merged
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
@@ -1,4 +1,4 @@
import {DropDownMenu, NotificationType, SlidingPanel} from 'argo-ui';
import {DropDownMenu, NotificationType, SlidingPanel, Tooltip} from 'argo-ui';
import * as classNames from 'classnames';
import * as PropTypes from 'prop-types';
import * as React from 'react';
Expand All @@ -24,7 +24,7 @@ import {ResourceDetails} from '../resource-details/resource-details';
import * as AppUtils from '../utils';
import {ApplicationResourceList} from './application-resource-list';
import {Filters, FiltersProps} from './application-resource-filter';
import {getAppDefaultSource, urlPattern} from '../utils';
import {getAppDefaultSource, urlPattern, helpTip} from '../utils';
import {ResourceStatus} from '../../../shared/models';
import {ApplicationsDetailsAppDropdown} from './application-details-app-dropdown';
import {useSidebarTarget} from '../../../sidebar/sidebar';
Expand Down Expand Up @@ -613,6 +613,7 @@ export class ApplicationDetails extends React.Component<RouteComponentProps<{app
const refreshing = app.metadata.annotations && app.metadata.annotations[appModels.AnnotationRefreshKey];
const fullName = AppUtils.nodeKey({group: 'argoproj.io', kind: app.kind, name: app.metadata.name, namespace: app.metadata.namespace});
const ActionMenuItem = (prop: {actionLabel: string}) => <span className={needOverlapLabelOnNarrowScreen ? 'show-for-large' : ''}>{prop.actionLabel}</span>;
const hasMultipleSources = app.spec.sources && app.spec.sources.length > 0;
return [
{
iconClassName: 'fa fa-info-circle',
Expand All @@ -638,9 +639,18 @@ export class ApplicationDetails extends React.Component<RouteComponentProps<{app
},
{
iconClassName: 'fa fa-history',
title: <ActionMenuItem actionLabel='History and rollback' />,
action: () => this.setRollbackPanelVisible(0),
disabled: !app.status.operationState
title: hasMultipleSources ? (
<React.Fragment>
<ActionMenuItem actionLabel=' History and rollback' />
{helpTip('Rollback is not supported for apps with multiple sources')}
</React.Fragment>
) : (
<ActionMenuItem actionLabel='History and rollback' />
),
action: () => {
this.setRollbackPanelVisible(0);
},
disabled: !app.status.operationState || hasMultipleSources
},
{
iconClassName: 'fa fa-times-circle',
Expand Down