Skip to content

Commit

Permalink
Merge pull request #5170 from rohitkrai03/app-selector-fix
Browse files Browse the repository at this point in the history
Bug 1827291: Fix bad websocket url error due to fetching of resourcea when not required
  • Loading branch information
openshift-merge-robot committed Apr 23, 2020
2 parents 3cbd690 + 61c5c5a commit f935899
Showing 1 changed file with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,14 @@ interface DispatchProps {
type Props = ApplicationSelectorProps & StateProps & DispatchProps;

const ApplicationSelector: React.FC<Props> = ({ namespace, application, onChange, disabled }) => {
if (namespace === ALL_NAMESPACES_KEY) return null;

const allApplicationsTitle = 'all applications';
const title: string = application === ALL_APPLICATIONS_KEY ? allApplicationsTitle : application;

const onApplicationChange = (newApplication: string, key: string) => {
key === ALL_APPLICATIONS_KEY ? onChange(key) : onChange(newApplication);
};
const allApplicationsTitle = 'all applications';

const allNamespaces = namespace === ALL_NAMESPACES_KEY;

let title: string = application;
if (allNamespaces) {
title = 'No applications';
} else if (title === ALL_APPLICATIONS_KEY) {
title = allApplicationsTitle;
}

return (
<ApplicationDropdown
Expand All @@ -55,7 +50,7 @@ const ApplicationSelector: React.FC<Props> = ({ namespace, application, onChange
selectedKey={application || ALL_APPLICATIONS_KEY}
onChange={onApplicationChange}
storageKey={APPLICATION_LOCAL_STORAGE_KEY}
disabled={disabled || allNamespaces}
disabled={disabled}
/>
);
};
Expand Down

0 comments on commit f935899

Please sign in to comment.