summaryrefslogtreecommitdiffstats
path: root/catalog-ui/app/scripts/directives/print-graph-screen
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-06-09 03:19:04 +0300
committerMichael Lando <ml636r@att.com>2017-06-09 03:19:04 +0300
commited64b5edff15e702493df21aa3230b81593e6133 (patch)
treea4cb01fdaccc34930a8db403a3097c0d1e40914b /catalog-ui/app/scripts/directives/print-graph-screen
parent280f8015d06af1f41a3ef12e8300801c7a5e0d54 (diff)
[SDC-29] catalog 1707 rebase commit.
Change-Id: I43c3dc5cf44abf5da817649bc738938a3e8388c1 Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'catalog-ui/app/scripts/directives/print-graph-screen')
-rw-r--r--catalog-ui/app/scripts/directives/print-graph-screen/print-graph-screen.ts211
1 files changed, 0 insertions, 211 deletions
diff --git a/catalog-ui/app/scripts/directives/print-graph-screen/print-graph-screen.ts b/catalog-ui/app/scripts/directives/print-graph-screen/print-graph-screen.ts
deleted file mode 100644
index 8204928e6f..0000000000
--- a/catalog-ui/app/scripts/directives/print-graph-screen/print-graph-screen.ts
+++ /dev/null
@@ -1,211 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-/// <reference path="../../references"/>
-module Sdc.Directives {
- 'use strict';
-
- export interface IPrintGraphScreenScope extends ng.IScope {
- entity:Models.Components.Component;
- }
-
-
- export class PrintGraphScreenDirective implements ng.IDirective {
-
- constructor(
- private $filter: ng.IFilterService,
- private sdcMenu:Models.IAppMenu,
- private sdcConfig:Models.IAppConfigurtaion,
- private urlToBase64Service:Sdc.Services.UrlToBase64Service
- ) {}
-
- scope = {
- entity: '='
- };
- restrict = 'A';
- link = (scope:IPrintGraphScreenScope, element:any) => {
-
-
- element.bind('click', function() {
- printScreen();
- });
-
-
- // TODO we need to implement export to PDF in cytoscape
- let printScreen = ():void => {
-
- //
- // let pdf :any = new jsPDF('landscape', 'mm', 'a4');
- // pdf.setProperties({
- // title: scope.entity.name,
- // subject: 'Design Snapshot for ' + scope.entity.name,
- // author: scope.entity.creatorFullName,
- // keywords: scope.entity.tags.join(', '),
- // creator: scope.entity.creatorFullName
- // });
- //
- // // A4 measures is 210 × 297 millimeters
- // let pdfWidth :number = 297,
- // pdfHeight :number = 210,
- // leftColumnWidth :number = 80;
- //
- // //left bar background
- // pdf.setDrawColor(0);
- // pdf.setFillColor(248, 249, 251);
- // pdf.rect(0, 0, leftColumnWidth, pdfHeight, 'F');
- //
- // //entity name
- // pdf.setFontSize(12);
- // pdf.setTextColor(38, 61, 77);
- // let splitTitle :any = pdf.splitTextToSize(scope.entity.name, 50);
- // pdf.text(22, 15 - (splitTitle.length - 1) * 2, splitTitle);
- //
- // //line
- // pdf.setLineWidth(0.2);
- // pdf.setDrawColor(208, 209, 213);
- // pdf.line(0, 28, leftColumnWidth, 28);
- //
- //
- // pdf.setFontSize(10);
- // let properties :any = getPdfProperties();
- //
- // let topOffset :number = 39, lines;
- // properties.forEach( (item:any) => {
- // if (!item.value) {
- // return;
- // }
- // if (item.title === 'Description:') {
- // topOffset += 5;
- // }
- //
- // pdf.setTextColor(38, 61, 77);
- // pdf.text(5, topOffset, item.title);
- // pdf.setTextColor(102, 102, 102);
- // lines = pdf.splitTextToSize(item.value, 49);
- // pdf.text(5 + item.offset, topOffset, lines[0]);
- // if (lines.length > 1) {
- // lines = pdf.splitTextToSize(item.value.substring(lines[0].length + 1), 65);
- // if (lines.length > 8) {
- // lines = lines.slice(0, 7);
- // lines[lines.length - 1] += '...';
- // }
- // pdf.text(5, topOffset + 4, lines);
- // topOffset += 4 * (lines.length);
- // }
- //
- // topOffset += 6;
- // });
- //
- //
- // //another background in case the text was too long
- // let declarationLineOffset :number = 176;
- // pdf.setDrawColor(0);
- // pdf.setFillColor(248, 249, 251);
- // pdf.rect(0, declarationLineOffset, leftColumnWidth, pdfHeight - declarationLineOffset, 'F');
- // //line
- // pdf.setLineWidth(0.2);
- // pdf.setDrawColor(208, 209, 213);
- // pdf.line(0, declarationLineOffset, leftColumnWidth, declarationLineOffset);
- //
- // //declaration
- // pdf.setFontSize(10.5);
- // pdf.setTextColor(38, 61, 77);
- // pdf.text(5, 185, 'Declaration');
- // pdf.setFontSize(9);
- // pdf.setTextColor(102, 102, 102);
- // pdf.setFontType('bold');
- // pdf.text(5, 190, this.$filter('translate')('PDF_FILE_DECLARATION_BOLD'));
- // pdf.setFontType('normal');
- // pdf.text(5, 194, pdf.splitTextToSize(this.$filter('translate')('PDF_FILE_DECLARATION'), 65));
- //
- // //entity icon
- // let self = this;
- // let addEntityIcon:Function = () => {
- // let iconPath:string = self.sdcConfig.imagesPath + '/styles/images/';
- // if (scope.entity.isService()) {
- // iconPath += 'service-icons/' + scope.entity.icon + '.png';
- // } else {
- // iconPath += 'resource-icons/' + scope.entity.icon + '.png';
- // }
- // self.urlToBase64Service.downloadUrl(iconPath, (base64string:string):void => {
- // if (base64string) {
- // pdf.addImage(base64string, 'JPEG', 5, 7, 15, 15);
- // }
- // pdf.save(scope.entity.name + '.pdf');
- // });
- // };
- //
- // //actual snapshop of canvas
- //
- // let diagramDiv :any = document.getElementById('myDiagram');
- // let diagram :any = null;// Sdc.Graph.Diagram.fromDiv(diagramDiv), canvasImg = new Image();
- // diagram.startTransaction('print screen');
- // let canvasImgBase64:any = diagram.makeImageData({
- // //scale: 1,
- // // size: new Sdc.Graph.Size(pdfHeight * 5, NaN),
- // background: 'white',
- // type: 'image/jpeg'
- // });
- // diagramDiv.firstElementChild.toDataURL();
- // diagram.commitTransaction('print screen');
- //
- // canvasImg.onload = () => {
- // if (canvasImg.height > 0) {
- // let canvasImgRatio:number = Math.min((pdfWidth - leftColumnWidth - 15) / canvasImg.width, pdfHeight / canvasImg.height);
- // let canvasImgWidth:number = canvasImg.width * canvasImgRatio,
- // canvasImgHeight:number = canvasImg.height * canvasImgRatio;
- // let canvasImgOffset:number = (pdfHeight - canvasImgHeight) / 2;
- // pdf.addImage(canvasImg, 'JPEG', leftColumnWidth, canvasImgOffset, canvasImgWidth, canvasImgHeight);
- //
- // addEntityIcon();
- // }
- // };
- //
- // if(canvasImg.src === 'data:,') { //empty canvas
- // addEntityIcon();
- // } else {
- // canvasImg.src = canvasImgBase64;
- // }
- };
-
- let getPdfProperties = ():Array<any> => {
- return [
- {title: this.$filter('translate')('GENERAL_LABEL_TYPE'), value: scope.entity.getComponentSubType(), offset: 10},
- {title: this.$filter('translate')('GENERAL_LABEL_VERSION'), value: scope.entity.version, offset: 15},
- {title: this.$filter('translate')('GENERAL_LABEL_CATEGORY'), value: scope.entity.categories.length ? scope.entity.categories[0].name : '', offset: 16},
- {title: this.$filter('translate')('GENERAL_LABEL_CREATION_DATE'), value: this.$filter('date')(scope.entity.creationDate, 'MM/dd/yyyy'), offset: 24},
- {title: this.$filter('translate')('GENERAL_LABEL_AUTHOR'), value: scope.entity.creatorFullName, offset: 13},
- {title: this.$filter('translate')('GENERAL_LABEL_CONTACT_ID'), value: scope.entity.contactId, offset: 41},
- {title: this.$filter('translate')('GENERAL_LABEL_STATUS'), value: (<any>this.sdcMenu).LifeCycleStatuses[scope.entity.lifecycleState].text, offset: 13},
- {title: this.$filter('translate')('GENERAL_LABEL_PROJECT_CODE'), value: scope.entity.projectCode, offset: 15},
- {title: this.$filter('translate')('GENERAL_LABEL_DESCRIPTION'), value: scope.entity.description, offset: 20},
- {title: this.$filter('translate')('GENERAL_LABEL_TAGS'), value: scope.entity.tags.join(', '), offset: 10}
- ];
- };
-
- };
-
- public static factory = ($filter:ng.IFilterService, sdcMenu:Models.IAppMenu, sdcConfig:Models.IAppConfigurtaion, urlToBase64Service:Sdc.Services.UrlToBase64Service)=> {
- return new PrintGraphScreenDirective($filter, sdcMenu, sdcConfig, urlToBase64Service);
- };
-
- }
-
- PrintGraphScreenDirective.factory.$inject = ['$filter', 'sdcMenu', 'sdcConfig', 'Sdc.Services.UrlToBase64Service'];
-}