Skip to content

Commit d26872a

Browse files
committed
refactor: clean up access token retrieval logic and remove unused authentication watcher
1 parent e697dda commit d26872a

File tree

2 files changed

+24
-23
lines changed

2 files changed

+24
-23
lines changed

ui/src/stores/modules/application.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ const useApplicationStore = defineStore('application', {
2525
async asyncGetAccessToken(id: string, loading?: Ref<boolean>) {
2626
return new Promise((resolve, reject) => {
2727
const user = useUserStore()
28-
if (user.isEE() || user.isPE()) {
29-
applicationXpackApi
30-
.getAccessToken(id, loading)
31-
.then((data) => {
32-
resolve(data)
33-
})
34-
.catch((error) => {
35-
reject(error)
36-
})
37-
} else {
28+
// if (user.isEE() || user.isPE()) {
29+
// applicationXpackApi
30+
// .getAccessToken(id, loading)
31+
// .then((data) => {
32+
// resolve(data)
33+
// })
34+
// .catch((error) => {
35+
// reject(error)
36+
// })
37+
// } else {
3838
applicationApi
3939
.getAccessToken(id, loading)
4040
.then((data) => {
@@ -43,7 +43,7 @@ const useApplicationStore = defineStore('application', {
4343
.catch((error) => {
4444
reject(error)
4545
})
46-
}
46+
// }
4747
})
4848
},
4949

ui/src/views/application-overview/xpack-component/XPackLimitDrawer.vue

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
v-if="form.authentication"
3535
v-model="form.authentication_value.type"
3636
class="card__radio"
37-
@change="(val: string) => val === 'password' && refreshAuthentication()"
37+
@change="(val: string) => val === 'password'"
3838
>
3939
<el-card
4040
shadow="never"
@@ -179,24 +179,24 @@ watch(dialogVisible, (bool) => {
179179
}
180180
}
181181
})
182-
watch(
183-
() => form.value.authentication,
184-
(b) => {
185-
if (b) {
186-
applicationApi.getChatUserAuthType().then((ok) => {
187-
auth_list.value = ok.data
188-
})
189-
}
190-
},
191-
)
182+
// watch(
183+
// () => form.value.authentication,
184+
// (b) => {
185+
// if (b) {
186+
// applicationApi.getChatUserAuthType().then((ok) => {
187+
// auth_list.value = ok.data
188+
// })
189+
// }
190+
// },
191+
// )
192192
const open = (data: any) => {
193193
form.value.access_num = data.access_num
194194
form.value.white_active = data.white_active
195195
form.value.white_list = data.white_list?.length ? data.white_list?.join('\n') : ''
196196
form.value.authentication_value = data.authentication_value || {
197197
type: 'password',
198198
}
199-
if (form.value.authentication_value.type === 'password') {
199+
if (form.value.authentication_value.type === 'password' && !form.value.authentication_value.password_value) {
200200
refreshAuthentication()
201201
}
202202
form.value.authentication = data.authentication
@@ -239,6 +239,7 @@ function refreshAuthentication() {
239239
}
240240
241241
function firstGeneration() {
242+
console.log('firstGeneration')
242243
if (form.value.authentication && !form.value.authentication_value) {
243244
form.value.authentication_value = generateAuthenticationValue()
244245
}

0 commit comments

Comments
 (0)