Commit 0da5f0db authored by Alexander Philipp Nowosad's avatar Alexander Philipp Nowosad
Browse files

Add loader to feature model edit views

parent 94700c29
Pipeline #137945 failed with stages
in 11 minutes and 2 seconds
import { Component, OnDestroy, OnInit } from '@angular/core';
import { Subscription } from 'rxjs';
import { CompanyModel } from '../../../canvas-meta-model/company-model';
import { ActivatedRoute } from '@angular/router';
import { Component } from '@angular/core';
import { CompanyModelService } from '../../../canvas-meta-model/company-model.service';
import { CompanyModelLoaderService } from '../company-model-loader.service';
@Component({
selector: 'app-company-model-edit',
templateUrl: './company-model-edit.component.html',
styleUrls: ['./company-model-edit.component.css'],
providers: [CompanyModelLoaderService],
})
export class CompanyModelEditComponent implements OnInit, OnDestroy {
runningProcessId: string;
companyModel: CompanyModel;
private routeSubscription: Subscription;
private queryParamSubscription: Subscription;
export class CompanyModelEditComponent {
constructor(
private companyModelService: CompanyModelService,
private route: ActivatedRoute
private companyModelLoaderService: CompanyModelLoaderService,
private companyModelService: CompanyModelService
) {}
ngOnInit() {
this.queryParamSubscription = this.route.queryParamMap.subscribe(
(paramMap) => {
this.runningProcessId = paramMap.get('runningProcessId');
}
);
this.routeSubscription = this.route.paramMap.subscribe((paramMap) => {
this.loadCompanyModel(paramMap.get('id'));
});
}
ngOnDestroy() {
if (this.queryParamSubscription) {
this.queryParamSubscription.unsubscribe();
}
if (this.routeSubscription) {
this.routeSubscription.unsubscribe();
}
}
async updateCompanyModel() {
await this.companyModelService.save(this.companyModel);
this.loadCompanyModel(this.companyModel._id);
}
async loadCompanyModel(companyModelId: string) {
this.companyModel = await this.companyModelService.get(companyModelId);
get companyModel() {
return this.companyModelLoaderService.companyModel;
}
}
import { Component, OnDestroy, OnInit } from '@angular/core';
import { ExpertModel } from '../../../canvas-meta-model/expert-model';
import { ActivatedRoute } from '@angular/router';
import { Subscription } from 'rxjs';
import { Component } from '@angular/core';
import { ExpertModelService } from '../../../canvas-meta-model/expert-model.service';
import { ExpertModelLoaderService } from '../expert-model-loader.service';
@Component({
selector: 'app-expert-model-edit',
templateUrl: './expert-model-edit.component.html',
styleUrls: ['./expert-model-edit.component.css'],
providers: [ExpertModelLoaderService],
})
export class ExpertModelEditComponent implements OnInit, OnDestroy {
expertModel: ExpertModel;
private routeSubscription: Subscription;
export class ExpertModelEditComponent {
constructor(
private expertModelService: ExpertModelService,
private route: ActivatedRoute
private expertModelLoaderService: ExpertModelLoaderService,
private expertModelService: ExpertModelService
) {}
ngOnInit() {
this.routeSubscription = this.route.paramMap.subscribe((paramMap) => {
this.loadExpertModel(paramMap.get('id'));
});
}
ngOnDestroy() {
if (this.routeSubscription) {
this.routeSubscription.unsubscribe();
}
}
async updateExpertModel() {
await this.expertModelService.save(this.expertModel);
this.loadExpertModel(this.expertModel._id);
}
async loadExpertModel(expertModelId: string) {
this.expertModel = await this.expertModelService.get(expertModelId);
get expertModel() {
return this.expertModelLoaderService.expertModel;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment