Skip to content

Commit

Permalink
Autofill devfile project name into the webview text field
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonlhart committed Dec 3, 2024
1 parent d5a306f commit 0d5bd1f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/features/contentCreator/createDevfilePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ export class CreateDevfile {
const nonce = getNonce();

const workspaceDir = this.getWorkspaceFolder();
let projectName = "";

if (workspaceDir !== "") {
const projectNameSplit = workspaceDir.split("/");
projectName = projectNameSplit[projectNameSplit.length - 1];
}

const webviewUri = getUri(webview, extensionUri, [
"out",
Expand Down Expand Up @@ -132,7 +138,7 @@ export class CreateDevfile {
</vscode-text-field>
<div class="devfile-name-div">
<vscode-text-field id="devfile-name" form="devfile-form" placeholder="Enter Ansible project name" size="512">Ansible project name *</vscode-text-field>
<vscode-text-field id="devfile-name" form="devfile-form" placeholder="${projectName}" size="512">Ansible project name *</vscode-text-field>
</div>
<div id="full-devfile-path" class="full-devfile-path">
Expand Down
2 changes: 2 additions & 0 deletions src/webview/apps/contentCreator/createDevfilePageApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ function main() {

destinationPathUrlTextField.value = destinationPathUrlTextField.placeholder;

devfileNameTextField.value = devfileNameTextField.placeholder;

devfilePathDiv?.appendChild(devfilePathElement);
}

Expand Down

0 comments on commit 0d5bd1f

Please sign in to comment.