Skip to content

Commit

Permalink
fix: prompt optimizations for create file/dir; fix session case
Browse files Browse the repository at this point in the history
Signed-off-by: Trae Yelovich <[email protected]>
  • Loading branch information
traeok committed Oct 4, 2024
1 parent 77235a3 commit 494961f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/zowe-explorer/src/trees/uss/USSActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class USSActions {
ZoweLogger.trace("uss.actions.createUSSNode called.");
await ussFileProvider.checkCurrentProfile(node);
let filePath = "";
if (SharedContext.isSession(node)) {
if (SharedContext.isSession(node) && node.fullPath?.length === 0) {
const filePathOptions: vscode.InputBoxOptions = {
placeHolder: vscode.l10n.t({
message: "{0} location",
Expand All @@ -60,17 +60,27 @@ export class USSActions {
value: node.tooltip as string,
};
filePath = await Gui.showInputBox(filePathOptions);
node.fullPath = filePath;
} else {
filePath = node.fullPath;
}

if (filePath == null || filePath.length === 0) {
return;
}

const nameOptions: vscode.InputBoxOptions = {
placeHolder: vscode.l10n.t("Name of file or directory"),
};
const name = await Gui.showInputBox(nameOptions);
if (name && filePath) {
try {
filePath = `${filePath}/${name}`;
const uri = node.resourceUri.with({ path: path.posix.join(node.resourceUri.path, name) });
const uri = node.resourceUri.with({
path: SharedContext.isSession(node)
? path.posix.join(node.resourceUri.path, filePath)
: path.posix.join(node.resourceUri.path, name),
});
await ZoweExplorerApiRegister.getUssApi(node.getProfile()).create(filePath, nodeType);
if (nodeType === "file") {
await vscode.workspace.fs.writeFile(uri, new Uint8Array());
Expand Down

0 comments on commit 494961f

Please sign in to comment.