Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
30 changes: 25 additions & 5 deletions Contrib-Inspur/OR-web/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
# OR-web

## Install
# antd-ob

## Project setup
```
npm install
```

### Compiles and hot-reloads for development
```
npm run serve
```

### Compiles and minifies for production
```
npm run build
scp -r ./dist/* root@bmcIP:/usr/share/www/
````
```

### Run your tests
```
npm run test
```

### Lints and fixes files
```
npm run lint
```

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
2 changes: 1 addition & 1 deletion Contrib-Inspur/OR-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"animate.css": "^3.7.0",
"ant-design-vue": "^1.3.1",
"axios": "^0.19.0",
"axios": "^0.18.0",
"dayjs": "^1.8.0",
"epic-spinners": "^1.0.4",
"vue": "^2.5.21",
Expand Down
21 changes: 16 additions & 5 deletions Contrib-Inspur/OR-web/src/service/i18n/en-US/psu.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
/*
* @Author: your name
* @Date: 2020-02-20 10:26:29
* @LastEditTime: 2020-03-01 19:21:02
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /bmcweb/home/mengyaohui/work/openbmc/openbmc/build/workspace/sources/phosphor-webui/src/service/i18n/en-US/psu.js
*/
export default {
title: 'Power Supply',
sub_title: 'Display all nodes\' information',
vendor: 'Vendor:',
model: 'Model:',
sn: 'SN:',
pn: 'PN:',
fw: 'Firmware Version:'
status: 'Status',
vendor: 'Vendor',
model: 'Model',
sn: 'SN',
pn: 'PN',
fw: 'Firmware Version',
enable: 'enable',
disable: 'disable',
}
21 changes: 16 additions & 5 deletions Contrib-Inspur/OR-web/src/service/i18n/zh-CN/psu.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
/*
* @Author: your name
* @Date: 2020-02-20 10:26:29
* @LastEditTime: 2020-03-01 19:20:37
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /bmcweb/home/mengyaohui/work/openbmc/openbmc/build/workspace/sources/phosphor-webui/src/service/i18n/zh-CN/psu.js
*/
export default {
title: '电源模块',
sub_title: '展示节点电源模块信息',
vendor: '生产商:',
model: '型号:',
sn: '序列号:',
pn: '部分编号:',
fw: '固件版本:'
status: '状态',
vendor: '生产商',
model: '型号',
sn: '序列号',
pn: '部分编号',
fw: '固件版本',
enable: '在位',
disable: '不在位',
}
103 changes: 60 additions & 43 deletions Contrib-Inspur/OR-web/src/views/psu/psu.vue
Original file line number Diff line number Diff line change
@@ -1,40 +1,32 @@
<!--
* @Author: your name
* @Date: 2020-02-29 18:14:51
* @LastEditTime: 2020-03-01 21:22:47
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /bmcweb/home/mengyaohui/work/openbmc/openbmc/build/workspace/sources/phosphor-webui/src/views/psu/psu.vue
-->
<template>
<view-content message="psu" @refresh="refresh">
<a-row style="margin-bottom: 20px">
<a-form>
<a-col :span="24">
<a-form-item :label="$t('message.common.select_node')" :labelCol="{ span: 3 }" :wrapperCol="{ span: 4 }">
<a-select v-model="node" @change="onChassisChange">
<a-select-option v-for="(item, index) in nodeList" :key="index" :value="item">{{'node ' + index}}</a-select-option>
</a-select>
</a-form-item>
</a-col>
</a-form>
</a-row>
<a-row class="item-row">
<a-col :span="3">{{$t('message.psu.vendor')}}</a-col>
<a-col :span="10">{{currentPsuInfo.vendor}}</a-col>
</a-row>
<a-row class="item-row">
<a-col :span="3">{{$t('message.psu.model')}}</a-col>
<a-col :span="10">{{currentPsuInfo.model}}</a-col>
</a-row>
<a-row class="item-row">
<a-col :span="3">{{$t('message.psu.sn')}}</a-col>
<a-col :span="10">{{currentPsuInfo.sn}}</a-col>
</a-row>
<a-row class="item-row">
<a-col :span="3">{{$t('message.psu.pn')}}</a-col>
<a-col :span="10">{{currentPsuInfo.pn}}</a-col>
</a-row>
<a-row class="item-row">
<a-col :span="3">{{$t('message.psu.fw')}}</a-col>
<a-col :span="10">{{currentPsuInfo.fw}}</a-col>
<a-table :columns="columns" :dataSource="data" size="small" rowKey='name'>
<span slot="status" slot-scope="status">
<a-icon v-if="status == 'enable'" type="check-circle" style="color: green;font-size: 1.2em;"/>
<a-icon v-else type="close-circle" style="color: orange;font-size: 1.2em;"/>
</span>
</a-table>
<a-row style="margin-bottom: 20px;">
<a-col :span="2">
<a-icon type="check-circle" style="color: green;font-size: 1.2em;margin-right: 10px"/>{{$t('message.psu.enable')}}
</a-col>
<a-col :span="2">
<a-icon type="close-circle" style="color: grey;font-size: 1.2em;margin-right: 10px"/>{{$t('message.psu.disable')}}
</a-col>
</a-row>
</view-content >
</template>

