Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/modules/opmode_start.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"fields": {
"NAME": "",
"GROUP": "",
"TYPE": "Auto",
"TYPE": "Teleop",
"ENABLED": true
}
},
Expand Down
7 changes: 5 additions & 2 deletions src/storage/client_side_storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,12 @@ class ClientSideStorage implements commonStorage.Storage {
});
}

async createProject(projectName: string, robotContent: string): Promise<void> {
async createProject(projectName: string, robotContent: string, opmodeContent : string): Promise<void> {
const modulePath = commonStorage.makeRobotPath(projectName);
return this._saveModule(commonStorage.MODULE_TYPE_ROBOT, modulePath, robotContent);
const opmodePath = commonStorage.makeModulePath(projectName, 'Teleop');

await this._saveModule(commonStorage.MODULE_TYPE_ROBOT, modulePath, robotContent);
await this._saveModule(commonStorage.MODULE_TYPE_OPMODE, opmodePath, opmodeContent);
}

async createModule(moduleType: string, modulePath: string, moduleContent: string): Promise<void> {
Expand Down
5 changes: 3 additions & 2 deletions src/storage/common_storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export interface Storage {
fetchEntry(entryKey: string, defaultValue: string): Promise<string>;
listProjects(): Promise<Project[]>;
fetchModuleContent(modulePath: string): Promise<string>;
createProject(projectName: string, robotContent: string): Promise<void>;
createProject(projectName: string, robotContent: string, opmodeContent: string): Promise<void>;
createModule(moduleType: string, modulePath: string, moduleContent: string): Promise<void>;
saveModule(modulePath: string, moduleContent: string): Promise<void>;
renameProject(oldProjectName: string, newProjectName: string): Promise<void>;
Expand All @@ -129,7 +129,8 @@ export async function createProject(
storage: Storage, proposedUserVisibleName: string): Promise<void> {
const newProjectName = pascalCaseToSnakeCase(proposedUserVisibleName);
const robotContent = newRobotContent(newProjectName);
await storage.createProject(newProjectName, robotContent);
const opmodeContent = newOpModeContent(newProjectName, 'Teleop');
await storage.createProject(newProjectName, robotContent, opmodeContent);
}

/**
Expand Down