Skip to content

Commit

Permalink
#109 add feature: delete token [vip:platform/pallas#819]
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanChan committed Jul 30, 2019
1 parent 1420658 commit 1b4c30d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
19 changes: 18 additions & 1 deletion pallas-console-web/src/pages/token_manage/token_manage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
<div style="color: gray;font-size: 12px;">{{scope.row.clientToken}}</div>
</template>
</el-table-column>
<el-table-column label="编辑" width="30px" align="center">
<el-table-column label="编辑" width="80px" align="center">
<template slot-scope="scope">
<el-button type="text" @click.stop="handleEdit(scope.row)"><i class="fa fa-pencil-square-o"></i></el-button>
<el-button type="text" @click="handleDelete(scope.row)"><i class="fa fa-trash"></i></el-button>
</template>
</el-table-column>
</el-table>
Expand Down Expand Up @@ -85,6 +86,19 @@ export default {
};
},
methods: {
handleDelete(row) {
this.$message.confirmMessage(`确定删除token: ${row.clientToken}吗?`, () => {
this.loading = true;
this.$http.post(`/token/delete/id.json?tokenId=${row.id}`).then(() => {
this.$message.successMessage('删除成功', () => {
this.refreshPage();
});
})
.finally(() => {
this.loading = false;
});
});
},
handleSearch() {
let filtered = this.initTokenList;
filtered = filtered.filter((e) => {
Expand Down Expand Up @@ -144,6 +158,9 @@ export default {
this.isPrivilege = true;
});
},
refreshPage() {
this.init();
},
init() {
this.loading = true;
Promise.all([this.getDataList()]).then()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ public List<SearchAuthorization> queryTokens(HttpServletRequest request){
return authService.selectAll();
}


@RequestMapping(path="/delete/id.json", method={RequestMethod.POST})
public void deleteToken(HttpServletRequest request,@RequestParam Long tokenId){
if (!AuthorizeUtil.authorizeTokenPrivilege(request, null)) {
throw new BusinessLevelException(403, "无权限操作");
}
authService.deleteById(tokenId);
}

@RequestMapping(path="/insert.json", method={RequestMethod.POST})
public void createOrUpdateToken(@RequestBody @Validated SearchAuthorization token, HttpServletRequest request){
if (!AuthorizeUtil.authorizeTokenPrivilege(request, null)) {
Expand Down

0 comments on commit 1b4c30d

Please sign in to comment.