test
This commit is contained in:
parent
2557e91888
commit
232d944640
|
@ -0,0 +1 @@
|
||||||
|
<p-messages [(value)]="msgs" [closable]="closable"></p-messages>
|
|
@ -0,0 +1,34 @@
|
||||||
|
import { Component, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core';
|
||||||
|
import { Message } from 'primeng/primeng';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'of-error-message',
|
||||||
|
templateUrl: './error-message.component.html',
|
||||||
|
})
|
||||||
|
export class ErrorMessageComponent implements OnInit, OnChanges {
|
||||||
|
|
||||||
|
@Input() error: any;
|
||||||
|
@Input() closeAfter: number;
|
||||||
|
@Input() closable: boolean;
|
||||||
|
msgs: Message[] = [];
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
|
if (changes['error'].currentValue) {
|
||||||
|
const detail = ' (' + this.error.response.code + ')';
|
||||||
|
this.msgs = [];
|
||||||
|
this.msgs.push({ severity: 'error', summary: 'Sorry. An Error has occurred.', detail: detail });
|
||||||
|
if (this.closeAfter) {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.msgs = [];
|
||||||
|
}, this.closeAfter * 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1 +1 @@
|
||||||
<p-messages [(value)]="msgs" [closable]="closable"></p-messages>
|
<p-messages [(value)]="message" [closable]="closable"></p-messages>
|
|
@ -5,30 +5,14 @@ import { Message } from 'primeng/primeng';
|
||||||
selector: 'of-message',
|
selector: 'of-message',
|
||||||
templateUrl: './message.component.html',
|
templateUrl: './message.component.html',
|
||||||
})
|
})
|
||||||
export class MessageComponent implements OnInit, OnChanges {
|
export class MessageComponent {
|
||||||
|
|
||||||
@Input() error: any;
|
@Input() message: Message;
|
||||||
@Input() closeAfter: number;
|
@Input() closeAfter: number;
|
||||||
@Input() closable: boolean;
|
@Input() closable: boolean;
|
||||||
msgs: Message[] = [];
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
|
||||||
if (changes['error'].currentValue) {
|
|
||||||
const detail = ' (' + this.error.response.code + ')';
|
|
||||||
this.msgs = [];
|
|
||||||
this.msgs.push({ severity: 'error', summary: 'Sorry. An Error has occurred.', detail: detail });
|
|
||||||
if (this.closeAfter) {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.msgs = [];
|
|
||||||
}, this.closeAfter * 1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { PrimeNGModules } from '@overflow/commons/prime-ng/prime-ng.module';
|
import { PrimeNGModules } from '@overflow/commons/prime-ng/prime-ng.module';
|
||||||
import { MessageComponent } from './message.component';
|
import { MessageComponent } from './message.component';
|
||||||
|
import { ErrorMessageComponent } from './error-message.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -9,10 +10,12 @@ import { MessageComponent } from './message.component';
|
||||||
PrimeNGModules
|
PrimeNGModules
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
MessageComponent
|
MessageComponent,
|
||||||
|
ErrorMessageComponent
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
MessageComponent
|
MessageComponent,
|
||||||
|
ErrorMessageComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class MessageModule { }
|
export class MessageModule { }
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<p-blockUI [target]="content" [blocked]="pending">
|
<of-error-message [error]="error" [closable]="false"></of-error-message>
|
||||||
<i class="fa ui-icon-lock block-icon"></i>
|
<of-block-progressbar [target]="content" [pending]="pending"></of-block-progressbar>
|
||||||
</p-blockUI>
|
|
||||||
|
|
||||||
<p-panel #content [showHeader]="false" class="block-panel">
|
<p-panel #content [showHeader]="false" class="block-panel">
|
||||||
<h1>Unauthorized</h1>
|
<h1>Unauthorized</h1>
|
||||||
|
@ -74,5 +73,5 @@
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</p-table>
|
</p-table>
|
||||||
<p-confirmDialog header="Confirmation" icon="fa ui-icon-warning" width="425"></p-confirmDialog>
|
<p-confirmDialog header="Confirmation" icon="fa ui-icon-warning" width="425"></p-confirmDialog>
|
||||||
<p-growl [(value)]="msgs"></p-growl>
|
<!-- <p-growl [(value)]="msgs"></p-growl> -->
|
||||||
</p-panel>
|
</p-panel>
|
|
@ -14,7 +14,6 @@ export class NoAuthProbeListComponent {
|
||||||
|
|
||||||
@Output() accept = new EventEmitter<NoAuthProbe>();
|
@Output() accept = new EventEmitter<NoAuthProbe>();
|
||||||
@Output() deny = new EventEmitter<NoAuthProbe>();
|
@Output() deny = new EventEmitter<NoAuthProbe>();
|
||||||
msgs: Message[];
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private confirmationService: ConfirmationService,
|
private confirmationService: ConfirmationService,
|
||||||
|
@ -22,8 +21,6 @@ export class NoAuthProbeListComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
onAcceptOrDeny(isAccept: boolean, selected: NoAuthProbe) {
|
onAcceptOrDeny(isAccept: boolean, selected: NoAuthProbe) {
|
||||||
console.log(selected);
|
|
||||||
this.msgs = [];
|
|
||||||
const title = isAccept ?
|
const title = isAccept ?
|
||||||
'Are you sure to accept this Probe?' : 'Are you sure to deny this Probe';
|
'Are you sure to accept this Probe?' : 'Are you sure to deny this Probe';
|
||||||
const message = isAccept ?
|
const message = isAccept ?
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
<p-messages [(value)]="msgs"></p-messages>
|
|
||||||
|
|
||||||
<of-noauth-probe-list
|
<of-noauth-probe-list
|
||||||
[noauthProbes]="noauthProbes$ | async"
|
[noauthProbes]="noauthProbes$ | async"
|
||||||
[pending]="pending$ | async"
|
[pending]="pending$ | async"
|
||||||
|
|
|
@ -1,41 +1,34 @@
|
||||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Store, select } from '@ngrx/store';
|
import { Store, select } from '@ngrx/store';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
import 'rxjs/add/operator/map';
|
import 'rxjs/add/operator/map';
|
||||||
|
|
||||||
import { AuthContainerSelector } from '@overflow/shared/auth/store';
|
import { AuthContainerSelector } from '@overflow/shared/auth/store';
|
||||||
import { Domain, DomainMember } from '@overflow/commons-typescript/model/domain';
|
import { DomainMember } from '@overflow/commons-typescript/model/domain';
|
||||||
import * as NoAuthProbeEntityStore from '../store/entity/noauth-probe';
|
import * as NoAuthProbeEntityStore from '../store/entity/noauth-probe';
|
||||||
import { NoAuthProbeListContainerSelector } from '../store';
|
import { NoAuthProbeListContainerSelector } from '../store';
|
||||||
import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';
|
import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';
|
||||||
import { ConfirmationService } from 'primeng/primeng';
|
import { ConfirmationService } from 'primeng/primeng';
|
||||||
import { MessageService } from 'primeng/components/common/messageservice';
|
import { MessageService } from 'primeng/components/common/messageservice';
|
||||||
import { RPCClientError } from '@loafer/ng-rpc';
|
import { RPCClientError } from '@loafer/ng-rpc';
|
||||||
import { Subscription } from 'rxjs';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'of-noauth-probe-list-container',
|
selector: 'of-noauth-probe-list-container',
|
||||||
templateUrl: './noauth-probe-list-container.component.html',
|
templateUrl: './noauth-probe-list-container.component.html',
|
||||||
providers: [ConfirmationService, MessageService]
|
|
||||||
})
|
})
|
||||||
export class NoAuthProbeListContainerComponent implements OnInit, OnDestroy {
|
export class NoAuthProbeListContainerComponent implements OnInit {
|
||||||
noauthProbes$: Observable<NoAuthProbe[]>;
|
noauthProbes$: Observable<NoAuthProbe[]>;
|
||||||
pending$: Observable<boolean>;
|
pending$: Observable<boolean>;
|
||||||
errorSubscription: Subscription;
|
error$: Observable<any>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private store: Store<any>,
|
private store: Store<any>,
|
||||||
private messageService: MessageService,
|
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.pending$ = this.store.pipe(select(NoAuthProbeListContainerSelector.selectPending));
|
this.pending$ = this.store.pipe(select(NoAuthProbeListContainerSelector.selectPending));
|
||||||
this.errorSubscription = this.store.pipe(select(NoAuthProbeListContainerSelector.selectError)).subscribe(
|
this.error$ = this.store.pipe(select(NoAuthProbeListContainerSelector.selectError));
|
||||||
(e: any) => {
|
|
||||||
this.messageService.add({severity: 'error', summary: 'Service Message', detail: 'Via MessageService'});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
this.noauthProbes$ = this.store.pipe(select(NoAuthProbeListContainerSelector.selectAll)).map((_noauthProbes: NoAuthProbe[]) => {
|
this.noauthProbes$ = this.store.pipe(select(NoAuthProbeListContainerSelector.selectAll)).map((_noauthProbes: NoAuthProbe[]) => {
|
||||||
if (null === _noauthProbes) {
|
if (null === _noauthProbes) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -53,10 +46,6 @@ export class NoAuthProbeListContainerComponent implements OnInit, OnDestroy {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
|
||||||
this.errorSubscription.unsubscribe();
|
|
||||||
}
|
|
||||||
|
|
||||||
accept(noAuthProbe: NoAuthProbe) {
|
accept(noAuthProbe: NoAuthProbe) {
|
||||||
this.store.dispatch(new NoAuthProbeEntityStore.Accept({aa: noAuthProbe.id} as any));
|
this.store.dispatch(new NoAuthProbeEntityStore.Accept({aa: noAuthProbe.id} as any));
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@ import { COMPONENTS } from './component';
|
||||||
import { CONTAINER_COMPONENTS } from './container';
|
import { CONTAINER_COMPONENTS } from './container';
|
||||||
|
|
||||||
import { SERVICES } from './service';
|
import { SERVICES } from './service';
|
||||||
|
import { MessageModule } from '@overflow/commons/component/message/message.module';
|
||||||
|
import { BlockProgressbarModule } from '@overflow/commons/component/block-progressbar/block-progressbar.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -17,6 +19,8 @@ import { SERVICES } from './service';
|
||||||
NoAuthProbeRPCModule,
|
NoAuthProbeRPCModule,
|
||||||
NoAuthProbeLoggerModule,
|
NoAuthProbeLoggerModule,
|
||||||
PrimeNGModules,
|
PrimeNGModules,
|
||||||
|
MessageModule,
|
||||||
|
BlockProgressbarModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
COMPONENTS,
|
COMPONENTS,
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<p-blockUI [target]="content" [blocked]="pending">
|
<of-error-message [error]="error" [closable]="false"></of-error-message>
|
||||||
<i class="fa ui-icon-lock block-icon"></i>
|
<of-block-progressbar [target]="content" [pending]="pending"></of-block-progressbar>
|
||||||
</p-blockUI>
|
|
||||||
|
|
||||||
<p-panel #content [showHeader]="false" class="block-panel">
|
<p-panel #content [showHeader]="false" class="block-panel">
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<h1>Probes</h1>
|
<h1>Probes</h1>
|
||||||
<of-message [error]="error" [closable]="false"></of-message>
|
<of-error-message [error]="error" [closable]="false"></of-error-message>
|
||||||
<of-block-progressbar [target]="content" [pending]="pending"></of-block-progressbar>
|
<of-block-progressbar [target]="content" [pending]="pending"></of-block-progressbar>
|
||||||
|
|
||||||
<p-panel #content [showHeader]="false" class="block-panel">
|
<p-panel #content [showHeader]="false" class="block-panel">
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Component, OnInit, AfterViewInit, AfterContentInit, ViewChild, OnDestroy, Output, EventEmitter, Input } from '@angular/core';
|
import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core';
|
||||||
import { ProbeHost, Probe } from '@overflow/commons-typescript/model/probe';
|
import { ProbeHost, Probe } from '@overflow/commons-typescript/model/probe';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
Loading…
Reference in New Issue
Block a user