Skip to content

Commit

Permalink
Resolved the nit's
Browse files Browse the repository at this point in the history
  • Loading branch information
lokanandaprabhu committed Oct 14, 2022
1 parent a529ea8 commit 0fa6ab9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
33 changes: 16 additions & 17 deletions frontend/packages/dev-console/src/actions/providers.ts
Expand Up @@ -26,6 +26,9 @@ import {
FLAG_DEVELOPER_CATALOG,
FLAG_OPERATOR_BACKED_SERVICE_CATALOG_TYPE,
FLAG_SAMPLE_CATALOG_TYPE,
OPERATOR_BACKED_SERVICE_CATALOG_TYPE_ID,
SAMPLE_CATALOG_TYPE_ID,
ADD_TO_PROJECT,
} from '../const';
import { isCatalogTypeEnabled, useIsDeveloperCatalogEnabled } from '../utils/catalog-utils';
import { AddActions, disabledActionsFilter } from './add-resources';
Expand Down Expand Up @@ -73,9 +76,9 @@ export const useDeveloperCatalogProvider = (setFeatureFlag: SetFeatureFlag) => {
setFeatureFlag(FLAG_DEVELOPER_CATALOG, useIsDeveloperCatalogEnabled());
setFeatureFlag(
FLAG_OPERATOR_BACKED_SERVICE_CATALOG_TYPE,
isCatalogTypeEnabled('OperatorBackedService'),
isCatalogTypeEnabled(OPERATOR_BACKED_SERVICE_CATALOG_TYPE_ID),
);
setFeatureFlag(FLAG_SAMPLE_CATALOG_TYPE, isCatalogTypeEnabled('sample'));
setFeatureFlag(FLAG_SAMPLE_CATALOG_TYPE, isCatalogTypeEnabled(SAMPLE_CATALOG_TYPE_ID));
};

export const useTopologyGraphActionProvider: TopologyActionProvider = ({
Expand Down Expand Up @@ -104,8 +107,10 @@ export const useTopologyGraphActionProvider: TopologyActionProvider = ({
serviceAccess;
const isCatalogImageResourceAccess = isImportResourceAccess && imageStreamImportAccess;
const isDevCatalogEnabled = useIsDeveloperCatalogEnabled();
const isOperatorBackedServiceEnabled = isCatalogTypeEnabled('OperatorBackedService');
const isSampleTypeEnabled = isCatalogTypeEnabled('Sample');
const isOperatorBackedServiceEnabled = isCatalogTypeEnabled(
OPERATOR_BACKED_SERVICE_CATALOG_TYPE_ID,
);
const isSampleTypeEnabled = isCatalogTypeEnabled(SAMPLE_CATALOG_TYPE_ID);

return React.useMemo(() => {
const sourceObj = connectorSource?.getData()?.resource;
Expand Down Expand Up @@ -155,35 +160,29 @@ export const useTopologyGraphActionProvider: TopologyActionProvider = ({
namespace,
undefined,
undefined,
'add-to-project',
ADD_TO_PROJECT,
!isImportResourceAccess,
),
);
}
actionsWithoutSourceRef.push(
AddActions.FromGit(
namespace,
undefined,
undefined,
'add-to-project',
!isImportResourceAccess,
),
AddActions.FromGit(namespace, undefined, undefined, ADD_TO_PROJECT, !isImportResourceAccess),
);
actionsWithoutSourceRef.push(
AddActions.ContainerImage(
namespace,
undefined,
undefined,
'add-to-project',
ADD_TO_PROJECT,
!isCatalogImageResourceAccess,
),
);
if (isDevCatalogEnabled) {
actionsWithoutSourceRef.push(
AddActions.DevCatalog(namespace, undefined, undefined, 'add-to-project', undefined),
AddActions.DevCatalog(namespace, undefined, undefined, ADD_TO_PROJECT, undefined),
);
actionsWithoutSourceRef.push(
AddActions.DatabaseCatalog(namespace, undefined, undefined, 'add-to-project', undefined),
AddActions.DatabaseCatalog(namespace, undefined, undefined, ADD_TO_PROJECT, undefined),
);
}
if (isOperatorBackedServiceEnabled) {
Expand All @@ -192,7 +191,7 @@ export const useTopologyGraphActionProvider: TopologyActionProvider = ({
namespace,
undefined,
undefined,
'add-to-project',
ADD_TO_PROJECT,
undefined,
undefined,
),
Expand All @@ -203,7 +202,7 @@ export const useTopologyGraphActionProvider: TopologyActionProvider = ({
namespace,
undefined,
undefined,
'add-to-project',
ADD_TO_PROJECT,
!isCatalogImageResourceAccess,
),
);
Expand Down
3 changes: 3 additions & 0 deletions frontend/packages/dev-console/src/const.ts
Expand Up @@ -29,3 +29,6 @@ export const INSTANCE_LABEL = 'app.kubernetes.io/instance';
export const FLAG_DEVELOPER_CATALOG = 'DEVELOPER_CATALOG';
export const FLAG_OPERATOR_BACKED_SERVICE_CATALOG_TYPE = 'OPERATOR_BACKED_SERVICE_CATALOG_TYPE';
export const FLAG_SAMPLE_CATALOG_TYPE = 'SAMPLE_CATALOG_TYPE';
export const OPERATOR_BACKED_SERVICE_CATALOG_TYPE_ID = 'OperatorBackedService';
export const SAMPLE_CATALOG_TYPE_ID = 'Sample';
export const ADD_TO_PROJECT = 'add-to-project';

0 comments on commit 0fa6ab9

Please sign in to comment.