diff --git a/client/src/app/app-routing.module.ts b/client/src/app/app-routing.module.ts index 47bb4d4..52f280c 100644 --- a/client/src/app/app-routing.module.ts +++ b/client/src/app/app-routing.module.ts @@ -93,13 +93,13 @@ const routes: Routes = [ ).then((m) => m.RecipeDetailsComponent), canActivate: [authGuard], }, - { - path: 'log', - loadComponent: () => - import('./features/changelog/changelog.component').then( - (m) => m.ChangelogComponent - ), - }, + // { + // path: 'log', + // loadComponent: () => + // import('./features/changelog/changelog.component').then( + // (m) => m.ChangelogComponent + // ), + // }, { path: '**', redirectTo: 'recipes', diff --git a/client/src/app/core/services/recipe.service.ts b/client/src/app/core/services/recipe.service.ts index 1b291ea..4764a0d 100644 --- a/client/src/app/core/services/recipe.service.ts +++ b/client/src/app/core/services/recipe.service.ts @@ -106,4 +106,20 @@ export class RecipeService { getRecipeFileNames(country: string): string[] { return this.recipeFiles[country]; } + + editChanges(version: string, change: any){ + console.log("target version = ", version); + console.log("change in edit: ",change.value) + return this._httpClient.post<{ + status: string + }>( + environment.api + ('/recipes/edit/'+version), + change.value, + { withCredentials: true, responseType: 'json', } + ).subscribe({ + next(value) { + console.log(value, change.value) + }, + }); + } } diff --git a/client/src/app/features/changelog/changelog.component.html b/client/src/app/features/changelog/changelog.component.html index b797975..c1e855d 100644 --- a/client/src/app/features/changelog/changelog.component.html +++ b/client/src/app/features/changelog/changelog.component.html @@ -94,4 +94,16 @@ +
+

Diff

+ +
+

Select Version

+
+ + +
+
+ +
diff --git a/client/src/app/features/changelog/changelog.component.ts b/client/src/app/features/changelog/changelog.component.ts index b774390..73f4a79 100644 --- a/client/src/app/features/changelog/changelog.component.ts +++ b/client/src/app/features/changelog/changelog.component.ts @@ -150,5 +150,12 @@ export class ChangelogComponent { -} + } + + + // Add version button + addVersion(){ + let dvs = document.getElementById("diff_version_select"); + dvs!.innerHTML += ``; + } } diff --git a/client/src/app/features/recipes/recipe-details/recipe-details.component.ts b/client/src/app/features/recipes/recipe-details/recipe-details.component.ts index 6932258..877452c 100644 --- a/client/src/app/features/recipes/recipe-details/recipe-details.component.ts +++ b/client/src/app/features/recipes/recipe-details/recipe-details.component.ts @@ -186,6 +186,14 @@ export class RecipeDetailsComponent implements OnInit { message: 'Do you want to save changes?', confirmCallBack: () => { console.log('confirm save'); + // TODO: update value in targeted recipe + this._recipeService.editChanges( + this._recipeService.getCurrentVersion(), + { + ...this.recipeDetail + } + ); + console.log("Sending changes") this._router.navigate(['/recipes']); }, }; diff --git a/client/src/app/features/recipes/recipes.component.html b/client/src/app/features/recipes/recipes.component.html index c116391..b8674be 100644 --- a/client/src/app/features/recipes/recipes.component.html +++ b/client/src/app/features/recipes/recipes.component.html @@ -9,7 +9,7 @@
Recipe Version {{ recipes?.MachineSetting?.configNumber }} | - {{ fileName }}
@@ -23,16 +23,17 @@