-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: PAM Service * perf: Remove useless * perf: Add go module download value --------- Co-authored-by: jiangweidong <[email protected]>
- Loading branch information
1 parent
11d40b4
commit 7a6c156
Showing
17 changed files
with
941 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<template> | ||
<Dialog | ||
:show-cancel="false" | ||
:title="title" | ||
:visible.sync="visible" | ||
:close-on-click-modal="false" | ||
width="700px" | ||
@close="onClose" | ||
@confirm="visible = false" | ||
> | ||
<el-alert type="warning" :closable="false"> | ||
{{ warningText }} | ||
<div class="secret"> | ||
<div class="row"> | ||
<span class="col">ID:</span> | ||
<span class="value">{{ keyInfo.id }}</span> | ||
<i class="el-icon-copy-document copy-icon" @click="handleCopy(keyInfo.id)" /> | ||
</div> | ||
<div class="row"> | ||
<span class="col">Secret:</span> | ||
<span class="value">{{ keyInfo.secret }}</span> | ||
<i class="el-icon-copy-document copy-icon" @click="handleCopy(keyInfo.secret)" /> | ||
</div> | ||
</div> | ||
</el-alert> | ||
</Dialog> | ||
</template> | ||
|
||
<script> | ||
import i18n from '@/i18n/i18n' | ||
import { copy } from '@/utils/common' | ||
import Dialog from '@/components/Dialog/index' | ||
export default { | ||
name: 'Secret', | ||
components: { | ||
Dialog | ||
}, | ||
props: { | ||
title: { | ||
type: String, | ||
default: () => i18n.t('CreateAccessKey') | ||
}, | ||
warningText: { | ||
type: String, | ||
default: () => i18n.t('ApiKeyWarning') | ||
} | ||
}, | ||
data() { | ||
return { | ||
keyInfo: { id: '', secret: '' }, | ||
visible: false | ||
} | ||
}, | ||
methods: { | ||
show(data) { | ||
this.keyInfo = data | ||
this.visible = true | ||
}, | ||
onClose() { | ||
this.$emit('close') | ||
}, | ||
handleCopy(value) { | ||
copy(value) | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang='scss' scoped> | ||
.secret { | ||
color: #2b2f3a; | ||
margin-top: 20px; | ||
} | ||
.row { | ||
margin-bottom: 10px; | ||
} | ||
.col { | ||
width: 100px; | ||
text-align: left; | ||
display: inline-block; | ||
} | ||
.copy-icon { | ||
margin-left: 5px; | ||
cursor: pointer; | ||
transition: color 0.2s; | ||
} | ||
.value { | ||
font-weight: 600; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<template> | ||
<div> | ||
<CardTable | ||
ref="table" | ||
:columns="3" | ||
:sub-component="subComponent" | ||
v-bind="$attrs" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script type="text/jsx"> | ||
import CardTable from '@/components/Table/CardTable' | ||
import CardPanel from './components/CardPanel.vue' | ||
export default { | ||
name: 'SmallCard', | ||
components: { | ||
CardTable | ||
}, | ||
data() { | ||
return { | ||
subComponent: CardPanel | ||
} | ||
}, | ||
methods: { | ||
reloadTable() { | ||
this.$refs.table.reloadTable() | ||
} | ||
} | ||
} | ||
</script> |
176 changes: 176 additions & 0 deletions
176
src/components/Table/CardTable/components/CardPanel.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
<template> | ||
<div class="account-panel"> | ||
<el-row :gutter="20"> | ||
<el-col :span="21"> | ||
<div class="title"> | ||
<span>{{ object.name }}</span> | ||
</div> | ||
</el-col> | ||
<el-col v-if="iActions.length !== 0" :span="3" @click.native="handleClick($event)"> | ||
<el-dropdown> | ||
<el-link :underline="false" type="primary"> | ||
<i class="el-icon-more el-icon--right" style="color: var(--color-text-primary)" /> | ||
</el-link> | ||
<el-dropdown-menu default="dropdown"> | ||
<el-dropdown-item | ||
v-for="action in iActions" | ||
:key="action.name" | ||
:disabled="action.disabled" | ||
@click.native="action.callback(object)" | ||
> | ||
<i v-if="action.icon" :class="action.icon" /> {{ action.name }} | ||
</el-dropdown-item> | ||
</el-dropdown-menu> | ||
</el-dropdown> | ||
</el-col> | ||
</el-row> | ||
<el-divider /> | ||
<el-row :gutter="20" class="panel-content"> | ||
<el-col :span="6" class="panel-image"> | ||
<el-image :src="imageUrl" fit="contain" /> | ||
</el-col> | ||
<el-col :span="18" class="panel-info"> | ||
<InfoPanel | ||
v-for="(obj, index) in getInfos(object)" | ||
:key="index" | ||
:content="obj.content" | ||
:title="obj.title" | ||
/> | ||
</el-col> | ||
</el-row> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import InfoPanel from './InfoPanel' | ||
export default { | ||
name: 'CardPanel', | ||
components: { | ||
InfoPanel | ||
}, | ||
props: { | ||
tableConfig: { | ||
type: Object, | ||
default: () => ({}) | ||
}, | ||
object: { | ||
type: Object, | ||
required: true | ||
}, | ||
actions: { | ||
type: Array, | ||
default: () => [] | ||
}, | ||
infos: { | ||
type: Array, | ||
default: () => [] | ||
}, | ||
getImage: { | ||
type: Function, | ||
default: (obj) => '' | ||
}, | ||
getInfos: { | ||
type: Function, | ||
default: (obj) => [] | ||
}, | ||
handleUpdate: { | ||
type: Function, | ||
default: () => {} | ||
} | ||
}, | ||
data() { | ||
return { | ||
defaultActions: [ | ||
{ | ||
id: 'update', | ||
name: this.$tc('Update'), | ||
icon: 'el-icon-edit', | ||
callback: this.handleUpdate, | ||
disabled: this.isDisabled('change') | ||
}, | ||
{ | ||
id: 'delete', | ||
name: this.$tc('Delete'), | ||
icon: 'el-icon-delete', | ||
callback: this.handleDelete, | ||
disabled: this.isDisabled('delete') | ||
} | ||
] | ||
} | ||
}, | ||
computed: { | ||
imageUrl() { | ||
return this.getImage(this.object) | ||
}, | ||
iActions() { | ||
const mergedActions = new Map() | ||
this.defaultActions.forEach(a => { | ||
mergedActions.set(a.id, { ...a }) | ||
}) | ||
this.actions.forEach(a => { | ||
mergedActions.set(a.id, { ...a }) | ||
}) | ||
return Array.from(mergedActions.values()) | ||
} | ||
}, | ||
methods: { | ||
isDisabled(action) { | ||
const app = this.tableConfig.permissions?.app | ||
const resource = this.tableConfig.permissions?.resource | ||
return !this.$hasPerm(`${app}.${action}_${resource}`) | ||
}, | ||
handleClick(event) { | ||
event.stopPropagation() | ||
}, | ||
handleDelete() { | ||
const url = this.tableConfig.url | ||
this.$confirm(this.$tc('DeleteConfirmMessage'), this.$tc('Delete'), { | ||
confirmButtonText: this.$tc('Confirm'), | ||
cancelButtonText: this.$tc('Cancel'), | ||
type: 'warning' | ||
}).then(() => { | ||
this.$axios.delete(`${url}${this.object.id}/`).then(() => { | ||
this.$message({ | ||
type: 'success', | ||
message: this.$tc('DeleteSuccess') | ||
}) | ||
this.$emit('refresh') | ||
}) | ||
}) | ||
} | ||
} | ||
} | ||
</script> | ||
<style lang="scss" scoped> | ||
.account-panel { | ||
display: flex; | ||
flex-direction: column; | ||
//height: 100%; | ||
cursor: pointer; | ||
.title { | ||
text-align: left; | ||
font-weight: 500; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} | ||
.panel-content { | ||
display: flex; | ||
height: 100px; | ||
padding: 10px 0; | ||
.panel-image { | ||
margin: auto 5px; | ||
} | ||
} | ||
.el-divider--horizontal { | ||
margin: 5px 0; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.