Skip to content

Commit

Permalink
feat(ui): PR deep links in Promotion steps and in Promotion lists (ak…
Browse files Browse the repository at this point in the history
…uity#3129)

Signed-off-by: Mayursinh Sarvaiya <[email protected]>
Signed-off-by: Diego Caspi <[email protected]>
  • Loading branch information
Marvin9 authored and diegocaspi committed Dec 18, 2024
1 parent e8d6f54 commit e4c3daa
Show file tree
Hide file tree
Showing 20 changed files with 468 additions and 63 deletions.
2 changes: 2 additions & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@eslint/compat": "^1.2.4",
"@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
"@tanstack/react-query-devtools": "^5.62.7",
"@types/git-url-parse": "^9.0.3",
"@types/json-schema": "^7.0.15",
"@types/node": "^22.10.2",
"@types/react": "^18.3.11",
Expand Down Expand Up @@ -72,6 +73,7 @@
"classnames": "^2.5.1",
"dagre": "^0.8.5",
"date-fns": "^4.1.0",
"git-url-parse": "^16.0.0",
"moment": "^2.30.1",
"monaco-editor": "^0.52.2",
"monaco-yaml": "^5.2.3",
Expand Down
59 changes: 59 additions & 0 deletions ui/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions ui/src/features/common/manifest-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export const ManifestPreview = ({
height?: string;
}) => {
const encodedObject = yaml.stringify(object.toJson(), (_, v) => {
if (!v) {
return;
}

if (typeof v === 'string' && v === '') {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/features/promotion-directives/registry/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ export type Runner = {
identifier: string;
// UI helper
// this accepts font-awesome icon
unstable_icons: IconDefinition[];
unstable_icons?: IconDefinition[];
config: JSONSchema7;
};
Original file line number Diff line number Diff line change
@@ -1,29 +1,3 @@
import {
faArrowUp,
faChartLine,
faCheck,
faClock,
faClone,
faCloudUploadAlt,
faCodeBranch,
faCodePullRequest,
faCopy,
faDraftingCompass,
faEdit,
faExchangeAlt,
faFileCode,
faFileEdit,
faFileImage,
faGlobe,
faHammer,
faHeart,
faNetworkWired,
faRedoAlt,
faSyncAlt,
faUpDown,
faUpload,
faWrench
} from '@fortawesome/free-solid-svg-icons';
import { JSONSchema7 } from 'json-schema';

// IMPORTANT(Marvin9): this must be replaced with proper discovery mechanism
Expand Down Expand Up @@ -53,82 +27,66 @@ export const useDiscoverPromotionDirectivesRegistries = (): PromotionDirectivesR
runners: [
{
identifier: 'argocd-update',
unstable_icons: [faUpDown, faHeart],
config: argocdUpdateConfig as JSONSchema7
},
{
identifier: 'copy',
unstable_icons: [faCopy],
config: copyConfig as JSONSchema7
},
{
identifier: 'git-clone',
unstable_icons: [faCodeBranch, faClone],
config: gitCloneConfig as JSONSchema7
},
{
identifier: 'git-push',
unstable_icons: [faArrowUp, faCloudUploadAlt, faUpload],
config: gitPushConfig as JSONSchema7
},
{
identifier: 'git-commit',
unstable_icons: [faCheck, faCodeBranch],
config: gitCommitConfig as unknown as JSONSchema7
},
{
identifier: 'git-open-pr',
unstable_icons: [faCodePullRequest, faFileCode],
config: gitOpenPR as unknown as JSONSchema7
},
{
identifier: 'git-wait-for-pr',
unstable_icons: [faClock, faCodePullRequest],
config: gitWaitForPR as unknown as JSONSchema7
},
{
identifier: 'yaml-update',
config: yamlUpdateConfig as unknown as JSONSchema7,
unstable_icons: [faFileCode, faSyncAlt, faEdit]
config: yamlUpdateConfig as unknown as JSONSchema7
},
{
identifier: 'git-push',
unstable_icons: [faArrowUp, faCloudUploadAlt],
config: gitPushConfig as unknown as JSONSchema7
},
{
identifier: 'git-clear',
unstable_icons: [faRedoAlt, faCodeBranch],
config: gitOverwriteConfig as JSONSchema7
},
{
identifier: 'helm-update-chart',
unstable_icons: [faSyncAlt, faChartLine],
config: helmUpdateChartConfig as JSONSchema7
},
{
identifier: 'helm-update-image',
unstable_icons: [faSyncAlt, faFileImage],
config: helmUpdateImageConfig as JSONSchema7
},
{
identifier: 'helm-template',
unstable_icons: [faFileCode, faDraftingCompass],
config: helmTemplateConfig as JSONSchema7
},
{
identifier: 'kustomize-build',
unstable_icons: [faWrench, faHammer],
config: kustomizeBuildConfig as JSONSchema7
},
{
identifier: 'kustomize-set-image',
unstable_icons: [faFileImage, faFileEdit],
config: kustomizeSetImageConfig as JSONSchema7
},
{
identifier: 'http',
unstable_icons: [faGlobe, faNetworkWired, faExchangeAlt],
config: httpConfig as JSONSchema7
}
]
Expand Down
4 changes: 3 additions & 1 deletion ui/src/features/stage/create-stage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { FieldContainer } from '@ui/features/common/form/field-container';
import schema from '@ui/gen/schema/stages.kargo.akuity.io_v1alpha1.json';
import { createResource } from '@ui/gen/service/v1alpha1/service-KargoService_connectquery';
import { PromotionStep, Stage } from '@ui/gen/v1alpha1/generated_pb';
import { cleanEmptyObjectValues } from '@ui/utils/helpers';
import { zodValidators } from '@ui/utils/validators';

import { getStageYAMLExample } from '../project/pipelines/utils/stage-yaml-example';
Expand Down Expand Up @@ -67,7 +68,8 @@ const stageFormToYAML = (
spec: {
requestedFreight: data.requestedFreight,
...(promotionTemplateSteps?.length > 0 && {
promotionTemplate: { spec: { steps: promotionTemplateSteps } }
// IMPORTANT TO CLEANUP EMPTY VALUES OR UNEXPECTED CONFIG FOR PROMOTION STEP WOULD HAPPEN
promotionTemplate: { spec: cleanEmptyObjectValues({ steps: promotionTemplateSteps }) }
})
}
});
Expand Down
Loading

0 comments on commit e4c3daa

Please sign in to comment.