* support cinder volume list and create volume.

This commit is contained in:
baiziyu 2021-09-14 18:01:16 +08:00
parent aee5c4cb6f
commit b976abf9ac
4 changed files with 18 additions and 17 deletions

View File

@ -147,7 +147,7 @@ export default {
this.tableLoading = true;
let ret = await this.$ajax({
type: 'get',
url: "api/keystone/v3/inspur/projects?" + $.param(params)
url: "api/keystone/v3/projects?" + $.param(params)
});
this.tableData = ret.projects;
this.total = ret.total;

View File

@ -156,7 +156,7 @@ export default {
}
let ret = await this.$ajax({
type: 'get',
url: "api/keystone/v3/inspur/users?" + $.param(param)
url: "api/keystone/v3/users?" + $.param(param)
})
this.tableData = ret.users;
this.total = ret.total;

View File

@ -11,7 +11,7 @@
</el-select>
</el-form-item>
<!--用户-->
<el-form-item :label="$t('storage.user')" prop="project" class="is-required" v-if="roleType=='0'">
<el-form-item :label="$t('storage.user')" prop="project" class="is-required">
<el-select v-model="newVolume.userId" v-bind:style="widthStyle" filterable>
<el-option v-for="item in userList" :key="item.id" :label="getSelectOptionName(item.name)" :value="item.id" :title="item.name.length > 80?item.name:''">
</el-option>
@ -130,7 +130,7 @@
</el-form>
<!-- </el-col>
<el-col :span="12">
</el-col> -->
<div slot="footer" class="dialog-footer">
<el-button @click="hide" :disabled="isDisabled">{{$t('lang.cancel')}}</el-button>
@ -645,7 +645,7 @@ export default {
async syncQuota() {
let self = this;
let projectId = self.newVolume.project;
let url = "api/cinderv3/v3/" + self.$cookie.get("pid") + "/inspur-volumes/" + projectId + "/syncquota"
let url = "api/cinderv3/v3/" + self.$cookie.get("pid") + "/volumes/" + projectId + "/syncquota"
try {
let ret = await this.$ajax({
type: 'POST',
@ -688,7 +688,7 @@ export default {
if ( !self.newVolume.project ) {
return false;
}
let url = 'api/keystone/v3/inspur/assignments/projects/' + projectId + '/users';
let url = 'api/keystone/v3/users';
try {
let result = await self.$ajax({
type: 'get',
@ -696,10 +696,11 @@ export default {
showErrMsg: false
});
let users = result['users'];
console.log(users);
let loginUser = "";
if (users != null) {
for (let u = 0; u < users.length; u++) {
let userObj = users[u].user;
let userObj = users[u];
self.userList.push(userObj);
//
//i
@ -936,7 +937,7 @@ export default {
let self = this;
self.loading = true;
let projectId = this.$cookie.get('pid');
let url = "api/cinderv3/v3/" + projectId + "/inspur-types";
let url = "api/cinderv3/v3/" + projectId + "/types";
//
try {
let result = await self.$ajax({
@ -984,7 +985,7 @@ export default {
let description = this.newVolume.description;
let vType = this.newVolume.type;
let selectProjectId = this.newVolume.project;
let url = "api/cinderv3/v3/" + projectId + "/inspur-volumes";
let url = "api/cinderv3/v3/" + projectId + "/volumes";
let type = "post";
let msg = this.$t('storage.createVolSuccess');
let body = {"volume": {"name": name, "size": size, "description": description, "multiattach": isShared, "volume_type": vType, "availability_zone": zone}};
@ -1009,7 +1010,7 @@ export default {
return;
}
if ("0" == roleType) {
url = "api/cinderv3/v3/" + projectId + "/inspur-volumes";
url = "api/cinderv3/v3/" + projectId + "/volumes";
body = {"volume": {"name": name, "size": size, "description": description, "multiattach": isShared, "volume_type": vType, "project_id": selectProjectId, "user_id": userId, "availability_zone": zone}};
}
if (!this.totalInfinite) {
@ -1442,4 +1443,4 @@ export default {
}
}
}
</script>
</script>

View File

@ -649,7 +649,7 @@ export default {
data["user_id"] = Vue.userId;
}
data['soft_deleted'] = "False";
let url = "api/cinderv3/v3/" + projectId + "/inspur-volumes/detail?metadata={'store_image_data':'False'}&" + $.param(data);
let url = "api/cinderv3/v3/" + projectId + "/volumes/detail";
try {
let result = await self.$ajax({
type: "get",
@ -805,7 +805,7 @@ export default {
self.projectlist = projectlist;
return false;
}
let url = "api/keystone/v3/inspur/projects?domain_id=default";
let url = "api/keystone/v3/projects?domain_id=default";
try {
let result = await self.$ajax({
type: "get",
@ -831,11 +831,11 @@ export default {
let roleType = Vue.roleType + "";
let url = "";
if ("2" == roleType || "3" == roleType) {
url = "api/keystone/v3/inspur/users?project_id=" + self.$cookie.get("pid");
url = "api/keystone/v3/users?project_id=" + self.$cookie.get("pid");
} else {
url = "api/keystone/v3/inspur/users?domain_id=default";
url = "api/keystone/v3/users?domain_id=default";
if (projectId) {
url = "api/keystone/v3/inspur/users?domain_id=default&project_id=" + projectId;
url = "api/keystone/v3/users?domain_id=default&project_id=" + projectId;
}
}
try {
@ -1354,4 +1354,4 @@ export default {
overflow-y: auto;
max-height: 400px;
}
</style>
</style>