Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Fix overwriting default project model
Browse files Browse the repository at this point in the history
  • Loading branch information
gregone committed Sep 8, 2021
1 parent 3903c72 commit a5b4bcc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ui/app/components/app-form/project-repository-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ export default class AppFormProjectRepositorySettings extends Component<ProjectS
@tracked project: Project.AsObject;
@tracked authCase: number;
@tracked serverHcl: boolean;
defaultProject: Project.AsObject;

constructor(owner: unknown, args: ProjectSettingsArgs) {
super(owner, args);
this.project = JSON.parse(JSON.stringify(DEFAULT_PROJECT_MODEL)) as Project.AsObject; // to ensure we're doing a deep copy
this.defaultProject = JSON.parse(JSON.stringify(DEFAULT_PROJECT_MODEL)) as Project.AsObject; // to ensure we're doing a deep copy
this.project = this.defaultProject;
let { project } = this.args;
this.populateExistingFields(project, this.project);
this.authCase = 4;
Expand Down Expand Up @@ -128,7 +130,7 @@ export default class AppFormProjectRepositorySettings extends Component<ProjectS
populateExistingFields(projectFromArgs: Project.AsObject, currentModel: Project.AsObject): void {
for (let [key, value] of Object.entries(projectFromArgs)) {
if (isEmpty(value)) {
currentModel[key] = DEFAULT_PROJECT_MODEL[key];
currentModel[key] = this.defaultProject[key];
continue;
}

Expand Down

0 comments on commit a5b4bcc

Please sign in to comment.