Compare commits

...

2 Commits

Author SHA1 Message Date
mikebofs
9128e20ebb perf: all assets can add to zone 2025-10-09 11:04:17 +08:00
feng
d8e111a0e3 perf: Open web ui 2025-09-24 17:58:14 +08:00
4 changed files with 38 additions and 9 deletions

View File

@@ -9,10 +9,15 @@
<div v-if="expanded" class="close-sidebar"> <div v-if="expanded" class="close-sidebar">
<i class="fa fa-compress" style="font-weight: 200" @click="$emit('compress')" /> <i class="fa fa-compress" style="font-weight: 200" @click="$emit('compress')" />
</div> </div>
<div class="close-sidebar">
<i class="fa fa-arrows-alt" style="font-weight: 200" @click="openWebsite()" />
</div>
</div> </div>
</template> </template>
<script> <script>
import { BASE_URL } from '@/utils/common/index'
export default { export default {
props: { props: {
active: { active: {
@@ -41,6 +46,36 @@ export default {
}, },
handleExpand() { handleExpand() {
this.$emit('expand-full') this.$emit('expand-full')
},
async openWebsite() {
let url = `${BASE_URL}/?_=${Date.now()}`
if (process.env.NODE_ENV !== 'production') {
url = url.replace('9528', '5173')
}
const res = await this.$axios.get('/api/v1/accounts/accounts/chat/')
const data = await this.$axios.post(
'/api/v1/authentication/admin-connection-token/?oid=00000000-0000-0000-0000-000000000004',
{
asset: res?.asset.id,
account: res?.id,
protocol: 'chat',
input_username: res?.username,
input_secret: '',
connect_method: 'web',
connect_options: {
charset: 'default',
disableautohash: false,
reusable: false,
token_reusable: false
}
}
)
const token = data?.id
const newUrl = new URL(url)
newUrl.searchParams.set('token', token)
window.open(newUrl.toString(), '_blank')
return url
} }
} }
} }

View File

@@ -25,10 +25,7 @@ export default {
component: AssetSelect, component: AssetSelect,
el: { el: {
value: [], value: [],
baseUrl: '/api/v1/assets/assets/?gateway_enabled=true', baseUrl: '/api/v1/assets/assets/',
treeUrlQuery: {
gateway_enabled: true
},
canSelect: (row) => { canSelect: (row) => {
return !row.platform?.name.startsWith('Gateway') return !row.platform?.name.startsWith('Gateway')
} }

View File

@@ -62,10 +62,7 @@ export default {
type: 'select2', type: 'select2',
el: { el: {
value: [], value: [],
url: '/api/v1/assets/assets/?gateway_enabled=true', url: '/api/v1/assets/assets/',
treeUrlQuery: {
gateway_enabled: true
},
canSelect: (row) => { canSelect: (row) => {
return !row.platform?.name.startsWith('Gateway') && this.object.assets.map(item => item.id).indexOf(row.id) === -1 return !row.platform?.name.startsWith('Gateway') && this.object.assets.map(item => item.id).indexOf(row.id) === -1
} }

View File

@@ -65,7 +65,7 @@ export default {
multiple: true, multiple: true,
clearable: true, clearable: true,
ajax: { ajax: {
url: '/api/v1/assets/assets/?gateway_enabled=true&is_gateway=1' url: '/api/v1/assets/assets/?is_gateway=1'
}, },
disabledValues: this.object.gateways.map(item => item.id) disabledValues: this.object.gateways.map(item => item.id)
} }