add edit json v1 WIP, testing

This commit is contained in:
pakintada@gmail.com 2023-10-20 14:32:16 +07:00
parent e5eee656d5
commit ea92145350
11 changed files with 216 additions and 67 deletions

View file

@ -94,4 +94,16 @@
<!-- Temporary remove merge tool -->
<div class="card h-full max-h-full">
<h2 class="card-title p-2">Diff</h2>
<!-- selectable version -->
<div class="card-body bg-stone-200">
<h3 class="card-title">Select Version</h3>
<div class="rela flex-row m-2" id="diff_version_select">
<input class="input input-md input-bordered m-2 bg-red-100" type="number" name="master_target" placeholder="Master Version" id="master_target">
<input class="input input-md input-bordered m-2 bg-green-100" type="number" name="target" placeholder="Target Version" id="target">
</div>
</div>
<button type="button" class="button bg-stone-400 p-2 rounded m-2 text-black font-bold" id="diff_load" (click)="addVersion()">&#43; Add Version</button>
</div>
</div>

View file

@ -150,5 +150,12 @@ export class ChangelogComponent {
}
}
// Add version button
addVersion(){
let dvs = document.getElementById("diff_version_select");
dvs!.innerHTML += `<input class="input input-md input-bordered m-2 bg-green-100" type="number" name="target" placeholder="Target Version" id="target">`;
}
}

View file

@ -182,6 +182,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']);
},
};

View file

@ -191,4 +191,6 @@
</div>
</div>
</div>
<button class="btn btn-circle fixed z-100 bottom-5 right-1" (click)="scrollToTop()">^</button>
</main>

View file

@ -43,7 +43,12 @@ export class DashboardComponent implements OnInit {
private searchStr = '';
private oldSearchStr = '';
tableCtx?: ElementRef;
@ViewChild('table', { static: false }) set content(table: ElementRef) {
// expose element ref for other fn
this.tableCtx = table;
table.nativeElement.addEventListener(
'scroll',
() => {
@ -202,4 +207,8 @@ export class DashboardComponent implements OnInit {
'_blank'
);
}
scrollToTop() {
this.tableCtx!.nativeElement.scroll;
}
}