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

Feature/container properties form #23020

Merged
merged 31 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c9f4b49
Added Tabs to Container Create Page and updated translation strings
motasimvd Sep 6, 2022
c227fd5
Added container properties component and added Inplace editor to it
motasimvd Sep 7, 2022
3583061
Removed unused comment
motasimvd Sep 8, 2022
15bd51c
Merge branch 'feature/container-properties' into feature/container-pr…
motasimvd Sep 11, 2022
e47a1fd
[WIP] Properties form UI updated
motasimvd Sep 14, 2022
b0d96dc
Added Monaco Editor to Properties Form
motasimvd Sep 19, 2022
b551ec6
Merge branch 'canary' into feature/container-properties-form
motasimvd Sep 19, 2022
8810dbf
add history and permission iframe
zulqarnainvd Sep 20, 2022
8479072
refactoring
zulqarnainvd Sep 21, 2022
8958892
create edit route for container and resolver
zulqarnainvd Sep 22, 2022
57ce542
Added controls to container form
motasimvd Sep 26, 2022
34b3f69
change component and folders name
zulqarnainvd Sep 27, 2022
2e69e8d
Added method docs, Added translations, Minor fixes
motasimvd Sep 29, 2022
c2b395f
Added missing translations
motasimvd Sep 29, 2022
adf59d6
Added MonacoEditor type model for reusability
motasimvd Sep 29, 2022
2af4929
CSS refactor
motasimvd Sep 29, 2022
260bbb2
CSS refactor
motasimvd Sep 29, 2022
8b25be2
Renamed container create component as DotContainerCreateComponent
motasimvd Sep 29, 2022
45bafe7
Component and SCSS refactor
motasimvd Oct 2, 2022
2b1d0ed
Refactored Loop editor to new component
motasimvd Oct 3, 2022
0598457
Update core-web/apps/dotcms-ui/src/app/portlets/dot-containers/dot-co…
zulqarnainvd Oct 3, 2022
69b736b
Update core-web/apps/dotcms-ui/src/app/portlets/dot-containers/dot-co…
zulqarnainvd Oct 3, 2022
52e20ab
Refactored Content Editor to new component
motasimvd Oct 3, 2022
00f0da0
Merge remote-tracking branch 'origin/feature/container-properties-for…
motasimvd Oct 3, 2022
9043a59
Fixed Permissions and History componanets
motasimvd Oct 3, 2022
d47e0c3
change css style and remove unnecessary ng deep
zulqarnainvd Oct 3, 2022
61d5453
change css style and remove unnecessary ng deep
zulqarnainvd Oct 3, 2022
87f0429
Update core-web/apps/dotcms-ui/src/app/portlets/dot-containers/dot-co…
motasimvd Oct 4, 2022
f70673e
Update core-web/apps/dotcms-ui/src/app/portlets/dot-containers/dot-co…
motasimvd Oct 4, 2022
998cba5
Removed unnecessary monaco editor initializations
motasimvd Oct 4, 2022
77f10b8
fixed box height issue
zulqarnainvd Oct 4, 2022
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
Expand Up @@ -2,13 +2,15 @@
<div class="container-create__tab-container">
Copy link
Contributor

Choose a reason for hiding this comment

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

image

missing the "dot-" prefix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alfredo-dotcms , Fixed.

