From 956d6b111c5a11288cf32eeba531ed39dbcce45c Mon Sep 17 00:00:00 2001 From: mauriziovitale84 Date: Mon, 24 Oct 2016 14:01:08 +0100 Subject: [PATCH] Add rest call task component --- ...gram-container-service-task.component.html | 3 + .../diagram-rest-call-task.component.html | 2 + .../diagram-rest-call-task.component.ts | 38 ++++++++++ .../components/diagrams/activities/index.ts | 5 +- ...diagram-icon-rest-call-task.component.html | 2 + .../diagram-icon-rest-call-task.component.ts | 46 ++++++++++++ .../src/components/diagrams/icons/index.ts | 5 +- .../src/components/raphael/index.ts | 5 +- .../raphael-icon-rest-call.component.ts | 75 +++++++++++++++++++ 9 files changed, 178 insertions(+), 3 deletions(-) create mode 100644 ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-rest-call-task.component.html create mode 100644 ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-rest-call-task.component.ts create mode 100644 ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-rest-call-task.component.html create mode 100644 ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-rest-call-task.component.ts create mode 100644 ng2-components/ng2-activiti-analytics/src/components/raphael/raphael-icon-rest-call.component.ts diff --git a/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-container-service-task.component.html b/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-container-service-task.component.html index f3c4b005cd..567081dc50 100644 --- a/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-container-service-task.component.html +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-container-service-task.component.html @@ -11,6 +11,9 @@
+
+ +
diff --git a/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-rest-call-task.component.html b/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-rest-call-task.component.html new file mode 100644 index 0000000000..e7e27ad5bd --- /dev/null +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-rest-call-task.component.html @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-rest-call-task.component.ts b/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-rest-call-task.component.ts new file mode 100644 index 0000000000..5cdfdb2826 --- /dev/null +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-rest-call-task.component.ts @@ -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() { + + } +} diff --git a/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/index.ts b/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/index.ts index bf95022371..5cbb435c7b 100644 --- a/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/index.ts +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/index.ts @@ -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 ]; diff --git a/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-rest-call-task.component.html b/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-rest-call-task.component.html new file mode 100644 index 0000000000..6621df0e84 --- /dev/null +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-rest-call-task.component.html @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-rest-call-task.component.ts b/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-rest-call-task.component.ts new file mode 100644 index 0000000000..d49b1f8cd8 --- /dev/null +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-rest-call-task.component.ts @@ -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' ; + } +} diff --git a/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/index.ts b/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/index.ts index 9860f0a81c..d8c5aa6292 100644 --- a/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/index.ts +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/index.ts @@ -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 ]; diff --git a/ng2-components/ng2-activiti-analytics/src/components/raphael/index.ts b/ng2-components/ng2-activiti-analytics/src/components/raphael/index.ts index 567f1ebad5..ba9a5b36f5 100644 --- a/ng2-components/ng2-activiti-analytics/src/components/raphael/index.ts +++ b/ng2-components/ng2-activiti-analytics/src/components/raphael/index.ts @@ -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 ]; diff --git a/ng2-components/ng2-activiti-analytics/src/components/raphael/raphael-icon-rest-call.component.ts b/ng2-components/ng2-activiti-analytics/src/components/raphael/raphael-icon-rest-call.component.ts new file mode 100644 index 0000000000..8a53130abd --- /dev/null +++ b/ng2-components/ng2-activiti-analytics/src/components/raphael/raphael-icon-rest-call.component.ts @@ -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); + } +}