Add rest call task component

This commit is contained in:
mauriziovitale84 2016-10-24 14:01:08 +01:00
parent 84ea69bf6a
commit 956d6b111c
9 changed files with 178 additions and 3 deletions

View File

@ -11,6 +11,9 @@
<div *ngSwitchCase="'alfresco_publish'">
<diagram-alfresco-publish-task [data]="data"></diagram-alfresco-publish-task>
</div>
<div *ngSwitchCase="'rest_call'">
<diagram-rest-call-task [data]="data"></diagram-rest-call-task>
</div>
<div *ngSwitchDefault>
<diagram-service-task [data]="data"></diagram-service-task>
</div>

View File

@ -0,0 +1,2 @@
<diagram-task [data]="data"></diagram-task>
<diagram-icon-rest-call-task [data]="data"></diagram-icon-rest-call-task>

View File

@ -0,0 +1,38 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Component, ElementRef, Input, Output, EventEmitter } from '@angular/core';
@Component({
moduleId: module.id,
selector: 'diagram-rest-call-task',
templateUrl: './diagram-rest-call-task.component.html',
styleUrls: ['./diagram-rest-call-task.component.css']
})
export class DiagramRestCallTaskComponent {
@Input()
data: any;
@Output()
onError = new EventEmitter();
constructor(public elementRef: ElementRef) {}
ngOnInit() {
}
}

View File

@ -24,6 +24,7 @@ import { DiagramManualTaskComponent } from './diagram-manual-task.component';
import { DiagramCamelTaskComponent } from './diagram-camel-task.component';
import { DiagramMuleTaskComponent } from './diagram-mule-task.component';
import { DiagramAlfrescoPublishTaskComponent } from './diagram-alfresco-publish-task.component';
import { DiagramRestCallTaskComponent } from './diagram-rest-call-task.component';
// primitives
export * from './diagram-container-service-task.component';
@ -35,6 +36,7 @@ export * from './diagram-manual-task.component';
export * from './diagram-camel-task.component';
export * from './diagram-mule-task.component';
export * from './diagram-alfresco-publish-task.component';
export * from './diagram-rest-call-task.component';
export const DIAGRAM_ACTIVITIES_DIRECTIVES: any[] = [
DiagramContainerServiceTaskComponent,
@ -45,5 +47,6 @@ export const DIAGRAM_ACTIVITIES_DIRECTIVES: any[] = [
DiagramManualTaskComponent,
DiagramCamelTaskComponent,
DiagramMuleTaskComponent,
DiagramAlfrescoPublishTaskComponent
DiagramAlfrescoPublishTaskComponent,
DiagramRestCallTaskComponent
];

View File

@ -0,0 +1,2 @@
<raphael-icon-rest-call [position]="position" [stroke]="options.stroke" [strokeWidth]="options.strokeWidth"
[fillColors]="options.fillColors" [fillOpacity]="options.fillOpacity"></raphael-icon-rest-call>

View File

@ -0,0 +1,46 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Component, ElementRef, Input, Output, EventEmitter } from '@angular/core';
import { DiagramColorService } from './../services/diagram-color.service';
@Component({
moduleId: module.id,
selector: 'diagram-icon-rest-call-task',
templateUrl: './diagram-icon-rest-call-task.component.html',
styleUrls: ['./diagram-icon-rest-call-task.component.css']
})
export class DiagramIconRestCallTaskComponent {
@Input()
data: any;
@Output()
onError = new EventEmitter();
position: any;
options: any = {stroke: '', fillColors: '', fillOpacity: '', strokeWidth: ''};
constructor(public elementRef: ElementRef,
private diagramColorService: DiagramColorService) {}
ngOnInit() {
this.position = {x: this.data.x + 2, y: this.data.y + 2};
this.options.stroke = 'none' ;
this.options.fillColors = '#bd4848' ;
}
}

View File