<p-tabView class="container-create__tabs">
<p-tabPanel [header]="'message.containers.tab.properties' | dm">
<ng-template pTemplate="content"> Complex Content to Lazy Load 1 </ng-template>
<ng-template pTemplate="content">
<dot-container-properties></dot-container-properties>
</ng-template>
</p-tabPanel>
<p-tabPanel [header]="'message.containers.tab.permissions' | dm">
<ng-template pTemplate="content"> Complex Content to Lazy Load 2 </ng-template>
<dot-container-permissions></dot-container-permissions>
</p-tabPanel>
<p-tabPanel [header]="'message.containers.tab.history' | dm">
<ng-template pTemplate="content"> Complex Content to Lazy Load 3 </ng-template>
<dot-container-history></dot-container-history>
</p-tabPanel>
</p-tabView>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@
:host ::ng-deep {
.container-create__tab-container {
display: flex;
flex: 1;
flex-direction: column;
overflow: auto;

.container-create__tabs {
Copy link
Member

Choose a reason for hiding this comment

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

You don't need this nesting here.

.p-tabview-panels {
overflow: hidden;
flex-grow: 1;
flex-basis: 0;
}
.p-tabview-nav {
padding: 0 $spacing-4;
background: $white;
}

.p-tabview-panel {
padding: 0 $spacing-4;
padding-top: $spacing-8;
padding-top: $spacing-4;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import { ContainerCreateComponent } from './container-create.component';
import { DotPortletBaseModule } from '@components/dot-portlet-base/dot-portlet-base.module';
import { TabViewModule } from 'primeng/tabview';
import { DotMessagePipeModule } from '@pipes/dot-message/dot-message-pipe.module';
import { DotContainerPropertiesModule } from '@portlets/dot-containers/container-create/dot-container-properties/dot-container-properties.module';
import { ContainerPermissionsModule } from '@dotcms/app/portlets/dot-containers/container-create/container-permissions/container-permissions.module';
import { ContainerHistoryModule } from '@dotcms/app/portlets/dot-containers/container-create/container-history/container-history.module';

@NgModule({
declarations: [ContainerCreateComponent],
Expand All @@ -14,7 +17,11 @@ import { DotMessagePipeModule } from '@pipes/dot-message/dot-message-pipe.module
ContainerCreateRoutingModule,
DotPortletBaseModule,
TabViewModule,
DotMessagePipeModule
DotMessagePipeModule,
DotContainerPropertiesModule,
DotMessagePipeModule,
ContainerPermissionsModule,
ContainerHistoryModule
]
})
export class ContainerCreateModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<dot-portlet-box>
<dot-iframe data-testId="historyIframe" [src]="historyUrl"></dot-iframe>
</dot-portlet-box>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dot-portlet-box {
height: 100vh;
overflow: hidden;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Component, DebugElement, ElementRef, Input, ViewChild } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { ContainerHistoryComponent } from './container-history.component';
import { DotPortletBoxModule } from '@components/dot-portlet-base/components/dot-portlet-box/dot-portlet-box.module';

@Component({
selector: 'dot-iframe',
template: ''
})
export class IframeMockComponent {
@Input() src: string;
@ViewChild('iframeElement') iframeElement: ElementRef;
}

describe('ContainerHistoryComponent', () => {
let component: ContainerHistoryComponent;
let fixture: ComponentFixture<ContainerHistoryComponent>;
let de: DebugElement;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ContainerHistoryComponent, IframeMockComponent],
imports: [DotPortletBoxModule]
}).compileComponents();

fixture = TestBed.createComponent(ContainerHistoryComponent);
de = fixture.debugElement;
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});