<script>
//import reqwest from 'reqwest';
import ViewContent from '@/components/viewContent'
import { mapMutations } from 'vuex'

Expand All @@ -45,10 +37,20 @@ export default {
name: 'psu',
data () {
return {
columns: [
{ title: 'No.', dataIndex: 'id', width: '5%' },
{ title: this.$t('message.psu.status'), dataIndex: 'status', width: '10%' , align: 'center', scopedSlots: { customRender: 'status' }},
{ title: this.$t('message.psu.vendor'), dataIndex: 'vendor', width: '10%' },
{ title: this.$t('message.psu.model'), dataIndex: 'model', width: '20%' },
{ title: this.$t('message.psu.sn'), dataIndex: 'sn', width: '20%' },
{ title: this.$t('message.psu.pn'), dataIndex: 'pn', width: '20%' },
{ title: this.$t('message.psu.fw'), dataIndex: 'fw' },
],
node: undefined,
nodeList: [],
chassisReqs: {},
currentPsuInfo: {}
currentPsuInfo: {},
data: []
}
},
methods: {
Expand All @@ -64,9 +66,14 @@ export default {
this.nodeList.push(name)
this.chassisReqs[name] = `/redfish/v1/Chassis/${name}/Power`
})
this.node = this.nodeList[0]
let resPower = await http('get', this.chassisReqs[this.node])
this.currentPsuInfo = this.parseData(resPower.data.PowerSupplies)
//this.node = this.nodeList[0]
let resPower = await http('get',`/redfish/v1/Chassis/chassis1/Power`)
resPower.data.PowerSupplies.forEach((power, index) => {
this.data.push(this.parseData(power, index))
})
//this.currentPsuInfo = this.parseData(resPower.data.PowerSupplies)
//this.data.push(this.currentPsuInfo)

} catch (error) {
errorHandler(this, error, this.$t('message.sensor.get_err_msg'))
}
Expand All @@ -80,23 +87,33 @@ export default {
// this.setRefreshFlag({ refreshFlag: true })

try {
this.node = val
let resPower = await http('get', this.chassisReqs[this.node])
this.currentPsuInfo = this.parseData(resPower.data.PowerSupplies)
//this.node = val
//let resPower = await http('get', this.chassisReqs[this.node])
//this.currentPsuInfo = this.parseData(resPower.data.PowerSupplies)
//this.data.push(this.currentPsuInfo)

let resPower = await http('get',`/redfish/v1/Chassis/chassis1/Power`)
console.log('resPower:', resPower)
resPower.data.PowerSupplies.forEach((power, index) => {
console.log('power:', power)
this.data.push(this.parseData(power, index))
})
} catch (error) {
errorHandler(this, error, this.$t('message.sensor.get_err_msg'))
}

this.setRefreshFlag({ refreshFlag: false })
},

