Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node resource usage ui optimize #210

Merged
merged 8 commits into from
Jan 11, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
frontend: change ui
  • Loading branch information
BennieMeng committed Jan 10, 2019
commit 78c538c517b37cfffba1a3cafdcf0c077f3bd20c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
</svg>
</div>
<div class="box" *ngIf="showView">
<echarts-pie style="height: 250px; width: 250px;" [title]="node.title" [data]="node.data"></echarts-pie>
<echarts-gauge style="height: 250px; width: 250px;" [title]="ready.title" [data]="ready.data" [name]="ready.name" type="percent" [tooltip]="ready.tooltip"></echarts-gauge>
<echarts-gauge style="height: 250px; width: 250px;" [title]="schedulable.title" [data]="schedulable.data" [name]="schedulable.name" type="percent" [tooltip]="schedulable.tooltip"></echarts-gauge>
<echarts-gauge style="height: 250px; width: 250px;" [title]="cpu.title" [data]="cpu.data" [name]="cpu.name" type="percent" [tooltip]="cpu.tooltip"></echarts-gauge>
<echarts-gauge style="height: 250px; width: 250px;" [title]="memory.title" [data]="memory.data" [name]="cpu.name" type="percent" [tooltip]="memory.tooltip"></echarts-gauge>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
display: flex;
justify-content: space-around;
flex-wrap: wrap;
height: 200px;
align-items: center;
& > * {
transform: scale(.8);
}
}
:host{
display: block;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,16 @@ export class NodeResourceComponent implements OnInit {
tooltip: '',
data: []
};
node = {
title: 'Node 使用概况',
ready = {
title: 'Ready 使用概况',
name: '使用量',
tooltip: '',
data: []
};
schedulable = {
title: 'Node 可调度概况',
name: '可调度',
tooltip: '',
data: []
};
setCpu(cpuSummary: Summary) {
Expand All @@ -52,34 +60,10 @@ export class NodeResourceComponent implements OnInit {
this.memory.data = [parseInt((memorySummary.Used / memorySummary.Total) * 100 + '', 10)];
}
setNode(nodeSummary: NodeSummary) {
this.node.data = [
{
title: 'Ready',
data: [
{
name: 'Ready',
value: nodeSummary.Ready
},
{
name: '其他',
value: nodeSummary.Total - nodeSummary.Ready
}
]
},
{
title: '可调度',
data: [
{
name: '可调度',
value: nodeSummary.Schedulable
},
{
name: '其他',
value: nodeSummary.Total - nodeSummary.Schedulable
}
]
}
];
this.ready.tooltip = `Ready/total: ${nodeSummary.Ready}/${nodeSummary.Total}`;
this.ready.data = [parseInt((nodeSummary.Ready / nodeSummary.Total) * 100 + '', 10)];
this.schedulable.tooltip = `可调度/total: ${nodeSummary.Schedulable}/${nodeSummary.Total}`;
this.schedulable.data = [parseInt((nodeSummary.Schedulable / nodeSummary.Total) * 100 + '', 10)];
}
changeShow() {
this.showView = !this.showView;
Expand Down