Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion frontend/webEditor/src/serialize/saveDfdAndDdFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ export class SaveDfdAndDdFileCommand extends SaveFileCommand {
async getFiles(context: CommandExecutionContext): Promise<FileData<string>[]> {
const savedDiagram = this.createSavedDiagram(context);

const response = await this.dfdWebSocket.sendMessage("Json2DFD:" + JSON.stringify(savedDiagram));
const newName = prompt("Enter Filename (Leave empty to use current file name)");

const response = await this.dfdWebSocket.sendMessage(
"Json2DFD:" + JSON.stringify(savedDiagram),
newName || undefined,
);
const nameEndIndex = response.indexOf(":");
const name = response.substring(0, nameEndIndex);
const endIndex =
Expand Down
4 changes: 2 additions & 2 deletions frontend/webEditor/src/webSocket/webSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class DfdWebSocket {
};
}

public sendMessage(message: string): Promise<string> {
public sendMessage(message: string, overwriteName?: string): Promise<string> {
const result = new Promise<string>((resolve, reject) => {
this.lastRequest.resolve = resolve;
this.lastRequest.reject = reject;
Expand All @@ -90,7 +90,7 @@ export class DfdWebSocket {
return result;
}

this.webSocket.send(this.webSocketId + ":" + this.fileName.getName() + ":" + message);
this.webSocket.send(this.webSocketId + ":" + (overwriteName ?? this.fileName.getName()) + ":" + message);
return result;
}
}
Loading