Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AAE-29971 Buttons for dynamic component #10539

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
<div #container></div>
<mat-card>
<mat-card-content>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can Dedicated Screens be rendered without a mat-card? Intention of Dedicated Screens would be more of a full screen complex screen. I don't have a strong opinion on this but a point to consider.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried solution without mat-card. This is how it looks
image
and this is with mat-card
image
and I think that there is no big difference. Mat-card is used for all tasks. Workflow for tasks is like: show it within table and when the user wants it to be fullscreen, there is a button to do it. So your component needs to provide function to make component fullscreen and it should fit space that is left by parent.

<div #container></div>
</mat-card-content>
<mat-card-actions align="end">
<ng-content select="[buttons]"></ng-content>
</mat-card-actions>
</mat-card>
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
*/

import { ComponentFixture, TestBed } from '@angular/core/testing';

import { TaskScreenCloudComponent } from './screen-cloud.component';
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ScreenRenderingService } from '../../../services/public-api';
import { Component } from '@angular/core';
import { By } from '@angular/platform-browser';
import { ScreenRenderingService } from '../../../services/public-api';
import { TaskScreenCloudComponent } from './screen-cloud.component';

@Component({
selector: 'adf-cloud-test-component',
Expand All @@ -31,15 +30,27 @@ import { By } from '@angular/platform-browser';
})
class TestComponent {}

@Component({
selector: 'adf-cloud-test-actions-component',
template: `<adf-cloud-task-screen [taskId]="'1'" [appName]="'app-name-test'" [screenId]="'test'">
<div buttons class="adf-cloud-test-buttons">
<button>Test</button>
</div>
</adf-cloud-task-screen> `,
imports: [CommonModule, TaskScreenCloudComponent],
standalone: true
})
class TestWrapperComponent {}

describe('TaskScreenCloudComponent', () => {
let fixture: ComponentFixture<TaskScreenCloudComponent>;
let fixture: ComponentFixture<TestWrapperComponent>;
let screenRenderingService: ScreenRenderingService;

beforeEach(() => {
TestBed.configureTestingModule({
imports: [TaskScreenCloudComponent, TestComponent]
imports: [TaskScreenCloudComponent, TestComponent, TestWrapperComponent]
});
fixture = TestBed.createComponent(TaskScreenCloudComponent);
fixture = TestBed.createComponent(TestWrapperComponent);
screenRenderingService = TestBed.inject(ScreenRenderingService);
screenRenderingService.register({ ['test']: () => TestComponent });
fixture.componentRef.setInput('screenId', 'test');
Expand All @@ -50,4 +61,9 @@ describe('TaskScreenCloudComponent', () => {
const dynamicComponent = fixture.debugElement.query(By.css('.adf-cloud-test-container'));
expect(dynamicComponent).toBeTruthy();
});

it('should project content into component', async () => {
const projectedContent = fixture.debugElement.query(By.css('.adf-cloud-test-buttons'));
expect(projectedContent).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
import { CommonModule } from '@angular/common';
import { Component, ComponentRef, inject, Input, OnInit, ViewChild, ViewContainerRef } from '@angular/core';
import { ScreenRenderingService } from '../../../services/public-api';
import { MatCardModule } from '@angular/material/card';

@Component({
selector: 'adf-cloud-task-screen',
standalone: true,
imports: [CommonModule],
template: '<div #container></div>'
imports: [CommonModule, MatCardModule],
templateUrl: './screen-cloud.component.html'
})
export class TaskScreenCloudComponent implements OnInit {
/** Task id to fetch corresponding form and values. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@

<ng-container *ngSwitchCase="taskTypeEnum.Screen">
<adf-cloud-task-screen
[taskId]="taskId"
[appName]="appName"
[screenId]="screenId"
/>
[taskId]="taskId"
>
<ng-template [ngTemplateOutlet]="taskFormCloudButtons" buttons>
</ng-template>
</adf-cloud-task-screen>
</ng-container>

<ng-container *ngSwitchCase="taskTypeEnum.None">
Expand Down
Loading