Skip to content

Commit

Permalink
remove isInvokedFromAppsPath from utils
Browse files Browse the repository at this point in the history
Signed-off-by: reggie <[email protected]>
  • Loading branch information
reggie-k committed Mar 14, 2024
1 parent 1be8d65 commit 5ddf36e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 0 additions & 6 deletions ui/src/app/applications/components/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1299,12 +1299,6 @@ export function isApp(abstractApp: appModels.AbstractApplication): abstractApp i
return abstractApp.kind === 'Application';
}

// Currently used for view-preferences-service only.
// TODO: GET RID OF IT (by finding an elegant solution for loading the relevant prefs by using location.pathname).
export function isInvokedFromApps(): boolean {
return true;
}

export function isInvokedFromAppsPath(pathname: string): boolean {
return pathname.includes('applicationsets') ? false : true;
}
Expand Down
9 changes: 7 additions & 2 deletions ui/src/app/shared/services/view-preferences-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as deepMerge from 'deepmerge';
import {BehaviorSubject, Observable} from 'rxjs';

import {PodGroupType} from '../../applications/components/application-pod-view/pod-view';
import {isInvokedFromApps} from '../../applications/components/utils';
import {UserMessages} from '../models';

export type AppsDetailsViewType = 'tree' | 'network' | 'list' | 'pods';
Expand Down Expand Up @@ -154,7 +153,13 @@ const VIEW_PREFERENCES_KEY = 'view_preferences';

const minVer = 5;

const DEFAULT_PREFERENCES: ViewPreferences | AppSetViewPreferences = isInvokedFromApps()
// Default view preferences for apps and for appsets should probably differ, and while constructing them,
// it should allegedly be clear what they are used for (apps or appsets)
// In reality, I didn't see any behavior difference for initializing the default preferences with any of them.
// So this is here to indicate that if a use case, in which the behaviour WOULD be different, would be found,
// isForApps would need to be calculated and then the separation is already in place.
const isForApps = true;
const DEFAULT_PREFERENCES: ViewPreferences | AppSetViewPreferences = isForApps
? {
version: 1,
appDetails: {
Expand Down

0 comments on commit 5ddf36e

Please sign in to comment.