Commit e4163f54 authored by wangqinghua's avatar wangqinghua

pipe

parent f04460a2
......@@ -120,6 +120,7 @@ import {CostComponent} from './work/modal/cost/cost.component';
import {CommonProblemComponent} from './knowladge/common-problem/common-problem.component';
import {InformationTechComponent} from './knowladge/information-tech/information-tech.component';
import {ManagementSystemComponent} from './knowladge/management-system/management-system.component';
import {PipeModule} from './shared/pipe/pipe.module';
@NgModule({
imports: [
......@@ -128,6 +129,7 @@ import {ManagementSystemComponent} from './knowladge/management-system/managemen
NgxEchartsModule,
FormsModule,
ReactiveFormsModule,
PipeModule,
NgZorroAntdModule.forRoot()
],
declarations: [
......
......@@ -119,30 +119,6 @@
</nz-collapse-panel>
</nz-collapse>
</div>
<!--<div nz-row>-->
<!--<nz-table #basicTable [nzData]="dataSet" [nzFrontPagination]="false" [nzTotal]="totalNumInOut" [nzPageIndex]="pageNum" [nzPageSize]="pageCount" (nzPageIndexChange)="changeInoutInfo($event)" [nzLoading]="inOutLoading">-->
<!--<thead>-->
<!--<tr>-->
<!--<th>状态</th>-->
<!--<th>接口</th>-->
<!--<th>进流量</th>-->
<!--<th>出流量</th>-->
<!--<th>状态变更时间</th>-->
<!--&lt;!&ndash;<th nzWidth="150px">图表</th>&ndash;&gt;-->
<!--</tr>-->
<!--</thead>-->
<!--<tbody>-->
<!--<tr *ngFor="let data of basicTable.data">-->
<!--<td>{{data.state}}</td>-->
<!--<td>{{data.name}}</td>-->
<!--<td>{{data.in}}</td>-->
<!--<td>{{data.out}}</td>-->
<!--<td>{{data.changeState}}</td>-->
<!--&lt;!&ndash;<td>图表</td>&ndash;&gt;-->
<!--</tr>-->
<!--</tbody>-->
<!--</nz-table>-->
<!--</div>-->
</section>
</nz-tab>
<nz-tab nzTitle="监测点列表">
......@@ -151,7 +127,7 @@
<button (click)="getCheckList()" nz-button nzType="default"><i class="anticon anticon-search" style="color: #6097b7"></i>搜索</button>
</div>
<div class="padding-15-0">
<nz-radio-group [(ngModel)]="itemTypeValue" [nzButtonStyle]="'solid'">
<nz-radio-group [(ngModel)]="itemTypeValue">
<label *ngFor="let item of itemTypeList" (click)="changeType(item)" nz-radio-button [nzValue]="item.applicationid">{{item.name}}</label>
</nz-radio-group>
</div>
......
......@@ -44,7 +44,7 @@
</div>
<nz-row>
<nz-col nzSpan="12">总大小:</nz-col>
<nz-col nzSpan="12">{{hostObj.disk[diskType].total || '-'}}</nz-col>
<nz-col nzSpan="12">{{hostObj.disk[diskType].total | unitConversion}}</nz-col>
</nz-row>
<nz-row>
<nz-col nzSpan="12">已用大小:</nz-col>
......@@ -73,7 +73,7 @@
</nz-row>
<nz-row>
<nz-col nzSpan="8">IP地址:</nz-col>
<nz-col nzSpan="16">{{server?.ip || '-'}}</nz-col>
<nz-col nzSpan="16">{{server?.host || '-'}}</nz-col>
</nz-row>
<nz-row>
<nz-col nzSpan="8">设备类型:</nz-col>
......
......@@ -225,4 +225,23 @@ export class CommonService implements OnInit {
}
return obj;
}
//内存单位换算
unitConversion(unit){
let res;
let Gbps = 1000 * 1000 * 1000;
let Mbps = 1000 * 1000;
let kbps = 1000;
let size = Math.abs(unit);
if (size / Gbps > 1) {
res += (size / Gbps).toFixed(2) + 'Gbps';
} else if (size / Mbps > 1) {
res += (size / Mbps).toFixed(2) + 'Mbps';
} else if (size / kbps > 1) {
res += (size / kbps).toFixed(2) + 'kbps';
} else {
res +=(size) + 'bps';
}
return res;
}
}
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import {UnitConversionPipe} from './unit-conversion/unit-conversion.pipe';
@NgModule({
imports: [
],
declarations: [
UnitConversionPipe
],
providers: [
],
entryComponents: [],
exports: [
UnitConversionPipe
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class PipeModule {}
import {Pipe, PipeTransform} from '@angular/core';
@Pipe({
name: 'unitConversion'
})
export class UnitConversionPipe implements PipeTransform {
transform(value: any, args?: any): any {
console.log(value);
let res = '';
let Gbps = 1000 * 1000 * 1000;
let Mbps = 1000 * 1000;
let kbps = 1000;
let size = Math.abs(value);
if (size / Gbps > 1) {
res += (size / Gbps).toFixed(2) + 'Gbps';
} else if (size / Mbps > 1) {
res += (size / Mbps).toFixed(2) + 'Mbps';
} else if (size / kbps > 1) {
res += (size / kbps).toFixed(2) + 'kbps';
} else {
res += (size) + 'bps';
}
return res;
}
}
......@@ -19,13 +19,15 @@ import {ReactiveFormsModule} from '@angular/forms';
import {CommonService} from './common/common.service';
import {UtilService} from './common/util.service';
import {DisableControlDirective} from './common/disable-control.directive';
import {PipeModule} from './pipe/pipe.module';
@NgModule({
imports: [
ReactiveFormsModule,
NgZorroAntdModule,
BootappSharedLibsModule,
BootappSharedCommonModule
BootappSharedCommonModule,
PipeModule,
],
declarations: [
JhiLoginModalComponent,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment