Skip to content

Commit

Permalink
Merge branch 'hotfix/2.1.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
denis-yuen committed Jun 11, 2018
2 parents f1cd0bd + b8038be commit 0e6edad
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/app/container/paramfiles/paramfiles.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</div>
<div *ngIf="content && _selectedVersion?.valid" class="code-copy">
<div class="code-copy-button btn-group">
<a *ngIf="(published$ | async)" download [href]="downloadFilePath" class="btn btn-default" type="button" title="{{filePath}}">
<a *ngIf="(published$ | async)" href id="downloadLinkParams" (click)="downloadFile(currentFile, 'downloadLinkParams')" class="btn btn-default" type="button" title="{{filePath}}">
<span class="glyphicon glyphicon-download"></span>
</a>
<button class="btn btn-default" type="button" ngxClipboard [cbContent]="content" [ngClass]="{'btn-copy':toolCopyBtn === 'test_param_file'}"
Expand Down
25 changes: 13 additions & 12 deletions src/app/container/paramfiles/paramfiles.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { ContainersService } from '../../shared/swagger';
import { Component, Input, ElementRef, OnInit, AfterViewChecked} from '@angular/core';
import { AfterViewChecked, Component, ElementRef, Input } from '@angular/core';
import { Observable } from 'rxjs/Observable';

import { HighlightJsService } from '../../shared/angular2-highlight-js/lib/highlight-js.module';

import { ContainerService } from '../../shared/container.service';
import { ParamfilesService } from './paramfiles.service';
import { EntryFileSelector } from '../../shared/selectors/entry-file-selector';

import { FileService } from '../../shared/file.service';
import { EntryFileSelector } from '../../shared/selectors/entry-file-selector';
import { ContainersService } from '../../shared/swagger';
import { Tag } from '../../shared/swagger/model/tag';
import { ParamfilesService } from './paramfiles.service';

@Component({
selector: 'app-paramfiles-container',
Expand All @@ -45,12 +42,12 @@ export class ParamfilesComponent extends EntryFileSelector implements AfterViewC
public downloadFilePath: string;

constructor(private containerService: ContainerService, private containersService: ContainersService,
private highlightJsService: HighlightJsService,
private paramfilesService: ParamfilesService,
public fileService: FileService,
private elementRef: ElementRef) {
private highlightJsService: HighlightJsService,
private paramfilesService: ParamfilesService,
public fileService: FileService,
private elementRef: ElementRef) {
super();
this.published$ = this.containerService.toolIsPublished$;
this.published$ = this.containerService.toolIsPublished$;
}
getDescriptors(version): Array<any> {
return this.paramfilesService.getDescriptors(this._selectedVersion);
Expand Down Expand Up @@ -79,4 +76,8 @@ export class ParamfilesComponent extends EntryFileSelector implements AfterViewC
getFilePath(file): string {
return this.fileService.getFilePath(file);
}

downloadFile(file, id): void {
this.fileService.downloadFile(file, id);
}
}
12 changes: 12 additions & 0 deletions src/app/shared/file.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,16 @@ export class FileService {
}
return null;
}

// Downloads a file
// TODO: Temporary, need to update test param endpoint to return raw file based on path
downloadFile(file, id): void {
let filename = 'dockstore.txt';
if (file != null) {
const splitFileName = (file.path).split('/');
filename = splitFileName[splitFileName.length - 1];
const data = 'data:text/plain,' + encodeURIComponent(file.content);
$('#' + id).attr('href', data).attr('download', filename);
}
}
}
2 changes: 1 addition & 1 deletion src/app/workflow/paramfiles/paramfiles.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</span>
<div *ngIf="content && _selectedVersion?.valid" class="code-copy">
<div class="code-copy-button btn-group">
<a *ngIf="(published$ | async)" download [href]="downloadFilePath" class="btn btn-default" type="button" title="{{filePath}}">
<a *ngIf="(published$ | async)" href id="downloadLinkParams" (click)="downloadFile(currentFile, 'downloadLinkParams')" class="btn btn-default" type="button" title="{{filePath}}">
<span class="glyphicon glyphicon-download"></span>
</a>
<button class="btn btn-default" type="button" ngxClipboard [cbContent]="content"
Expand Down
19 changes: 11 additions & 8 deletions src/app/workflow/paramfiles/paramfiles.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import {Component, Input, OnInit, ElementRef, AfterViewChecked} from '@angular/core';
import { AfterViewChecked, Component, ElementRef, Input } from '@angular/core';
import { Observable } from 'rxjs/Observable';

import { ParamfilesService } from '../../container/paramfiles/paramfiles.service';
import { HighlightJsService } from '../../shared/angular2-highlight-js/lib/highlight-js.module';
import { EntryFileSelector } from '../../shared/selectors/entry-file-selector';

import { FileService } from '../../shared/file.service';
import { EntryFileSelector } from '../../shared/selectors/entry-file-selector';
import { WorkflowService } from '../../shared/workflow.service';
import { WorkflowVersion } from './../../shared/swagger/model/workflowVersion';

Expand All @@ -41,10 +40,10 @@ export class ParamfilesWorkflowComponent extends EntryFileSelector implements Af
public downloadFilePath: string;

constructor(private paramfilesService: ParamfilesService,
private highlightJsService: HighlightJsService,
public fileService: FileService,
private elementRef: ElementRef,
private workflowService: WorkflowService) {
private highlightJsService: HighlightJsService,
public fileService: FileService,
private elementRef: ElementRef,
private workflowService: WorkflowService) {
super();
this.published$ = this.workflowService.workflowIsPublished$;
}
Expand Down Expand Up @@ -75,4 +74,8 @@ export class ParamfilesWorkflowComponent extends EntryFileSelector implements Af
getFilePath(file): string {
return this.fileService.getFilePath(file);
}

downloadFile(file, id): void {
this.fileService.downloadFile(file, id);
}
}

0 comments on commit 0e6edad

Please sign in to comment.