Skip to content

Commit

Permalink
Merge pull request #118 from lharzenetter/properties
Browse files Browse the repository at this point in the history
BoundaryDefintions properties
  • Loading branch information
koppor committed Sep 8, 2017
2 parents 7301319 + 59f76a5 commit f056821
Showing 1 changed file with 3 additions and 17 deletions.
Expand Up @@ -10,13 +10,10 @@
* Tino Stadelmaier, Philipp Meyer - initial API and implementation
*/
import { Component, Input, OnInit, ViewChild } from '@angular/core';
import { Response } from '@angular/http';
import { EditXMLService } from './editXML.service';
import { WineryNotificationService } from '../../../wineryNotificationModule/wineryNotification.service';
import { WineryEditorComponent } from '../../../wineryEditorModule/wineryEditor.component';
import { InstanceService } from '../../instance.service';
import { ToscaTypes } from '../../../wineryInterfaces/enums';
import { Router } from '@angular/router';
import { isNullOrUndefined } from 'util';

declare var requirejs: any;

Expand All @@ -41,8 +38,6 @@ export class EditXMLComponent implements OnInit {
height = 500;

constructor(private service: EditXMLService,
private sharedData: InstanceService,
private router: Router,
private notify: WineryNotificationService) {
}

Expand All @@ -62,7 +57,7 @@ export class EditXMLComponent implements OnInit {
this.service.saveXmlData(this.editor.getData())
.subscribe(
data => this.handlePutResponse(data),
error => this.handleError(error)
(error: Response) => this.handleError(error.text())
);
this.loading = true;
}
Expand All @@ -78,16 +73,7 @@ export class EditXMLComponent implements OnInit {

private handleXmlData(xml: string) {
this.loading = false;
if (!isNullOrUndefined(xml)
&& xml.length === 0
&& this.sharedData.toscaComponent.toscaType === ToscaTypes.ServiceTemplate
&& this.router.url.endsWith('properties')) {
this.xmlData = `<tosca:properties xmlns:tosca="http://docs.oasis-open.org/tosca/ns/2011/12">
</tosca:properties>`;
} else {
this.xmlData = xml;
}
this.xmlData = xml;
}

private handleError(error: any): void {
Expand Down

0 comments on commit f056821

Please sign in to comment.