Skip to content

Commit

Permalink
Update YAML editor to provide default content
Browse files Browse the repository at this point in the history
If the user switches to YAML mode in the Create PipelineRun page we
should not present them with an empty editor. At the very least we
should pre-populate it with the basic outline of a PipelineRun, i.e.
`apiVersion`, `kind`, `metadata` with default name + namespace
placeholder, `spec`.

If the user has already updated the form before switching to YAML
mode, preserve their selected inputs and display the corresponding
YAML so they can continue editing as needed.

Remove unused code from the YAML editor related to loading of the
Pipeline resource.
AlanGreene authored and tekton-robot committed Dec 12, 2022
1 parent 83c3a7c commit e58b8cd
Showing 6 changed files with 162 additions and 171 deletions.
183 changes: 58 additions & 125 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@
"carbon-icons": "^7.0.7",
"core-js": "^3.26.1",
"git-url-parse": "^13.1.0",
"js-yaml": "^4.1.0",
"lodash.clonedeep": "^4.5.0",
"lodash.keyby": "^4.6.0",
"prop-types": "^15.7.2",
2 changes: 2 additions & 0 deletions packages/e2e/cypress/e2e/run/create-pipelinerun.cy.js
Original file line number Diff line number Diff line change
@@ -97,6 +97,7 @@ spec:
cy.contains('button', 'YAML Mode').click();
cy.url().should('include', 'mode=yaml');

cy.get('.cm-content').clear();
cy.get('.cm-content').type(preserveIndentation(pipelineRun));

cy.contains('button', 'Create').click();
@@ -131,6 +132,7 @@ spec:
`;
cy.visit(`/#/pipelineruns/create?mode=yaml`);

cy.get('.cm-content').clear();
cy.get('.cm-content').type(preserveIndentation(pipelineRun));

cy.contains('button', 'Create').click();
Loading

0 comments on commit e58b8cd

Please sign in to comment.