Skip to content

Commit

Permalink
feat: First iteration of example content for openmfp (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
rrogoda authored Feb 7, 2025
1 parent 0ff73fb commit ab81023
Show file tree
Hide file tree
Showing 19 changed files with 557 additions and 34 deletions.
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"ng": "ng",
"start": "ng serve ui",
"start:wc": "ng serve wc --single-bundle --no-live-reload",
"start:wc": "ng serve wc --single-bundle --no-live-reload --port=4201",
"build": "ng build ui",
"build:wc": "ng build wc --single-bundle --output-hashing none",
"build-prod": "ng build ui -c production",
Expand Down
4 changes: 4 additions & 0 deletions frontend/projects/ui/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ import { CatalogComponent } from './catalog/catalog.component';
import { CatalogItemDetailsComponent } from './catalog-item-details/catalog-item-details.component';
import { OpenmcpComponent } from './openmcp/openmcp.component';
import { IronCoreComponent } from './iron-core/iron-core.component';
import { ShowcaseComponent } from './showcase/showcase.component';
import { ShowcaseDetailsComponent } from './showcase/showcase-details/showcase-details.component';

export const routes: Routes = [
{ path: 'showcase', component: ShowcaseComponent },
{ path: 'showcase/showcase-details', component: ShowcaseDetailsComponent },
{ path: 'global-catalog', component: CatalogComponent },
{
path: 'catalog-item/:catalogItemId',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<ui5-card class="card">
<ui5-card-header slot="header" title-text="Congratulations !"
subtitle-text="Click below to navigate back">
</ui5-card-header>
<div class="content">
<ui5-button (click)="navigate()">Click here !</ui5-button>
</div>
</ui5-card>

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.card {
width: 300px;
}

.content {
margin-left: 10px;
padding: 5px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Component } from '@angular/core';
import { linkManager } from '@luigi-project/client';
import { Ui5WebcomponentsModule } from '@ui5/webcomponents-ngx';

@Component({
selector: 'app-showcase-details',
standalone: true,
imports: [Ui5WebcomponentsModule],
templateUrl: './showcase-details.component.html',
styleUrl: './showcase-details.component.scss'
})
export class ShowcaseDetailsComponent {

navigate() {
linkManager().fromContext('showcase').navigate(`/`);
}
}
10 changes: 10 additions & 0 deletions frontend/projects/ui/src/app/showcase/showcase.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<ui5-card class="card">
<ui5-card-header slot="header" title-text="Virtualtree navigation example"
subtitle-text="Click below to test the navigation">
</ui5-card-header>
<div class="content">
<ui5-button (click)="navigate()">Click here !</ui5-button>
</div>
</ui5-card>


8 changes: 8 additions & 0 deletions frontend/projects/ui/src/app/showcase/showcase.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.card {
width: 300px;
}

.content {
margin-left: 10px;
padding: 5px;
}
17 changes: 17 additions & 0 deletions frontend/projects/ui/src/app/showcase/showcase.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Component } from '@angular/core';
import { Ui5WebcomponentsModule } from '@ui5/webcomponents-ngx';
import { linkManager } from '@luigi-project/client';

@Component({
selector: 'app-showcase',
standalone: true,
imports: [Ui5WebcomponentsModule],
templateUrl: './showcase.component.html',
styleUrl: './showcase.component.scss'
})
export class ShowcaseComponent {

navigate() {
linkManager().fromContext('showcase').navigate(`/showcase-details`);
}
}
33 changes: 0 additions & 33 deletions frontend/projects/ui/src/assets/accounts.json

This file was deleted.

49 changes: 49 additions & 0 deletions frontend/projects/ui/src/assets/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "configuration-examples-overview",
"creationTimestamp": "",
"luigiConfigFragment": {
"data": {
"nodes": [
{
"entityType": "global",
"pathSegment": "home",
"hideFromNav": true,
"defineEntity": {
"id": "main"
},
"children": [
{
"pathSegment": "overview",
"label": "Configuration examples overview",
"icon": "home",
"defineEntity": {
"id": "overview"
},
"compound": {
"renderer": {
"use": "grid",
"config": {
"columns": "1fr 1fr 1fr 1fr"
}
}
}
}
]
},
{
"entityType": "main.overview::compound",
"url": "https://luigiwebcomponents.gitlab.io/layouts/panelHeader.js",
"context": {
"border": "shadow",
"title": "Welcome to OpenMFP Portal",
"description": "Click on Show Example button to preview particular feature."
},
"layoutConfig": {
"row": "1",
"column": "1 / -1"
}
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "entity-definition-example",
"creationTimestamp": "",
"luigiConfigFragment": {
"data": {
"nodes": [
{
"entityType": "main",
"pathSegment": "firstExample",
"hideFromNav": true,
"defineEntity": {
"id": "first-example"
},
"compound": {
"renderer": {
"use": "grid",
"config": {
"columns": "1fr 1fr 1fr 1fr"
}
}
}
},
{
"entityType": "main.first-example::compound",
"url": "https://luigiwebcomponents.gitlab.io/layouts/panelHeader.js",
"context": {
"border": "shadow",
"title": "{{firstExampleTitle}}",
"description": "{{firstExampleDescription}}"
}
}
],
"texts": [
{
"locale": "",
"textDictionary": {
"firstExampleTitle": "Definition of an Entity",
"firstExampleDescription": "Entity is basic building block of configuration."
}
},
{
"locale": "en",
"textDictionary": {
"firstExampleTitle": "Definition of an Entity",
"firstExampleDescription": "Entity is basic building block of configuration."
}
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "web-component-integration-example",
"creationTimestamp": "",
"luigiConfigFragment": {
"data": {
"nodes": [
{
"entityType": "main",
"pathSegment": "fourthExample",
"hideFromNav": true,
"defineEntity": {
"id": "fourth-example"
},
"compound": {
}
},
{
"entityType": "main.fourth-example::compound",
"urlSuffix": "/ui/example-content/main.js#account-overview",
"context": {
"title": "Showcase"
},
"layoutConfig": {
"row": "1",
"column": "1 / -1"
},
"webcomponent": {
"selfRegistered": true
}
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "micro-frontend-iframe-example",
"creationTimestamp": "",
"luigiConfigFragment": {
"data": {
"nodes": [
{
"entityType": "main",
"pathSegment": "secondExample",
"virtualTree": true,
"navigationContext": "showcase",
"urlSuffix": "/ui/example-content/index.html#/showcase",
"loadingIndicator": {
"enabled": false
},
"requiredIFramePermissions": {
"sandbox": [
"allow-forms",
"allow-modals",
"allow-popups",
"allow-popups-to-escape-sandbox",
"allow-same-origin",
"allow-scripts",
"allow-download"
],
"allow": [
"clipboard-read",
"clipboard-write"
]
}
}
]
}
}
}
4 changes: 4 additions & 0 deletions frontend/projects/wc/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { DataChartComponent } from './charts/data-chart/data-chart.component';
import { DoughnutChartComponent } from './charts/doughnut-chart/doughnut-chart.component';
import { EnabledCapabilitiesComponent } from './enabled-capabilities/enabled-capabilities.component';
import { RootOverviewComponent } from './root-overview/root-overview.component';
import { ShowcaseComponent } from './showcase/showcase.component';

@NgModule({
imports: [
Expand All @@ -17,6 +18,7 @@ import { RootOverviewComponent } from './root-overview/root-overview.component';
DoughnutChartComponent,
EnabledCapabilitiesComponent,
RootOverviewComponent,
ShowcaseComponent,
],
})
export class AppModule implements DoBootstrap {
Expand All @@ -37,6 +39,7 @@ export class AppModule implements DoBootstrap {
const accountOverviewComponent = createCustomElement(AccountOverviewComponent, {injector: this.injector});
const rootOverviewComponent = createCustomElement(RootOverviewComponent, {injector: this.injector});
const enabledCapabilitiesComponent = createCustomElement(EnabledCapabilitiesComponent, {injector: this.injector});
const showcaseComponent = createCustomElement(ShowcaseComponent, {injector: this.injector});

try {
this.registerWebcomponent(dataChartComponent, 'chart');
Expand All @@ -45,6 +48,7 @@ export class AppModule implements DoBootstrap {
this.registerWebcomponent(accountOverviewComponent, 'account-overview');
this.registerWebcomponent(rootOverviewComponent, 'root-overview');
this.registerWebcomponent(enabledCapabilitiesComponent, 'enabled-capabilities');
this.registerWebcomponent(showcaseComponent, 'showcase');
} catch (e) {
if (!customElements.get('data-chart')) {
customElements.define('data-chart', dataChartComponent);
Expand Down
16 changes: 16 additions & 0 deletions frontend/projects/wc/src/app/showcase/showcase.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="showcase-cards">
@for (item of showcaseItems; track $index) {
<ui5-card class="showcase-card">
<ui5-panel fixed>
<div class="header">
<ui5-title class="title" level="H4">{{item.header}}</ui5-title>
@if(item.linkToExample) {
<ui5-button class="button" design="Emphasized" (ui5Click)="show(item.linkToExample)">Show Example</ui5-button>
}
</div>
<ui5-label class="description">{{item.label}}</ui5-label>
<ui5-text class="content">{{item.example}}</ui5-text>
</ui5-panel>
</ui5-card>
}
</div>
35 changes: 35 additions & 0 deletions frontend/projects/wc/src/app/showcase/showcase.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.showcase-cards {
display: flex;
flex-wrap: wrap;
gap: 1rem;
margin-top: 1rem;
}

.showcase-card {
display: block;

.description {
margin: 10px;
}

.content {
white-space: pre-wrap;
word-spacing: 4px;
}
}

.header {
padding: 10px;
display: flex;

.title {
padding-top: 5px;
}

.button {
margin-left: 30px;
padding: 5px;
border-radius: 5px;
}
}

Loading

0 comments on commit ab81023

Please sign in to comment.