mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 10:12:51 +00:00
feat: application
This commit is contained in:
parent
6bfee8d072
commit
3540ad8550
|
|
@ -1,8 +1,15 @@
|
|||
import { Result } from '@/request/Result'
|
||||
import { get, put } from '@/request/index'
|
||||
import useStore from '@/stores'
|
||||
import { type Ref } from 'vue'
|
||||
|
||||
const prefix = '/application'
|
||||
const prefix: any = { _value: '/workspace/' }
|
||||
Object.defineProperty(prefix, 'value', {
|
||||
get: function () {
|
||||
const { user } = useStore()
|
||||
return this._value + user.getWorkspaceId() + '/application'
|
||||
},
|
||||
})
|
||||
|
||||
/**
|
||||
* 替换社区版-获取AccessToken
|
||||
|
|
@ -10,9 +17,9 @@ const prefix = '/application'
|
|||
*/
|
||||
const getAccessToken: (application_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = (
|
||||
application_id,
|
||||
loading
|
||||
loading,
|
||||
) => {
|
||||
return get(`${prefix}/${application_id}/setting`, undefined, loading)
|
||||
return get(`${prefix.value}/${application_id}/setting`, undefined, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -30,12 +37,12 @@ const getAccessToken: (application_id: string, loading?: Ref<boolean>) => Promis
|
|||
const putAccessToken: (
|
||||
application_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (application_id, data, loading) => {
|
||||
return put(`${prefix}/${application_id}/setting`, data, undefined, loading)
|
||||
return put(`${prefix.value}/${application_id}/setting`, data, undefined, loading)
|
||||
}
|
||||
|
||||
export default {
|
||||
getAccessToken,
|
||||
putAccessToken
|
||||
putAccessToken,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
<el-form label-position="top" ref="displayFormRef" :model="form">
|
||||
<el-form-item>
|
||||
<span>{{
|
||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.languageLabel')
|
||||
}}</span>
|
||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.languageLabel')
|
||||
}}</span>
|
||||
<el-select v-model="form.language" clearable>
|
||||
<el-option
|
||||
v-for="item in langList"
|
||||
|
|
@ -21,18 +21,17 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-space direction="vertical" alignment="start">
|
||||
<el-space direction="vertical" alignment="start" :size="2">
|
||||
<el-checkbox
|
||||
v-model="form.show_source"
|
||||
:label="$t('views.applicationOverview.appInfo.SettingDisplayDialog.showSourceLabel')"
|
||||
/>
|
||||
</el-space>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-space direction="vertical" alignment="start">
|
||||
|
||||
<el-checkbox
|
||||
v-model="form.show_exec"
|
||||
:label="$t('views.applicationOverview.appInfo.SettingDisplayDialog.showExecutionDetail')"
|
||||
:label="
|
||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.showExecutionDetail')
|
||||
"
|
||||
/>
|
||||
</el-space>
|
||||
</el-form-item>
|
||||
|
|
@ -48,16 +47,16 @@
|
|||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {ref, watch} from 'vue'
|
||||
import {useRoute} from 'vue-router'
|
||||
import type {FormInstance, FormRules, UploadFiles} from 'element-plus'
|
||||
import { ref, watch } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import type { FormInstance, FormRules, UploadFiles } from 'element-plus'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import {MsgSuccess, MsgError} from '@/utils/message'
|
||||
import {getBrowserLang, langList, t} from '@/locales'
|
||||
import { MsgSuccess, MsgError } from '@/utils/message'
|
||||
import { getBrowserLang, langList, t } from '@/locales'
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: {id}
|
||||
params: { id },
|
||||
} = route
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
|
@ -66,7 +65,7 @@ const displayFormRef = ref()
|
|||
const form = ref<any>({
|
||||
show_source: false,
|
||||
show_exec: false,
|
||||
language: ''
|
||||
language: '',
|
||||
})
|
||||
|
||||
const detail = ref<any>(null)
|
||||
|
|
@ -79,7 +78,7 @@ watch(dialogVisible, (bool) => {
|
|||
form.value = {
|
||||
show_source: false,
|
||||
show_exec: false,
|
||||
language: ''
|
||||
language: '',
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -105,6 +104,6 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
})
|
||||
}
|
||||
|
||||
defineExpose({open})
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
|
|||
|
|
@ -192,12 +192,9 @@
|
|||
<APIKeyDialog ref="APIKeyDialogRef" />
|
||||
<LimitDialog ref="LimitDialogRef" @refresh="refresh" />
|
||||
<EditAvatarDialog ref="EditAvatarDialogRef" @refresh="refreshIcon" />
|
||||
<XPackDisplaySettingDialog
|
||||
ref="XPackDisplaySettingDialogRef"
|
||||
@refresh="refresh"
|
||||
v-if="user.isEnterprise()"
|
||||
/>
|
||||
<DisplaySettingDialog ref="DisplaySettingDialogRef" @refresh="refresh" v-else />
|
||||
<XPackDisplaySettingDialog ref="XPackDisplaySettingDialogRef" @refresh="refresh" />
|
||||
<!-- v-if="user.isEnterprise()" -->
|
||||
<DisplaySettingDialog ref="DisplaySettingDialogRef" @refresh="refresh" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
|
@ -292,11 +289,11 @@ function toUrl(url: string) {
|
|||
window.open(url, '_blank')
|
||||
}
|
||||
function openDisplaySettingDialog() {
|
||||
if (user.isEnterprise()) {
|
||||
XPackDisplaySettingDialogRef.value?.open(accessToken.value, detail.value)
|
||||
} else {
|
||||
DisplaySettingDialogRef.value?.open(accessToken.value, detail.value)
|
||||
}
|
||||
// if (user.isEnterprise()) {
|
||||
XPackDisplaySettingDialogRef.value?.open(accessToken.value, detail.value)
|
||||
// } else {
|
||||
// DisplaySettingDialogRef.value?.open(accessToken.value, detail.value)
|
||||
// }
|
||||
}
|
||||
function openEditAvatar() {
|
||||
EditAvatarDialogRef.value.open(detail.value)
|
||||
|
|
|
|||
Loading…
Reference in New Issue