describe('history', () => {
beforeEach(() => {
fixture.detectChanges();
});

it('should set iframe history url', () => {
const permissions = de.query(By.css('[data-testId="historyIframe"]'));
expect(permissions.componentInstance.src).toBe('/html/containers/push_history.jsp');
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Component, OnChanges, OnInit, ViewChild } from '@angular/core';
Copy link
Member

Choose a reason for hiding this comment

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

FYI I'm getting 404 in both, not sure why.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

BE changes not merged in this branch

import { IframeComponent } from '@components/_common/iframe/iframe-component';

@Component({
selector: 'dot-container-history',
templateUrl: './container-history.component.html',
styleUrls: ['./container-history.component.scss']
})
export class ContainerHistoryComponent implements OnInit, OnChanges {
Copy link
Contributor

Choose a reason for hiding this comment

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

you're missing the "Dot-" prefix also
#23018 (comment)

please check that on all Container files

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ViewChild('historyIframe') historyIframe: IframeComponent;
historyUrl = '';

ngOnInit() {
this.historyUrl = `/html/containers/push_history.jsp`;
}

ngOnChanges(): void {
if (this.historyIframe) {
this.historyIframe.iframeElement.nativeElement.contentWindow.location.reload();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { ContainerHistoryComponent } from './container-history.component';
import { DotPortletBoxModule } from '@components/dot-portlet-base/components/dot-portlet-box/dot-portlet-box.module';
import { IFrameModule } from '@components/_common/iframe';

@NgModule({
declarations: [ContainerHistoryComponent],
exports: [ContainerHistoryComponent],
imports: [CommonModule, DotPortletBoxModule, IFrameModule]
})
export class ContainerHistoryModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<dot-portlet-box>
<dot-iframe data-testId="permissionsIframe" [src]="permissionsUrl"></dot-iframe>
</dot-portlet-box>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dot-portlet-box {
height: 100vh;
overflow: hidden;
Copy link
Member

Choose a reason for hiding this comment

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

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

It is because we need 100% height of the box and hides the unnecessary scrollbar before content.

Copy link
Member

Choose a reason for hiding this comment

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

But there are vertical space from the top bar and the padding that I think is not being take into consideration here.

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Component, DebugElement, ElementRef, Input, ViewChild } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { ContainerPermissionsComponent } from './container-permissions.component';
import { DotPortletBoxModule } from '@components/dot-portlet-base/components/dot-portlet-box/dot-portlet-box.module';

@Component({
selector: 'dot-iframe',
template: ''
})
export class IframeMockComponent {
@Input() src: string;
@ViewChild('iframeElement') iframeElement: ElementRef;
}

describe('ContainerPermissionsComponent', () => {
let component: ContainerPermissionsComponent;
let fixture: ComponentFixture<ContainerPermissionsComponent>;
let de: DebugElement;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ContainerPermissionsComponent, IframeMockComponent],
imports: [DotPortletBoxModule]
}).compileComponents();

fixture = TestBed.createComponent(ContainerPermissionsComponent);
de = fixture.debugElement;
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});

describe('permissions', () => {
beforeEach(() => {
fixture.detectChanges();
});

it('should set iframe permissions url', () => {
const permissions = de.query(By.css('[data-testId="permissionsIframe"]'));
expect(permissions.componentInstance.src).toBe('/html/containers/permissions.jsp');
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'dot-container-permissions',
templateUrl: './container-permissions.component.html',
styleUrls: ['./container-permissions.component.scss']
})
export class ContainerPermissionsComponent implements OnInit {
permissionsUrl = '';

ngOnInit() {
this.permissionsUrl = `/html/containers/permissions.jsp`;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { ContainerPermissionsComponent } from './container-permissions.component';
import { DotPortletBoxModule } from '@components/dot-portlet-base/components/dot-portlet-box/dot-portlet-box.module';
import { IFrameModule } from '@components/_common/iframe';

@NgModule({
declarations: [ContainerPermissionsComponent],
exports: [ContainerPermissionsComponent],
imports: [CommonModule, DotPortletBoxModule, IFrameModule]
})
export class ContainerPermissionsModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<ng-container *ngIf="vm$ | async as vm">
<div class="dot-container-properties__title-container">
<p-inplace #editText>
<ng-template pTemplate="content">
<span class="p-input-icon-right">
<i class="pi pi-times" (click)="editText.deactivate()"></i>
<input type="text" pInputText />
</span>
</ng-template>
<ng-template pTemplate="display">
Click to Edit
Copy link
Contributor

Choose a reason for hiding this comment

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

language key

<i class="pi pi-pencil"></i>
</ng-template>
</p-inplace>
</div>
<div class="field">
<label for="description" class="block">Description</label>
Copy link
Contributor

Choose a reason for hiding this comment

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

language key

<input id="description" type="text" pInputText />
</div>
<div class="field">
<label for="max-contents" class="block">Max Contents</label>
Copy link
Contributor

Choose a reason for hiding this comment

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

language key

<input id="max-contents" type="text" pInputText />
<button pButton class="p-button-secondary" type="button" label="Clear"></button>
<button pButton type="button" label="content type code"></button>
</div>

<div class="dot-container-properties__code-container-outer">
<form [formGroup]="form">
<div class="dot-container-properties__pre-post-loop">
<div
class="dot-container-properties__pre-post-loop-inplace"
*ngIf="!vm.showPrePostLoopInput"
>
<button
pButton
class="p-button-outlined p-button-secondary"
type="button"
label="ADD PRE AND POST LOOP CODE"
Copy link
Contributor

Choose a reason for hiding this comment

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

language key

(click)="showLoopInput()"
></button>
</div>
<div *ngIf="vm.showPrePostLoopInput">
<label>Pre-loop</label>
Copy link
Contributor

Choose a reason for hiding this comment

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

language key

<dot-textarea-content
formControlName="body"
#value
height="100%"
formControlName="body"
[show]="['code']"
language="html"
(monacoInit)="initEditor($event)"
></dot-textarea-content>
</div>
</div>
<div class="dot-container-properties__content-tab-container">
<label>Content Type and Code</label>
Copy link
Contributor

Choose a reason for hiding this comment

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

language key

<p-tabView
[scrollable]="true"
(onChange)="handleChange($event)"
[activeIndex]="vm.activeTabIndex"
>
<p-tabPanel headerStyleClass="tab-panel-btn">
<ng-template pTemplate="header">
<i
class="pi pi-plus"
(click)="handleChange($event); actionsMenu.toggle($event)"
></i>
<p-menu
#actionsMenu
[popup]="true"
[model]="vm.contentTypes"
appendTo="body"
></p-menu>
</ng-template>
</p-tabPanel>
<p-tabPanel closable="true" header="Content (Generic)">
<dot-textarea-content
formControlName="body"
#value
height="100%"
formControlName="body"
[show]="['code']"
language="html"
(monacoInit)="initEditor($event)"
></dot-textarea-content>
</p-tabPanel>
</p-tabView>
</div>
<div class="dot-container-properties__pre-post-loop">
<div
class="dot-container-properties__pre-post-loop-inplace"
*ngIf="!vm.showPrePostLoopInput"
>
<button
pButton
class="p-button-outlined p-button-secondary"
type="button"
label="ADD PRE AND POST LOOP CODE"
></button>
</div>
<div *ngIf="vm.showPrePostLoopInput">
<label>Post-loop</label>
Copy link
Contributor

Choose a reason for hiding this comment

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

language key

<dot-textarea-content
formControlName="body"
#value
height="100%"
formControlName="body"
[show]="['code']"
language="html"
(monacoInit)="initEditor($event)"
></dot-textarea-content>
</div>
</div>
</form>
</div>
</ng-container>
Loading