Skip to content

Commit

Permalink
feat: [CI-3426]: STO Step UI (#6661)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-harness authored Mar 1, 2022
1 parent fff8e91 commit da1ca10
Show file tree
Hide file tree
Showing 48 changed files with 5,535 additions and 34 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ BASE_URL=https://qb.harness.io/gateway
TARGET_LOCALHOST=false
ENABLE_GITOPSUI=false
ENABLE_GOVERNANCE=false
ENABLE_STO=false
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"generate-microfrontend-types": "rm -rf src/microfrontends/dist && webpack --config src/microfrontends/webpack.config.js",
"publish-types": "yarn generate-microfrontend-types; yarn publish src/microfrontends;",
"generate-certificate": "sh scripts/generate-certificate.sh",
"generate-eslint": "node scripts/generate-eslint-config-for-imports.mjs",
"build-docker": "sh scripts/docker-build.sh",
"lighthouse": "node scripts/lighthouse/lighthouse.js",
"custom-coverage": "npx new-files-coverage-check --e !**/*.test.tsx !**/*.test.ts !**/*.snap !**/*.js !**/*.scss !**/*.mock.ts !**/*.spec.ts !**/*.d.ts !**/*.json !**/*.types.ts !**/*.yml !**/*.yaml !**cypress/** !**cypress/** !**/__test*/** !**/*.png !**/*.svg"
Expand Down
1 change: 1 addition & 0 deletions scripts/strings/yamlStringsCheck.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ for (const [i, layer] of moduleLayers.entries()) {
const restrictedModules = _.flatten(moduleLayers.slice(i))
.map(mod => mod.moduleRef)
.filter(mod => mod !== moduleRef)
.map(mod => `${mod}.`)

values[moduleRef] = parsedContent
validateStrings(parsedContent, [moduleRef], restrictedModules)
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
sonar.projectKey=nextgenui
sonar.sources=src
sonar.exclusions=src/_stories/**,src/services/**
sonar.exclusions=src/_stories/**,src/services/**,src/**/*.stories.tsx*
sonar.tests=src
sonar.test.inclusions=src/**/*.test.tsx*,src/**/*.test.ts*,src/**/__tests__/**

4 changes: 3 additions & 1 deletion src/framework/strings/languageLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import ce from '@ce/strings/strings.en.yaml'
import cf from '@cf/strings/strings.en.yaml'
import ci from '@ci/strings/strings.en.yaml'
import cv from '@cv/strings/strings.en.yaml'
import stoSteps from '@sto-steps/strings/strings.en.yaml'

export default function languageLoader() {
return {
Expand All @@ -56,6 +57,7 @@ export default function languageLoader() {
ce,
cf,
ci,
cv
cv,
stoSteps
}
}
2 changes: 2 additions & 0 deletions src/modules/10-common/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ rules:
- modules/75-cf/*
- modules/75-ci/*
- modules/85-cv/*
- modules/85-sto-steps/*
- '@notifications/*'
- '@audit-trail/*'
- '@rbac/*'
Expand All @@ -46,6 +47,7 @@ rules:
- '@cf/*'
- '@ci/*'
- '@cv/*'
- '@sto-steps/*'
paths:
- lodash
- name: yaml
Expand Down
2 changes: 2 additions & 0 deletions src/modules/15-notifications/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ rules:
- modules/75-cf/*
- modules/75-ci/*
- modules/85-cv/*
- modules/85-sto-steps/*
- '@audit-trail/*'
- '@rbac/*'
- '@governance/*'
Expand All @@ -44,6 +45,7 @@ rules:
- '@cf/*'
- '@ci/*'
- '@cv/*'
- '@sto-steps/*'
paths:
- lodash
- name: yaml
Expand Down
2 changes: 2 additions & 0 deletions src/modules/18-audit-trail/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ rules:
- modules/75-cf/*
- modules/75-ci/*
- modules/85-cv/*
- modules/85-sto-steps/*
- '@rbac/*'
- '@governance/*'
- '@sto/*'
Expand All @@ -42,6 +43,7 @@ rules:
- '@cf/*'
- '@ci/*'
- '@cv/*'
- '@sto-steps/*'
paths:
- lodash
- name: yaml
Expand Down
2 changes: 2 additions & 0 deletions src/modules/20-rbac/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ rules:
- modules/75-cf/*
- modules/75-ci/*
- modules/85-cv/*
- modules/85-sto-steps/*
- '@governance/*'
- '@sto/*'
- '@delegates/*'
Expand All @@ -40,6 +41,7 @@ rules:
- '@cf/*'
- '@ci/*'
- '@cv/*'
- '@sto-steps/*'
paths:
- lodash
- name: yaml
Expand Down
2 changes: 2 additions & 0 deletions src/modules/25-governance/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ rules:
- modules/75-cf/*
- modules/75-ci/*
- modules/85-cv/*
- modules/85-sto-steps/*
- '@sto/*'
- '@delegates/*'
- '@secrets/*'
Expand All @@ -38,6 +39,7 @@ rules:
- '@cf/*'
- '@ci/*'
- '@cv/*'
- '@sto-steps/*'
paths:
- lodash
- name: yaml
Expand Down
2 changes: 2 additions & 0 deletions src/modules/27-sto/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ rules:
- modules/75-cf/*
- modules/75-ci/*
- modules/85-cv/*
- modules/85-sto-steps/*
- '@delegates/*'
- '@secrets/*'
- '@auth-settings/*'
Expand All @@ -36,6 +37,7 @@ rules:
- '@cf/*'
- '@ci/*'
- '@cv/*'
- '@sto-steps/*'
paths:
- lodash
- name: yaml
Expand Down
3 changes: 1 addition & 2 deletions src/modules/27-sto/PipelineSecurityView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import React from 'react'
import { RemotePipelineSecurityView, STORemoteComponentMounter } from './STOApp'

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const PipelineSecurityView: React.FC<Record<string, any>> = props => (
export const PipelineSecurityView: React.FC<Record<string, unknown>> = props => (
<STORemoteComponentMounter component={<RemotePipelineSecurityView {...props} />} />
)
2 changes: 2 additions & 0 deletions src/modules/30-delegates/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ rules:
- modules/75-cf/*
- modules/75-ci/*
- modules/85-cv/*
- modules/85-sto-steps/*
- '@secrets/*'
- '@auth-settings/*'
- '@connectors/*'
Expand All @@ -34,6 +35,7 @@ rules:
- '@cf/*'
- '@ci/*'
- '@cv/*'
- '@sto-steps/*'
paths:
- lodash
- name: yaml
Expand Down
2 changes: 2 additions & 0 deletions src/modules/30-secrets/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ rules:
- modules/75-cf/*
- modules/75-ci/*
- modules/85-cv/*
- modules/85-sto-steps/*
- '@delegates/*'
- '@auth-settings/*'
- '@connectors/*'
Expand All @@ -34,6 +35,7 @@ rules:
- '@cf/*'
- '@ci/*'
- '@cv/*'
- '@sto-steps/*'
paths:
- lodash
- name: yaml
Expand Down
2 changes: 2 additions & 0 deletions src/modules/33-auth-settings/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ rules:
- modules/75-cf/*
- modules/75-ci/*
- modules/85-cv/*
- modules/85-sto-steps/*
- '@connectors/*'
- '@user-profile/*'
- '@gitsync/*'
Expand All @@ -30,6 +31,7 @@ rules:
- '@cf/*'
- '@ci/*'
- '@cv/*'
- '@sto-steps/*'
paths:
- lodash
- name: yaml
Expand Down
2 changes: 2 additions & 0 deletions src/modules/35-connectors/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ rules:
- modules/75-cf/*
- modules/75-ci/*
- modules/85-cv/*
- modules/85-sto-steps/*
- '@user-profile/*'
- '@gitsync/*'
- '@dashboards/*'
Expand All @@ -28,6 +29,7 @@ rules:
- '@cf/*'
- '@ci/*'
- '@cv/*'
- '@sto-steps/*'
paths:
- lodash
- name: yaml
Expand Down
2 changes: 2 additions & 0 deletions src/modules/35-user-profile/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ rules:
- modules/75-cf/*
- modules/75-ci/*
- modules/85-cv/*
- modules/85-sto-steps/*
- '@connectors/*'
- '@gitsync/*'
- '@dashboards/*'
Expand All @@ -28,6 +29,7 @@ rules:
- '@cf/*'
- '@ci/*'
- '@cv/*'
- '@sto-steps/*'
paths:
- lodash
- name: yaml
Expand Down
2 changes: 2 additions & 0 deletions src/modules/40-gitsync/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ rules:
- modules/75-cf/*
- modules/75-ci/*
- modules/85-cv/*
- modules/85-sto-steps/*
- '@dashboards/*'
- '@projects-orgs/*'
- '@pipeline/*'
Expand All @@ -24,6 +25,7 @@ rules:
- '@cf/*'
- '@ci/*'
- '@cv/*'
- '@sto-steps/*'
paths:
- lodash
- name: yaml
Expand Down
2 changes: 2 additions & 0 deletions src/modules/45-dashboards/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ rules:
- modules/75-cf/*
- modules/75-ci/*
- modules/85-cv/*
- modules/85-sto-steps/*
- '@projects-orgs/*'
- '@pipeline/*'
- '@templates-library/*'
Expand All @@ -22,6 +23,7 @@ rules:
- '@cf/*'
- '@ci/*'
- '@cv/*'
- '@sto-steps/*'
paths:
- lodash
- name: yaml
Expand Down
2 changes: 2 additions & 0 deletions src/modules/45-projects-orgs/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ rules:
- modules/75-cf/*
- modules/75-ci/*
- modules/85-cv/*
- modules/85-sto-steps/*
- '@dashboards/*'
- '@pipeline/*'
- '@templates-library/*'
Expand All @@ -22,6 +23,7 @@ rules:
- '@cf/*'
- '@ci/*'
- '@cv/*'
- '@sto-steps/*'
paths:
- lodash
- name: yaml
Expand Down
2 changes: 2 additions & 0 deletions src/modules/70-pipeline/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ rules:
- modules/75-cf/*
- modules/75-ci/*
- modules/85-cv/*
- modules/85-sto-steps/*
- '@templates-library/*'
- '@triggers/*'
- '@cd/*'
- '@ce/*'
- '@cf/*'
- '@ci/*'
- '@cv/*'
- '@sto-steps/*'
paths:
- lodash
- name: yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ export enum StepType {
KubernetesGcp = 'KubernetesGcp',
ResourceConstraint = 'ResourceConstraint',
FlagConfiguration = 'FlagConfiguration',
Template = 'Template'
Template = 'Template',
ZeroNorth = 'Security'
}
2 changes: 2 additions & 0 deletions src/modules/70-pipeline/components/PipelineStudio/StepUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import { StepType } from '../PipelineSteps/PipelineStepInterface'
import '@cd/components/PipelineSteps'
// eslint-disable-next-line no-restricted-imports
import '@ci/components/PipelineSteps'
// eslint-disable-next-line no-restricted-imports
import '@sto-steps/components/PipelineSteps'
import { StepViewType } from '../AbstractSteps/Step'

export const clearRuntimeInput = (template: PipelineInfoConfig): PipelineInfoConfig => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,26 +140,6 @@ export default function ExecutionTabs(props: React.PropsWithChildren<unknown>):
}
]

if (
(isCD && stoCDPipelineSecurityEnabled) ||
(isCI && stoCIPipelineSecurityEnabled) ||
localStorage.STO_PIPELINE_SECURITY_ENABLED
) {
tabList.push({
id: TAB_ID_MAP.STO_SECURITY,
title: (
<NavLink
to={routes.toExecutionSecurityView(params) + location.search}
className={css.tabLink}
activeClassName={css.activeLink}
>
<Icon name="report-gear-grey" size={16} />
<span>{getString('pipeline.security.title')}</span>
</NavLink>
)
})
}

if (opaBasedGovernanceEnabled) {
tabList.push({
id: TAB_ID_MAP.POLICY_EVALUATIONS,
Expand Down Expand Up @@ -223,6 +203,26 @@ export default function ExecutionTabs(props: React.PropsWithChildren<unknown>):
})
}

if (
(isCD && stoCDPipelineSecurityEnabled) ||
(isCI && stoCIPipelineSecurityEnabled) ||
localStorage.STO_PIPELINE_SECURITY_ENABLED
) {
tabList.push({
id: TAB_ID_MAP.STO_SECURITY,
title: (
<NavLink
to={routes.toExecutionSecurityView(params) + location.search}
className={css.tabLink}
activeClassName={css.activeLink}
>
<Icon name="sto-grey" size={16} />
<span>{getString('pipeline.security.title')}</span>
</NavLink>
)
})
}

return (
<div className={css.main}>
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ export default function ExecutionSecurityView(): React.ReactElement | null {
const { accountId, orgIdentifier, projectIdentifier, pipelineIdentifier, executionIdentifier, module } =
useParams<PipelineType<ExecutionPathProps>>()
const context = useExecutionContext()
const pipelineExecutionSummary = context?.pipelineExecutionDetail?.pipelineExecutionSummary
const pipelineExecutionDetail = context?.pipelineExecutionDetail

if (!pipelineExecutionSummary) {
if (!pipelineExecutionDetail || !pipelineExecutionDetail.pipelineExecutionSummary) {
return null
}

return (
<Container width="100%" height="100%">
<PipelineSecurityView
pipelineExecutionSummary={pipelineExecutionSummary}
pipelineExecutionDetail={pipelineExecutionDetail}
accountId={accountId}
module={module}
orgIdentifier={orgIdentifier}
Expand Down
Loading

0 comments on commit da1ca10

Please sign in to comment.