mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-28 05:15:04 +08:00
feat: 运行环境样式修改 (#519)
This commit is contained in:
parent
281cf48aaa
commit
1b5387dc5a
@ -402,14 +402,12 @@ func (a *AppInstallService) DeleteCheck(installId uint) ([]dto.AppResource, erro
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if app.Type == "website" {
|
websites, _ := websiteRepo.GetBy(websiteRepo.WithAppInstallId(appInstall.ID))
|
||||||
websites, _ := websiteRepo.GetBy(websiteRepo.WithAppInstallId(appInstall.ID))
|
for _, website := range websites {
|
||||||
for _, website := range websites {
|
res = append(res, dto.AppResource{
|
||||||
res = append(res, dto.AppResource{
|
Type: "website",
|
||||||
Type: "website",
|
Name: website.PrimaryDomain,
|
||||||
Name: website.PrimaryDomain,
|
})
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if app.Key == constant.AppOpenresty {
|
if app.Key == constant.AppOpenresty {
|
||||||
websites, _ := websiteRepo.GetBy()
|
websites, _ := websiteRepo.GetBy()
|
||||||
|
@ -390,9 +390,13 @@ func upApp(ctx context.Context, composeFilePath string, appInstall model.AppInst
|
|||||||
appInstall.Message = err.Error()
|
appInstall.Message = err.Error()
|
||||||
}
|
}
|
||||||
appInstall.Status = constant.Error
|
appInstall.Status = constant.Error
|
||||||
_ = appInstallRepo.Save(ctx, &appInstall)
|
|
||||||
} else {
|
} else {
|
||||||
appInstall.Status = constant.Running
|
appInstall.Status = constant.Running
|
||||||
|
}
|
||||||
|
exist, _ := appInstallRepo.GetFirst(commonRepo.WithByID(appInstall.ID))
|
||||||
|
if exist.ID > 0 {
|
||||||
|
_ = appInstallRepo.Save(context.Background(), &appInstall)
|
||||||
|
} else {
|
||||||
_ = appInstallRepo.Save(ctx, &appInstall)
|
_ = appInstallRepo.Save(ctx, &appInstall)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/1Panel-dev/1Panel/backend/utils/common"
|
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"reflect"
|
"reflect"
|
||||||
@ -184,9 +183,6 @@ func (w WebsiteService) CreateWebsite(ctx context.Context, create request.Websit
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if common.ScanPort(create.Port) {
|
|
||||||
return buserr.WithDetail(constant.ErrPortInUsed, create.Port, nil)
|
|
||||||
}
|
|
||||||
if runtime.Resource == constant.ResourceAppstore {
|
if runtime.Resource == constant.ResourceAppstore {
|
||||||
var req request.AppInstallCreate
|
var req request.AppInstallCreate
|
||||||
reg, _ := regexp.Compile("[^a-z0-9_\\-]+")
|
reg, _ := regexp.Compile("[^a-z0-9_\\-]+")
|
||||||
|
@ -249,7 +249,7 @@ var AddDefaultGroup = &gormigrate.Migration{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var AddTableRuntime = &gormigrate.Migration{
|
var AddTableRuntime = &gormigrate.Migration{
|
||||||
ID: "20230330-add-table-runtime",
|
ID: "20230406-add-table-runtime",
|
||||||
Migrate: func(tx *gorm.DB) error {
|
Migrate: func(tx *gorm.DB) error {
|
||||||
return tx.AutoMigrate(&model.Runtime{}, &model.Website{})
|
return tx.AutoMigrate(&model.Runtime{}, &model.Website{})
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-tag :type="getType(status)" round effect="light">
|
<el-tag :type="getType(status)" round effect="light">
|
||||||
{{ $t('commons.status.' + status) }}
|
{{ $t('commons.status.' + status) }}
|
||||||
<el-icon v-if="status === 'installing'" class="is-loading">
|
<el-icon v-if="loadingIcon(status)" class="is-loading">
|
||||||
<Loading />
|
<Loading />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</el-tag>
|
</el-tag>
|
||||||
@ -31,6 +31,12 @@ const getType = (status: string) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const loadingStatus = ['installing', 'building', 'restarting'];
|
||||||
|
|
||||||
|
const loadingIcon = (status: string): boolean => {
|
||||||
|
return loadingStatus.indexOf(status) > -1;
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
status.value = props.status.toLocaleLowerCase();
|
status.value = props.status.toLocaleLowerCase();
|
||||||
});
|
});
|
||||||
|
@ -97,6 +97,8 @@ import MdEditor from 'md-editor-v3';
|
|||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import Install from './install/index.vue';
|
import Install from './install/index.vue';
|
||||||
|
import router from '@/routers';
|
||||||
|
|
||||||
const language = useI18n().locale.value;
|
const language = useI18n().locale.value;
|
||||||
|
|
||||||
interface OperateProps {
|
interface OperateProps {
|
||||||
@ -147,7 +149,12 @@ const openInstall = () => {
|
|||||||
params: appDetail.value.params,
|
params: appDetail.value.params,
|
||||||
appDetailId: appDetail.value.id,
|
appDetailId: appDetail.value.id,
|
||||||
};
|
};
|
||||||
installRef.value.acceptParams(params);
|
console.log(app.value);
|
||||||
|
if (app.value.type === 'php') {
|
||||||
|
router.push({ path: '/websites/runtime/php' });
|
||||||
|
} else {
|
||||||
|
installRef.value.acceptParams(params);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -244,7 +244,11 @@ const getRuntime = async (id: number) => {
|
|||||||
version: data.version,
|
version: data.version,
|
||||||
};
|
};
|
||||||
editParams.value = data.appParams;
|
editParams.value = data.appParams;
|
||||||
searchApp(data.appId);
|
if (mode.value == 'create') {
|
||||||
|
searchApp(data.appId);
|
||||||
|
} else {
|
||||||
|
initParam.value = true;
|
||||||
|
}
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, reactive, ref } from 'vue';
|
import { onMounted, onUnmounted, reactive, ref } from 'vue';
|
||||||
import { Runtime } from '@/api/interface/runtime';
|
import { Runtime } from '@/api/interface/runtime';
|
||||||
import { DeleteRuntime, SearchRuntimes } from '@/api/modules/runtime';
|
import { DeleteRuntime, SearchRuntimes } from '@/api/modules/runtime';
|
||||||
import { dateFormat, toLowerCase } from '@/utils/util';
|
import { dateFormat, toLowerCase } from '@/utils/util';
|
||||||
@ -82,14 +82,15 @@ import { useDeleteData } from '@/hooks/use-delete-data';
|
|||||||
|
|
||||||
const paginationConfig = reactive({
|
const paginationConfig = reactive({
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
pageSize: 15,
|
pageSize: 10,
|
||||||
total: 0,
|
total: 0,
|
||||||
});
|
});
|
||||||
let req = reactive<Runtime.RuntimeReq>({
|
let req = reactive<Runtime.RuntimeReq>({
|
||||||
name: '',
|
name: '',
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 15,
|
pageSize: 40,
|
||||||
});
|
});
|
||||||
|
let timer: NodeJS.Timer | null = null;
|
||||||
|
|
||||||
const buttons = [
|
const buttons = [
|
||||||
{
|
{
|
||||||
@ -138,5 +139,13 @@ const openDelete = async (row: Runtime.Runtime) => {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
search();
|
search();
|
||||||
|
timer = setInterval(() => {
|
||||||
|
search();
|
||||||
|
}, 10000 * 3);
|
||||||
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
clearInterval(Number(timer));
|
||||||
|
timer = null;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -102,7 +102,7 @@ import { MsgSuccess } from '@/utils/message';
|
|||||||
|
|
||||||
const paginationConfig = reactive({
|
const paginationConfig = reactive({
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
pageSize: 20,
|
pageSize: 10,
|
||||||
total: 0,
|
total: 0,
|
||||||
});
|
});
|
||||||
const acmeAccountRef = ref();
|
const acmeAccountRef = ref();
|
||||||
|
@ -393,6 +393,9 @@ const changeRuntime = (runID: number) => {
|
|||||||
runtimes.value.forEach((item) => {
|
runtimes.value.forEach((item) => {
|
||||||
if (item.id === runID) {
|
if (item.id === runID) {
|
||||||
runtimeResource.value = item.resource;
|
runtimeResource.value = item.resource;
|
||||||
|
if (item.type === 'appstore') {
|
||||||
|
getAppDetailByID(item.appDetailId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -405,7 +408,7 @@ const getRuntimes = async () => {
|
|||||||
const first = runtimes.value[0];
|
const first = runtimes.value[0];
|
||||||
website.value.runtimeID = first.id;
|
website.value.runtimeID = first.id;
|
||||||
runtimeResource.value = first.resource;
|
runtimeResource.value = first.resource;
|
||||||
if (first.type === 'appstore') {
|
if (first.resource === 'appstore') {
|
||||||
getAppDetailByID(first.appDetailId);
|
getAppDetailByID(first.appDetailId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,13 +217,13 @@ let groups = ref<Group.GroupInfo[]>([]);
|
|||||||
|
|
||||||
const paginationConfig = reactive({
|
const paginationConfig = reactive({
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
pageSize: 15,
|
pageSize: 10,
|
||||||
total: 0,
|
total: 0,
|
||||||
});
|
});
|
||||||
let req = reactive({
|
let req = reactive({
|
||||||
name: '',
|
name: '',
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 15,
|
pageSize: 10,
|
||||||
websiteGroupId: 0,
|
websiteGroupId: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user