Add google drive publish component

This commit is contained in:
mauriziovitale84 2016-10-24 16:13:59 +01:00
parent 956d6b111c
commit 3057047d73
9 changed files with 178 additions and 3 deletions

View File

@ -14,6 +14,9 @@
<div *ngSwitchCase="'rest_call'"> <div *ngSwitchCase="'rest_call'">
<diagram-rest-call-task [data]="data"></diagram-rest-call-task> <diagram-rest-call-task [data]="data"></diagram-rest-call-task>
</div> </div>
<div *ngSwitchCase="'google_drive_publish'">
<diagram-google-drive-publish-task [data]="data"></diagram-google-drive-publish-task>
</div>
<div *ngSwitchDefault> <div *ngSwitchDefault>
<diagram-service-task [data]="data"></diagram-service-task> <diagram-service-task [data]="data"></diagram-service-task>
</div> </div>

View File

@ -0,0 +1,2 @@
<diagram-task [data]="data"></diagram-task>
<diagram-icon-google-drive-publish-task [data]="data"></diagram-icon-google-drive-publish-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-google-drive-publish-task',
templateUrl: './diagram-google-drive-publish-task.component.html',
styleUrls: ['./diagram-google-drive-publish-task.component.css']
})
export class DiagramGoogleDrivePublishTaskComponent {
@Input()
data: any;
@Output()
onError = new EventEmitter();
constructor(public elementRef: ElementRef) {}
ngOnInit() {
}
}

View File

