perf(merge_component): 🎨 improve condition of display

remove loops while creating div of recipelist
This commit is contained in:
pakintada@gmail.com 2024-03-15 11:02:20 +07:00
parent 07ece78cd6
commit 333bfa5a5b

View file

@ -22,7 +22,11 @@
<br />
<!-- third source selector / from machine -->
<label for="anotherKeys">Select another source : </label>
<select class="select select-sm select-primary" name="anotherKeys" (change)="selectAnotherSource($event)">
<select
class="select select-sm select-primary"
name="anotherKeys"
(change)="selectAnotherSource($event)"
>
<option>--- Commit ---</option>
<option
*ngFor="let commit of getPatchMapKeys()"
@ -37,7 +41,12 @@
<option>--- Recipe ---</option>
</select>
<input type="text" placeholder="version number only..." *ngIf="this.anotherSelectedSource == '--- Recipe ---'" (mouseout)="changeAnotherSource($event)">
<input
type="text"
placeholder="version number only..."
*ngIf="this.anotherSelectedSource == '--- Recipe ---'"
(mouseout)="changeAnotherSource($event)"
/>
<!-- enable from console -->
<button class="hidden" (click)="testLoadCheck()">Test load</button>
@ -75,163 +84,145 @@
selectedCommit != '---'
"
>
<!-- option if has ignored in list -->
<div
class="m-2 p-2 !rounded-md bg-gray-400"
*ngIf="!isIgnoreListEmpty() && isCommitHasIgnored()"
>
<div class="flex p-2">
<p class="font-semibold text-md">Options</p>
</div>
<div
class="flex flex-row p-2 bg-gray-200 space-x-2"
id="ignore-replace-with-base-{{ selectedCommit }}"
>
<input type="checkbox" id="replace-{{ selectedCommit }}-with-base" />
<p>Replace selected values with master value</p>
</div>
<div
class="flex flex-row p-2 bg-gray-200 space-x-2"
id="ignore-replace-with-machine-{{ selectedCommit }}"
>
<input
type="checkbox"
id="replace-{{ selectedCommit }}-with-machine"
/>
<p>Replace selected values with machine value</p>
</div>
<!-- remove -->
<div
class="flex flex-row p-2 bg-gray-200 space-x-2"
id="remove-{{ selectedCommit }}"
>
<input type="checkbox" id="remove-{{ selectedCommit }}" />
<p>Remove it. Don't include this</p>
</div>
<!-- change state -->
<div
class="flex flex-row p-2 bg-gray-200 space-x-2"
id="toggle-state-{{ selectedCommit }}"
>
<input type="checkbox" id="toggle-state-{{ selectedCommit }}" />
<p>Switch state. On {{ "<-->" }} Off</p>
</div>
<!-- other -->
<div class="hidden p-2 bg-gray-200 space-x-2" id="command">
<div class="flex flex-row p-2 space-x-2">
<input type="checkbox" id="command-enable" />
<p>Command</p>
</div>
<!-- <input class="w-56" type="text"> -->
<div class="flex flex-row gap-2">
<code class="">
<textarea
class="p-2 resize-none bg-black text-white"
id="command-code"
cols="30"
rows="10"
>
//Evaluate</textarea
>
</code>
<code class="">
<textarea
class="p-2 resize bg-black text-green-600"
id="command-output"
cols="30"
rows="10"
></textarea>
</code>
</div>
</div>
<div class="flex justify-end">
<button class="m-2 btn btn-warning right-2" (click)="eval()">
OK
</button>
</div>
</div>
<!-- left as base -->
<div class="flex flex-row tooltip justify-evenly w-52">
<input type="checkbox" id="left-as-base">
<p class="tooltip" data-tip="Saved recipe from web has more priority than the machine">Main Priority</p>
<div class="flex flex-row">
<div class="flex flex-row tooltip justify-evenly w-52">
<input type="checkbox" id="left-as-base" />
<p
class="tooltip"
data-tip="Saved recipe from web has more priority than the machine"
>
Commit Priority
</p>
</div>
<div class="flex flex-row justify-evenly w-52" *ngIf="hasProductCodeOfCommits() && anotherSelectedSource != ''">
<input type="checkbox" id="right-as-base" />
<p
class="tooltip"
data-tip="Recipe from machine has more priority than the saved recipe from web"
>
Machine Priority
</p>
</div>
</div>
<details class="collapse collapse-arrow">
<summary class="collapse-title bg-red-200">
{{ selectedCommit }}
</summary>
<div class="collapse-content">
<app-recipe-list
[productCode]="
getCommitAttr(selectedCommit, 'contents').productCode
"
[noFetch]="true"
[recipeList]="getCommitAttr(selectedCommit, 'contents').recipes"
[displayOnly]="true"
[diffChangeContext]="buildContext()"
(recipeListFormChange)="onRecipeListFormChange($event)"
></app-recipe-list>
<div class="collapse-content flex flex-row join-item join-horizontal">
<div>
<app-recipe-list
[productCode]="
getCommitAttr(selectedCommit, 'contents').productCode
"
[noFetch]="true"
[recipeList]="getCommitAttr(selectedCommit, 'contents').recipes"
[displayOnly]="true"
[diffChangeContext]="buildContext()"
(recipeListFormChange)="onRecipeListFormChange($event)"
></app-recipe-list>
</div>
<div>
<app-recipe-list
[productCode]="
getCommitAttr(selectedCommit, 'contents').productCode!
"
[noFetch]="false"
[displayOnly]="true"
[diffChangeContext]="
buildContext(
'master',
getCommitAttr(selectedCommit, 'contents').productCode
)
"
></app-recipe-list>
</div>
<div
id="another-source"
*ngIf="hasProductCodeOfCommits() && anotherSelectedSource != ''"
>
<!-- right as base -->
<!-- <div class="flex flex-row justify-evenly w-52">
<input type="checkbox" id="right-as-base">
<p class="tooltip" data-tip="Recipe from machine has more priority than the saved recipe from web">Main Priority</p>
</div>
<div *ngFor="let pd of getProductCodesOfCommits()">
<div *ngIf="pd == getCommitAttr(selectedCommit, 'contents').productCode && anotherTargetRecipe[pd] != undefined">
<details class="collapse collapse-arrow">
<summary class="collapse-title">{{pd}} - {{anotherSelectedSource}}</summary>
<div>
</div>
</details>
</div>
</div> -->
<app-recipe-list
[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>
</div>
</div>
</details>
</div>
<!-- from master -->
<div *ngIf="hasProductCodeOfCommits()">
<!-- display zone -->
<div *ngFor="let pd of getProductCodesOfCommits()">
<div
class="container"
*ngIf="pd == getCommitAttr(selectedCommit, 'contents').productCode"
>
<details class="collapse collapse-arrow">
<summary class="collapse-title">{{ pd }}</summary>
<div>
<app-recipe-list
[productCode]="pd!"
[noFetch]="false"
[displayOnly]="true"
[diffChangeContext]="buildContext('master', pd)"
></app-recipe-list>
</div>
<!-- collapse -->
</details>
</div>
</div>
</div>
<div id="another-source" *ngIf="hasProductCodeOfCommits() && anotherSelectedSource != ''">
<!-- right as base -->
<div class="flex flex-row justify-evenly w-52">
<input type="checkbox" id="right-as-base">
<p class="tooltip" data-tip="Recipe from machine has more priority than the saved recipe from web">Main Priority</p>
</div>
<div *ngFor="let pd of getProductCodesOfCommits()">
<div *ngIf="pd == getCommitAttr(selectedCommit, 'contents').productCode && anotherTargetRecipe[pd] != undefined">
<details class="collapse collapse-arrow">
<summary class="collapse-title">{{pd}} - {{anotherSelectedSource}}</summary>
<div>
<app-recipe-list
[productCode]="pd!"
[noFetch]="true"
[recipeList]="anotherTargetRecipe[pd].recipes"
[displayOnly]="true"
[diffChangeContext]="buildContext('right', pd)"
(recipeListFormChange)="onSourceListFormChange($event)"
>
</app-recipe-list>
</div>
</details>
</div>
</div>
</div>
</div>
<!-- another source -->
<!-- prep for machine recipe-->
<details>
<summary>Console</summary>
<div class="m-2 p-2 !rounded-md bg-gray-400">
<!-- other -->
<div class="p-2 bg-gray-200 space-x-2" id="command">
<div class="flex flex-row p-2 space-x-2">
<input type="checkbox" id="command-enable" />
<p>Command</p>
</div>
<!-- <input class="w-56" type="text"> -->
<div class="flex flex-row">
<div class="mockup-code">
<code class="">
<textarea
class="p-2 resize-none bg-black text-white text-sm textarea-xs"
id="command-code"
cols="100"
rows="10"
>
//"!tb help" for more info.</textarea
>
<div class="divider divider-vertical"></div>
<textarea
class="p-2 bg-black text-green-600 text-sm textarea-xs resize-none"
id="command-output"
cols="100"
rows="10"
disabled
></textarea>
</code>
</div>
</div>
</div>
<div class="flex justify-end">
<button class="m-2 btn btn-warning right-2" (click)="eval()">OK</button>
</div>
</div>
</details>
</div>