Skip to content
Snippets Groups Projects
Commit 97019c97 authored by Bilal Hassan's avatar Bilal Hassan
Browse files

working on TreeConfig

->config Representation
parent 386d4296
No related branches found
No related tags found
4 merge requests!25Draft: Resolve #78,!7fixUrlPath,!4merge dev into main,!1after meeting with zoe
...@@ -44,6 +44,7 @@ import { MatNativeDateModule } from '@angular/material/core'; ...@@ -44,6 +44,7 @@ import { MatNativeDateModule } from '@angular/material/core';
import { MomentDateModule } from '@angular/material-moment-adapter'; import { MomentDateModule } from '@angular/material-moment-adapter';
import { StationConfigComponent } from './module/pages/home/station-config/station-config.component'; import { StationConfigComponent } from './module/pages/home/station-config/station-config.component';
import {MatTreeModule} from "@angular/material/tree"; import {MatTreeModule} from "@angular/material/tree";
import { FormDialogComponent } from './module/components/customUX/forms/form-dialog/form-dialog.component';
const MY_DATE_FORMATS: MatDateFormats = { const MY_DATE_FORMATS: MatDateFormats = {
parse: { parse: {
...@@ -78,7 +79,8 @@ const MY_DATE_FORMATS: MatDateFormats = { ...@@ -78,7 +79,8 @@ const MY_DATE_FORMATS: MatDateFormats = {
SliderComponent, SliderComponent,
SummaryComponent, SummaryComponent,
ListIconComponent, ListIconComponent,
StationConfigComponent StationConfigComponent,
FormDialogComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
......
<div *ngIf="!isOpen" class="fixed inset-0 flex items-center justify-center z-50">
<div class="bg-white rounded-lg p-6">
<h2 class="text-lg font-semibold">Modal Dialog</h2>
<form>
<div class="relative z-0 w-full mb-6 group">
<mat-form-field appearance="fill" class="w-full">
<mat-label>Username</mat-label>
<input matInput formControlName="username">
<mat-error>
Please enter a valid username.
</mat-error>
</mat-form-field>
</div>
<div class="relative z-0 w-full mb-6 group">
<mat-form-field appearance="fill" class="w-full">
<mat-label>Username</mat-label>
<input matInput formControlName="username">
<mat-error>
Please enter a valid username.
</mat-error>
</mat-form-field>
</div>
<div class="grid md:grid-cols-2 md:gap-6">
<div class="relative z-0 w-full mb-6 group">
<mat-form-field appearance="fill" class="w-full">
<mat-label>Username</mat-label>
<input matInput formControlName="username">
<mat-error>
Please enter a valid username.
</mat-error>
</mat-form-field>
</div>
<div class="relative z-0 w-full mb-6 group">
<mat-form-field appearance="fill" class="w-full">
<mat-label>Username</mat-label>
<input matInput formControlName="username">
<mat-error>
Please enter a valid username.
</mat-error>
</mat-form-field>
</div>
</div>
<div class="relative w-full flex justify-between bg-danger">
<button type="submit" class=" my-2 text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">Submit</button>
<button class=" mt-4 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600" (click)="closeModal()">Close</button>
</div>
</form>
</div>
</div>
<div *ngIf="!isOpen" class="fixed inset-0 bg-black opacity-50"></div>
{{isOpen}}
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FormDialogComponent } from './form-dialog.component';
describe('FormDialogComponent', () => {
let component: FormDialogComponent;
let fixture: ComponentFixture<FormDialogComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ FormDialogComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(FormDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import {Component, EventEmitter, Input, Output} from '@angular/core';
@Component({
selector: 'app-form-dialog',
templateUrl: './form-dialog.component.html',
styleUrls: ['./form-dialog.component.css']
})
export class FormDialogComponent {
@Input() isOpen:boolean = false;
@Output() sizeChange = new EventEmitter<boolean>();
openModal(): void {
this.isOpen = true;
}
closeModal(): void {
this.sizeChange.emit(false);
this.isOpen = false;
}
}
<section class="mt-3 rounded-xl relative"> <section class="mt-3 rounded-xl relative">
<mat-tree class="rounded-xl mr-3" [dataSource]="dataSource" [treeControl]="treeControl"> <mat-tree class="rounded-xl mr-3" [dataSource]="dataSource" [treeControl]="treeControl" >
<!-- This is the tree node template for leaf nodes --> <!-- This is the tree node template for leaf nodes -->
<mat-tree-node *matTreeNodeDef="let node" matTreeNodePadding class="justify-between"> <mat-tree-node *matTreeNodeDef="let node" matTreeNodePadding class="justify-between">
<!-- use a disabled button to provide padding for tree leaf --> <!-- use a disabled button to provide padding for tree leaf -->
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
{{node.name}} {{node.name}}
</section> </section>
<section class="pr-2"> <section class="pr-2" >
<button> <button (click)="alerts()">
<mat-icon> <mat-icon>
edit edit
</mat-icon> </mat-icon>
</button> s
</button >
</section> </section>
</mat-tree-node> </mat-tree-node>
<!-- This is the tree node template for expandable nodes --> <!-- This is the tree node template for expandable nodes -->
...@@ -21,7 +22,7 @@ ...@@ -21,7 +22,7 @@
<section class="flex items-center"> <section class="flex items-center">
<button mat-icon-button matTreeNodeToggle <button mat-icon-button matTreeNodeToggle
[attr.aria-label]="'Toggle ' + node.name"> [attr.aria-label]="'Toggle ' + node.name" >
<mat-icon class="mat-icon-rtl-mirror"> <mat-icon class="mat-icon-rtl-mirror">
{{treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'}} {{treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'}}
</mat-icon> </mat-icon>
...@@ -29,10 +30,11 @@ ...@@ -29,10 +30,11 @@
{{node.name}} {{node.name}}
</section> </section>
<section class="pr-2"> <section class="pr-2">
<button> <button (click)="openModule=true" >
<mat-icon> <mat-icon>
edit edit
</mat-icon> </mat-icon>
sdk
</button> </button>
</section> </section>
</mat-tree-node> </mat-tree-node>
...@@ -40,10 +42,10 @@ ...@@ -40,10 +42,10 @@
</section> </section>
<app-form-dialog [isOpen]="openModule" (sizeChange)="openModule=$event"></app-form-dialog>
{{openModule}}
...@@ -9,6 +9,7 @@ import { ...@@ -9,6 +9,7 @@ import {
StationControllerService StationControllerService
} from "../../../../../../projects/generated-api/src"; } from "../../../../../../projects/generated-api/src";
import {combineLatest, Observable, of, switchMap, tap} from "rxjs"; import {combineLatest, Observable, of, switchMap, tap} from "rxjs";
import {b} from "chart.js/dist/chunks/helpers.core";
...@@ -209,8 +210,11 @@ export class StationConfigComponent implements OnInit{ ...@@ -209,8 +210,11 @@ export class StationConfigComponent implements OnInit{
}); });
} }
alert=()=>{alert("focused")} alerts(): void {
alert("focused");
}
public openModule:boolean=false;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment