Merge pull request 'fix: [Saved,Value does not change], [Recipes undefined on another source], [Value does not change in main-source], [Fix to choose the same produceCode]' (#1) from fixDetectChanges into main
Reviewed-on: https://pakin-inspiron-15-3530.tail360bd.ts.net/pakin/taobin_recipe_manager/pulls/1
This commit is contained in:
commit
c76f47aa3e
3 changed files with 96 additions and 47 deletions
|
|
@ -15,10 +15,10 @@
|
||||||
>
|
>
|
||||||
[{{ getCommitAttr(commit, "Created_at") }}] [{{
|
[{{ getCommitAttr(commit, "Created_at") }}] [{{
|
||||||
getCommitAttr(commit, "Editor")
|
getCommitAttr(commit, "Editor")
|
||||||
}}] | {{ getCommitAttr(commit, "Msg") }}
|
}}] | {{ getCommitAttr(commit, "Msg") }} | {{ getCommitAttr(commit, "Id") }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<!-- third source selector / from machine -->
|
<!-- third source selector / from machine -->
|
||||||
<label for="anotherKeys">Select another source : </label>
|
<label for="anotherKeys">Select another source : </label>
|
||||||
|
|
@ -29,13 +29,13 @@
|
||||||
>
|
>
|
||||||
<option>--- Commit ---</option>
|
<option>--- Commit ---</option>
|
||||||
<option
|
<option
|
||||||
*ngFor="let commit of getPatchMapKeys()"
|
*ngFor="let commit of getPatchMapKeysIfProductCode()"
|
||||||
[value]="commit"
|
[value]="commit"
|
||||||
id="source3_{{ commit }}"
|
id="source3_{{ commit }}"
|
||||||
>
|
>
|
||||||
[{{ getCommitAttr(commit, "Created_at") }}] [{{
|
[{{ getCommitAttr(commit, "Created_at") }}] [{{
|
||||||
getCommitAttr(commit, "Editor")
|
getCommitAttr(commit, "Editor")
|
||||||
}}] | {{ getCommitAttr(commit, "Msg") }}
|
}}] | {{ getCommitAttr(commit, "Msg") }} | {{ getCommitAttr(commit, "Id") }}
|
||||||
</option>
|
</option>
|
||||||
<option>--- Machine ---</option>
|
<option>--- Machine ---</option>
|
||||||
<option>--- Recipe ---</option>
|
<option>--- Recipe ---</option>
|
||||||
|
|
@ -109,6 +109,8 @@
|
||||||
<details class="collapse collapse-arrow">
|
<details class="collapse collapse-arrow">
|
||||||
<summary class="collapse-title bg-red-200">
|
<summary class="collapse-title bg-red-200">
|
||||||
{{ selectedCommit }}
|
{{ selectedCommit }}
|
||||||
|
{{ anotherSelectedSource}}
|
||||||
|
{{ anotherSelectedSource.startsWith('coffeethai02_') }}
|
||||||
</summary>
|
</summary>
|
||||||
<div class="collapse-content grid grid-cols-3">
|
<div class="collapse-content grid grid-cols-3">
|
||||||
<div class="flex-shrink-0 overflow-x-scroll shadow-lg" id="commit-source" (scroll)="addSyncingScrollDiffPane('commit-source')">
|
<div class="flex-shrink-0 overflow-x-scroll shadow-lg" id="commit-source" (scroll)="addSyncingScrollDiffPane('commit-source')">
|
||||||
|
|
@ -123,7 +125,7 @@
|
||||||
(recipeListFormChange)="onRecipeListFormChange($event)"
|
(recipeListFormChange)="onRecipeListFormChange($event)"
|
||||||
></app-recipe-list>
|
></app-recipe-list>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-shrink-0 overflow-x-scroll shadow-lg" id="main-source" (scroll)="addSyncingScrollDiffPane('main-source')">
|
<div *ngIf="reloadMainSource" class="flex-shrink-0 overflow-x-scroll shadow-lg" id="main-source" (scroll)="addSyncingScrollDiffPane('main-source')">
|
||||||
<app-recipe-list
|
<app-recipe-list
|
||||||
[productCode]="
|
[productCode]="
|
||||||
getCommitAttr(selectedCommit, 'contents').productCode!
|
getCommitAttr(selectedCommit, 'contents').productCode!
|
||||||
|
|
@ -138,33 +140,50 @@
|
||||||
"
|
"
|
||||||
></app-recipe-list>
|
></app-recipe-list>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="flex-shrink-0 overflow-x-scroll shadow-lg"
|
class="flex-shrink-0 overflow-x-scroll shadow-lg"
|
||||||
id="another-source"
|
id="another-source"
|
||||||
(scroll)="addSyncingScrollDiffPane('another-source')"
|
(scroll)="addSyncingScrollDiffPane('another-source')"
|
||||||
*ngIf="hasProductCodeOfCommits() && anotherSelectedSource != ''"
|
>
|
||||||
>
|
<ng-container *ngIf="hasProductCodeOfCommits() && anotherSelectedSource != '' && anotherSelectedSource.startsWith('coffeethai02_'); else recipeTemplate"
|
||||||
<app-recipe-list
|
>
|
||||||
[productCode]="
|
<app-recipe-list
|
||||||
getCommitAttr(selectedCommit, 'contents').productCode!
|
[productCode]="
|
||||||
"
|
getCommitAttr(selectedCommit, 'contents').productCode!
|
||||||
|
"
|
||||||
|
[noFetch]="true"
|
||||||
|
[recipeList]="
|
||||||
|
anotherTargetRecipe[
|
||||||
|
getCommitAttr(selectedCommit, 'contents').productCode
|
||||||
|
].recipes
|
||||||
|
"
|
||||||
|
[displayOnly]="true"
|
||||||
|
[diffChangeContext]="
|
||||||
|
buildContext(
|
||||||
|
'right',
|
||||||
|
getCommitAttr(selectedCommit, 'contents').productCode
|
||||||
|
)
|
||||||
|
"
|
||||||
|
(recipeListFormChange)="onSourceListFormChange($event)"
|
||||||
|
>
|
||||||
|
</app-recipe-list>
|
||||||
|
</ng-container>
|
||||||
|
</div>
|
||||||
|
<ng-template #recipeTemplate>
|
||||||
|
<app-recipe-list
|
||||||
|
[productCode]="getCommitAttr(selectedCommit, 'contents').productCode!"
|
||||||
[noFetch]="true"
|
[noFetch]="true"
|
||||||
[recipeList]="
|
[recipeList]="getCommitAttr(anotherSelectedSource, 'contents').recipes"
|
||||||
anotherTargetRecipe[
|
|
||||||
getCommitAttr(selectedCommit, 'contents').productCode
|
|
||||||
].recipes
|
|
||||||
"
|
|
||||||
[displayOnly]="true"
|
[displayOnly]="true"
|
||||||
[diffChangeContext]="
|
[diffChangeContext]="
|
||||||
buildContext(
|
buildContext(
|
||||||
'right',
|
'right',
|
||||||
getCommitAttr(selectedCommit, 'contents').productCode
|
getCommitAttr(selectedCommit, 'contents').productCode
|
||||||
)
|
)"
|
||||||
"
|
|
||||||
(recipeListFormChange)="onSourceListFormChange($event)"
|
(recipeListFormChange)="onSourceListFormChange($event)"
|
||||||
>
|
>
|
||||||
</app-recipe-list>
|
</app-recipe-list>
|
||||||
</div>
|
</ng-template>
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,8 @@ export class MergeComponent
|
||||||
// from another source
|
// from another source
|
||||||
anotherTargetRecipe: any = {};
|
anotherTargetRecipe: any = {};
|
||||||
|
|
||||||
|
reloadMainSource = true;
|
||||||
|
|
||||||
// -------------------- current selection
|
// -------------------- current selection
|
||||||
|
|
||||||
// currentTargetOfMaster: any = undefined;
|
// 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<void> {
|
async ngOnInit(): Promise<void> {
|
||||||
// fetch related product codes
|
// fetch related product codes
|
||||||
}
|
}
|
||||||
|
|
@ -200,6 +210,15 @@ export class MergeComponent
|
||||||
// get patch map keys
|
// get patch map keys
|
||||||
getPatchMapKeys = () => Object.keys(this.patchMap);
|
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
|
// check if load patch keys
|
||||||
isPatchMapKeysLoaded = () => this.getPatchMapKeys().length > 0;
|
isPatchMapKeysLoaded = () => this.getPatchMapKeys().length > 0;
|
||||||
testLoadCheck = () =>
|
testLoadCheck = () =>
|
||||||
|
|
@ -260,19 +279,26 @@ export class MergeComponent
|
||||||
selectCommit = (commit: any) => {
|
selectCommit = (commit: any) => {
|
||||||
// console.log('select commit', commit.target.value);
|
// console.log('select commit', commit.target.value);
|
||||||
this.selectedCommit = 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) => {
|
selectAnotherSource = (source: any) => {
|
||||||
this.anotherSelectedSource = source.target.value;
|
this.anotherSelectedSource = source.target.value;
|
||||||
|
console.log("another select target v : ",this.anotherSelectedSource)
|
||||||
};
|
};
|
||||||
|
|
||||||
changeAnotherSource = async (source: any) => {
|
changeAnotherSource = async (source: any) => {
|
||||||
this.anotherSelectedSource =
|
//base on change
|
||||||
'coffeethai02_' + source.target.value + '.json';
|
this.anotherSelectedSource = 'coffeethai02_' + source.target.value + '.json';
|
||||||
console.log(
|
// const vset = '691'
|
||||||
'another source: target version -> ',
|
// this.anotherSelectedSource = `coffeethai02_${source}.json`;
|
||||||
this.anotherSelectedSource
|
console.log('another source: target version -> ',this.anotherSelectedSource);
|
||||||
);
|
console.log("anotherTargetRecipe : ",this.anotherTargetRecipe)
|
||||||
|
|
||||||
// activate fetch
|
// activate fetch
|
||||||
for (let pd of this.getProductCodesOfCommits()) {
|
for (let pd of this.getProductCodesOfCommits()) {
|
||||||
await this.getAnotherRecipeOfProductCode(pd);
|
await this.getAnotherRecipeOfProductCode(pd);
|
||||||
|
|
@ -321,7 +347,8 @@ export class MergeComponent
|
||||||
return {
|
return {
|
||||||
changeContext: undefined,
|
changeContext: undefined,
|
||||||
skipZeroes: true,
|
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
|
// test compare
|
||||||
this.getPatchMapKeys().forEach((patchId) => {
|
this.getPatchMapKeys().forEach((patchId) => {
|
||||||
// compare with master
|
// compare with master
|
||||||
let cmp = compare(
|
if (this.anotherTargetRecipe[productCode!]['productCode'] == this.fullPatches[patchId].contents['productCode']) {
|
||||||
this.anotherTargetRecipe[productCode!],
|
let cmp = compare(
|
||||||
this.fullPatches[patchId].contents,
|
this.anotherTargetRecipe[productCode!],
|
||||||
['LastChange']
|
this.fullPatches[patchId].contents,
|
||||||
);
|
['LastChange']
|
||||||
// save only what changes
|
);
|
||||||
this.changeMap[patchId + '_' + this.anotherSelectedSource] = {
|
// save only what changes
|
||||||
changes: cmp,
|
this.changeMap[patchId + '_' + this.anotherSelectedSource] = {
|
||||||
};
|
changes: cmp,
|
||||||
|
};
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('change map', this.changeMap);
|
console.log('change map', this.changeMap);
|
||||||
|
|
@ -500,6 +529,7 @@ export class MergeComponent
|
||||||
|
|
||||||
// selection empty?
|
// selection empty?
|
||||||
isSelectionEmpty(side: string): boolean {
|
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;
|
return this.selectionMap[this.selectedCommit + side] == undefined || this.selectionMap[this.selectedCommit + side].length == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@
|
||||||
>
|
>
|
||||||
<p>Volume</p>
|
<p>Volume</p>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="number"
|
||||||
class="bg-transparent w-8"
|
class="bg-transparent w-8"
|
||||||
formControlName="powderGram"
|
formControlName="powderGram"
|
||||||
/>
|
/>
|
||||||
|
|
@ -77,7 +77,7 @@
|
||||||
>
|
>
|
||||||
<p>Volume</p>
|
<p>Volume</p>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="number"
|
||||||
class="bg-transparent w-8"
|
class="bg-transparent w-8"
|
||||||
formControlName="syrupGram"
|
formControlName="syrupGram"
|
||||||
/>
|
/>
|
||||||
|
|
@ -122,7 +122,7 @@
|
||||||
<p>Hot</p>
|
<p>Hot</p>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="number"
|
||||||
class="w-8 bg-transparent"
|
class="w-8 bg-transparent"
|
||||||
formControlName="waterYield"
|
formControlName="waterYield"
|
||||||
/>
|
/>
|
||||||
|
|
@ -139,7 +139,7 @@
|
||||||
>
|
>
|
||||||
<p>Cold</p>
|
<p>Cold</p>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="number"
|
||||||
class="w-8 bg-transparent"
|
class="w-8 bg-transparent"
|
||||||
formControlName="waterCold"
|
formControlName="waterCold"
|
||||||
/>
|
/>
|
||||||
|
|
@ -161,7 +161,7 @@
|
||||||
>
|
>
|
||||||
<p>{{ getTooltipForStirTime(getTypeForRecipeListAtIndex(i)) }}</p>
|
<p>{{ getTooltipForStirTime(getTypeForRecipeListAtIndex(i)) }}</p>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="number"
|
||||||
class="bg-transparent w-8"
|
class="bg-transparent w-8"
|
||||||
formControlName="stirTime"
|
formControlName="stirTime"
|
||||||
/>
|
/>
|
||||||
|
|
@ -301,7 +301,7 @@
|
||||||
>
|
>
|
||||||
<input type="checkbox" formControlName="isUse" />
|
<input type="checkbox" formControlName="isUse" />
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="number"
|
||||||
class="input input-primary"
|
class="input input-primary"
|
||||||
formControlName="materialPathId"
|
formControlName="materialPathId"
|
||||||
(click)="openMaterialList(isdx)"
|
(click)="openMaterialList(isdx)"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue