mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 22:18:07 +08:00
feat: 优化 nginx 编辑器代码高亮 (#6497)
This commit is contained in:
parent
417ad81aa4
commit
1bca3a182e
@ -11,7 +11,7 @@ import { EditorState } from '@codemirror/state';
|
||||
import { javascript } from '@codemirror/lang-javascript';
|
||||
import { oneDark } from '@codemirror/theme-one-dark';
|
||||
import { StreamLanguage } from '@codemirror/language';
|
||||
import { nginx } from '@codemirror/legacy-modes/mode/nginx';
|
||||
import { nginx } from './nginx';
|
||||
import { yaml } from '@codemirror/legacy-modes/mode/yaml';
|
||||
import { dockerFile } from '@codemirror/legacy-modes/mode/dockerfile';
|
||||
import { placeholder } from '@codemirror/view';
|
||||
|
143
frontend/src/components/codemirror-pro/nginx.ts
Normal file
143
frontend/src/components/codemirror-pro/nginx.ts
Normal file
File diff suppressed because one or more lines are too long
@ -1,65 +1,49 @@
|
||||
<template>
|
||||
<el-drawer
|
||||
v-model="open"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
size="40%"
|
||||
:before-close="handleClose"
|
||||
>
|
||||
<template #header>
|
||||
<DrawerHeader :header="$t('commons.button.' + authBasic.operate)" :back="handleClose" />
|
||||
</template>
|
||||
<el-row v-loading="loading">
|
||||
<el-col :span="22" :offset="1">
|
||||
<el-form-item>
|
||||
<el-alert
|
||||
v-if="authBasic.operate === 'edit'"
|
||||
:title="$t('website.editBasicAuthHelper')"
|
||||
type="info"
|
||||
:closable="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form ref="proxyForm" label-position="top" :model="authBasic" :rules="rules">
|
||||
<el-form-item :label="$t('commons.table.name')" prop="name" v-if="authBasic.scope != 'root'">
|
||||
<el-input v-model.trim="authBasic.name" :disabled="authBasic.operate === 'edit'"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.path')" prop="path" v-if="authBasic.scope != 'root'">
|
||||
<el-input v-model.trim="authBasic.path" :disabled="authBasic.operate === 'edit'"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.login.username')" prop="username">
|
||||
<el-input
|
||||
v-model.trim="authBasic.username"
|
||||
:disabled="authBasic.scope == 'root' && authBasic.operate === 'edit'"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.login.password')" prop="password">
|
||||
<el-input type="password" clearable show-password v-model.trim="authBasic.password">
|
||||
<template #append>
|
||||
<el-button @click="random">
|
||||
{{ $t('commons.button.random') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.remark')" prop="remark">
|
||||
<el-input v-model.trim="authBasic.remark"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<DrawerPro v-model="open" :header="$t('commons.button.' + authBasic.operate)" :back="handleClose">
|
||||
<el-form-item>
|
||||
<el-alert
|
||||
v-if="authBasic.operate === 'edit'"
|
||||
:title="$t('website.editBasicAuthHelper')"
|
||||
type="info"
|
||||
:closable="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form ref="proxyForm" label-position="top" :model="authBasic" :rules="rules">
|
||||
<el-form-item :label="$t('commons.table.name')" prop="name" v-if="authBasic.scope != 'root'">
|
||||
<el-input v-model.trim="authBasic.name" :disabled="authBasic.operate === 'edit'"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.path')" prop="path" v-if="authBasic.scope != 'root'">
|
||||
<el-input v-model.trim="authBasic.path" :disabled="authBasic.operate === 'edit'"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.login.username')" prop="username">
|
||||
<el-input
|
||||
v-model.trim="authBasic.username"
|
||||
:disabled="authBasic.scope == 'root' && authBasic.operate === 'edit'"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.login.password')" prop="password">
|
||||
<el-input type="password" clearable show-password v-model.trim="authBasic.password">
|
||||
<template #append>
|
||||
<el-button @click="random">
|
||||
{{ $t('commons.button.random') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.remark')" prop="remark">
|
||||
<el-input v-model.trim="authBasic.remark"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="handleClose" :disabled="loading">{{ $t('commons.button.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="submit(proxyForm)" :disabled="loading">
|
||||
{{ $t('commons.button.confirm') }}
|
||||
</el-button>
|
||||
</span>
|
||||
<el-button @click="handleClose" :disabled="loading">{{ $t('commons.button.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="submit(proxyForm)" :disabled="loading">
|
||||
{{ $t('commons.button.confirm') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-drawer>
|
||||
</DrawerPro>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import DrawerHeader from '@/components/drawer-header/index.vue';
|
||||
import { OperateAuthConfig, OperatePathAuthConfig } from '@/api/modules/website';
|
||||
import { Rules } from '@/global/form-rules';
|
||||
import i18n from '@/lang';
|
||||
|
@ -1,81 +1,65 @@
|
||||
<template>
|
||||
<el-drawer
|
||||
v-model="open"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
size="40%"
|
||||
:before-close="handleClose"
|
||||
>
|
||||
<template #header>
|
||||
<DrawerHeader :header="$t('commons.button.' + redirect.operate)" :back="handleClose" />
|
||||
</template>
|
||||
<el-row v-loading="loading">
|
||||
<el-col :span="22" :offset="1">
|
||||
<el-form ref="redirectForm" label-position="top" :model="redirect" :rules="rules">
|
||||
<el-form-item :label="$t('commons.table.name')" prop="name">
|
||||
<el-input
|
||||
v-model.trim="redirect.name"
|
||||
:disabled="redirect.operate === 'edit' || redirect.type == '404'"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.table.type')" prop="type">
|
||||
<el-select
|
||||
v-model="redirect.type"
|
||||
@change="changeType(redirect.type)"
|
||||
:disabled="redirect.operate === 'edit'"
|
||||
>
|
||||
<el-option :label="$t('website.domain')" :value="'domain'"></el-option>
|
||||
<el-option :label="$t('website.path')" :value="'path'"></el-option>
|
||||
<el-option :label="'404'" :value="'404'"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.redirectWay')" prop="redirect">
|
||||
<el-select v-model="redirect.redirect">
|
||||
<el-option :label="'301'" :value="'301'"></el-option>
|
||||
<el-option :label="'302'" :value="'302'"></el-option>
|
||||
</el-select>
|
||||
<span class="input-help">
|
||||
{{ $t('website.redirectHelper') }}
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.path')" prop="path" v-if="redirect.type == 'path'">
|
||||
<el-input v-model.trim="redirect.path"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.domain')" prop="domains" v-if="redirect.type == 'domain'">
|
||||
<el-select v-model="redirect.domains" multiple>
|
||||
<el-option
|
||||
v-for="(item, index) in domains"
|
||||
:key="index"
|
||||
:value="item.domain"
|
||||
:label="item.domain"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.redirectRoot')" prop="redirectRoot" v-if="redirect.type == '404'">
|
||||
<el-switch v-model="redirect.redirectRoot"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.targetURL')" prop="target" v-if="!redirect.redirectRoot">
|
||||
<el-input v-model.trim="redirect.target"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.keepPath')" prop="keepPath" v-if="redirect.type !== '404'">
|
||||
<el-switch v-model="redirect.keepPath"></el-switch>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<DrawerPro v-model="open" :header="$t('commons.button.' + redirect.operate)" :back="handleClose">
|
||||
<el-form ref="redirectForm" label-position="top" :model="redirect" :rules="rules" v-loading="loading">
|
||||
<el-form-item :label="$t('commons.table.name')" prop="name">
|
||||
<el-input
|
||||
v-model.trim="redirect.name"
|
||||
:disabled="redirect.operate === 'edit' || redirect.type == '404'"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.table.type')" prop="type">
|
||||
<el-select
|
||||
v-model="redirect.type"
|
||||
@change="changeType(redirect.type)"
|
||||
:disabled="redirect.operate === 'edit'"
|
||||
>
|
||||
<el-option :label="$t('website.domain')" :value="'domain'"></el-option>
|
||||
<el-option :label="$t('website.path')" :value="'path'"></el-option>
|
||||
<el-option :label="'404'" :value="'404'"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.redirectWay')" prop="redirect">
|
||||
<el-select v-model="redirect.redirect">
|
||||
<el-option :label="'301'" :value="'301'"></el-option>
|
||||
<el-option :label="'302'" :value="'302'"></el-option>
|
||||
</el-select>
|
||||
<span class="input-help">
|
||||
{{ $t('website.redirectHelper') }}
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.path')" prop="path" v-if="redirect.type == 'path'">
|
||||
<el-input v-model.trim="redirect.path"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.domain')" prop="domains" v-if="redirect.type == 'domain'">
|
||||
<el-select v-model="redirect.domains" multiple>
|
||||
<el-option
|
||||
v-for="(item, index) in domains"
|
||||
:key="index"
|
||||
:value="item.domain"
|
||||
:label="item.domain"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.redirectRoot')" prop="redirectRoot" v-if="redirect.type == '404'">
|
||||
<el-switch v-model="redirect.redirectRoot"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.targetURL')" prop="target" v-if="!redirect.redirectRoot">
|
||||
<el-input v-model.trim="redirect.target"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.keepPath')" prop="keepPath" v-if="redirect.type !== '404'">
|
||||
<el-switch v-model="redirect.keepPath"></el-switch>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="handleClose" :disabled="loading">{{ $t('commons.button.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="submit(redirectForm)" :disabled="loading">
|
||||
{{ $t('commons.button.confirm') }}
|
||||
</el-button>
|
||||
</span>
|
||||
<el-button @click="handleClose" :disabled="loading">{{ $t('commons.button.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="submit(redirectForm)" :disabled="loading">
|
||||
{{ $t('commons.button.confirm') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-drawer>
|
||||
</DrawerPro>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import DrawerHeader from '@/components/drawer-header/index.vue';
|
||||
import { ListDomains, OperateRedirectConfig, GetRedirectConfig } from '@/api/modules/website';
|
||||
import { Rules } from '@/global/form-rules';
|
||||
import i18n from '@/lang';
|
||||
|
Loading…
x
Reference in New Issue
Block a user