Merge "feat(card):add button click event"
diff --git a/components/datalake-handler/admin/src/src/app/shared/modules/card/card.component.html b/components/datalake-handler/admin/src/src/app/shared/modules/card/card.component.html
index 7081054..7b8d865 100644
--- a/components/datalake-handler/admin/src/src/app/shared/modules/card/card.component.html
+++ b/components/datalake-handler/admin/src/src/app/shared/modules/card/card.component.html
@@ -17,7 +17,7 @@
limitations under the License.
============LICENSE_END=========================================================
-->
-<div class="card-panel d-flex flex-column">
+<div class="card-panel d-flex flex-column" (click)="cardClick()">
<div class="d-flex flex-row p-2">
<div class="dl-h4 title mr-auto ml-3 mt-2">{{ this.title }}</div>
@@ -26,10 +26,10 @@
<i class="fas fa-ellipsis-h fa-2x dl-icon-enable"></i>
</a>
<div class="dropdown-menu action-icon-btn">
- <button class="dropdown-item" type="button">
+ <button class="dropdown-item" type="button" (click)="cardMoreAction('edit')">
{{ 'EDIT' | translate }}
</button>
- <button class="dropdown-item" type="button">
+ <button class="dropdown-item" type="button" (click)="cardMoreAction('delete')">
{{ 'DELETE' | translate }}
</button>
</div>
diff --git a/components/datalake-handler/admin/src/src/app/shared/modules/card/card.component.ts b/components/datalake-handler/admin/src/src/app/shared/modules/card/card.component.ts
index c5f90d2..9be0b84 100644
--- a/components/datalake-handler/admin/src/src/app/shared/modules/card/card.component.ts
+++ b/components/datalake-handler/admin/src/src/app/shared/modules/card/card.component.ts
@@ -23,7 +23,7 @@
* @author Ekko Chang
*
*/
-import { Component, OnInit, Input } from "@angular/core";
+import { Component, OnInit, Input, Output, EventEmitter } from "@angular/core";
@Component({
selector: "app-card",
@@ -38,7 +38,19 @@
@Input() modifiable: boolean;
@Input() iconSize: string[] = ["sm", "md", "lg"];
+ @Output() cardAction = new EventEmitter<object>();
+ @Output() edit = new EventEmitter<object>();
+
constructor() {}
ngOnInit() {}
+
+ cardClick() {
+ this.cardAction.emit();
+ }
+
+ cardMoreAction(type) {
+ this.edit.emit(type);
+ }
+
}
diff --git a/components/datalake-handler/admin/src/src/app/views/test/test.component.html b/components/datalake-handler/admin/src/src/app/views/test/test.component.html
index 6f077f6..549fa54 100644
--- a/components/datalake-handler/admin/src/src/app/views/test/test.component.html
+++ b/components/datalake-handler/admin/src/src/app/views/test/test.component.html
@@ -3,13 +3,13 @@
<div>
<p>Module 1 -----> card</p>
<app-card [iconPath]="this.cardIconPath" [iconSize]="'md'" [subcontent]="this.cardSubcontent"
- [modifiable]="this.cardModifiable">
+ [modifiable]="this.cardModifiable" (edit)="cardMoreAction($event)">
</app-card>
<br>
<app-card [title]="this.cardTitle" [content]="this.cardContent">
</app-card>
<br>
- <app-card [iconPath]="this.cardAddicon" [iconSize]="'sm'">
+ <app-card [iconPath]="this.cardAddicon" [iconSize]="'sm'" (cardAction)="cardClick()">
</app-card>
<br>
</div>
diff --git a/components/datalake-handler/admin/src/src/app/views/test/test.component.ts b/components/datalake-handler/admin/src/src/app/views/test/test.component.ts
index 9786612..d7dbc96 100644
--- a/components/datalake-handler/admin/src/src/app/views/test/test.component.ts
+++ b/components/datalake-handler/admin/src/src/app/views/test/test.component.ts
@@ -141,4 +141,16 @@
modalRef.close();
});
}
+
+ cardMoreAction($event) {
+ if($event == "edit"){
+ this.openModalDemo()
+ }else {
+ console.log($event,"$event")
+ }
+ }
+ cardClick(){
+ this.openModalDemo();
+ }
+
}