Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Cloud sync support ali rds #4594

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/Table/CardTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ export default {
const pageQuery = this.getPageQuery(this.page, this.paginationSize)
const query = Object.assign(this.extraQuery, pageQuery)
const queryString = Object.keys(query).map(key => key + '=' + query[key]).join('&')
const url = `${this.tableUrl}?${queryString}`
const connector = this.tableUrl.indexOf('?') === -1 ? '?' : '&'
const url = `${this.tableUrl}${connector}${queryString}`

this.$axios
.get(url, this.axiosConfig)
Expand Down
15 changes: 14 additions & 1 deletion src/views/assets/Asset/AssetList/DatabaseList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,20 @@ export default {
return {
config: {
category: 'database',
url: '/api/v1/assets/databases/'
url: '/api/v1/assets/databases/',
headerActions: {
extraActions: [
{
name: this.$t('CloudSync'),
title: this.$t('CloudSync'),
icon: 'cloud-provider',
has: () => this.$hasPerm('xpack.view_account') && this.$hasLicense(),
callback: () => this.$router.push(
{ name: 'CloudAccountList', query: { category: 'database' }}
)
}
]
}
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code you've shared does not contain any specific differences that might indicate problems or inefficiencies, especially in relation to the export statement. It appears to be consistent with modern JavaScript practices. However, due to lack of context regarding the project environment (e.g., React frameworks and versions used), there could be other components or features within this codebase that may have introduced similar inconsistencies.

To fully evaluate if any discrepancies exist or if improvements can be made, considering the current limitations provided, it would be beneficial to know more about the system structure and how other parts of the application interact. Additionally, since you're checking for irregularities, potential issues, optimizations, please ensure that any changes or additions should also adhere to best programming practices without losing the essence of the original design.

Expand Down
4 changes: 3 additions & 1 deletion src/views/assets/Asset/AssetList/HostList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export default {
title: this.$t('CloudSync'),
icon: 'cloud-provider',
has: () => vm.$hasPerm('xpack.view_account') && vm.$hasLicense(),
callback: () => this.$router.push({ name: 'CloudAccountList' })
callback: () => this.$router.push(
{ name: 'CloudAccountList', query: { category: 'host' }}
)
}
]
},
Expand Down
19 changes: 12 additions & 7 deletions src/views/assets/Cloud/Account/AccountList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
colWidth: 6,
subComponent: AccountPanel,
tableConfig: {
url: '/api/v1/xpack/cloud/accounts/',
url: `/api/v1/xpack/cloud/accounts/?category=${this.$route.query.category}`,
permissions: {
app: 'xpack',
resource: 'account'
Expand All @@ -58,12 +58,15 @@ export default {
title: this.$t('PublicCloud'),
icon: 'public-cloud',
callback: () => {
const providers = [
aliyun, qcloud, qcloud_lighthouse, huaweicloud,
baiducloud, jdcloud, kingsoftcloud, aws_china,
aws_international, azure, azure_international,
gcp, ucloud, volcengine
]
let providers = [aliyun]
if (this.$route.query.category === 'host') {
providers = providers.concat([
aliyun, qcloud, qcloud_lighthouse, huaweicloud,
baiducloud, jdcloud, kingsoftcloud, aws_china,
aws_international, azure, azure_international,
gcp, ucloud, volcengine
])
}
this.providerConfig.providers = providers.map(
(item) => ACCOUNT_PROVIDER_ATTRS_MAP[item]
)
Expand All @@ -74,6 +77,7 @@ export default {
name: 'privateCloud',
icon: 'private-cloud',
title: this.$t('PrivateCloud'),
has: () => this.$route.query.category === 'host',
callback: () => {
const providers = [
vmware, qingcloud_private, huaweicloud_private, state_private,
Expand All @@ -89,6 +93,7 @@ export default {
name: 'LAN',
title: this.$t('LAN'),
icon: 'computer',
has: () => this.$route.query.category === 'host',
callback: () => {
const providers = [lan]
this.providerConfig.providers = providers.map(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There have been no identified irregularities, potential issues, or optimizations suggested in the provided HTML template code snippet from 2021 to the moment (January 13th, 2025).

Expand Down
1 change: 1 addition & 0 deletions src/views/assets/Cloud/Account/components/AuthPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export default {
const newValues = JSON.parse(JSON.stringify(values))
newValues['attrs'] = encryptAttrsField(newValues.attrs)
newValues['provider'] = vm.provider
newValues['category'] = this.$route.query.category || 'host'
return newValues
},
addContinue: true
Expand Down
4 changes: 2 additions & 2 deletions src/views/assets/Cloud/Account/components/ProviderPanel.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="cloud-select-wrap">
<el-row :gutter="12">
<el-col v-for="p in providers" :key="p.name" :style="p.imageCSS ? p.imageCSS : ''">
<el-row :gutter="12" style="min-height: 300px">
<el-col v-for="p in providers" :key="p.name">
<el-card
:body-style="{ display: 'flex', alignItems: 'center', justifyContent: 'flex-start' }"
:class="selected === p.name ? 'active': ''"
Expand Down
13 changes: 10 additions & 3 deletions src/views/assets/Cloud/Strategy/StrategyCreateUpdate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,22 @@ export default {
component: ActionInput
}
},
updateSuccessNextRoute: { name: 'CloudAccountList', params: { activeMenu: 'StrategyList' }},
createSuccessNextRoute: { name: 'CloudAccountList', params: { activeMenu: 'StrategyList' }},
updateSuccessNextRoute: this.getNextRoute(),
createSuccessNextRoute: this.getNextRoute(),
getUrl() {
const id = this.$route.params?.id
return id ? `${this.url}${id}/` : this.url
}
}
},
methods: {}
methods: {
getNextRoute() {
return {
name: 'CloudAccountList', params: { activeMenu: 'StrategyList' },
query: { category: this.$route.query.category || 'host' }
}
}
}
}

</script>
Expand Down
9 changes: 1 addition & 8 deletions src/views/assets/Cloud/Strategy/StrategyDetail/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,7 @@ export default {
return this.Account.name !== 'default'
},
deleteSuccessRoute: 'CloudAccountList',
updateCallback: () => {
const id = this.$route.params.id
const routeName = 'CloudStrategyUpdate'
this.$router.push({
name: routeName,
params: { id: id }
})
}
updateRoute: 'CloudStrategyUpdate'
}
}
}
Expand Down
18 changes: 15 additions & 3 deletions src/views/assets/Cloud/Strategy/StrategyList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export default {
name: {
formatter: DetailFormatter,
formatterArgs: {
route: 'CloudStrategyDetail'
getRoute: ({ row }) => ({
name: 'CloudStrategyDetail', params: { id: row.id },
query: { category: this.$route.query.category || 'host' }
})
}
},
strategy_rules: {
Expand All @@ -38,7 +41,12 @@ export default {
},
actions: {
formatterArgs: {
updateRoute: 'CloudStrategyUpdate',
updateRoute: ({ row }) => {
return {
name: 'CloudStrategyUpdate', params: { id: row.id },
query: { category: this.$route.query.category || 'host' }
}
},
hasClone: false,
canDelete: ({ row }) => { return row.name !== 'default' },
canUpdate: ({ row }) => { return row.name !== 'default' }
Expand All @@ -50,7 +58,11 @@ export default {
hasImport: false,
hasExport: false,
hasMoreActions: false,
createRoute: 'CloudStrategyCreate'
createRoute: () => {
return {
name: 'CloudStrategyCreate', query: { category: this.$route.query.category || 'host' }
}
}
}
}
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be able to analyze the provided code more effectively with more specific information about its structure and contents. The context and specifications you have not included make it impossible for me to properly evaluate or provide advice on potential irregularities, issues, optimization suggestions, etc.

Expand Down
3 changes: 1 addition & 2 deletions src/views/assets/Cloud/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ export const ACCOUNT_PROVIDER_ATTRS_MAP = {
name: lan,
title: i18n.t('LAN'),
attrs: ['ip_group', 'test_port', 'test_timeout', 'hostname_prefix'],
image: require('@/assets/img/cloud/lan.svg'),
imageCSS: { height: '250px' }
image: require('@/assets/img/cloud/lan.svg')
}
}

Expand Down
Loading