Skip to content
This repository has been archived by the owner on Nov 22, 2019. It is now read-only.

Commit

Permalink
TTOOLS-500 - additional tweaks to fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
blafond committed Oct 23, 2018
1 parent e839ce8 commit 493fb58
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 40 deletions.
Expand Up @@ -46,7 +46,7 @@ import { Composition } from "@dataservices/shared/composition.model";
templateUrl: "./view-canvas.component.html",
styleUrls: ["./view-canvas.component.css"]
})
export class ViewCanvasComponent implements OnInit, AfterViewInit, OnDestroy {
export class ViewCanvasComponent implements OnInit, OnDestroy {

// used by html
public readonly noSourcesAlert = ViewEditorI18n.noSourcesAlert;
Expand Down Expand Up @@ -197,40 +197,6 @@ export class ViewCanvasComponent implements OnInit, AfterViewInit, OnDestroy {
this.canvasSubscription = this.canvasService.canvasEvent.subscribe((event) => this.handleCanvasEvent(event));
}

public ngAfterViewInit(): void {
// const labels:string[] = ['Employee', 'Admin', 'Payroll', 'EmployeeAdmin', 'EmployeePayDay'];
// const type:string[] = [
// CanvasConstants.SOURCE_TYPE,
// CanvasConstants.SOURCE_TYPE,
// CanvasConstants.SOURCE_TYPE,
// CanvasConstants.COMPOSITION_TYPE,
// CanvasConstants.COMPOSITION_TYPE
// ];
//
// /** constructing the nodes array */
// const nodeIds: string[] = [];
// for (let i = 0; i < 5; i++) {
// const id = this.canvasService.createNode(type[i], labels[i]);
// nodeIds.push(id);
// }
//
// this.canvasService.createLink(nodeIds[0], nodeIds[3]);
// this.canvasService.createLink(nodeIds[1], nodeIds[3]);
// this.canvasService.createLink(nodeIds[2], nodeIds[4]);
// this.canvasService.createLink(nodeIds[3], nodeIds[4], true);

this.canvasService.canvasEvent.subscribe((nodes) => {
if (_.isEmpty(nodes)) {
console.log("No nodes selected");
return;
}

for (const node of nodes) {
console.log("Node " + node.label + " selected");
}
});
}

/**
* @returns {boolean} `true` if view being edited is readonly
*/
Expand Down
Expand Up @@ -87,6 +87,7 @@ export class GraphVisualComponent implements OnInit {
constructor(canvasService: CanvasService, ref: ChangeDetectorRef) {
this.canvasService = canvasService;
this.ref = ref;
this.canvasGraph = this.canvasService.newCanvasGraph(this.options, this.ref);
}

public get nodes(): CanvasNode[] {
Expand All @@ -99,9 +100,6 @@ export class GraphVisualComponent implements OnInit {

public ngOnInit(): void {
console.log("graph-visual: ngOnInit");

/** Receiving an initialized simulated graph from our custom canvas.service */
this.canvasGraph = this.canvasService.newCanvasGraph(this.options, this.ref);
}

// TODO: Need to discuss how all the layout sizes affect each other.
Expand Down
Expand Up @@ -34,6 +34,7 @@ import {ConfirmDialogComponent} from "@shared/confirm-dialog/confirm-dialog.comp
import {CommandFactory} from "@dataservices/virtualization/view-editor/command/command-factory";
import {Command} from "@dataservices/virtualization/view-editor/command/command";
import {CreateViewDialogComponent} from "@dataservices/virtualization/view-editor/create-view-dialog/create-view-dialog.component";
import {ChangeDetectorRef} from "@angular/core";

@Component({
encapsulation: ViewEncapsulation.None,
Expand Down Expand Up @@ -62,17 +63,20 @@ export class ViewsListComponent implements OnInit, OnDestroy, AfterViewInit {
private viewsLoadingState: LoadingState = LoadingState.LOADING;
private selectedVirtualization: Dataservice;
private viewSavedUponCompletion: ViewDefinition;
private cdRef: ChangeDetectorRef;

constructor( editorService: ViewEditorService,
dataserviceService: DataserviceService,
selectionService: SelectionService,
logger: LoggerService,
modalService: BsModalService) {
modalService: BsModalService,
cdRef: ChangeDetectorRef) {
this.editorService = editorService;
this.dataserviceService = dataserviceService;
this.selectionService = selectionService;
this.logger = logger;
this.modalService = modalService;
this.cdRef = cdRef;
}

/**
Expand Down Expand Up @@ -136,12 +140,12 @@ export class ViewsListComponent implements OnInit, OnDestroy, AfterViewInit {
emptyStateConfig: this.emptyStateConfig
} as TableConfig;


}

public ngAfterViewInit(): void {
// init the available views
this.initViews();
this.cdRef.detectChanges();
}

/*
Expand Down

0 comments on commit 493fb58

Please sign in to comment.