@ -25,6 +25,7 @@ import { DiagramCamelTaskComponent } from './diagram-camel-task.component';
import { DiagramMuleTaskComponent } from './diagram-mule-task.component'; import { DiagramMuleTaskComponent } from './diagram-mule-task.component';
import { DiagramAlfrescoPublishTaskComponent } from './diagram-alfresco-publish-task.component'; import { DiagramAlfrescoPublishTaskComponent } from './diagram-alfresco-publish-task.component';
import { DiagramRestCallTaskComponent } from './diagram-rest-call-task.component'; import { DiagramRestCallTaskComponent } from './diagram-rest-call-task.component';
import { DiagramGoogleDrivePublishTaskComponent } from './diagram-google-drive-publish-task.component';
// primitives // primitives
export * from './diagram-container-service-task.component'; export * from './diagram-container-service-task.component';
@ -37,6 +38,7 @@ export * from './diagram-camel-task.component';
export * from './diagram-mule-task.component'; export * from './diagram-mule-task.component';
export * from './diagram-alfresco-publish-task.component'; export * from './diagram-alfresco-publish-task.component';
export * from './diagram-rest-call-task.component'; export * from './diagram-rest-call-task.component';
export * from './diagram-google-drive-publish-task.component';
export const DIAGRAM_ACTIVITIES_DIRECTIVES: any[] = [ export const DIAGRAM_ACTIVITIES_DIRECTIVES: any[] = [
DiagramContainerServiceTaskComponent, DiagramContainerServiceTaskComponent,
@ -48,5 +50,6 @@ export const DIAGRAM_ACTIVITIES_DIRECTIVES: any[] = [
DiagramCamelTaskComponent, DiagramCamelTaskComponent,
DiagramMuleTaskComponent, DiagramMuleTaskComponent,
DiagramAlfrescoPublishTaskComponent, DiagramAlfrescoPublishTaskComponent,
DiagramRestCallTaskComponent DiagramRestCallTaskComponent,
DiagramGoogleDrivePublishTaskComponent
]; ];

View File

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

View File

@ -0,0 +1,44 @@
/*!
* @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-google-drive-publish-task',
templateUrl: './diagram-icon-google-drive-publish-task.component.html',
styleUrls: ['./diagram-icon-google-drive-publish-task.component.css']
})
export class DiagramIconGoogleDrivePublishTaskComponent {
@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 + 6, y: this.data.y + 6};
}
}

View File

@ -23,6 +23,7 @@ import { DiagramIconCamelTaskComponent } from './diagram-icon-camel-task.compone
import { DiagramIconMuleTaskComponent } from './diagram-icon-mule-task.component'; import { DiagramIconMuleTaskComponent } from './diagram-icon-mule-task.component';
import { DiagramIconAlfrescoPublishTaskComponent } from './diagram-icon-alfresco-publish-task.component'; import { DiagramIconAlfrescoPublishTaskComponent } from './diagram-icon-alfresco-publish-task.component';
import { DiagramIconRestCallTaskComponent } from './diagram-icon-rest-call-task.component'; import { DiagramIconRestCallTaskComponent } from './diagram-icon-rest-call-task.component';
import { DiagramIconGoogleDrivePublishTaskComponent } from './diagram-icon-google-drive-publish-task.component';
// primitives // primitives
export * from './diagram-icon-service-task.component'; export * from './diagram-icon-service-task.component';
@ -33,6 +34,7 @@ export * from './diagram-icon-camel-task.component';
export * from './diagram-icon-mule-task.component'; export * from './diagram-icon-mule-task.component';
export * from './diagram-icon-alfresco-publish-task.component'; export * from './diagram-icon-alfresco-publish-task.component';
export * from './diagram-icon-rest-call-task.component'; export * from './diagram-icon-rest-call-task.component';
export * from './diagram-icon-google-drive-publish-task.component';
export const DIAGRAM_ICONS_DIRECTIVES: any[] = [ export const DIAGRAM_ICONS_DIRECTIVES: any[] = [
DiagramIconServiceTaskComponent, DiagramIconServiceTaskComponent,
@ -42,5 +44,6 @@ export const DIAGRAM_ICONS_DIRECTIVES: any[] = [
DiagramIconCamelTaskComponent, DiagramIconCamelTaskComponent,
DiagramIconMuleTaskComponent, DiagramIconMuleTaskComponent,
DiagramIconAlfrescoPublishTaskComponent, DiagramIconAlfrescoPublishTaskComponent,
DiagramIconRestCallTaskComponent DiagramIconRestCallTaskComponent,
DiagramIconGoogleDrivePublishTaskComponent
]; ];

View File

@ -33,6 +33,7 @@ import { RaphaelIconCamelDirective } from './raphael-icon-camel.component';
import { RaphaelIconMuleDirective } from './raphael-icon-mule.component'; import { RaphaelIconMuleDirective } from './raphael-icon-mule.component';
import { RaphaelIconAlfrescoPublishDirective } from './raphael-icon-alfresco-publish.component'; import { RaphaelIconAlfrescoPublishDirective } from './raphael-icon-alfresco-publish.component';
import { RaphaelIconRestCallDirective } from './raphael-icon-rest-call.component'; import { RaphaelIconRestCallDirective } from './raphael-icon-rest-call.component';
import { RaphaelIconGoogleDrivePublishDirective } from './raphael-icon-google-drive-publish.component';
// primitives // primitives
export * from './raphael-circle.component'; export * from './raphael-circle.component';
@ -52,6 +53,7 @@ export * from './raphael-icon-camel.component';
export * from './raphael-icon-mule.component'; export * from './raphael-icon-mule.component';
export * from './raphael-icon-alfresco-publish.component'; export * from './raphael-icon-alfresco-publish.component';
export * from './raphael-icon-rest-call.component'; export * from './raphael-icon-rest-call.component';
export * from './raphael-icon-google-drive-publish.component';
export const RAPHAEL_DIRECTIVES: any[] = [ export const RAPHAEL_DIRECTIVES: any[] = [
RaphaelCircleDirective, RaphaelCircleDirective,
@ -69,5 +71,6 @@ export const RAPHAEL_DIRECTIVES: any[] = [
RaphaelIconCamelDirective, RaphaelIconCamelDirective,
RaphaelIconMuleDirective, RaphaelIconMuleDirective,
RaphaelIconAlfrescoPublishDirective, RaphaelIconAlfrescoPublishDirective,
RaphaelIconRestCallDirective RaphaelIconRestCallDirective,
RaphaelIconGoogleDrivePublishDirective
]; ];

View File

@ -0,0 +1,77 @@
/*!
* @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-google-drive-publish'})
export class RaphaelIconGoogleDrivePublishDirective 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 image = this.paper.image();
image.attr({'x': position.x});
image.attr({'y': position.y});
image.attr({'id': 'image3398'});
image.attr({'preserveAspectRatio': 'none'});
image.attr({'height': '16'});
image.attr({'width': '17'});
image.attr({'src': `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBA
JqcGAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAIHSURBVDiNpVI7a1RREP7mzLl3d+9mScxaiBLFwohxQcXCwjwao/gqFAQhRGOphQgmgs9oGxaV
gFhpYPUPGMFCCzEqCgETg0uK4CuFoLhZyWNf994zFrqy9xJWwQ+mOB8z33wzZ4D/BIWJppG+plstc+mjK9yttbzALHExcoDaRxdqeRUWcFkGBz7G1s152CCQ7dUAqNOLuZf
qOmi439MmhifF86e6uLj4MFXoCuVXWPkp2vZkZlkHYvRNAJYwtz79oXdMLfFMSMD2Dd9YdoSGTO9hQLoBQBESQvLpUNaZD1sGsN8d390dFBjpiwooHVBW6tvXCr2H4EFo6L
wR97pkj9h/BByWfgDrA4lRTWDvHIPOAihVaWO8txCkygu50wBAsbsnWpT2pwHEA/sgXC30Zq4BwJfHHRdY0R4nxp5mbFGEJIB5l2SjVtoMhYsBfC5EikPVh7Z4uFyqnKq43
hoQFrXCIydCjZbWlyl+79gzCDprq1dPnnyhS8nNZDmvRVmbAIDhKyL5/e2kjKi4pbwxLQZniDAOgAHAybW90aXmncp2xoSsvdVDMWBAAi69sqsvqsLxzARB7vxaMHvJDwcT
ZCVeClnhIwqC5Pb08Kp3CgBUxT4PINc4u+u54uY8FLfXLQa+sx0dRNV2eXSi6OzryK2c7Wkl0msB5OuG0JVsOvnqL03+DT8BxkC5RkIpSlIAAAAASUVORK5CYII=`});
}
}