diff --git a/client/src/app/features/merge/merge.component.html b/client/src/app/features/merge/merge.component.html index f510ed8..eb5f08f 100644 --- a/client/src/app/features/merge/merge.component.html +++ b/client/src/app/features/merge/merge.component.html @@ -15,10 +15,10 @@ > [{{ getCommitAttr(commit, "Created_at") }}] [{{ getCommitAttr(commit, "Editor") - }}] | {{ getCommitAttr(commit, "Msg") }} + }}] | {{ getCommitAttr(commit, "Msg") }} | {{ getCommitAttr(commit, "Id") }} - +
@@ -29,13 +29,13 @@ > @@ -109,6 +109,8 @@
{{ selectedCommit }} + {{ anotherSelectedSource}} + {{ anotherSelectedSource.startsWith('coffeethai02_') }}
@@ -123,7 +125,7 @@ (recipeListFormChange)="onRecipeListFormChange($event)" >
-
+
-
- + + + + +
+ + -
+
diff --git a/client/src/app/features/merge/merge.component.ts b/client/src/app/features/merge/merge.component.ts index 9f5563b..0359b41 100644 --- a/client/src/app/features/merge/merge.component.ts +++ b/client/src/app/features/merge/merge.component.ts @@ -83,6 +83,8 @@ export class MergeComponent // from another source anotherTargetRecipe: any = {}; + reloadMainSource = true; + // -------------------- current selection // currentTargetOfMaster: any = undefined; @@ -169,6 +171,14 @@ export class MergeComponent }); } + // reload data of main-source + triggerReload() { + this.reloadMainSource = false; + setTimeout(() => { + this.reloadMainSource = true; + }, 0); + } + async ngOnInit(): Promise { // fetch related product codes } @@ -200,6 +210,15 @@ export class MergeComponent // get patch map keys getPatchMapKeys = () => Object.keys(this.patchMap); + // get patch map keys, if have the same productCode + getPatchMapKeysIfProductCode() { + const keys = Object.keys(this.patchMap).filter(selectedCommit => { + return this.patchMap[selectedCommit].productCode === this.selectedProductCode; + }); + // console.log("Filtered PacthMap : ", keys); + return keys; + } + // check if load patch keys isPatchMapKeysLoaded = () => this.getPatchMapKeys().length > 0; testLoadCheck = () => @@ -260,19 +279,26 @@ export class MergeComponent selectCommit = (commit: any) => { // console.log('select commit', commit.target.value); this.selectedCommit = commit.target.value; + this.selectedProductCode = this.getCommitAttr(this.selectedCommit,"contents").productCode + // reload data of main-source + this.triggerReload(); + console.log("selectedCommit target v : ",this.selectedCommit) + console.log("selectedProductCode : ",this.selectedProductCode) }; selectAnotherSource = (source: any) => { this.anotherSelectedSource = source.target.value; + console.log("another select target v : ",this.anotherSelectedSource) }; changeAnotherSource = async (source: any) => { - this.anotherSelectedSource = - 'coffeethai02_' + source.target.value + '.json'; - console.log( - 'another source: target version -> ', - this.anotherSelectedSource - ); + //base on change + this.anotherSelectedSource = 'coffeethai02_' + source.target.value + '.json'; + // const vset = '691' + // this.anotherSelectedSource = `coffeethai02_${source}.json`; + console.log('another source: target version -> ',this.anotherSelectedSource); + console.log("anotherTargetRecipe : ",this.anotherTargetRecipe) + // activate fetch for (let pd of this.getProductCodesOfCommits()) { await this.getAnotherRecipeOfProductCode(pd); @@ -321,7 +347,8 @@ export class MergeComponent return { changeContext: undefined, skipZeroes: true, - toppingData: this.anotherTargetRecipe[pd!].ToppingSet, + // toppingData: this.anotherTargetRecipe[pd!].ToppingSet, + toppingData: this.getCommitAttr(this.selectedCommit, 'contents').ToppingSet, }; } } @@ -384,15 +411,17 @@ export class MergeComponent // test compare this.getPatchMapKeys().forEach((patchId) => { // compare with master - let cmp = compare( - this.anotherTargetRecipe[productCode!], - this.fullPatches[patchId].contents, - ['LastChange'] - ); - // save only what changes - this.changeMap[patchId + '_' + this.anotherSelectedSource] = { - changes: cmp, - }; + if (this.anotherTargetRecipe[productCode!]['productCode'] == this.fullPatches[patchId].contents['productCode']) { + let cmp = compare( + this.anotherTargetRecipe[productCode!], + this.fullPatches[patchId].contents, + ['LastChange'] + ); + // save only what changes + this.changeMap[patchId + '_' + this.anotherSelectedSource] = { + changes: cmp, + }; + } }); console.log('change map', this.changeMap); @@ -500,6 +529,7 @@ export class MergeComponent // selection empty? isSelectionEmpty(side: string): boolean { + console.log("isSelectionEmpty : ",side,this.selectionMap[this.selectedCommit + side]) return this.selectionMap[this.selectedCommit + side] == undefined || this.selectionMap[this.selectedCommit + side].length == 0; } diff --git a/client/src/app/features/recipes/recipe-details/recipe-list/recipe-list.component.html b/client/src/app/features/recipes/recipe-details/recipe-list/recipe-list.component.html index 211323b..0d5644b 100644 --- a/client/src/app/features/recipes/recipe-details/recipe-list/recipe-list.component.html +++ b/client/src/app/features/recipes/recipe-details/recipe-list/recipe-list.component.html @@ -61,7 +61,7 @@ >

Volume

@@ -77,7 +77,7 @@ >

Volume

@@ -122,7 +122,7 @@

Hot

@@ -139,7 +139,7 @@ >

Cold

@@ -161,7 +161,7 @@ >

{{ getTooltipForStirTime(getTypeForRecipeListAtIndex(i)) }}

@@ -301,7 +301,7 @@ >