Browse Source

feat: 修改应用安装数据库名的默认值 (#1904)

pull/1906/head
zhengkunwang 1 year ago committed by GitHub
parent
commit
278a562320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      frontend/src/utils/util.ts
  2. 7
      frontend/src/views/app-store/detail/params/index.vue

11
frontend/src/utils/util.ts

@ -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;
}

7
frontend/src/views/app-store/detail/params/index.vue

@ -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…
Cancel
Save