Merge branch 'pam' of github.com:jumpserver/lina into pam

This commit is contained in:
ibuler
2025-02-12 18:07:40 +08:00
10 changed files with 197 additions and 130 deletions

View File

@@ -26,15 +26,15 @@ export default {
return {
loading: false,
config: {
title: '账号成功/失败情况',
tip: '账号成功/失败情况'
title: this.$t('AccountResult'),
tip: this.$t('AccountResult')
},
lineChartConfig: {
datesMetrics: [],
primaryData: [1],
primaryName: '成功',
primaryName: this.$t('Success'),
secondaryData: [1],
secondaryName: '失败'
secondaryName: this.$t('Failed')
}
}
},

View File

@@ -26,12 +26,12 @@ export default {
data() {
return {
logConfig: {
title: '当前状态',
tip: '当前状态'
title: this.$t('CurrentStatus'),
tip: this.$t('CurrentStatus')
},
sessionConfig: {
title: '改密任务执行状态',
tip: '改密任务执行状态'
title: this.$t('ChangeSecretTaskStatus'),
tip: this.$t('ChangeSecretTaskStatus')
},
data: {
total_count_change_secrets: 0,
@@ -47,23 +47,20 @@ export default {
LogItems() {
return [
{
title: '任务数',
title: this.$t('TaskCount'),
body: {
route: { name: `LoginLogList` },
count: this.data.total_count_change_secrets
}
},
{
title: '定时任务数',
title: this.$t('ScheduledTaskCount'),
body: {
route: { name: `LoginLogList` },
count: this.data.total_count_periodic_change_secrets
}
},
{
title: '资产数',
title: this.$t('AssetsOfNumber'),
body: {
route: { name: `OperateLogList` },
count: this.data.total_count_change_secret_assets
}
}
@@ -72,23 +69,20 @@ export default {
sessionItems() {
return [
{
title: '任务执行数',
title: this.$t('TaskExecutionCount'),
body: {
route: { name: `SessionList`, params: { activeMenu: 'OnlineList' }},
count: this.data.total_count_change_secret_executions
}
},
{
title: '成功数',
title: this.$t('SuccessCount'),
body: {
route: { name: `SessionList`, params: { activeMenu: 'OfflineList' }},
count: this.data.total_count_success_change_secret_executions
}
},
{
title: '失败数',
title: this.$t('FailCount'),
body: {
route: { name: `FtpLog` },
count: this.data.total_count_failed_change_secret_executions
}
}

View File

@@ -22,8 +22,8 @@ export default {
data() {
return {
logConfig: {
title: '当前正在改密情况',
tip: '当前正在改密情况'
title: this.$t('OngoingPwdChange'),
tip: this.$t('OngoingPwdChange')
},
data: {
total_count_ongoing_change_secret: 0,
@@ -36,21 +36,21 @@ export default {
LogItems() {
return [
{
title: '任务执行数',
title: this.$t('TaskExecutionCount'),
body: {
route: { name: `LoginLogList` },
count: this.data.total_count_ongoing_change_secret
}
},
{
title: '资产数',
title: this.$t('AssetsOfNumber'),
body: {
route: { name: `LoginLogList` },
count: this.data.total_count_ongoing_change_secret_assets
}
},
{
title: '账号数',
title: this.$t('AccountAmount'),
body: {
route: { name: `OperateLogList` },
count: this.data.total_count_ongoing_change_secret_accounts

View File

@@ -31,7 +31,7 @@ export default {
return {
showViewSecretDialog: false,
cardConfig: {
title: '改密失败账号'
title: this.$tc('ChangeSecretFailAccounts')
},
tableConfig: {
url: `/api/v1/accounts/change-secret-records/dashboard/?days=${this.days}`,

View File

@@ -46,7 +46,7 @@ export default {
const str = data[this.url.split('?')[1].split('=')[0]]
if (this.url.includes('accounts')) {
this.titleConfig.title = this.$t('ProportionOfAccontTypes')
this.titleConfig.title = this.$t('ProportionOfAccountTypes')
this.titleConfig.tip = this.$t('ProportionOfAccountTypes')
} else {
this.titleConfig.title = this.$t('ProportionOfAssetTypes')

View File

@@ -26,10 +26,10 @@ export default {
route: { name: 'PamAccounts' },
total: 0,
weekAdd: 0,
privileged: 0,
resetSecret: 0,
connectable: 0,
privilegedAccount: 0,
regularAccount: 0
valid: 0
}
}
},
@@ -44,20 +44,20 @@ export default {
params: {
total_accounts: 1,
total_week_add_accounts: 1,
total_privileged_accounts: 1,
total_secret_reset_accounts: 1,
total_connectivity_ok_accounts: 1
total_connectivity_ok_accounts: 1,
total_valid_accounts: 1
}
}
)
this.accountConfig.total = data.total_accounts
this.accountConfig.weekAdd = data.total_week_add_accounts
this.accountConfig.privileged = data.total_privileged_accounts
this.accountConfig.resetSecret = data.total_secret_reset_accounts
this.accountConfig.connectable = data.total_connectivity_ok_accounts
// TODO 额外两个字段
this.accountConfig.privilegedAccount = data.total_privileged_accounts
this.accountConfig.regularAccount = data.total_regular_accounts
this.accountConfig.valid = data.total_valid_accounts
}
}
}

View File

@@ -25,14 +25,14 @@ export default {
data() {
return {
config: {
title: '任务执行情况',
tip: '任务执行情况'
title: this.$t('Task Distribution'),
tip: this.$t('Task Distribution')
},
counter: {
total_count_gathered_account_automation: 0,
total_count_change_secret_automation: 0,
total_count_push_account_automation: 0,
total_count_gathered_account_automation: 0,
total_count_backup_account_automation: 0,
total_count_risk_account: 0,
total_count_integration_application: 0
},
chart: null
@@ -41,10 +41,16 @@ export default {
computed: {
chartOption() {
return {
tooltip: {
trigger: 'item',
formatter: (params) => {
return `${params.name}: ${params.value} (${params.percent}%)`
}
},
legend: {
orient: 'vertical',
top: '13%',
right: '15%',
top: '25%',
right: this.$i18n.locale === 'zh' ? '20%' : '10%',
itemGap: 20,
textStyle: {
color: '#666',
@@ -55,23 +61,37 @@ export default {
itemHeight: 8,
formatter: (name) => {
const data = [
{ name: '账号收集任务', value: this.counter.total_count_gathered_account_automation },
{ name: '账号推送任务', value: this.counter.total_count_push_account_automation },
{ name: '账号备份任务', value: this.counter.total_count_backup_account_automation },
{ name: '风险账号', value: this.counter.total_count_risk_account },
{ name: '集成应用', value: this.counter.total_count_integration_application }
{ name: this.$t('BaseAccountChangeSecret'), value: this.counter.total_count_change_secret_automation },
{ name: this.$t('BaseAccountPush'), value: this.counter.total_count_push_account_automation },
{ name: this.$t('DiscoverAccounts'), value: this.counter.total_count_gathered_account_automation },
{ name: this.$t('AccountBackup'), value: this.counter.total_count_backup_account_automation },
{ name: this.$t('RelevantApp'), value: this.counter.total_count_integration_application }
]
const item = data.find(item => item.name === name)
return name.padEnd(10, '\u2003') + (item.value || 0)
const item = data.find(item => item.name === name)
return `${name}: ${item?.value || 0}`
},
rich: {
name: {
width: this.$i18n.locale === 'zh' ? 120 : 200,
color: '#666',
fontSize: 12,
padding: [0, 15, 0, 0]
},
value: {
width: 60,
align: 'right',
color: '#666',
fontSize: 12
}
}
},
series: [
{
name: '任务分布',
name: this.$t('Task Distribution'),
type: 'pie',
radius: ['50%', '70'],
center: ['25%', '50%'],
radius: ['50%', '60%'],
center: ['30%', '50%'],
label: {
show: false
},
@@ -80,24 +100,24 @@ export default {
},
data: [
{
value: this.counter.total_count_gathered_account_automation,
name: '账号收集任务'
value: this.counter.total_count_change_secret_automation,
name: this.$t('BaseAccountChangeSecret')
},
{
value: this.counter.total_count_push_account_automation,
name: '账号推送任务'
name: this.$t('BaseAccountPush')
},
{
value: this.counter.total_count_gathered_account_automation,
name: this.$t('DiscoverAccounts')
},
{
value: this.counter.total_count_backup_account_automation,
name: '账号备份任务'
},
{
value: this.counter.total_count_risk_account,
name: '风险账号'
name: this.$t('AccountBackup')
},
{
value: this.counter.total_count_integration_application,
name: '集成应用'
name: this.$t('RelevantApp')
}
],
emphasis: {
@@ -139,10 +159,10 @@ export default {
async getResourcesCount() {
return this.$axios.get('/api/v1/accounts/pam-dashboard/', {
params: {
total_count_change_secret_automation: 1,
total_count_gathered_account_automation: 1,
total_count_push_account_automation: 1,
total_count_backup_account_automation: 1,
total_count_risk_account: 1,
total_count_integration_application: 1
}
})
@@ -172,7 +192,6 @@ export default {
height: 100%;
background: #fff;
border-radius: 4px;
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
.header {
padding: 1.25rem;
@@ -193,7 +212,7 @@ export default {
.chart-container {
width: 100%;
height: 226px;
height: 19.25rem;
}
}
}

View File

@@ -13,11 +13,6 @@
class="metric-item"
/>
</template>
<!-- <el-row :gutter="20">
<el-col v-for="item of summaryItems" :key="item.title" :md="6" :sm="12" :xs="12">
<SummaryCard :body="item.body" :title="item.title" />
</el-col>
</el-row> -->
</div>
</div>
</template>
@@ -35,15 +30,19 @@ export default {
tip: this.$t('RealTimeData')
},
counter: {
total_long_time_no_login_accounts: '.',
total_weak_password_accounts: '.',
total_long_time_change_password_accounts: '.',
total_leaked_password_accounts: '.',
total_repeated_password_accounts: '.',
total_password_expired_accounts: '.',
total_no_admin_account_accounts: '.',
total_password_error_accounts: '.',
total_new_found_accounts: '.'
'total_long_time_no_login_accounts': '.',
'total_new_found_accounts': '.',
'total_group_changed_accounts': '.',
'total_sudo_changed_accounts': '.',
'total_authorized_keys_changed_accounts': '.',
'total_account_deleted_accounts': '.',
'total_password_expired_accounts': '.',
'total_long_time_password_accounts': '.',
'total_weak_password_accounts': '.',
'total_leaked_password_accounts': '.',
'total_repeated_password_accounts': '.',
'total_password_error_accounts': '.',
'total_no_admin_account_accounts': '.'
}
}
},
@@ -51,9 +50,58 @@ export default {
summaryItems() {
return [
{
title: this.$t('LeakedPassword'),
title: this.$t('NoLoginLongTime'),
body: {
count: this.counter.total_leaked_password_accounts,
count: this.counter.total_long_time_no_login_accounts,
disabled: true
}
},
{
title: this.$t('NewAccountsFound'),
body: {
count: this.counter.total_new_found_accounts,
disabled: true
}
},
{
title: this.$t('GroupChanged'),
body: {
count: this.counter.total_group_changed_accounts,
disabled: true
}
},
{
title: this.$t('SudoChanged'),
body: {
count: this.counter.total_sudo_changed_accounts,
disabled: true
}
},
{
title: this.$t('AuthorizedKeysChanged'),
body: {
count: this.counter.total_authorized_keys_changed_accounts,
disabled: true
}
},
{
title: this.$t('AccountDeleted'),
body: {
count: this.counter.total_account_deleted_accounts,
disabled: true
}
},
{
title: this.$t('PasswordExpired'),
body: {
count: this.counter.total_password_expired_accounts,
disabled: true
}
},
{
title: this.$t('LongTimePassword'),
body: {
count: this.counter.total_long_time_password_accounts,
disabled: true
}
},
@@ -65,17 +113,9 @@ export default {
}
},
{
title: this.$t('LongTimeNoLogin'),
title: this.$t('LeakedPassword'),
body: {
route: { name: `SessionList`, params: { activeMenu: 'OnlineList' }},
count: this.counter.total_long_time_no_login_accounts
}
},
{
title: this.$t('LongTimeNoChangeSecret'),
body: {
count: this.counter.total_long_time_change_password_accounts,
count: this.counter.total_leaked_password_accounts,
disabled: true
}
},
@@ -87,28 +127,14 @@ export default {
}
},
{
title: this.$t('Unmanaged'),
body: {
count: this.counter.total_new_found_accounts,
disabled: true
}
},
{
title: this.$t('Password expiration'),
body: {
count: this.counter.total_password_expired_accounts,
disabled: true
}
},
{
title: this.$t('Error password'),
title: this.$t('PasswordError'),
body: {
count: this.counter.total_password_error_accounts,
disabled: true
}
},
{
title: this.$t('No admin'),
title: this.$t('NoAdminAccount'),
body: {
count: this.counter.total_no_admin_account_accounts,
disabled: true
@@ -126,13 +152,19 @@ export default {
'/api/v1/accounts/pam-dashboard/',
{
params: {
total_privileged_accounts: 1,
total_ordinary_accounts: 1,
total_unmanaged_accounts: 1,
total_unavailable_accounts: 1,
total_long_time_no_login_accounts: 1,
total_new_found_accounts: 1,
total_group_changed_accounts: 1,
total_sudo_changed_accounts: 1,
total_authorized_keys_changed_accounts: 1,
total_account_deleted_accounts: 1,
total_password_expired_accounts: 1,
total_long_time_password_accounts: 1,
total_weak_password_accounts: 1,
total_long_time_change_password_accounts: 1
total_leaked_password_accounts: 1,
total_repeated_password_accounts: 1,
total_password_error_accounts: 1,
total_no_admin_account_accounts: 1
}
}
)

View File

@@ -50,24 +50,20 @@ export default {
return {
summaryItems: [
{
label: 'Connectable',
key: 'connectable',
className: 'connection'
label: this.$t('Privileged'),
key: 'privileged'
},
{
label: 'Reset secret',
key: 'resetSecret',
className: 'reset'
label: this.$t('Reset secret'),
key: 'resetSecret'
},
{
label: 'Privileged Account',
key: 'privilegedAccount',
className: 'privileged'
label: this.$t('Connectable'),
key: 'connectable'
},
{
label: 'Regular Account',
key: 'regularAccount',
className: 'regular'
label: this.$t('Valid'),
key: 'valid'
}
]
}

View File

@@ -4,10 +4,14 @@
<div class="code-container">
<el-tabs v-model="currentLanguage" @tab-click="handleInput">
<el-tab-pane v-for="language in languages" :key="language.value" :label="language.label" :name="language.value">
<template>
<vue-markdown v-if="readme" class="code-markdown" :source="readme" />
<span v-else>{{ $tc('NoData') }}</span>
</template>
<two-col>
<template>
<vue-markdown class="code-markdown" :source="readme" />
</template>
<template #right>
<vue-markdown class="code-demo" :source="code" />
</template>
</two-col>
</el-tab-pane>
</el-tabs>
<div class="copy-btn">
@@ -25,11 +29,12 @@
import { IBox } from '@/components'
import VueMarkdown from 'vue-markdown'
import { highlightBlock } from 'highlight.js'
import 'highlight.js/styles/github.css'
import TwoCol from '@/layout/components/Page/TwoColPage.vue'
export default {
name: 'SDKList',
components: {
TwoCol,
IBox,
VueMarkdown
},
@@ -37,6 +42,7 @@ export default {
return {
currentLanguage: 'python',
readme: '',
code: '',
languages: [
{ label: 'Python', value: 'python' },
{ label: 'Go', value: 'go' }
@@ -49,10 +55,10 @@ export default {
methods: {
async copyContent() {
try {
await navigator.clipboard.writeText(this.readme)
this.$message.success('复制成功')
await navigator.clipboard.writeText(this.code)
this.$message.success(this.$tc('CopySuccess'))
} catch (err) {
this.$message.error('复制失败')
this.$message.error(this.$tc('CopyFailed'))
}
},
highlightCode() {
@@ -67,6 +73,7 @@ export default {
const url = `/api/v1/accounts/integration-applications/sdks/?language=${this.currentLanguage}`
this.$axios.get(url).then(res => {
this.readme = res.readme
this.code = `\`\`\`${this.currentLanguage}\n${res.code}\n\`\`\``
this.$nextTick(() => {
this.highlightCode()
})
@@ -84,9 +91,28 @@ export default {
}
.code-markdown {
min-height: 210px;
padding: 10px 20px;
border: 1px solid #DCDFE6;
::v-deep .table {
border-collapse: collapse;
border-spacing: 0;
width: 100%;
th, td {
border: 1px solid #ebeef5;
padding: 10px;
text-align: left;
}
th {
background-color: #f5f7fa;
}
}
}
.code-demo{
@import "~highlight.js/styles/atom-one-light.css";
min-height: 210px;
padding: 10px 20px;
border: 1px solid #DCDFE6;
}
.copy-btn {
font-size: 20px;
position: absolute;