Skip to content

Commit

Permalink
fix: Fix image tags real-time updating (#25)
Browse files Browse the repository at this point in the history
Jira: EPMDEDP-12483
Resolves: #25
Change-Id: I557906e0e66c457e29f82c52a9a354d157f40b92
  • Loading branch information
callmevladik committed Aug 21, 2023
1 parent be0f77e commit 4fe6017
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { UseQueryOptions } from 'react-query';
import { CODEBASE_TYPES } from '../../../constants/codebaseTypes';
import { KubeObjectListInterface } from '../../../types/k8s';
import { EDPCDPipelineKubeObjectInterface } from '../../EDPCDPipeline/types';
import { useCodebaseImageStreamListQuery } from '../../EDPCodebaseImageStream/hooks/useCodebaseImageStreamListQuery';
import { EDPCodebaseImageStreamKubeObject } from '../../EDPCodebaseImageStream';
import { EDPCodebaseImageStreamKubeObjectInterface } from '../../EDPCodebaseImageStream/types';
import { EDPCodebaseKubeObjectInterface } from '../types';
import { useCodebasesByTypeLabelQuery } from './useCodebasesByTypeLabelQuery';
Expand Down Expand Up @@ -47,13 +47,8 @@ export const useEnrichedApplicationsWithImageStreamsQuery = ({
[normalizedInputDockerStreamNames]
);

const { data: codebaseImageStreams } = useCodebaseImageStreamListQuery({
props: {
namespace: CDPipelineData?.metadata.namespace,
},
options: {
enabled: !!CDPipelineData?.metadata.namespace,
},
const [codebaseImageStreams] = EDPCodebaseImageStreamKubeObject.useList({
namespace: CDPipelineData?.metadata.namespace,
});

return useCodebasesByTypeLabelQuery<EnrichedApplicationWithItsImageStreams[]>({
Expand All @@ -63,6 +58,7 @@ export const useEnrichedApplicationsWithImageStreamsQuery = ({
},
options: {
enabled: !!codebaseImageStreams,
cacheTime: 0,
select: data => {
return data?.items
.map(el => {
Expand All @@ -74,10 +70,9 @@ export const useEnrichedApplicationsWithImageStreamsQuery = ({
return;
}

const codebaseImageStreamsByCodebaseName =
codebaseImageStreams?.items.filter(
({ spec: { codebase } }) => codebase === name
);
const codebaseImageStreamsByCodebaseName = codebaseImageStreams?.filter(
({ spec: { codebase } }) => codebase === name
);

const applicationImageStream =
codebaseImageStreamsByCodebaseName &&
Expand Down
2 changes: 0 additions & 2 deletions src/providers/ViewMode/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ export const ViewModeContextProvider: React.FC<ViewModeContextProviderProps> = (
VIEW_MODES.TABLE
);

console.log(viewMode);

const handleChangeViewMode = React.useCallback(
(viewMode: ViewMode) => {
LOCAL_STORAGE_SERVICE.setItem(`VIEW_MODE::${entityID}`, viewMode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ export const ApplicationRow = ({ application }: ApplicationRowProps) => {
handleChangeApplicationToPromote({ name, value }),
}
)}
defaultValue={CDPipelineData?.spec.applicationsToPromote.includes(appName)}
defaultValue={CDPipelineData?.spec?.applicationsToPromote?.includes(
appName
)}
label={<FormControlLabelWithTooltip label={'Promote in pipeline'} />}
control={control}
errors={errors}
Expand Down
4 changes: 0 additions & 4 deletions src/widgets/DeleteKubeObject/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ export const DeleteKubeObject = () => {
DELETE_KUBE_OBJECT_DIALOG_NAME
);

console.log(isDetailsPage);

const [errorTemplate, setErrorTemplate] = React.useState<React.ReactNode | string>(null);
const [loadingActive, setLoadingActive] = React.useState<boolean>(false);
const { register, handleSubmit, watch, reset } = useForm();
Expand Down Expand Up @@ -80,8 +78,6 @@ export const DeleteKubeObject = () => {
});
reset();

console.log(isDetailsPage);

if (isDetailsPage) {
history.goBack();
}
Expand Down

0 comments on commit 4fe6017

Please sign in to comment.