Skip to content

Commit

Permalink
fix: disable rollback button for apps with multiple sources (argoproj…
Browse files Browse the repository at this point in the history
…#11785)

* disble rollback button for apps with multiple sources

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* fix lint errors

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* disble rollback button for apps with multiple sources

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>
Signed-off-by: emirot <emirot.nolan@gmail.com>
  • Loading branch information
ishitasequeira authored and emirot committed Jan 27, 2023
1 parent 6565910 commit 47800c0
Showing 1 changed file with 15 additions and 5 deletions.
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

0 comments on commit 47800c0

Please sign in to comment.