[Monitor_dashboard|Trunk]

move dashboard shared components (input, loading) under library



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@57938 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
Argiro Kokogiannaki 2019-12-23 14:02:29 +00:00
parent a1cff21086
commit 947cef796f
8 changed files with 5 additions and 130 deletions

View File

@ -5,8 +5,8 @@ import {FreeGuard} from "../openaireLibrary/login/freeGuard.guard";
import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
import {CommonModule} from "@angular/common";
import {RouterModule} from "@angular/router";
import {InputModule} from "../library/sharedComponents/input/input.module";
import {LoadingModule} from "../library/sharedComponents/loading/loading.module";
import {InputModule} from "../openaireLibrary/dashboard/sharedComponents/input/input.module";
import {LoadingModule} from "../openaireLibrary/dashboard/sharedComponents/loading/loading.module";
import {AlertModalModule} from "../openaireLibrary/utils/modal/alertModal.module";
import {ReactiveFormsModule} from "@angular/forms";

View File

@ -1,59 +0,0 @@
import {Component, Input, OnDestroy, OnInit} from "@angular/core";
import {Option} from "../../../utils/indicator-utils";
import {AbstractControl} from "@angular/forms";
import {HelperFunctions} from "../../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: '[dashboard-input]',
template: `
<mat-form-field *ngIf="type != 'checkbox'" class="uk-width-1-1 uk-padding-remove">
<input *ngIf="type === 'text'" matInput [placeholder]="label"
[formControl]="formControl" [required]="required">
<textarea *ngIf="type === 'textarea'" [rows]="rows" matInput
[placeholder]="label" [formControl]="formControl"></textarea>
<mat-select *ngIf="type === 'select'" [placeholder]="label"
(openedChange)="stopPropagation()" [formControl]="formControl" [disableOptionCentering]="true">
<mat-option *ngFor="let option of options" [value]="option.value">
{{option.label}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-checkbox *ngIf="type === 'checkbox'" [formControl]="formControl" >{{label}}</mat-checkbox>
`
})
export class InputComponent implements OnInit, OnDestroy {
@Input('formInput') formControl: AbstractControl;
@Input('type') type: string = 'text';
@Input('label') label: string;
@Input('rows') rows: number = 3;
@Input('options') options: Option[];
private initValue: any;
constructor() {
}
ngOnInit(): void {
this.initValue = HelperFunctions.copy(this.formControl.value);
this.formControl.valueChanges.subscribe(value => {
if(this.initValue === value) {
this.formControl.markAsPristine();
}
});
}
ngOnDestroy(): void {
}
public get required(): boolean {
return this.formControl && this.formControl.validator
&& this.formControl.validator(this.formControl)
&& this.formControl.validator(this.formControl).required;
}
stopPropagation() {
if(event) {
event.stopPropagation();
}
}
}

View File

@ -1,26 +0,0 @@
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {InputComponent} from "./input.component";
import {SharedModule} from "../../../shared/shared.module";
import {MatFormFieldModule} from "@angular/material/form-field";
import {MatInputModule} from "@angular/material/input";
import {MatSelectModule} from "@angular/material/select";
import {MatCheckboxModule} from '@angular/material/checkbox';
@NgModule({
imports: [
CommonModule,
SharedModule,
MatFormFieldModule,
MatInputModule,
MatSelectModule,
MatCheckboxModule
],
exports: [
InputComponent
],
declarations: [
InputComponent
]
})
export class InputModule {
}

View File

@ -1,22 +0,0 @@
import {Component, Input} from "@angular/core";
@Component({
selector: 'loading',
template: `
<div class="uk-flex uk-flex-center uk-margin-small-top">
<div class="md-preloader" [ngClass]="(color)?('md-preloader-' + color):''">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="48" width="48" viewBox="0 0 75 75">
<circle cx="37.5" cy="37.5" r="33.5" stroke-width="4"></circle>
</svg>
</div>
</div>`
})
export class LoadingComponent {
/**
* Possible values '': blue, 'success': green, 'warning': orange and 'danger': red
*/
@Input() color: 'success' | 'warning' | 'danger' = null;
constructor() {
}
}

View File

@ -1,18 +0,0 @@
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {LoadingComponent} from "./loading.component";
@NgModule({
imports: [
CommonModule,
],
declarations: [
LoadingComponent
],
providers: [],
exports: [
LoadingComponent
]
})
export class LoadingModule {
}

View File

@ -15,7 +15,7 @@ import {MonitorRoutingModule} from "./monitor-routing.module";
import {MonitorComponent} from "./monitor.component";
import {StatisticsService} from "../utils/services/statistics.service";
import {SideBarModule} from "../openaireLibrary/dashboard/sharedComponents/sidebar/sideBar.module";
import {InputModule} from "../library/sharedComponents/input/input.module";
import {InputModule} from "../openaireLibrary/dashboard/sharedComponents/input/input.module";
import {UserMiniModule} from "../openaireLibrary/login/userMiniModule.module";
import {ClickModule} from "../openaireLibrary/utils/click/click.module";

View File

@ -10,7 +10,7 @@ import {FormsModule, ReactiveFormsModule} from "@angular/forms";
import {AlertModalModule} from "../openaireLibrary/utils/modal/alertModal.module";
import {StakeholderComponent} from "./stakeholder.component";
import {StakeholderRoutingModule} from "./stakeholder-routing.module";
import {InputModule} from "../library/sharedComponents/input/input.module";
import {InputModule} from "../openaireLibrary/dashboard/sharedComponents/input/input.module";
import {ClickModule} from "../openaireLibrary/utils/click/click.module";
@NgModule({

View File

@ -11,7 +11,7 @@ import {RouterModule} from "@angular/router";
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
import {IndicatorsComponent} from "./indicators.component";
import {AlertModalModule} from "../openaireLibrary/utils/modal/alertModal.module";
import {InputModule} from "../library/sharedComponents/input/input.module";
import {InputModule} from "../openaireLibrary/dashboard/sharedComponents/input/input.module";
import {ClickModule} from "../openaireLibrary/utils/click/click.module";
@NgModule({