Merge pull request #554 from jumpserver/dev

Chore: Merge Dev
This commit is contained in:
Jiangjie.Bai 2020-12-17 15:14:11 +08:00 committed by GitHub
commit 6fa7800d6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 60 additions and 213 deletions

View File

@ -199,9 +199,9 @@ export default {
error += `${parseInt(key) + 1}.${str[key][0]} ` error += `${parseInt(key) + 1}.${str[key][0]} `
}) })
} }
if (field.attrs.error === error) { // if (field.attrs.error === error) {
error += '.' // error += '.'
} // }
field.attrs.error = error field.attrs.error = error
} }
} }

View File

@ -81,10 +81,6 @@ export default {
deep: true deep: true
} }
}, },
mounted() {
this.$log.debug(this.headerActions)
this.$log.debug(this.iTableConfig)
},
methods: { methods: {
handleSelectionChange(val) { handleSelectionChange(val) {
this.selectedRows = val this.selectedRows = val

View File

@ -198,6 +198,7 @@
"BadRoleErrorMsg": "请求错误,无该操作权限", "BadRoleErrorMsg": "请求错误,无该操作权限",
"BadConflictErrorMsg": "正在刷新中,请稍后再试", "BadConflictErrorMsg": "正在刷新中,请稍后再试",
"Basic": "基本", "Basic": "基本",
"PleaseAgreeToTheTerms": "请同意条款",
"BasicInfo": "基本信息", "BasicInfo": "基本信息",
"Cancel": "取消", "Cancel": "取消",
"Close": "关闭", "Close": "关闭",

View File

@ -190,6 +190,7 @@
"actionsTips":"Clipboard's copy and paste control only support RDP/VNC protocol.", "actionsTips":"Clipboard's copy and paste control only support RDP/VNC protocol.",
"Active": "Active", "Active": "Active",
"Add": "Add", "Add": "Add",
"PleaseAgreeToTheTerms": "Please agree to the terms",
"PushSelected":"Push selected", "PushSelected":"Push selected",
"UpdateAssetDetail": "Update more detail", "UpdateAssetDetail": "Update more detail",
"AddSuccessMsg": "Add success", "AddSuccessMsg": "Add success",

View File

@ -9,6 +9,7 @@
:clean-form-value="cleanFormValue" :clean-form-value="cleanFormValue"
:get-method="getMethod" :get-method="getMethod"
:on-perform-success="onPerformSuccess" :on-perform-success="onPerformSuccess"
:perform-submit="performSubmit"
/> />
</IBox> </IBox>
</template> </template>
@ -88,6 +89,13 @@ export default {
getMethod() { getMethod() {
return 'put' return 'put'
}, },
performSubmit(validValues) {
if (!validValues.terms) {
this.$message.error(this.$t('common.PleaseAgreeToTheTerms'))
return Promise.reject()
}
return this.$axios['put'](this.url, validValues)
},
onPerformSuccess() { onPerformSuccess() {
this.$message.success(this.$t('common.updateSuccessMsg')) this.$message.success(this.$t('common.updateSuccessMsg'))
setTimeout(() => this.$router.push({ name: 'UserGuide' }), 100) setTimeout(() => this.$router.push({ name: 'UserGuide' }), 100)

View File

@ -37,6 +37,7 @@ export default {
actions: { actions: {
prop: '', prop: '',
formatterArgs: { formatterArgs: {
hasClone: true,
performDelete: function({ row, col, cellValue, reload }) { performDelete: function({ row, col, cellValue, reload }) {
this.$axios.delete( this.$axios.delete(
`/api/v1/applications/applications/${row.id}/` `/api/v1/applications/applications/${row.id}/`

View File

@ -34,6 +34,7 @@ export default {
}, },
actions: { actions: {
formatterArgs: { formatterArgs: {
hasClone: true,
onUpdate: ({ row }) => { onUpdate: ({ row }) => {
vm.$router.push({ name: 'RemoteAppUpdate', params: { id: row.id }, query: { type: row.type }}) vm.$router.push({ name: 'RemoteAppUpdate', params: { id: row.id }, query: { type: row.type }})
}, },

View File

@ -4,7 +4,6 @@
<script> <script>
import { GenericListPage } from '@/layout/components' import { GenericListPage } from '@/layout/components'
import { DetailFormatter, ActionsFormatter } from '@/components/ListTable/formatters/index'
export default { export default {
components: { components: {
@ -14,49 +13,15 @@ export default {
return { return {
tableConfig: { tableConfig: {
url: '/api/v1/assets/admin-users/', url: '/api/v1/assets/admin-users/',
columns: [ columns: ['name', 'username', 'assets_amount', 'comment', 'actions'],
{ columnsMeta: {
prop: 'name', username: {
label: this.$t('common.Name'), showOverflowTooltip: true
formatter: DetailFormatter,
showOverflowTooltip: true,
sortable: true,
formatterArgs: {
route: 'AdminUserDetail'
}
}, },
{ assets_amount: {
prop: 'username',
label: this.$t('common.Username'),
showOverflowTooltip: true,
sortable: 'custom'
},
{
prop: 'assets_amount',
label: this.$t('assets.Assets'),
width: '80px' width: '80px'
},
{
prop: 'comment',
showOverflowTooltip: true,
label: this.$t('common.Comment'),
sortable: 'custom'
},
{
prop: 'id',
align: 'center',
label: this.$t('common.Action'),
formatter: ActionsFormatter,
width: '200px',
formatterArgs: {
performDelete: ({ row, col }) => {
const id = row.id
const url = `/api/v1/assets/admin-users/${id}/`
return this.$axios.delete(url)
}
}
} }
] }
}, },
updateRoute: 'AdminUserUpdate', updateRoute: 'AdminUserUpdate',
headerActions: { headerActions: {

View File

@ -48,6 +48,7 @@ export default {
}, },
headerActions: { headerActions: {
hasSearch: true, hasSearch: true,
hasBulkDelete: false,
createRoute: { createRoute: {
name: 'CommandFilterRulesCreate', name: 'CommandFilterRulesCreate',
query: { query: {

View File

@ -4,7 +4,7 @@
<script> <script>
import { GenericListPage } from '@/layout/components' import { GenericListPage } from '@/layout/components'
import { DetailFormatter, ActionsFormatter } from '@/components/ListTable/formatters/index' import { DetailFormatter } from '@/components/ListTable/formatters/index'
export default { export default {
components: { components: {
@ -14,62 +14,31 @@ export default {
return { return {
tableConfig: { tableConfig: {
url: '/api/v1/assets/cmd-filters/', url: '/api/v1/assets/cmd-filters/',
columns: [ columns: ['name', 'rules', 'system_users', 'comment', 'actions'],
{ columnsMeta: {
prop: 'name', rules: {
label: this.$t('assets.Name'),
formatter: DetailFormatter,
showOverflowTooltip: true,
sortable: true,
formatterArgs: {
route: 'CommandFilterDetail'
}
},
{
prop: 'rules',
label: this.$t('assets.Rules'), label: this.$t('assets.Rules'),
formatter: DetailFormatter, formatter: DetailFormatter,
formatterArgs: { formatterArgs: {
getTitle: ({ cellValue }) => {
return cellValue.length
},
routeQuery: { routeQuery: {
activeTab: 'rules' activeTab: 'rules'
}, }
getTitle: ({ cellValue }) => cellValue.length
} }
}, },
{ system_users: {
prop: 'system_users',
label: this.$t('assets.SystemUsers'), label: this.$t('assets.SystemUsers'),
formatter: DetailFormatter, formatter: DetailFormatter,
formatterArgs: { formatterArgs: {
route: 'CommandFilterDetail', route: 'CommandFilterDetail',
getTitle: ({ cellValue }) => cellValue.length getTitle: ({ cellValue }) => {
} return cellValue.length
},
{
prop: 'comment',
showOverflowTooltip: true,
label: this.$t('assets.Comment')
},
{
prop: 'id',
align: 'center',
label: this.$t('assets.Action'),
formatter: ActionsFormatter,
width: '200px',
formatterArgs: {
performDelete: ({ row, col }) => {
const id = row.id
const url = `/api/v1/assets/cmd-filters/${id}/`
return this.$axios.delete(url).then(res => {
this.$message.success(this.$t('common.deleteSuccessMsg'))
window.location.reload()
}).catch(error => {
this.$message.error(this.$t('common.deleteErrorMsg' + ' ' + error))
})
} }
} }
} }
] }
}, },
headerActions: { headerActions: {
hasRightActions: false, hasRightActions: false,

View File

@ -4,7 +4,6 @@
<script> <script>
import { GenericListPage } from '@/layout/components' import { GenericListPage } from '@/layout/components'
import { ActionsFormatter } from '@/components/ListTable/formatters/index'
export default { export default {
components: { components: {
@ -14,39 +13,15 @@ export default {
return { return {
tableConfig: { tableConfig: {
url: '/api/v1/assets/labels/', url: '/api/v1/assets/labels/',
columns: [ columns: ['name', 'value', 'asset_count', 'actions'],
{ columnsMeta: {
prop: 'name', name: {
label: this.$t('assets.Name'), formatter: null
showOverflowTooltip: true,
sortable: true
}, },
{ asset_count: {
prop: 'value', label: this.$t('assets.Assets')
label: this.$t('assets.Value'),
showOverflowTooltip: true,
sortable: 'custom'
},
{
prop: 'asset_count',
label: this.$t('assets.Assets'),
width: '80px'
},
{
prop: 'id',
align: 'center',
formatter: ActionsFormatter,
label: this.$t('assets.Action'),
width: '200px',
formatterArgs: {
performDelete: ({ row, col }) => {
const id = row.id
const url = `/api/v1/assets/labels/${id}/`
return this.$axios.delete(url)
}
}
} }
] }
}, },
headerActions: { headerActions: {
hasRightActions: false, hasRightActions: false,

View File

@ -4,7 +4,6 @@
<script> <script>
import { GenericListPage } from '@/layout/components' import { GenericListPage } from '@/layout/components'
import { DetailFormatter, ActionsFormatter } from '@/components/ListTable/formatters/index'
export default { export default {
components: { components: {
@ -15,49 +14,13 @@ export default {
tableConfig: { tableConfig: {
url: '/api/v1/assets/platforms/', url: '/api/v1/assets/platforms/',
columns: [ columns: [
{ 'name', 'base', 'comment', 'actions'
prop: 'name', ],
label: this.$t('assets.Name'), columnsMeta: {
formatter: DetailFormatter, base: {
showOverflowTooltip: true,
sortable: true,
formatterArgs: {
route: 'PlatformDetail'
}
},
{
prop: 'base',
label: this.$t('assets.BasePlatform'),
sortable: 'custom',
width: '140px' width: '140px'
},
{
prop: 'comment',
showOverflowTooltip: true,
label: this.$t('assets.Comment'),
sortable: 'custom'
},
{
prop: 'id',
align: 'center',
label: this.$t('assets.Action'),
formatter: ActionsFormatter,
width: '200px',
formatterArgs: {
canDelete: (row, vaule) => {
return !row.internal
},
canUpdate: (row, vaule) => {
return !row.internal
},
performDelete: ({ row, col }) => {
const id = row.id
const url = `/api/v1/assets/platforms/${id}/`
return this.$axios.delete(url)
}
}
} }
] }
}, },
headerActions: { headerActions: {
hasRightActions: false, hasRightActions: false,
@ -66,6 +29,7 @@ export default {
hasRefresh: false, hasRefresh: false,
hasSearch: false, hasSearch: false,
hasMoreActions: false, hasMoreActions: false,
hasBulkDelete: false,
createRoute: 'PlatformCreate' createRoute: 'PlatformCreate'
} }
} }

View File

@ -4,7 +4,6 @@
<script> <script>
import { GenericListPage } from '@/layout/components' import { GenericListPage } from '@/layout/components'
import { DetailFormatter, ActionsFormatter } from '@/components/ListTable/formatters/index'
export default { export default {
components: { components: {
@ -14,60 +13,21 @@ export default {
return { return {
tableConfig: { tableConfig: {
url: '/api/v1/assets/system-users/', url: '/api/v1/assets/system-users/',
columns: [ columns: ['name', 'username', 'protocol', 'login_mode', 'assets_amount', 'comment', 'actions'],
{ columnsMeta: {
prop: 'name', username: {
label: this.$t('common.Name'), showOverflowTooltip: true
formatter: DetailFormatter,
showOverflowTooltip: true,
sortable: true,
formatterArgs: {
route: 'SystemUserDetail'
}
}, },
{ protocol: {
prop: 'username',
label: this.$t('common.Username'),
showOverflowTooltip: true,
sortable: 'custom'
},
{
prop: 'protocol',
label: this.$t('assets.Protocol'),
sortable: 'custom',
width: '100px' width: '100px'
}, },
{ login_mode: {
prop: 'login_mode_display',
label: this.$t('assets.LoginModel'),
width: '120px' width: '120px'
}, },
{ assets_amount: {
prop: 'assets_amount',
label: this.$t('assets.Assets'),
width: '80px' width: '80px'
},
{
prop: 'comment',
showOverflowTooltip: true,
label: this.$t('common.Comment')
},
{
prop: 'id',
align: 'center',
formatter: ActionsFormatter,
width: '200px',
label: this.$t('common.Action'),
updateRoute: 'SystemUserUpdate',
formatterArgs: {
performDelete: ({ row, col }) => {
const id = row.id
const url = `/api/v1/assets/system-users/${id}/`
return this.$axios.delete(url)
}
}
} }
] }
}, },
headerActions: { headerActions: {
hasMoreActions: false, hasMoreActions: false,

View File

@ -72,6 +72,11 @@ export default {
activeTab: 'RemoteAppPermissionRemoteApp' activeTab: 'RemoteAppPermissionRemoteApp'
} }
} }
},
actions: {
formatterArgs: {
hasClone: true
}
} }
} }
}, },