parseData (content) {
parseData (content, index) {
return {
vendor: content[0].Manufacturer,
model: content[0].Model,
sn: content[0].SerialNumber,
pn: content[0].PartNumber,
fw: content[0].FirmwareVersion
id: index,
status: content.Status.State,
vendor: content.Manufacturer,
model: content.Model,
sn: content.SerialNumber,
pn: content.PartNumber,
fw: content.FirmwareVersion
}
}
},
Expand Down
113 changes: 113 additions & 0 deletions Contrib-Inspur/OR-web/src/views/psu/psu.vue.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<template>
<view-content message="psu" @refresh="refresh">
<a-row style="margin-bottom: 20px">
<a-form>
<a-col :span="24">
<a-form-item :label="$t('message.common.select_node')" :labelCol="{ span: 3 }" :wrapperCol="{ span: 4 }">
<a-select v-model="node" @change="onChassisChange">
<a-select-option v-for="(item, index) in nodeList" :key="index" :value="item">{{'node ' + index}}</a-select-option>
</a-select>
</a-form-item>
</a-col>
</a-form>
</a-row>
<a-row class="item-row">
<a-col :span="3">{{$t('message.psu.vendor')}}</a-col>
<a-col :span="10">{{currentPsuInfo.vendor}}</a-col>
</a-row>
<a-row class="item-row">
<a-col :span="3">{{$t('message.psu.model')}}</a-col>
<a-col :span="10">{{currentPsuInfo.model}}</a-col>
</a-row>
<a-row class="item-row">
<a-col :span="3">{{$t('message.psu.sn')}}</a-col>
<a-col :span="10">{{currentPsuInfo.sn}}</a-col>
</a-row>
<a-row class="item-row">
<a-col :span="3">{{$t('message.psu.pn')}}</a-col>
<a-col :span="10">{{currentPsuInfo.pn}}</a-col>
</a-row>
<a-row class="item-row">
<a-col :span="3">{{$t('message.psu.fw')}}</a-col>
<a-col :span="10">{{currentPsuInfo.fw}}</a-col>
</a-row>
</view-content >
</template>

<script>
import ViewContent from '@/components/viewContent'
import { mapMutations } from 'vuex'

import http from '@/service/api/http'
import errorHandler, { getChassisInfo } from '@/service/api'

export default {
name: 'psu',
data () {
return {
node: undefined,
nodeList: [],
chassisReqs: {},
currentPsuInfo: {}
}
},
methods: {
...mapMutations(['setRefreshFlag']),
async refresh () {
this.nodeList = []
this.chassisReqs = {}
try {
let resChassis = await getChassisInfo()
resChassis.data.Members.forEach((item) => {
let tmps = item['@odata.id'].split('/')
let name = tmps[tmps.length - 1]
this.nodeList.push(name)
this.chassisReqs[name] = `/redfish/v1/Chassis/${name}/Power`
})
this.node = this.nodeList[0]
let resPower = await http('get', this.chassisReqs[this.node])
this.currentPsuInfo = this.parseData(resPower.data.PowerSupplies)
} catch (error) {
errorHandler(this, error, this.$t('message.sensor.get_err_msg'))
}

this.setRefreshFlag({ refreshFlag: false })
},

// chassis变化回调函数
async onChassisChange (val) {
this.currentPsuInfo = {}
// this.setRefreshFlag({ refreshFlag: true })

try {
this.node = val
let resPower = await http('get', this.chassisReqs[this.node])
this.currentPsuInfo = this.parseData(resPower.data.PowerSupplies)
} catch (error) {
errorHandler(this, error, this.$t('message.sensor.get_err_msg'))
}

this.setRefreshFlag({ refreshFlag: false })
},

parseData (content) {
return {
vendor: content[0].Manufacturer,
model: content[0].Model,
sn: content[0].SerialNumber,
pn: content[0].PartNumber,
fw: content[0].FirmwareVersion
}
}
},
components: {
ViewContent
}
}
</script>
<style lang="less" scoped>
.item-row {
margin-bottom: 15px;
/* border-bottom: 1px solid grey; */
}
</style>
Loading