@ -22,6 +22,7 @@ import { DiagramIconManualTaskComponent } from './diagram-icon-manual-task.compo
import { DiagramIconCamelTaskComponent } from './diagram-icon-camel-task.component';
import { DiagramIconMuleTaskComponent } from './diagram-icon-mule-task.component';
import { DiagramIconAlfrescoPublishTaskComponent } from './diagram-icon-alfresco-publish-task.component';
import { DiagramIconRestCallTaskComponent } from './diagram-icon-rest-call-task.component';
// primitives
export * from './diagram-icon-service-task.component';
@ -31,6 +32,7 @@ export * from './diagram-icon-manual-task.component';
export * from './diagram-icon-camel-task.component';
export * from './diagram-icon-mule-task.component';
export * from './diagram-icon-alfresco-publish-task.component';
export * from './diagram-icon-rest-call-task.component';
export const DIAGRAM_ICONS_DIRECTIVES: any[] = [
DiagramIconServiceTaskComponent,
@ -39,5 +41,6 @@ export const DIAGRAM_ICONS_DIRECTIVES: any[] = [
DiagramIconManualTaskComponent,
DiagramIconCamelTaskComponent,
DiagramIconMuleTaskComponent,
DiagramIconAlfrescoPublishTaskComponent
DiagramIconAlfrescoPublishTaskComponent,
DiagramIconRestCallTaskComponent
];

View File

@ -32,6 +32,7 @@ import { RaphaelIconManualDirective } from './raphael-icon-manual.component';
import { RaphaelIconCamelDirective } from './raphael-icon-camel.component';
import { RaphaelIconMuleDirective } from './raphael-icon-mule.component';
import { RaphaelIconAlfrescoPublishDirective } from './raphael-icon-alfresco-publish.component';
import { RaphaelIconRestCallDirective } from './raphael-icon-rest-call.component';
// primitives
export * from './raphael-circle.component';
@ -50,6 +51,7 @@ export * from './raphael-icon-manual.component';
export * from './raphael-icon-camel.component';
export * from './raphael-icon-mule.component';
export * from './raphael-icon-alfresco-publish.component';
export * from './raphael-icon-rest-call.component';
export const RAPHAEL_DIRECTIVES: any[] = [
RaphaelCircleDirective,
@ -66,5 +68,6 @@ export const RAPHAEL_DIRECTIVES: any[] = [
RaphaelIconManualDirective,
RaphaelIconCamelDirective,
RaphaelIconMuleDirective,
RaphaelIconAlfrescoPublishDirective
RaphaelIconAlfrescoPublishDirective,
RaphaelIconRestCallDirective
];

View File

@ -0,0 +1,75 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Directive, OnInit, ElementRef, Input, Output, EventEmitter } from '@angular/core';
import { Point } from './models/point';
import { RaphaelBase } from './raphael-base';
import { RaphaelService } from './raphael.service';
@Directive({selector: 'raphael-icon-rest-call'})
export class RaphaelIconRestCallDirective extends RaphaelBase implements OnInit {
@Input()
paper: any;
@Input()
position: Point;
@Input()
text: string;
@Output()
onError = new EventEmitter();
@Input()
strokeWidth: number;
@Input()
fillColors: any;
@Input()
stroke: any;
@Input()
fillOpacity: any;
constructor(public elementRef: ElementRef,
raphaelService: RaphaelService) {
super(elementRef, raphaelService);
}
ngOnInit() {
console.log(this.elementRef);
this.draw(this.position);
}
public draw(position: Point) {
let path1 = this.paper.path(`m 16.704699,5.9229055 q 0.358098,0 0.608767,0.2506681 0.250669,0.250668 0.250669,0.6087677 0,0.3580997
-0.250669,0.6087677 -0.250669,0.2506679 -0.608767,0.2506679 -0.358098,0 -0.608767,-0.2506679 -0.250669,-0.250668
-0.250669,-0.6087677 0,-0.3580997 0.250669,-0.6087677 0.250669,-0.2506681 0.608767,-0.2506681 z m 2.578308,-2.0053502 q
-2.229162,0 -3.854034,0.6759125 -1.624871,0.6759067 -3.227361,2.2694472 -0.716197,0.725146 -1.575633,1.7457293 L
7.2329969,8.7876913 Q 7.0897576,8.8055849 7.000233,8.9309334 L 4.9948821,12.368677 q -0.035811,0.06267 -0.035811,0.143242
0,0.107426 0.080572,0.205905 l 0.5729577,0.572957 q 0.125334,0.116384 0.2864786,0.07162 l 2.4708789,-0.760963 2.5156417,2.515645
-0.76096,2.470876 q -0.009,0.02687 -0.009,0.08057 0,0.125338 0.08058,0.205905 l 0.572957,0.572958 q 0.170096,0.152194
0.349146,0.04476 l 3.437744,-2.005351 q 0.125335,-0.08953 0.143239,-0.232763 l 0.17905,-3.392986 q 1.02058,-0.859435
1.745729,-1.575629 1.67411,-1.6830612 2.309735,-3.2049805 0.635625,-1.5219191 0.635625,-3.8585111 0,-0.1253369 -0.08505,-0.2148575
-0.08505,-0.089526 -0.201431,-0.089526 z`).attr({
'stroke': this.stroke,
'fill': this.fillColors
});
return path1.transform('T' + position.x + ',' + position.y);
}
}