Skip to content

Commit 90806f9

Browse files
committed
Added the env filter on build and deploy and build history
1 parent d72c1a9 commit 90806f9

File tree

7 files changed

+43
-20
lines changed

7 files changed

+43
-20
lines changed

src/components/app/details/cIDetails/CIDetails.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { ScannedByToolModal } from '../../../common/security/ScannedByToolModal'
2626
const terminalStatus = new Set(['succeeded', 'failed', 'error', 'cancelled', 'nottriggered', 'notbuilt'])
2727
let statusSet = new Set(['starting', 'running', 'pending'])
2828

29-
export default function CIDetails({ isJobView }: { isJobView?: boolean }) {
29+
export default function CIDetails({ isJobView, filteredEnvIds }: { isJobView?: boolean, filteredEnvIds?: string }) {
3030
const { appId, pipelineId, buildId } = useParams<{
3131
appId: string
3232
pipelineId: string
@@ -45,11 +45,11 @@ export default function CIDetails({ isJobView }: { isJobView?: boolean }) {
4545
const [initDataLoading, initDataResults] = useAsync(
4646
() =>
4747
Promise.allSettled([
48-
getCIPipelines(+appId),
48+
getCIPipelines(+appId, filteredEnvIds),
4949
getModuleInfo(ModuleNameMap.SECURITY),
5050
getModuleConfigured(ModuleNameMap.BLOB_STORAGE),
5151
]),
52-
[appId],
52+
[appId, filteredEnvIds],
5353
)
5454
const [loading, triggerHistoryResult, , , , dependencyState] = useAsync(
5555
() => getTriggerHistory(+pipelineId, pagination),

src/components/app/details/main.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ export default function AppDetailsPage({ isV2 }: AppDetailsProps) {
219219
<Route path={`${path}/${URLS.APP_OVERVIEW}`}>
220220
<Overview appMetaInfo={appMetaInfo} getAppMetaInfoRes={getAppMetaInfoRes} filteredEnvIds={_filteredEnvIds} />
221221
</Route>
222-
<Route path={`${path}/${URLS.APP_TRIGGER}`} render={(props) => <TriggerView />} />
222+
<Route path={`${path}/${URLS.APP_TRIGGER}`} render={(props) => <TriggerView filteredEnvIds={_filteredEnvIds}/>} />
223223
<Route path={`${path}/${URLS.APP_CI_DETAILS}/:pipelineId(\\d+)?/:buildId(\\d+)?`}>
224-
<CIDetails key={appId} />
224+
<CIDetails key={appId} filteredEnvIds={_filteredEnvIds} />
225225
</Route>
226226
<Route
227227
path={`${path}/${URLS.APP_DEPLOYMENT_METRICS}/:envId(\\d+)?`}

src/components/app/details/triggerView/TriggerView.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class TriggerView extends Component<TriggerViewProps, TriggerViewState> {
161161
}
162162

163163
getWorkflows = (isFromOnMount?: boolean) => {
164-
getTriggerWorkflows(this.props.match.params.appId, !this.props.isJobView, this.props.isJobView)
164+
getTriggerWorkflows(this.props.match.params.appId, !this.props.isJobView, this.props.isJobView, this.props.filteredEnvIds)
165165
.then((result) => {
166166
const _filteredCIPipelines = result.filteredCIPipelines || []
167167
const wf = result.workflows || []
@@ -214,7 +214,10 @@ class TriggerView extends Component<TriggerViewProps, TriggerViewState> {
214214
}
215215

216216
componentDidUpdate(prevProps) {
217-
if (this.props.match.params.appId !== prevProps.match.params.appId) {
217+
if (
218+
this.props.match.params.appId !== prevProps.match.params.appId ||
219+
prevProps.filteredEnvIds !== this.props.filteredEnvIds
220+
) {
218221
this.setState({
219222
showCIModal: false,
220223
showMaterialRegexModal: false,

src/components/app/details/triggerView/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ export interface TriggerViewProps extends RouteComponentProps<{
287287
envId: string
288288
}> {
289289
isJobView?: boolean
290+
filteredEnvIds?: string
290291
}
291292

292293
export interface WorkflowType {
@@ -544,7 +545,7 @@ export interface CDStageConfigMapSecretNames {
544545
secrets: any[]
545546
}
546547

547-
export interface PrePostDeployStageType {
548+
export interface PrePostDeployStageType {
548549
isValid: boolean;
549550
steps: TaskErrorObj[];
550551
triggerType: string

src/components/app/details/triggerView/workflow.service.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,17 @@ export const getTriggerWorkflows = (
2222
appId,
2323
useAppWfViewAPI: boolean,
2424
isJobView: boolean,
25+
filteredEnvIds?: string
2526
): Promise<{ appName: string; workflows: WorkflowType[]; filteredCIPipelines }> => {
26-
return getInitialWorkflows(appId, WorkflowTrigger, WorkflowTrigger.workflow, useAppWfViewAPI, isJobView)
27+
return getInitialWorkflows(appId, WorkflowTrigger, WorkflowTrigger.workflow, useAppWfViewAPI, isJobView, filteredEnvIds)
2728
}
2829

2930
export const getCreateWorkflows = (
3031
appId,
3132
isJobView: boolean,
33+
filteredEnvIds?: string
3234
): Promise<{ appName: string; workflows: WorkflowType[], filteredCIPipelines }> => {
33-
return getInitialWorkflows(appId, WorkflowCreate, WorkflowCreate.workflow, false, isJobView)
35+
return getInitialWorkflows(appId, WorkflowCreate, WorkflowCreate.workflow, false, isJobView, filteredEnvIds)
3436
}
3537

3638
const getInitialWorkflows = (
@@ -39,9 +41,14 @@ const getInitialWorkflows = (
3941
workflowOffset: Offset,
4042
useAppWfViewAPI?: boolean,
4143
isJobView?: boolean,
44+
filteredEnvIds?: string
4245
): Promise<{ appName: string; workflows: WorkflowType[]; filteredCIPipelines }> => {
46+
let filteredEnvParams = ''
47+
if (filteredEnvIds) {
48+
filteredEnvParams = `?envIds=${filteredEnvIds}`
49+
}
4350
if (useAppWfViewAPI) {
44-
return getWorkflowViewList(id).then((response) => {
51+
return getWorkflowViewList(id, filteredEnvParams).then((response) => {
4552
const workflows = {
4653
appId: id,
4754
workflows: response.result?.workflows as Workflow[],
@@ -63,7 +70,7 @@ const getInitialWorkflows = (
6370
)
6471
})
6572
} else if (isJobView) {
66-
return Promise.all([getWorkflowList(id), getCIConfig(id)]).then(([workflow, ciConfig]) => {
73+
return Promise.all([getWorkflowList(id, filteredEnvParams), getCIConfig(id)]).then(([workflow, ciConfig]) => {
6774
return processWorkflow(
6875
workflow.result as WorkflowResult,
6976
ciConfig.result as CiPipelineResult,

src/components/app/service.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,13 @@ export const getWorkflowStatus = (appId: string) => {
496496
return get(URL)
497497
}
498498

499-
export const getCIPipelines = (appId) => {
500-
let URL = `${Routes.APP}/${appId}/${Routes.APP_CI_PIPELINE}`
501-
return get(URL)
499+
export const getCIPipelines = (appId, filteredEnvIds?: string) => {
500+
let filteredEnvParams = ''
501+
if (filteredEnvIds) {
502+
filteredEnvParams = `?envIds=${filteredEnvIds}`
503+
}
504+
const URL = `${Routes.APP}/${appId}/${Routes.APP_CI_PIPELINE}${filteredEnvParams}`
505+
return get(URL)
502506
}
503507

504508
export function refreshGitMaterial(gitMaterialId: string, abortSignal: AbortSignal) {

src/services/service.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,21 @@ export function getEnvironmentSecrets(appId, envId) {
202202
return get(`${Routes.APP_CREATE_ENV_SECRET}/${appId}/${envId}`)
203203
}
204204

205-
export function getWorkflowList(appId) {
206-
const URL = `${Routes.WORKFLOW}/${appId}`
207-
return get(URL)
205+
export function getWorkflowList(appId, filteredEnvIds?: string) {
206+
let filteredEnvParams = ''
207+
if (filteredEnvIds) {
208+
filteredEnvParams = `?envIds=${filteredEnvIds}`
209+
}
210+
const URL = `${Routes.WORKFLOW}/${appId}${filteredEnvParams}`
211+
return get(URL)
208212
}
209213

210-
export function getWorkflowViewList(appId) {
211-
return get(`${Routes.WORKFLOW}/view/${appId}`);
214+
export function getWorkflowViewList(appId, filteredEnvIds?: string) {
215+
let filteredEnvParams = ''
216+
if (filteredEnvIds) {
217+
filteredEnvParams = `?envIds=${filteredEnvIds}`
218+
}
219+
return get(`${Routes.WORKFLOW}/view/${appId}${filteredEnvParams}`)
212220
}
213221

214222
export function stopStartApp(AppId, EnvironmentId, RequestType) {

0 commit comments

Comments
 (0)