Skip to content

Commit

Permalink
API migrate and fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
yanyin1986 authored Mar 19, 2024
1 parent ddd1e45 commit 93bf9b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/api/rbac.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ export function createRole(data) {
})
}

export function roleScopesBatchUpdate(data) {
export function updateRoleScopes(data) {
return request({
url: '/v1/rbac/role/scope/batch',
method: 'post',
url: '/v1/rbac/role/scope',
method: 'put',
data
})
}
Expand Down Expand Up @@ -61,10 +61,10 @@ export function setDefaultRole(data) {
})
}

export function setDefaultScope(data) {
export function setRoleDefaultScope(data) {
return request({
url: '/v1/rbac/role/scope/default',
method: 'post',
method: 'put',
data
})
}
Expand Down
12 changes: 6 additions & 6 deletions src/views/rbac/roles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@

<el-table-column align="center" min-width="100px" label="Role Name">
<template slot-scope="scope">
<svg-icon icon-class="star" style="color:#FFA500" v-show="application.default_role == scope.row.id" />
<svg-icon v-show="application.default_role == scope.row.id" icon-class="star" style="color:#FFA500" />
<span class="link-type" @click="handleSetDefaultRole(scope)">{{ scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column align="center" min-width="100px" label="Scopes">
<template slot-scope="scope">
<div class="block">
<el-tag v-for="s in scope.row.scopes" :key="s.name" type="info" class="tag-item" style="margin-right:5px">
<svg-icon icon-class="star" style="color:#FFA500" v-show="scope.row.default_scope == s.id" />
<svg-icon v-show="scope.row.default_scope == s.id" icon-class="star" style="color:#FFA500" />
<span class="link-type" @click="handleSetDefaultScope(scope.row, s)">{{ s.name }}</span>
</el-tag>
</div>
Expand Down Expand Up @@ -49,7 +49,7 @@
<el-dialog :visible.sync="editRoleVisible" :title="'Edit Role'">
<el-form :model="role" label-width="80px" label-position="left">
<el-form-item label="Name">
<el-input v-model="role.name" placeholder="Role Name" :disabled="true"/>
<el-input v-model="role.name" placeholder="Role Name" :disabled="true" />
</el-form-item>
<el-form-item label="Scopes">
<el-drag-select v-model="value" style="width:500px;" multiple placeholder="select scopes" :disabled="dragSelectDisabled">
Expand Down Expand Up @@ -97,7 +97,7 @@
<script>
import { deepClone } from '@/utils'
import ElDragSelect from '@/components/DragSelect' // base on element-ui
import { getRoles, getScopes, createRole, setDefaultRole, setDefaultScope, roleScopesBatchUpdate } from '@/api/rbac'
import { getRoles, getScopes, createRole, setDefaultRole, setRoleDefaultScope, updateRoleScopes } from '@/api/rbac'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
const defaultRole = {
Expand Down Expand Up @@ -208,7 +208,7 @@ export default {
role_id: this.role.id,
scopes: this.value
}
await roleScopesBatchUpdate(data)
await updateRoleScopes(data)
this.editRoleVisible = false
await this.getRoleList()
},
Expand All @@ -226,7 +226,7 @@ export default {
role_id: this.defaultRole.id,
scope_id: this.defaultScope.id
}
await setDefaultScope(data)
await setRoleDefaultScope(data)
this.setDefaultScopeVisible = false
await this.getRoleList()
}
Expand Down

0 comments on commit 93bf9b1

Please sign in to comment.