@@ -3,6 +3,7 @@ import {FilesService} from "../../services/files.service";
33import * as uuid from "uuid" ;
44import { UploadFileComponent } from "../upload-file/upload-file.component" ;
55import { MessageService } from "primeng/api" ;
6+ import { Container } from "../../utils/Container" ;
67
78@Component ( {
89 selector : 'app-start' ,
@@ -11,8 +12,8 @@ import {MessageService} from "primeng/api";
1112} )
1213export class StartComponent implements OnInit {
1314 idContainer : string = "" ;
14- containers : any [ ] = [ ] ;
15- selected : any ;
15+ containers : Container [ ] = [ ] ;
16+ selected : Container ;
1617
1718 @ViewChild ( UploadFileComponent , { static : false } ) uploaderCmp ;
1819
@@ -29,9 +30,8 @@ export class StartComponent implements OnInit {
2930 }
3031
3132 async remove ( ) {
32- const code = this . selected ;
33+ const code = this . selected . name ;
3334 const listOfFiles : any = await this . filesService . listOfFilesInContainer ( code ) ;
34- console . log ( "ListOfBlobs" , listOfFiles ) ;
3535
3636 for ( const i in listOfFiles ) {
3737 const idFile = listOfFiles [ i ] ;
@@ -48,9 +48,31 @@ export class StartComponent implements OnInit {
4848
4949 async onRowSelect ( data : any ) {
5050 this . selected = data . data ;
51- const code = this . selected ;
51+ const code = this . selected . name ;
5252 const listOfFiles : any = await this . filesService . listOfFilesInContainer ( code ) ;
53- console . log ( "onRowSelect" , data , listOfFiles ) ;
53+ const url = ( listOfFiles . length > 0 ) ? await this . filesService . getStorageLink ( code , listOfFiles [ 0 ] ) : "" ;
54+
55+ console . log ( "onRowSelect" , data , listOfFiles , url ) ;
56+ }
57+
58+ async open ( event , row : Container ) {
59+ const code = row . name ;
60+ const listOfFiles : any = await this . filesService . listOfFilesInContainer ( code ) ;
61+ const url = ( listOfFiles . length > 0 ) ? await this . filesService . getStorageLink ( code , listOfFiles [ 0 ] ) : "" ;
62+
63+ //this._loading = true;
64+ ( event as MouseEvent ) . preventDefault ( ) ;
65+ if ( url != "" ) window . open ( "" + url , "_blank" )
66+ // this.dataService.getLink(this.idProject, id)
67+ // .pipe(finalize(() => this._loading = false))
68+ // .subscribe(
69+ // data => {
70+ // window.open(data, '_blank');
71+ // },
72+ // error => {
73+ // this.messageService.showMessage(error, 'Error receiving data');
74+ // }
75+ // );
5476 }
5577
5678 fileUploadSuccess ( data : any ) {
0 commit comments