member modify
This commit is contained in:
parent
5bafb1243e
commit
13e1106a4e
|
@ -7,7 +7,7 @@ export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
restBaseURL: 'http://192.168.1.50:19080/webapp',
|
restBaseURL: 'http://192.168.1.50:19080/webapp',
|
||||||
webappRPCConfig: {
|
webappRPCConfig: {
|
||||||
url: 'ws://192.168.1.50:19090/webapp',
|
url: 'ws://192.168.1.103:19090/webapp',
|
||||||
reconnectInterval: 5000,
|
reconnectInterval: 5000,
|
||||||
reconnectRetry: 10,
|
reconnectRetry: 10,
|
||||||
},
|
},
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
<i class="fa ui-icon-stop ui-status-icon ui-status-success"></i>{{node.label}}
|
<i class="fa ui-icon-stop ui-status-icon ui-status-success"></i>{{node.label}}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{node.obj.itemCount}} SensorItems
|
{{node.obj.itemCount}} SensorItems
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
@ -82,6 +82,18 @@
|
||||||
</p-dialog>
|
</p-dialog>
|
||||||
|
|
||||||
|
|
||||||
|
<p-dialog header="Rename Probe" [(visible)]="renameProbeVisible" [modal]="true" [responsive]="true" [width]="350" [minWidth]="200"
|
||||||
|
[minY]="70">
|
||||||
|
<span class="md-inputfield">
|
||||||
|
<input #probeAlias type="text" pInputText placeholder="aaaa">
|
||||||
|
</span>
|
||||||
|
<p-footer>
|
||||||
|
<button type="button" pButton icon="fa-check" (click)="onSaveProbeName(probeAlias.value)" label="Save"></button>
|
||||||
|
<button type="button" pButton icon="fa-close" (click)="renameProbeVisible=false" label="Cancel"></button>
|
||||||
|
</p-footer>
|
||||||
|
</p-dialog>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,15 +41,12 @@ export class MapComponent implements OnInit, AfterContentInit {
|
||||||
|
|
||||||
infras$ = this.listStore.pipe(select(ListSelector.select('page')));
|
infras$ = this.listStore.pipe(select(ListSelector.select('page')));
|
||||||
sensors$ = this.sensorListStore.pipe(select(sensorListSelector.select('page')));
|
sensors$ = this.sensorListStore.pipe(select(sensorListSelector.select('page')));
|
||||||
|
|
||||||
display = false;
|
display = false;
|
||||||
loading = false;
|
loading = false;
|
||||||
|
renameProbeVisible = false;
|
||||||
totalList: Infra[];
|
totalList: Infra[];
|
||||||
hostDataList: HostData[] = new Array();
|
hostDataList: HostData[] = new Array();
|
||||||
|
|
||||||
sensorMap: Map<number, Array<Sensor>> = new Map();
|
sensorMap: Map<number, Array<Sensor>> = new Map();
|
||||||
|
|
||||||
targetTreeMap: Map<number, TreeNode> = new Map();
|
targetTreeMap: Map<number, TreeNode> = new Map();
|
||||||
|
|
||||||
DEFAULT_EXPANDED: Boolean = true;
|
DEFAULT_EXPANDED: Boolean = true;
|
||||||
|
@ -66,7 +63,6 @@ export class MapComponent implements OnInit, AfterContentInit {
|
||||||
|
|
||||||
visibleSidebar = false;
|
visibleSidebar = false;
|
||||||
selectedNode: TreeNode = null;
|
selectedNode: TreeNode = null;
|
||||||
targetNodeForView: Object = null;
|
|
||||||
|
|
||||||
sensorSettingDisplay = false;
|
sensorSettingDisplay = false;
|
||||||
target: Target = null;
|
target: Target = null;
|
||||||
|
@ -473,6 +469,8 @@ export class MapComponent implements OnInit, AfterContentInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
editProbeAlias() {
|
editProbeAlias() {
|
||||||
|
console.log(this.selectedNode);
|
||||||
|
this.renameProbeVisible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
editSensor() {
|
editSensor() {
|
||||||
|
@ -494,6 +492,10 @@ export class MapComponent implements OnInit, AfterContentInit {
|
||||||
this.target = null;
|
this.target = null;
|
||||||
this.sensorSettingDisplay = false;
|
this.sensorSettingDisplay = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onSaveProbeName(value) {
|
||||||
|
console.log(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const testInfraList = [
|
const testInfraList = [
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||||
import {ActivatedRoute, Router} from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { PagesComponent } from 'app/pages/pages.component';
|
import { PagesComponent } from 'app/pages/pages.component';
|
||||||
|
|
||||||
import * as AuthStore from '../../store/auth';
|
import * as AuthStore from '../../store/auth';
|
||||||
|
@ -7,8 +7,11 @@ import * as ModifyStore from '../../store/modify';
|
||||||
|
|
||||||
import { Member } from '../../model';
|
import { Member } from '../../model';
|
||||||
import { AuthSelector } from '../../store';
|
import { AuthSelector } from '../../store';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store, select } from '@ngrx/store';
|
||||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||||
|
import { ModifySelector } from '../../store';
|
||||||
|
import { Subscription } from 'rxjs/Subscription';
|
||||||
|
import { RPCClientError } from '@loafer/ng-rpc/protocol';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -16,17 +19,20 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||||
templateUrl: './profile.component.html',
|
templateUrl: './profile.component.html',
|
||||||
styleUrls: ['./profile.component.scss']
|
styleUrls: ['./profile.component.scss']
|
||||||
})
|
})
|
||||||
export class ProfileComponent implements OnInit {
|
export class ProfileComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
member: Member;
|
member: Member;
|
||||||
modifyForm: FormGroup;
|
modifyForm: FormGroup;
|
||||||
|
|
||||||
|
modifiedMember$ = this.modifyStore.pipe(select(ModifySelector.select('member')));
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public app: PagesComponent,
|
public app: PagesComponent,
|
||||||
private activatedRoute: ActivatedRoute,
|
private activatedRoute: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private store: Store<AuthStore.State>,
|
private store: Store<AuthStore.State>,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
|
private modifyStore: Store<ModifyStore.State>
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,15 +49,18 @@ export class ProfileComponent implements OnInit {
|
||||||
this.initForm();
|
this.initForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
}
|
||||||
|
|
||||||
initForm() {
|
initForm() {
|
||||||
this.modifyForm = this.formBuilder.group({
|
this.modifyForm = this.formBuilder.group({
|
||||||
'email': [ this.member.email,
|
'email': [this.member.email,
|
||||||
[
|
[
|
||||||
Validators.required,
|
Validators.required,
|
||||||
Validators.email
|
Validators.email
|
||||||
]],
|
]],
|
||||||
'name': [ this.member.name, []],
|
'name': [this.member.name, []],
|
||||||
'companyName': [this.member.companyName, []],
|
'companyName': [this.member.companyName, []],
|
||||||
'phone': [this.member.phone, []],
|
'phone': [this.member.phone, []],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -64,8 +73,22 @@ export class ProfileComponent implements OnInit {
|
||||||
phone: modifyValue.phone,
|
phone: modifyValue.phone,
|
||||||
companyName: modifyValue.companyName,
|
companyName: modifyValue.companyName,
|
||||||
};
|
};
|
||||||
this.store.dispatch(new ModifyStore.Modify({member}));
|
this.modifyStore.dispatch(new ModifyStore.Modify({ member }));
|
||||||
console.log(member);
|
|
||||||
|
const modifiedMemberSubscription$ = this.modifiedMember$.subscribe(
|
||||||
|
(m: Member) => {
|
||||||
|
if (m) {
|
||||||
|
console.log(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (modifiedMemberSubscription$) {
|
||||||
|
modifiedMemberSubscription$.unsubscribe();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(error: RPCClientError) => {
|
||||||
|
console.log(error.response.message);
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ export const EFFECTS = [
|
||||||
AuthStore.Effects,
|
AuthStore.Effects,
|
||||||
SignupStore.Effects,
|
SignupStore.Effects,
|
||||||
TotpStore.Effects,
|
TotpStore.Effects,
|
||||||
|
ModifyStore.Effects
|
||||||
];
|
];
|
||||||
|
|
||||||
export const selectMemberState = createFeatureSelector<State>(MODULE.name);
|
export const selectMemberState = createFeatureSelector<State>(MODULE.name);
|
||||||
|
@ -50,3 +51,8 @@ export const TotpSelector = new StateSelector<TotpStore.State>(createSelector(
|
||||||
selectMemberState,
|
selectMemberState,
|
||||||
(state: State) => state.totp
|
(state: State) => state.totp
|
||||||
));
|
));
|
||||||
|
|
||||||
|
export const ModifySelector = new StateSelector<ModifyStore.State>(createSelector(
|
||||||
|
selectMemberState,
|
||||||
|
(state: State) => state.modify
|
||||||
|
));
|
||||||
|
|
|
@ -13,7 +13,7 @@ export enum ActionType {
|
||||||
export class Modify implements Action {
|
export class Modify implements Action {
|
||||||
readonly type = ActionType.Modify;
|
readonly type = ActionType.Modify;
|
||||||
|
|
||||||
constructor(public payload: {member: Member }) {}
|
constructor(public payload: Member ) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModifySuccess implements Action {
|
export class ModifySuccess implements Action {
|
||||||
|
|
|
@ -10,8 +10,9 @@ import { RPCClientError } from '@loafer/ng-rpc/protocol';
|
||||||
import { sensorListSelector } from 'packages/sensor/store';
|
import { sensorListSelector } from 'packages/sensor/store';
|
||||||
import * as SensorListStore from 'packages/sensor/store/list';
|
import * as SensorListStore from 'packages/sensor/store/list';
|
||||||
import { PageParams, Page } from 'app/commons/model';
|
import { PageParams, Page } from 'app/commons/model';
|
||||||
// import { target } from 'packages/target/store';
|
import { ModifySelector } from 'packages/target/store';
|
||||||
// import * as SensorListStore from 'packages/sensor/store/list';
|
import * as TargetModifyStore from 'packages/target/store/modify';
|
||||||
|
import { Target } from '../../model';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -24,8 +25,7 @@ export class DetailComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||||
infra$ = this.infraDetailStore.pipe(select(InfraDetailSelector.select('infra')));
|
infra$ = this.infraDetailStore.pipe(select(InfraDetailSelector.select('infra')));
|
||||||
sensorsSubscription$: Subscription;
|
sensorsSubscription$: Subscription;
|
||||||
sensors$ = this.sensorListStore.pipe(select(sensorListSelector.select('page')));
|
sensors$ = this.sensorListStore.pipe(select(sensorListSelector.select('page')));
|
||||||
|
target$ = this.targetModifyStore.pipe(select(ModifySelector.select('target')));
|
||||||
targetSubscription$: Subscription;
|
|
||||||
|
|
||||||
infraId = null;
|
infraId = null;
|
||||||
infra: Infra;
|
infra: Infra;
|
||||||
|
@ -41,7 +41,8 @@ export class DetailComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private infraDetailStore: Store<InfraDetailStore.State>,
|
private infraDetailStore: Store<InfraDetailStore.State>,
|
||||||
private sensorListStore: Store<SensorListStore.State>
|
private sensorListStore: Store<SensorListStore.State>,
|
||||||
|
private targetModifyStore: Store<TargetModifyStore.State>
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -122,29 +123,27 @@ export class DetailComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||||
|
|
||||||
|
|
||||||
onDisplayNameChange(value: string) {
|
onDisplayNameChange(value: string) {
|
||||||
console.log(value);
|
if (value === this.infra.target.displayName) {
|
||||||
// if (value === this.probe.displayName) {
|
return;
|
||||||
// return;
|
}
|
||||||
// }
|
const target = this.infra.target;
|
||||||
// this.probe.displayName = value;
|
target.displayName = value;
|
||||||
// this.modifyStore.dispatch(
|
this.targetModifyStore.dispatch(
|
||||||
// new ModifyStore.Modify(this.probe)
|
new TargetModifyStore.Modify(target)
|
||||||
// );
|
);
|
||||||
|
|
||||||
// const modifySuccessSubscription$: Subscription = this.modifySuccess$.subscribe(
|
const modifySuccessSubscription$: Subscription = this.target$.subscribe(
|
||||||
// (probe: Probe) => {
|
(t: Target) => {
|
||||||
// if (probe) {
|
if (t) {
|
||||||
// this.msgs = [];
|
}
|
||||||
// this.msgs.push({ severity: 'success', summary: 'Succeed', detail: 'Probe name has changed.' });
|
if (modifySuccessSubscription$) {
|
||||||
// }
|
modifySuccessSubscription$.unsubscribe();
|
||||||
// if (modifySuccessSubscription$) {
|
}
|
||||||
// modifySuccessSubscription$.unsubscribe();
|
},
|
||||||
// }
|
(error: RPCClientError) => {
|
||||||
// },
|
console.log(error);
|
||||||
// (error: RPCClientError) => {
|
}
|
||||||
// console.log(error.response.message);
|
);
|
||||||
// }
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onDisplayNameChangeKeypress(event, value) {
|
onDisplayNameChangeKeypress(event, value) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ import {
|
||||||
|
|
||||||
export const selectTargetState = createFeatureSelector<State>(MODULE.name);
|
export const selectTargetState = createFeatureSelector<State>(MODULE.name);
|
||||||
|
|
||||||
export const ReadAllByDomainSelector = new StateSelector<TargetModifyStore.State>(createSelector(
|
export const ModifySelector = new StateSelector<TargetModifyStore.State>(createSelector(
|
||||||
selectTargetState,
|
selectTargetState,
|
||||||
(state: State) => state.modify
|
(state: State) => state.modify
|
||||||
));
|
));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user