@@ -4,7 +4,7 @@ import { MatDialog, MatDialogConfig } from '@angular/material/dialog'
44import { ActivatedRoute , Router } from '@angular/router'
55import * as _ from 'lodash'
66import { AddThumbnailComponent } from '../../add-thumbnail/add-thumbnail.component'
7- import { ImageCropComponent } from '../../image-crop/image-crop.component'
7+ // import { ImageCropComponent } from '../../image-crop/image-crop.component'
88import { environment } from '../../../../../../../../../../src/environments/environment'
99import { MatSnackBar } from '@angular/material/snack-bar'
1010import { SectorsService } from '../sectors.service'
@@ -63,7 +63,7 @@ export class AddSectorComponent implements OnInit {
6363 this . router . navigate ( [ `/app/home/sectors` ] )
6464 }
6565 this . isLoading = false
66- } , error => {
66+ } , error => {
6767 this . snackBar . open ( error , 'X' , { duration : sectorConstants . duration } )
6868 this . isLoading = false
6969 } )
@@ -106,7 +106,7 @@ export class AddSectorComponent implements OnInit {
106106 if ( ! file ) {
107107 return
108108 }
109- const formdata = new FormData ( )
109+ // const formdata = new FormData()
110110 const fileName = file . name
111111
112112 if (
@@ -127,58 +127,58 @@ export class AddSectorComponent implements OnInit {
127127 return
128128 }
129129
130- const dialogRef = this . dialog . open ( ImageCropComponent , {
131- width : '70%' ,
132- data : {
133- isRoundCrop : false ,
134- imageFile : file ,
135- width : sectorConstants . width ,
136- height : sectorConstants . width ,
137- isThumbnail : true ,
138- imageFileName : fileName ,
139- } ,
140- } )
130+ // const dialogRef = this.dialog.open(ImageCropComponent, {
131+ // width: '70%',
132+ // data: {
133+ // isRoundCrop: false,
134+ // imageFile: file,
135+ // width: sectorConstants.width,
136+ // height: sectorConstants.width,
137+ // isThumbnail: true,
138+ // imageFileName: fileName,
139+ // },
140+ // })
141141
142- dialogRef . afterClosed ( ) . subscribe ( {
143- next : ( result : File ) => {
144- if ( result ) {
145- formdata . append ( 'content' , result , fileName )
146- let randomNumber = ''
147- // tslint:disable-next-line: no-increment-decrement
148- for ( let i = 0 ; i < 16 ; i ++ ) {
149- randomNumber += Math . floor ( Math . random ( ) * 10 )
150- }
142+ // dialogRef.afterClosed().subscribe({
143+ // next: (result: File) => {
144+ // if (result) {
145+ // formdata.append('content', result, fileName)
146+ // let randomNumber = ''
147+ // // tslint:disable-next-line: no-increment-decrement
148+ // for (let i = 0; i < 16; i++) {
149+ // randomNumber += Math.floor(Math.random() * 10)
150+ // }
151151
152- const requestBody = {
153- request : {
154- content : {
155- code : randomNumber ,
156- contentType : 'Asset' ,
157- createdBy : this . currentUser ,
158- creator : this . currentUser ,
159- mimeType : 'image/png' ,
160- mediaType : 'image' ,
161- name : fileName ,
162- language : [ 'English' ] ,
163- license : 'CC BY 4.0' ,
164- primaryCategory : 'Asset' ,
165- } ,
166- } ,
167- }
168- this . sectorsService . createImageContent ( requestBody ) . subscribe ( ( res : any ) => {
169- this . sectorsService
170- . upload ( formdata , {
171- contentId : res . result . identifier ,
172- contentType : this . sectorsService . CONTENT_BASE_STATIC ,
173- } ) . subscribe ( ( data : any ) => {
174- if ( data . result ) {
175- this . addSectorForm . controls . appIcon . setValue ( this . generateUrl ( data . result . artifactUrl ) )
176- }
177- } )
178- } )
179- }
180- } ,
181- } )
152+ // const requestBody = {
153+ // request: {
154+ // content: {
155+ // code: randomNumber,
156+ // contentType: 'Asset',
157+ // createdBy: this.currentUser,
158+ // creator: this.currentUser,
159+ // mimeType: 'image/png',
160+ // mediaType: 'image',
161+ // name: fileName,
162+ // language: ['English'],
163+ // license: 'CC BY 4.0',
164+ // primaryCategory: 'Asset',
165+ // },
166+ // },
167+ // }
168+ // this.sectorsService.createImageContent(requestBody).subscribe((res: any) => {
169+ // this.sectorsService
170+ // .upload(formdata, {
171+ // contentId: res.result.identifier,
172+ // contentType: this.sectorsService.CONTENT_BASE_STATIC,
173+ // }).subscribe((data: any) => {
174+ // if (data.result) {
175+ // this.addSectorForm.controls.appIcon.setValue(this.generateUrl(data.result.artifactUrl))
176+ // }
177+ // })
178+ // })
179+ // }
180+ // },
181+ // })
182182 }
183183
184184 // format the URL to dispaly sector image
0 commit comments