Skip to content

Commit

Permalink
Merge branch 'pam' of github.com:jumpserver/lina into pr@pam@feat_pas…
Browse files Browse the repository at this point in the history
…sword_leakage
  • Loading branch information
O-Jiangweidong committed Dec 20, 2024
2 parents 9a02b4a + ac60401 commit 75668d9
Show file tree
Hide file tree
Showing 53 changed files with 1,340 additions and 764 deletions.
8 changes: 1 addition & 7 deletions src/components/Apps/AccountCreateUpdateForm/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ export const accountFieldsMeta = (vm) => {
}
}
}
},
hidden: () => {
return vm.addTemplate
}
},
username: {
Expand Down Expand Up @@ -188,10 +185,7 @@ export const accountFieldsMeta = (vm) => {
label: vm.$t('IsActive')
},
comment: {
label: vm.$t('Comment'),
hidden: () => {
return vm.addTemplate
}
label: vm.$t('Comment')
}
}
}
8 changes: 4 additions & 4 deletions src/components/Apps/AccountCreateUpdateForm/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ export default {
form: Object.assign({ 'on_invalid': 'error' }, this.account || {}),
encryptedFields: ['secret'],
fields: [
[this.$t('AccountTemplate'), ['template']],
[this.$t('Basic'), ['assets', 'name', 'username', 'privileged', 'su_from', 'su_from_username']],
[this.$t('Basic'), ['name', 'username', 'privileged', 'su_from', 'su_from_username', 'template']],
[this.$t('Assets'), ['assets']],
[this.$t('Secret'), [
'secret_type', 'password', 'ssh_key', 'token',
'access_key', 'passphrase', 'api_key',
Expand Down Expand Up @@ -158,10 +158,10 @@ export default {
<style lang='scss' scoped>
.account-add {
::v-deep .el-form-item {
margin-bottom: 5px;
//margin-bottom: 5px;
.help-block {
margin-bottom: 5px;
//margin-bottom: 5px;
}
}
Expand Down
31 changes: 1 addition & 30 deletions src/components/Apps/AccountListTable/AccountCreateUpdate.vue
Original file line number Diff line number Diff line change
@@ -1,30 +1,7 @@
<template v-if="iVisible">
<Dialog
v-if="origin !== 'pam'"
:close-on-click-modal="false"
:destroy-on-close="true"
:show-cancel="false"
:show-confirm="false"
:title="title"
:visible.sync="iVisible"
v-bind="$attrs"
width="900px"
v-on="$listeners"
>
<AccountCreateUpdateForm
v-if="!loading"
ref="form"
:account="account"
:add-template="addTemplate"
:asset="asset"
@add="addAccount"
@edit="editAccount"
/>
</Dialog>

<Drawer
v-else
:title="title"
:visible="iVisible"
@close-drawer="iVisible = false"
>
<AccountCreateUpdateForm
Expand All @@ -41,14 +18,12 @@

<script>
import Drawer from '@/components/Drawer/index.vue'
import Dialog from '@/components/Dialog/index.vue'
import AccountCreateUpdateForm from '@/components/Apps/AccountCreateUpdateForm/index.vue'
export default {
name: 'CreateAccountDialog',
components: {
Drawer,
Dialog,
AccountCreateUpdateForm
},
props: {
Expand All @@ -73,10 +48,6 @@ export default {
default: function() {
return this.$t('AddAccount')
}
},
origin: {
type: String,
default: ''
}
},
data() {
Expand Down
14 changes: 3 additions & 11 deletions src/components/Apps/AccountListTable/AccountList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<AccountCreateUpdate
v-if="showAddDialog"
:account="account"
:origin="origin"
:asset="iAsset"
:title="accountCreateUpdateTitle"
:visible.sync="showAddDialog"
Expand All @@ -31,7 +30,6 @@
<AccountCreateUpdate
v-if="showAddTemplateDialog"
:account="account"
:origin="origin"
:add-template="true"
:asset="iAsset"
:title="accountCreateByTemplateTitle"
Expand All @@ -56,9 +54,7 @@

<script>
import ListTable from '@/components/Table/ListTable/index.vue'
import {
ActionsFormatter, PlatformFormatter, SecretViewerFormatter
} from '@/components/Table/TableFormatters'
import { ActionsFormatter, PlatformFormatter, SecretViewerFormatter } from '@/components/Table/TableFormatters'
import ViewSecret from './ViewSecret.vue'
import UpdateSecretInfo from './UpdateSecretInfo.vue'
import AccountCreateUpdate from './AccountCreateUpdate.vue'
Expand Down Expand Up @@ -138,10 +134,6 @@ export default {
extraQuery: {
type: Object,
default: () => ({})
},
origin: {
type: String,
default: ''
}
},
data() {
Expand Down Expand Up @@ -200,13 +192,13 @@ export default {
{
label: '僵尸账号',
filter: {
risk: 'zombie'
risk: 'long_time_no_login'
}
},
{
label: '幽灵账号',
filter: {
risk: 'ghost'
risk: 'new_found'
}
},
{
Expand Down
9 changes: 5 additions & 4 deletions src/components/Cards/SummaryCard/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</div>
<slot>
<h3 class="no-margins ">
<span class="num" @click="handleClick">
{{ iCount }}
<span v-async="iCount" class="num" @click="handleClick">
-
</span>
</h3>
</slot>
Expand All @@ -27,7 +27,7 @@ export default {
default: () => ({})
},
count: {
type: [Number, String],
type: [Number, String, Promise],
default: 0
},
route: {
Expand All @@ -49,7 +49,8 @@ export default {
},
computed: {
iCount() {
return this.body.count || this.count
const count = this.body.count || this.count
return count
},
iRoute() {
return this.body.route || this.route
Expand Down
38 changes: 32 additions & 6 deletions src/components/DataActions/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,27 @@
v-if="action.dropdown"
v-show="action.dropdown.length > 0"
:key="action.name"
:class="[action.name, {grouped: action.grouped }]"
:size="action.size"
:split-button="!!action.split"
:type="action.type"
class="action-item"
placement="bottom-start"
trigger="click"
@command="handleDropdownCallback"
>
<el-button :class="action.name" :size="size" class="more-action" v-bind="{...cleanButtonAction(action), icon: ''}">
<span v-if="action.icon" class="pre-icon">
<Icon :icon="action.icon" />
<span v-if="action.split" @click="handleClick(action)">
{{ action.title }}
</span>
<el-button
v-else
:class="action.name"
:size="size"
class="more-action"
v-bind="{...cleanButtonAction(action), icon: ''}"
>
<span class="pre-icon">
<Icon v-if="action.icon" :icon="action.icon" />
</span>
<span v-if="action.title">
{{ action.title }}<i class="el-icon-arrow-down el-icon--right" />
Expand Down Expand Up @@ -42,8 +55,8 @@
class="dropdown-item"
v-bind="{...option, icon: ''}"
>
<span v-if="option.icon" class="pre-icon">
<Icon :icon="option.icon" />
<span v-if="actionsHasIcon(action.dropdown)" class="pre-icon">
<Icon v-if="option.icon" :icon="option.icon" />
</span>
{{ option.title }}
</el-dropdown-item>
Expand All @@ -55,7 +68,7 @@
<el-button
v-else
:key="action.name"
:class="action.name"
:class="[action.name, {grouped: action.grouped }]"
:size="size"
class="action-item"
v-bind="{...cleanButtonAction(action), icon: ''}"
Expand Down Expand Up @@ -107,6 +120,9 @@ export default {
}
},
methods: {
actionsHasIcon(actions) {
return actions.some(action => action.icon)
},
hasIcon(action, type = '') {
const icon = action.icon
if (!icon) {
Expand Down Expand Up @@ -164,6 +180,7 @@ export default {
delete action['callback']
delete action['name']
delete action['can']
delete action['split']
return action
},
cleanActions(actions) {
Expand Down Expand Up @@ -193,6 +210,10 @@ export default {
}
delete action['can']
if (!action.size) {
action.size = 'small'
}
if (action.dropdown) {
action.dropdown = this.cleanActions(action.dropdown)
}
Expand All @@ -217,6 +238,10 @@ $color-drop-menu-border: #e4e7ed;
.action-item {
margin-left: 5px;
&.grouped {
margin-left: 0;
}
&:first-child {
margin-left: 0;
}
Expand Down Expand Up @@ -314,6 +339,7 @@ $color-drop-menu-border: #e4e7ed;
.dropdown-item {
color: var(--color-text-primary);
line-height: 34px;
.pre-icon {
width: 17px;
Expand Down
Loading

0 comments on commit 75668d9

Please sign in to comment.