Skip to content
This repository has been archived by the owner on Nov 22, 2019. It is now read-only.

Commit

Permalink
TEIIDTOOLS-397 Add download action to dataservices list view
Browse files Browse the repository at this point in the history
  • Loading branch information
mdrillin committed Mar 27, 2018
1 parent 1ed97ff commit 0bf967a
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 4 deletions.
Expand Up @@ -5,6 +5,13 @@
font-family: "FontAwesome";
}

/* Adds an icon to the left of the download action item in dropdown of kebab. */
.object-list .secondary-action[title*="Download"]:before {
color: var(--card-action-icon-color);
content: "\f019";
font-family: "FontAwesome";
}

/* Adds an icon to the left of the publish action item in dropdown of kebab. */
.object-list .secondary-action[title*="Publish"]:before {
color: var(--card-action-icon-color);
Expand Down
Expand Up @@ -39,7 +39,14 @@
</ng-template>
<ng-template #actionTemplate let-item="item" let-index="index">
<pfng-action class="list-pf-actions"
[config]="getActionConfig( item, editActionTemplate, testActionTemplate, quickLookActionTemplate, activateActionTemplate, publishActionTemplate, refreshActionTemplate, deleteActionTemplate )"
[config]="getActionConfig( item, editActionTemplate,
testActionTemplate,
quickLookActionTemplate,
activateActionTemplate,
publishActionTemplate,
downloadActionTemplate,
refreshActionTemplate,
deleteActionTemplate )"
(onActionSelect)="handleAction($event, item)">
<ng-template #editActionTemplate let-action="action">
<span class="fa fa-edit">&nbsp;</span>{{ action.title }}
Expand All @@ -56,6 +63,9 @@
<ng-template #publishActionTemplate let-action="action">
<span class="fa fa-external-link-alt">&nbsp;</span>{{ action.title }}
</ng-template>
<ng-template #downloadActionTemplate let-action="action">
<span class="fa fa-download">&nbsp;</span>{{ action.title }}
</ng-template>
<ng-template #refreshActionTemplate let-action="action">
<span class="fa fa-refresh">&nbsp;</span>{{ action.title }}
</ng-template>
Expand Down
Expand Up @@ -41,6 +41,7 @@ export class DataservicesListComponent implements OnInit {
private static readonly editActionId = "edit";
private static readonly previewActionId = "preview";
private static readonly publishActionId = "publish";
private static readonly downloadActionId = "download";
private static readonly refreshActionId = "refresh";
private static readonly testActionId = "test";

Expand All @@ -56,6 +57,7 @@ export class DataservicesListComponent implements OnInit {
@Output() public activateDataservice: EventEmitter<string> = new EventEmitter<string>();
@Output() public testDataservice: EventEmitter<string> = new EventEmitter<string>();
@Output() public publishDataservice: EventEmitter<string> = new EventEmitter<string>();
@Output() public downloadDataservice: EventEmitter<string> = new EventEmitter<string>();
@Output() public deleteDataservice: EventEmitter<string> = new EventEmitter<string>();
@Output() public editDataservice: EventEmitter<string> = new EventEmitter<string>();
@Output() public quickLookDataservice: EventEmitter<string> = new EventEmitter<string>();
Expand All @@ -79,6 +81,7 @@ export class DataservicesListComponent implements OnInit {
* @param quickLookActionTemplate {TemplateRef} the preview action template
* @param activateActionTemplate {TemplateRef} the activate action template
* @param publishActionTemplate {TemplateRef} the publish action template
* @param downloadActionTemplate {TemplateRef} the download action template
* @param refreshActionTemplate {TemplateRef} the refresh action template
* @param deleteActionTemplate {TemplateRef} the delete action template
* @returns {ActionConfig} the actions configuration
Expand All @@ -89,6 +92,7 @@ export class DataservicesListComponent implements OnInit {
quickLookActionTemplate: TemplateRef< any >,
activateActionTemplate: TemplateRef< any >,
publishActionTemplate: TemplateRef< any >,
downloadActionTemplate: TemplateRef< any >,
refreshActionTemplate: TemplateRef< any >,
deleteActionTemplate: TemplateRef< any > ): ActionConfig {
const actionConfig = {
Expand Down Expand Up @@ -137,6 +141,13 @@ export class DataservicesListComponent implements OnInit {
title: "Publish",
tooltip: "Publish this data service"
},
{
disabled: ds.serviceDeploymentLoading,
id: DataservicesListComponent.downloadActionId,
template: downloadActionTemplate,
title: "Download",
tooltip: "Download this data service"
},
{
disabled: ds.serviceDeploymentLoading,
id: DataservicesListComponent.deleteActionId,
Expand Down Expand Up @@ -202,6 +213,10 @@ export class DataservicesListComponent implements OnInit {
this.publishDataservice.emit(dataserviceName);
}

public onDownloadDataservice(dataserviceName: string): void {
this.downloadDataservice.emit(dataserviceName);
}

public onDeleteDataservice(dataserviceName: string): void {
this.deleteDataservice.emit(dataserviceName);
}
Expand All @@ -222,6 +237,9 @@ export class DataservicesListComponent implements OnInit {
case DataservicesListComponent.deleteActionId:
this.onDeleteDataservice( item.getId() );
break;
case DataservicesListComponent.downloadActionId:
this.onDownloadDataservice( item.getId() );
break;
case DataservicesListComponent.editActionId:
this.onEditDataservice( item.getId() );
break;
Expand Down
3 changes: 2 additions & 1 deletion ngapp/src/app/dataservices/dataservices.component.html
Expand Up @@ -86,7 +86,8 @@ <h1 class="card-pf-title">
(activateDataservice)="onActivate($event)" (testDataservice)="onTest($event)"
(publishDataservice)="onPublish($event)" (deleteDataservice)="onDelete($event)"
(editDataservice)="onEdit($event)" (quickLookDataservice)="onQuickLook($event)"
(dataserviceSelected)="onSelected($event)" (dataserviceDeselected)="onDeselected($event)"></app-dataservices-list>
(downloadDataservice)="onDownload($event)" (dataserviceSelected)="onSelected($event)"
(dataserviceDeselected)="onDeselected($event)"></app-dataservices-list>
<app-dataservices-cards *ngIf="isCardLayout" [dataservices]="filteredDataservices" [selectedDataservices]="selectedDataservices"
(activateDataservice)="onActivate($event)" (testDataservice)="onTest($event)"
(publishDataservice)="onPublish($event)" (deleteDataservice)="onDelete($event)"
Expand Down
2 changes: 1 addition & 1 deletion ngapp/src/app/dataservices/dataservices.component.ts
Expand Up @@ -437,7 +437,7 @@ export class DataservicesComponent extends AbstractPageComponent implements OnIn
},
(error) => {
self.exportNotificationHeader = this.downloadFailedHeader;
self.exportNotificationMessage = " Failed to downlaod dataservice " + svcName;
self.exportNotificationMessage = " Failed to download dataservice " + svcName;
self.exportNotificationType = NotificationType.DANGER;
this.logger.error("[DataservicesPageComponent] Download dataservice " + svcName + " failed.");
}
Expand Down
2 changes: 1 addition & 1 deletion ngapp/src/app/shared/test-data.service.ts
Expand Up @@ -22,7 +22,7 @@ import { ServiceCatalogSource } from "@connections/shared/service-catalog-source
import { Dataservice } from "@dataservices/shared/dataservice.model";
import { VdbStatus } from "@dataservices/shared/vdb-status.model";
import { Vdb } from "@dataservices/shared/vdb.model";
import { QueryResults } from "../dataservices/shared/query-results.model";
import { QueryResults } from "@dataservices/shared/query-results.model";

@Injectable()
export class TestDataService {
Expand Down

0 comments on commit 0bf967a

Please sign in to comment.