-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Separates data into static,dynamic on stage,cdpipeline pages (#40)
Jira: EPMDEDP-12606 Related: #40 Change-Id: I66f45624e7c169cc45c97e73b165b4b88368e090
- Loading branch information
1 parent
7fe1e7f
commit 73d90cb
Showing
36 changed files
with
160 additions
and
177 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
src/pages/edp-cdpipeline-details/components/CDPipelineApplicationsTable/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
src/pages/edp-cdpipeline-details/providers/CDPipeline/context.ts
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
src/pages/edp-cdpipeline-details/providers/CDPipeline/hooks.ts
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
src/pages/edp-cdpipeline-details/providers/CDPipeline/provider.tsx
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
src/pages/edp-cdpipeline-details/providers/CDPipeline/types.ts
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
src/pages/edp-cdpipeline-details/providers/CDPipelineStages/context.ts
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
src/pages/edp-cdpipeline-details/providers/CDPipelineStages/hooks.ts
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
src/pages/edp-cdpipeline-details/providers/CDPipelineStages/provider.tsx
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
src/pages/edp-cdpipeline-details/providers/CDPipelineStages/types.ts
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
src/pages/edp-cdpipeline-details/providers/DynamicData/context.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import React from 'react'; | ||
import { DynamicDataContextProviderValue } from './types'; | ||
|
||
export const DynamicDataContext = React.createContext<DynamicDataContextProviderValue>({ | ||
stages: null, | ||
CDPipeline: null, | ||
enrichedApplications: null, | ||
}); |
4 changes: 4 additions & 0 deletions
4
src/pages/edp-cdpipeline-details/providers/DynamicData/hooks.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import React from 'react'; | ||
import { DynamicDataContext } from './context'; | ||
|
||
export const useDynamicDataContext = () => React.useContext(DynamicDataContext); |
53 changes: 53 additions & 0 deletions
53
src/pages/edp-cdpipeline-details/providers/DynamicData/provider.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React from 'react'; | ||
import { useParams } from 'react-router-dom'; | ||
import { useStreamCDPipeline } from '../../../../k8s/EDPCDPipeline/hooks/useStreamCDPipeline'; | ||
import { useStreamStagesByCDPipelineName } from '../../../../k8s/EDPCDPipelineStage/hooks/useStreamStagesByCDPipelineName'; | ||
import { useEnrichedApplicationsWithImageStreamsQuery } from '../../../../k8s/EDPCodebase/hooks/useEnrichedApplicationsWithImageStreamsQuery'; | ||
import { EDPCDPipelineRouteParams } from '../../types'; | ||
import { DynamicDataContext } from './context'; | ||
|
||
export const DynamicDataContextProvider: React.FC = ({ children }) => { | ||
const { namespace, name } = useParams<EDPCDPipelineRouteParams>(); | ||
|
||
const CDPipeline = useStreamCDPipeline({ | ||
namespace, | ||
CDPipelineMetadataName: name, | ||
}); | ||
|
||
const { | ||
isLoading: isEnrichedApplicationsWithImageStreamsQueryLoading, | ||
data: enrichedApplications, | ||
} = useEnrichedApplicationsWithImageStreamsQuery({ | ||
props: { | ||
CDPipelineData: CDPipeline, | ||
}, | ||
}); | ||
|
||
const enrichedApplicationsValue = React.useMemo( | ||
() => !isEnrichedApplicationsWithImageStreamsQueryLoading && enrichedApplications, | ||
[enrichedApplications, isEnrichedApplicationsWithImageStreamsQueryLoading] | ||
); | ||
|
||
const stages = useStreamStagesByCDPipelineName({ | ||
namespace, | ||
CDPipelineMetadataName: name, | ||
select: React.useCallback(data => { | ||
return data.sort((a, b) => a.spec.order - b.spec.order); | ||
}, []), | ||
}); | ||
|
||
const DataContextValue = React.useMemo( | ||
() => ({ | ||
CDPipeline, | ||
stages, | ||
enrichedApplications: enrichedApplicationsValue, | ||
}), | ||
[CDPipeline, stages, enrichedApplicationsValue] | ||
); | ||
|
||
return ( | ||
<DynamicDataContext.Provider value={DataContextValue}> | ||
{children} | ||
</DynamicDataContext.Provider> | ||
); | ||
}; |
9 changes: 9 additions & 0 deletions
9
src/pages/edp-cdpipeline-details/providers/DynamicData/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { EDPCDPipelineKubeObjectInterface } from '../../../../k8s/EDPCDPipeline/types'; | ||
import { EDPCDPipelineStageKubeObjectInterface } from '../../../../k8s/EDPCDPipelineStage/types'; | ||
import { EnrichedApplicationWithItsImageStreams } from '../../../../k8s/EDPCodebase/hooks/useEnrichedApplicationsWithImageStreamsQuery'; | ||
|
||
export interface DynamicDataContextProviderValue { | ||
CDPipeline: EDPCDPipelineKubeObjectInterface; | ||
stages: EDPCDPipelineStageKubeObjectInterface[]; | ||
enrichedApplications: EnrichedApplicationWithItsImageStreams[]; | ||
} |
7 changes: 0 additions & 7 deletions
7
src/pages/edp-cdpipeline-details/providers/EnrichedApplications/context.ts
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
src/pages/edp-cdpipeline-details/providers/EnrichedApplications/hooks.ts
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
src/pages/edp-cdpipeline-details/providers/EnrichedApplications/provider.tsx
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
src/pages/edp-cdpipeline-details/providers/EnrichedApplications/types.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.