feat(merge_component): ✨ Add merge from website
Merge contents from patch selected by user into newer version merge from client feature
This commit is contained in:
parent
292c7697a4
commit
09c21301d6
15 changed files with 343 additions and 42 deletions
|
|
@ -114,7 +114,7 @@ export class DepartmentComponent {
|
|||
}
|
||||
|
||||
onClick(id: string) {
|
||||
// TODO: add handler for redirect
|
||||
// add handler for redirect
|
||||
this.notfoundHandler.handleSwitchCountry(id, async () => {
|
||||
// set country
|
||||
await AsyncStorage.setItem('currentRecipeCountry', getCountryMapSwitcher(id));
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ export class LayoutComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
// this.isCommitLoaded = Promise.resolve(true);
|
||||
// }
|
||||
|
||||
// // TODO: optimize
|
||||
// // optimize
|
||||
// if(data != undefined && typeof data === 'object'){
|
||||
// // check if attr exists
|
||||
// if(data.files != null && data.files != undefined){
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ export class RecipeService {
|
|||
}
|
||||
|
||||
getCurrentFile(): string {
|
||||
// TODO: get default from server
|
||||
// get default from server
|
||||
|
||||
const currentRecipeFile = localStorage.getItem('currentRecipeFile');
|
||||
if (currentRecipeFile) {
|
||||
|
|
@ -236,6 +236,17 @@ export class RecipeService {
|
|||
});
|
||||
}
|
||||
|
||||
upgradeRecipe(country: string, filename: string, ctx: any){
|
||||
return this._httpClient.post<any>(
|
||||
environment.api + ('/recipes/upgrade/' + country + '/' + filename),
|
||||
ctx,
|
||||
{
|
||||
withCredentials: true,
|
||||
responseType: 'json',
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
getSavedTmp(country: string, filename: string) {
|
||||
console.log('loading saved .tmp* file', country, filename);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ export class ChangelogComponent {
|
|||
}
|
||||
|
||||
public fetchLoglist(): string[] {
|
||||
// TODO: Fetch changelog.html
|
||||
// Fetch changelog.html
|
||||
// fetch("/changelog")
|
||||
let dirlist: any[] = [];
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
<div *ngIf="currentMaterialSettings != null" [formGroup]="materialSettingForm">
|
||||
<p>Material Settings</p>
|
||||
|
||||
<!-- TODO: add form -->
|
||||
<!-- add form -->
|
||||
|
||||
<div class="divider"></div>
|
||||
<div formArrayName="materialSetting" *ngFor="let material of materialSetting.controls; let i = index">
|
||||
|
|
|
|||
|
|
@ -21,6 +21,14 @@
|
|||
|
||||
<!-- enable from console -->
|
||||
<button class="hidden" (click)="testLoadCheck()">Test load</button>
|
||||
|
||||
<!-- This do send to server that the shown commit id will 1be applied to main recipe -->
|
||||
|
||||
<div class="m-2 space-x-2" *ngIf="selectedCommit != '' && selectedCommit != '---'">
|
||||
<button class="btn btn-primary" (click)="sendApply()">Apply</button>
|
||||
<button class="btn btn-error">Reject</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- 3 columns with master at center -->
|
||||
|
|
|
|||
|
|
@ -70,8 +70,8 @@ export class MergeComponent implements OnInit, AfterViewInit, OnDestroy, OnChang
|
|||
|
||||
// -------------------- current selection
|
||||
|
||||
currentTargetOfMaster: any = undefined;
|
||||
highlightChanges: any = {};
|
||||
// currentTargetOfMaster: any = undefined;
|
||||
// highlightChanges: any = {};
|
||||
selectedProductCode = '';
|
||||
|
||||
changePackage:
|
||||
|
|
@ -97,11 +97,12 @@ export class MergeComponent implements OnInit, AfterViewInit, OnDestroy, OnChang
|
|||
@ViewChild('templateRecipeChangeContent')
|
||||
templateRecipeChangeContent!: TemplateRef<any>;
|
||||
|
||||
// ---------------------- Recipe from machine
|
||||
recipeFromMachine: any = {};
|
||||
|
||||
constructor(
|
||||
private _recipeService: RecipeService,
|
||||
private _containerRef: ViewContainerRef // private cfr: ComponentFactoryResolver,
|
||||
) // private appRef: ApplicationRef,
|
||||
// private injector: Injector
|
||||
private _recipeService: RecipeService
|
||||
)
|
||||
{}
|
||||
|
||||
async ngOnChanges(changes: SimpleChanges): Promise<void> {
|
||||
|
|
@ -242,6 +243,10 @@ export class MergeComponent implements OnInit, AfterViewInit, OnDestroy, OnChang
|
|||
this.selectedCommit = commit.target.value;
|
||||
}
|
||||
|
||||
selectAnotherSource = (sourceType: string) => {
|
||||
|
||||
}
|
||||
|
||||
buildContext = () => {
|
||||
|
||||
if(this.selectedCommit == "" || this.selectedCommit == undefined || this.selectedCommit == '---'){
|
||||
|
|
@ -377,4 +382,33 @@ export class MergeComponent implements OnInit, AfterViewInit, OnDestroy, OnChang
|
|||
// getProductCodeByCommitRef = (commitRef: string) => {
|
||||
// return this.patchMap[commitRef].productCode;
|
||||
// };
|
||||
|
||||
// use with 'apply' button
|
||||
async sendApply() {
|
||||
|
||||
console.log("test send apply", this.fullPatches[this.selectedCommit])
|
||||
|
||||
let commitKey = this.getCommitAttr(this.selectedCommit, 'Change_file');
|
||||
|
||||
let to_send: any = {
|
||||
changeKey: commitKey
|
||||
}
|
||||
|
||||
// add appliedMachineRecipe if this is 3 ways merge
|
||||
if(Object.keys(this.recipeFromMachine).length > 0){
|
||||
to_send["appliedMachineRecipe"] = this.recipeFromMachine;
|
||||
}
|
||||
|
||||
console.log("sending upgrade", to_send);
|
||||
|
||||
this._recipeService.upgradeRecipe(
|
||||
await this._recipeService.getCurrentCountry(),
|
||||
this._recipeService.getCurrentFile(),
|
||||
to_send
|
||||
).subscribe({
|
||||
next: (value) => {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@
|
|||
|
||||
<!-- try pop up modal -->
|
||||
|
||||
<!-- TODO: do topping -->
|
||||
<!-- do topping -->
|
||||
|
||||
<div
|
||||
class="sticky bottom-0 col-span-3 max-w-screen-lg flex justify-end bg-white rounded-full drop-shadow-2xl p-3"
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ export class RecipeToppingComponent implements OnInit, OnChanges {
|
|||
}
|
||||
} else {
|
||||
// padding
|
||||
// TODO: move padding to recipelist then insert padding between original last index and this index
|
||||
// move padding to recipelist then insert padding between original last index and this index
|
||||
if (this.index! > data.length) {
|
||||
// for (
|
||||
// let init = this.toppingList.length - 1;
|
||||
|
|
@ -413,7 +413,7 @@ export class RecipeToppingComponent implements OnInit, OnChanges {
|
|||
'if override',
|
||||
overrideDefault
|
||||
);
|
||||
// TODO: Turn on if need to overwrite
|
||||
// Turn on if need to overwrite
|
||||
// value.defaultIDSelect = overrideDefault;
|
||||
} else {
|
||||
value.ListGroupID = [parseInt(value.groupID), 0, 0, 0];
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ export class RecipesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
async ngOnInit(): Promise<void> {
|
||||
console.log('Trigger onInit where department = ', this.department);
|
||||
|
||||
// TODO: check if department is legit
|
||||
// check if department is legit
|
||||
|
||||
this.notfoundHandler.handleInvalidDepartment(
|
||||
this.department!,
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@
|
|||
</div>
|
||||
</dialog>
|
||||
|
||||
<!-- TODO: save all changes and send to server -->
|
||||
<!-- save all changes and send to server -->
|
||||
<button class="btn">
|
||||
<p>Save Changes</p>
|
||||
</button>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue