Compare commits

...

8 Commits

11 changed files with 1930 additions and 1834 deletions

1
GITSHA Normal file
View File

@@ -0,0 +1 @@
81b3c79ac15dd02e31090e2bee138fbeca56799d

View File

@@ -72,7 +72,6 @@
"vue-i18n": "^8.15.5",
"vue-json-editor": "^1.4.3",
"vue-markdown": "^2.2.4",
"vue-moment": "^4.1.0",
"vue-password-strength-meter": "^1.7.2",
"vue-router": "3.0.6",
"vue-select": "^3.9.5",

View File

@@ -9,7 +9,7 @@
class="text edit-input"
@blur="onEditBlur"
/>
<span v-if="realValue" class="action">
<span class="action">
<template v-for="(item, index) in iActions">
<el-tooltip
v-if="item.has"

View File

@@ -81,7 +81,7 @@ export default {
},
{
label: this.$t('common.Version'),
value: 'version-dev'
value: 'v3.10.19'
},
{
label: this.$t('common.PermissionCompany'),

View File

@@ -24,6 +24,8 @@ import { message } from '@/utils/message'
import xss from '@/utils/xss'
import request from '@/utils/request'
import ElTableTooltipPatch from '@/utils/elTableTooltipPatch.js'
import moment from 'moment'
moment.locale('zh-cn')
/**
* If you don't want to use mock-server
@@ -50,11 +52,7 @@ Vue.config.productionTip = false
Vue.use(VueCookie)
window.$cookie = VueCookie
const moment = require('moment')
require('moment/locale/zh-cn')
Vue.use(require('vue-moment'), {
moment
})
Vue.prototype.$moment = moment
Vue.use(VueLogger, loggerOptions)

View File

@@ -90,10 +90,20 @@ function ifBadRequest({ response, error }) {
}
}
export function logout() {
window.location.href = `${process.env.VUE_APP_LOGOUT_PATH}?next=${location.pathname}`
}
export function flashErrorMsg({ response, error }) {
if (!response.config.disableFlashErrorMsg) {
const responseErrorMsg = getErrorResponseMsg(error)
const msg = responseErrorMsg || error.message
if (response.status === 403 && msg === 'CSRF Failed: CSRF token missing.') {
setTimeout(() => {
logout()
}, 1000)
}
message({
message: msg,
type: 'error',

View File

@@ -122,9 +122,53 @@ export default {
return {
name: 'AccountChangeSecretCreate'
}
}
},
extraMoreActions: [
{
name: 'BatchDisable',
title: this.$t('common.BatchDisable'),
icon: 'fa fa-ban',
can: ({ selectedRows }) => selectedRows.length > 0 && this.$hasPerm('accounts.change_changesecretautomation'),
callback: ({ selectedRows, reloadTable }) => this.bulkDisableCallback(selectedRows, reloadTable)
},
{
name: 'BatchActivate',
title: this.$t('common.BatchActivate'),
icon: 'fa fa-check-circle-o',
can: ({ selectedRows }) => selectedRows.length > 0 && this.$hasPerm('accounts.change_changesecretautomation'),
callback: ({ selectedRows, reloadTable }) => this.bulkActivateCallback(selectedRows, reloadTable)
}
]
}
}
},
methods: {
bulkDisableCallback(selectedRows, reloadTable) {
const url = '/api/v1/accounts/change-secret-automations/'
const data = selectedRows.map(row => {
return { id: row.id, is_active: false }
})
if (data.length === 0) return
this.$axios.patch(url, data).then(() => {
reloadTable()
this.$message.success(this.$t('common.disableSuccessMsg'))
}).catch(error => {
this.$message.error(this.$t('common.updateError') + ' ' + error)
})
},
bulkActivateCallback(selectedRows, reloadTable) {
const url = '/api/v1/accounts/change-secret-automations/'
const data = selectedRows.map(row => {
return { id: row.id, is_active: true }
})
if (data.length === 0) return
this.$axios.patch(url, data).then(() => {
reloadTable()
this.$message.success(this.$t('common.activateSuccessMsg'))
}).catch(error => {
this.$message.error(this.$t('common.updateError') + ' ' + error)
})
}
}
}
</script>

View File

@@ -127,9 +127,58 @@ export default {
headerActions: {
hasRefresh: true,
hasExport: false,
hasImport: false
hasImport: false,
createRoute: () => {
return {
name: 'AccountPushCreate'
}
},
extraMoreActions: [
{
name: 'BatchDisable',
title: this.$t('common.BatchDisable'),
icon: 'fa fa-ban',
can: ({ selectedRows }) => selectedRows.length > 0 && this.$hasPerm('accounts.change_pushaccountautomation'),
callback: ({ selectedRows, reloadTable }) => this.bulkDisableCallback(selectedRows, reloadTable)
},
{
name: 'BatchActivate',
title: this.$t('common.BatchActivate'),
icon: 'fa fa-check-circle-o',
can: ({ selectedRows }) => selectedRows.length > 0 && this.$hasPerm('accounts.change_pushaccountautomation'),
callback: ({ selectedRows, reloadTable }) => this.bulkActivateCallback(selectedRows, reloadTable)
}
]
}
}
},
methods: {
bulkDisableCallback(selectedRows, reloadTable) {
const url = '/api/v1/accounts/push-account-automations/'
const data = selectedRows.map(row => {
return { id: row.id, is_active: false }
})
if (data.length === 0) return
this.$axios.patch(url, data).then(() => {
reloadTable()
this.$message.success(this.$t('common.disableSuccessMsg'))
}).catch(error => {
this.$message.error(this.$t('common.updateError') + ' ' + error)
})
},
bulkActivateCallback(selectedRows, reloadTable) {
const url = '/api/v1/accounts/push-account-automations/'
const data = selectedRows.map(row => {
return { id: row.id, is_active: true }
})
if (data.length === 0) return
this.$axios.patch(url, data).then(() => {
reloadTable()
this.$message.success(this.$t('common.activateSuccessMsg'))
}).catch(error => {
this.$message.error(this.$t('common.updateError') + ' ' + error)
})
}
}
}
</script>

View File

@@ -20,7 +20,8 @@ export const platformFieldsMeta = (vm) => {
'change_secret_enabled', 'change_secret_method', 'change_secret_params',
'push_account_enabled', 'push_account_method', 'push_account_params',
'verify_account_enabled', 'verify_account_method', 'verify_account_params',
'gather_accounts_enabled', 'gather_accounts_method', 'gather_accounts_params'
'gather_accounts_enabled', 'gather_accounts_method', 'gather_accounts_params',
'remove_account_enabled', 'remove_account_method', 'remove_account_params'
],
fieldsMeta: {
ansible_config: {
@@ -28,12 +29,15 @@ export const platformFieldsMeta = (vm) => {
hidden: (formValue) => !formValue['ansible_enabled']
},
gather_facts_enabled: {},
remove_account_enabled: {},
ping_method: {},
ping_params: {
label: ''
},
gather_facts_method: {},
push_account_method: {},
remove_account_method: {},
remove_account_params: {},
push_account_params: {
label: ''
},

View File

@@ -11,7 +11,6 @@
<script>
import { GenericCreateUpdatePage } from '@/layout/components'
import AssetSelect from '@/components/Apps/AssetSelect'
import { getDayFuture } from '@/utils/common'
import AccountFormatter from './components/AccountFormatter'
import { AllAccount } from '../const'
import ProtocolsSelect from '@/components/Form/FormFields/AllOrSpec.vue'
@@ -34,7 +33,6 @@ export default {
initial: {
is_active: true,
date_start: new Date().toISOString(),
date_expired: getDayFuture(25550, new Date()).toISOString(),
nodes: nodesInitial,
assets: assetsInitial,
accounts: [AllAccount]

3635
yarn.lock

File diff suppressed because it is too large Load Diff