bug fixing...
This commit is contained in:
parent
42bfa5fade
commit
0fc8c60648
|
@ -23,49 +23,42 @@
|
|||
</div>
|
||||
|
||||
<div class="col-md-9">
|
||||
|
||||
<!-- inizio ngSwitch-account -->
|
||||
<!-- <div [ngSwitch]="account !== null">
|
||||
<div class="alert alert-success" *ngSwitchCase="true">
|
||||
<span id="home-logged-message" *ngIf="account" jhiTranslate="home.logged.message"
|
||||
[translateValues]="{ username: account.login }">You are logged in as user "{{account.login}}".</span>
|
||||
</div>
|
||||
|
||||
<div class="d-inline-block my-3">
|
||||
<mat-form-field>
|
||||
<mat-label>Your Contexts</mat-label>
|
||||
<mat-select>
|
||||
<mat-option *ngFor="let context of getContexts()" [value]="context">
|
||||
{{context|contexttransform}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
-->
|
||||
<div>
|
||||
<div class="d-inline-block my-3" ngbDropdown #myDrop="ngbDropdown" ></div>
|
||||
|
||||
|
||||
<form [formGroup]="chooseContextForm">
|
||||
<mat-form-field appearance="outline" class="form-field">
|
||||
<mat-label for="namefield" class="ml-4 ">Context name</mat-label>
|
||||
<div class="my-3">
|
||||
<mat-form-field [style.width.px]=400 >
|
||||
<input matInput panel
|
||||
#contextInput (keyup)="(0)"
|
||||
#contextInput
|
||||
[matAutocomplete]="auto"
|
||||
placeholder="Name" type="text"
|
||||
[formControl]="namefield"
|
||||
placeholder="Type in for other contexts" type="text"
|
||||
[formControl]="pathfield"
|
||||
/>
|
||||
<mat-error>Please, enter a valid name!</mat-error>
|
||||
<mat-autocomplete #auto="matAutocomplete" [panelWidth]=350 [displayWith]="displayFn.bind(this)">
|
||||
|
||||
<mat-autocomplete id="myauto" #auto="matAutocomplete" [panelWidth]=400 [displayWith]="displayFn.bind(this)" autoActiveFirstOption="true">
|
||||
<mat-option *ngFor="let fctx of filteredContexts | async" [value]="fctx">
|
||||
<span>{{ fctx.path }}</span>
|
||||
</mat-option>
|
||||
</mat-autocomplete>
|
||||
</mat-form-field>
|
||||
<mat-form-field id="uidfield" [style.width.px]=327 appearance="outline" class="form-field">
|
||||
<mat-label for="uidfield">Context UUID</mat-label>
|
||||
<input matInput class="uid-input" type="text" placeholder="UUID" formControlName="uidfield" readonly [value]="namefield.value.id" />
|
||||
</div>
|
||||
|
||||
<mat-form-field [style.width.px]=327 appearance="outline" class="form-field">
|
||||
<mat-label for="namefield" class="ml-4 ">Name</mat-label>
|
||||
<input matInput class="uid-input" type="text" placeholder="Name"
|
||||
readonly [value]="pathfield.value.name"
|
||||
[formControl]="namefield"/>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
<mat-form-field [style.width.px]=327 appearance="outline" class="form-field">
|
||||
<mat-label for="uidfield">Context UUID</mat-label>
|
||||
<input matInput class="uid-input" type="text" placeholder="UUID"
|
||||
readonly [value]="pathfield.value.id"
|
||||
[formControl]="uidfield"/>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
|
||||
<button mat-button (click)="copyUid(namefield)" color="primary" matTooltip="copy UUID" matTooltipPosition="below">
|
||||
<mat-icon class="icon-wide2">content_copy</mat-icon>
|
||||
</button>
|
||||
|
|
|
@ -31,3 +31,9 @@ Main page styles
|
|||
z-index: 99;
|
||||
}
|
||||
|
||||
/*
|
||||
.mat-form-field-infix{
|
||||
width: 500px !important;
|
||||
background-color: aquamarine;
|
||||
}
|
||||
*/
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-inferrable-types */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable no-var */
|
||||
|
@ -10,14 +11,13 @@ import { Component, OnDestroy, OnInit, ViewChild,ElementRef, AfterContentInit, A
|
|||
import { LoginService } from 'app/login/login.service';
|
||||
import { AccountService } from 'app/core/auth/account.service';
|
||||
import { Account } from 'app/core/auth/account.model';
|
||||
import { FormBuilder, FormControl, FormGroup, ValidationErrors, ValidatorFn, Validators } from '@angular/forms';
|
||||
import { FormBuilder, FormControl, FormGroup, FormGroupDirective, NgForm, ValidationErrors, ValidatorFn, Validators } from '@angular/forms';
|
||||
import { Clipboard } from '@angular/cdk/clipboard'
|
||||
import { Observable, Subject, Subscription, delay, map, startWith, takeUntil } from 'rxjs';
|
||||
import { ContextsLoaderService } from 'app/services/contexts-loader.service';
|
||||
import { IContextNode } from 'app/services/i-context-node';
|
||||
import { AutofillValidator, instanceOfContext } from './autofill-validator';
|
||||
import { SpinnerLoadingService } from 'app/services/spinner-loading.service';
|
||||
//import { RscTreeComponent } from 'app/rsc-tree/rsc-tree.component';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -30,17 +30,16 @@ import { SpinnerLoadingService } from 'app/services/spinner-loading.service';
|
|||
export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
account: Account | null = null;
|
||||
myContext: IContextNode | null = null;
|
||||
//stringCtxs: string[];
|
||||
allCtxs: IContextNode[];
|
||||
rootPath: string;
|
||||
rootName: string;
|
||||
rootId: string;
|
||||
public filteredContexts: Observable<IContextNode[]> | null = null;
|
||||
//public filteredContextsStr: Observable<string[]>| undefined;
|
||||
chooseContextForm: FormGroup | any;
|
||||
resType: string;
|
||||
isLoading: boolean = false;
|
||||
subscriptions: Subscription[] = [];
|
||||
|
||||
//@ViewChild('leftTree') leftTree: ElementRef | undefined;
|
||||
|
||||
constructor(
|
||||
private accountService: AccountService,
|
||||
private loginService: LoginService,
|
||||
|
@ -51,9 +50,16 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
//initialise on HostingNodes
|
||||
this.resType="HostingNode";
|
||||
this.allCtxs = [];
|
||||
this.rootPath = "";
|
||||
this.rootName = "";
|
||||
this.rootId = "";
|
||||
}
|
||||
|
||||
|
||||
get pathfield(): any {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return this.chooseContextForm.get('pathfield');
|
||||
}
|
||||
get namefield(): any {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return this.chooseContextForm.get('namefield');
|
||||
|
@ -64,18 +70,23 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
this.chooseContextForm = this.fb.group({
|
||||
pathfield: [[Validators.required,AutofillValidator]],
|
||||
});
|
||||
;
|
||||
|
||||
//to identify users and their account
|
||||
this.accountService.identity().subscribe(account => (this.account = account));
|
||||
this.chooseContextForm = this.fb.group({
|
||||
namefield: ['', [Validators.required,AutofillValidator]],
|
||||
uidfield: [''],
|
||||
});
|
||||
|
||||
// per la form dei contesti
|
||||
this.ctxLoaderService.fetchAll().subscribe(res => {
|
||||
this.allCtxs = res;
|
||||
this.namefield.setValue(res[0].name);
|
||||
this.uidfield.setValue(res[0].id);
|
||||
this.pathfield.setValue(res[0].path);
|
||||
|
||||
});
|
||||
|
||||
alert('valore namefield: '+this.allCtxs[0].id);
|
||||
this.subscriptions.push(this.progressService.getState()
|
||||
.pipe()
|
||||
.subscribe(res => {
|
||||
|
@ -84,10 +95,11 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this.filteredContexts = this.chooseContextForm.get('namefield').valueChanges.pipe(
|
||||
this.filteredContexts = this.chooseContextForm.get('pathfield').valueChanges.pipe(
|
||||
startWith(''),
|
||||
map(ctx => (ctx ? this.filterContexts(ctx/*,contextInput*/) : this.allCtxs.slice()))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -127,7 +139,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
|
||||
displayFn(ctx: IContextNode): string {
|
||||
//return ctx.name ? ctx.name + ' | ' + ctx.id : '';
|
||||
return ctx.name;
|
||||
return ctx.path;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import { TableScreenEsModule } from 'app/table-screen-es/table-screen-es.module'
|
|||
import { AsyncPipe, NgSwitchCase, NgSwitchDefault } from '@angular/common';
|
||||
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [SharedModule,
|
||||
RouterModule.forChild([HOME_ROUTE]),
|
||||
|
|
|
@ -129,12 +129,14 @@ export class TableScreenComponent implements OnInit, AfterViewInit, OnChanges {
|
|||
}
|
||||
|
||||
closeTab(index: number): void {
|
||||
/*
|
||||
console.debug('---------');
|
||||
console.debug(index);
|
||||
console.debug('---IDs:');
|
||||
console.debug(this.chosenIds);
|
||||
console.debug(this.tabs[index].id);
|
||||
console.debug('++++++++++');
|
||||
*/
|
||||
const x = this.chosenIds.indexOf(this.tabs[index].id);
|
||||
if (x !== -1) {
|
||||
this.chosenIds.splice(x, 1);
|
||||
|
|
Loading…
Reference in New Issue