mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 14:08:06 +08:00
feat: 修改应用安装数据库名的默认值 (#1904)
This commit is contained in:
parent
c0d8578466
commit
278a562320
@ -116,6 +116,17 @@ export function getRandomStr(e: number): string {
|
||||
return n;
|
||||
}
|
||||
|
||||
export function getDBName(e: number): string {
|
||||
const t = 'abcdefhijkmnprstwxyz2345678';
|
||||
const a = t.length;
|
||||
let n = '';
|
||||
|
||||
for (let i = 0; i < e; i++) {
|
||||
n += t.charAt(Math.floor(Math.random() * a));
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
export function loadZero(i: number) {
|
||||
return i < 10 ? '0' + i : '' + i;
|
||||
}
|
||||
|
@ -102,6 +102,7 @@ import { Rules } from '@/global/form-rules';
|
||||
import { App } from '@/api/interface/app';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { getDBName } from '@/utils/util';
|
||||
const router = useRouter();
|
||||
|
||||
interface ParamObj extends App.FromField {
|
||||
@ -167,7 +168,11 @@ const handleParams = () => {
|
||||
pObj.disabled = p.disabled;
|
||||
paramObjs.value.push(pObj);
|
||||
if (p.random) {
|
||||
form[p.envKey] = p.default + '_' + getRandomStr(6);
|
||||
if (p.envKey === 'PANEL_DB_NAME') {
|
||||
form[p.envKey] = p.default + '_' + getDBName(6);
|
||||
} else {
|
||||
form[p.envKey] = p.default + '_' + getRandomStr(6);
|
||||
}
|
||||
} else {
|
||||
form[p.envKey] = p.default;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user