Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions backend/app/service/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (r *RuntimeService) Create(create request.RuntimeCreate) (*model.Runtime, e
if exist != nil {
return nil, buserr.New(constant.ErrImageExist)
}
case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo, constant.RuntimePython, constant.RuntimeDoNet:
case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo, constant.RuntimePython, constant.RuntimeDotNet:
if !fileOp.Stat(create.CodeDir) {
return nil, buserr.New(constant.ErrPathNotFound)
}
Expand Down Expand Up @@ -133,7 +133,7 @@ func (r *RuntimeService) Create(create request.RuntimeCreate) (*model.Runtime, e
if err = handlePHP(create, runtime, fileOp, appVersionDir); err != nil {
return nil, err
}
case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo, constant.RuntimePython, constant.RuntimeDoNet:
case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo, constant.RuntimePython, constant.RuntimeDotNet:
runtime.Port = create.Port
if err = handleNodeAndJava(create, runtime, fileOp, appVersionDir); err != nil {
return nil, err
Expand Down Expand Up @@ -217,7 +217,7 @@ func (r *RuntimeService) Delete(runtimeDelete request.RuntimeDelete) error {
global.LOG.Errorf("delete image id [%s] error %v", imageID, err)
}
}
case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo, constant.RuntimePython, constant.RuntimeDoNet:
case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo, constant.RuntimePython, constant.RuntimeDotNet:
if out, err := compose.Down(runtime.GetComposePath()); err != nil && !runtimeDelete.ForceDelete {
if out != "" {
return errors.New(out)
Expand Down Expand Up @@ -300,7 +300,7 @@ func (r *RuntimeService) Get(id uint) (*response.RuntimeDTO, error) {
}
}
res.AppParams = appParams
case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo, constant.RuntimePython, constant.RuntimeDoNet:
case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo, constant.RuntimePython, constant.RuntimeDotNet:
res.Params = make(map[string]interface{})
envs, err := gotenv.Unmarshal(runtime.Env)
if err != nil {
Expand Down Expand Up @@ -361,7 +361,7 @@ func (r *RuntimeService) Update(req request.RuntimeUpdate) error {
if exist != nil {
return buserr.New(constant.ErrImageExist)
}
case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo, constant.RuntimePython, constant.RuntimeDoNet:
case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo, constant.RuntimePython, constant.RuntimeDotNet:
if runtime.Port != req.Port {
if err = checkPortExist(req.Port); err != nil {
return err
Expand Down Expand Up @@ -441,7 +441,7 @@ func (r *RuntimeService) Update(req request.RuntimeUpdate) error {
return err
}
go buildRuntime(runtime, imageID, req.Rebuild)
case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo, constant.RuntimePython, constant.RuntimeDoNet:
case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo, constant.RuntimePython, constant.RuntimeDotNet:
runtime.Version = req.Version
runtime.CodeDir = req.CodeDir
runtime.Port = req.Port

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no known irregularities, issues, or optimization suggestions present in the code snippet provided. The current implementation appears to be functioning correctly.

The code checks for an existence of certain types of image files specified by the case statement (constant) and handles situations where they do and don't exist using switch cases respectively. Also, it validates various conditions related to paths/files such as checking if directories exists. Additionally, some functions like handlePHP() and checkPortExist() also perform their specific tasks efficiently while maintaining readability. Overall, there doesn't seem to be anything requiring major changes here.

For efficiency improvements, you might consider implementing caching mechanisms for frequently accessed files/directories or performing validations that require less overhead without impacting performance too much. However, such refinements would usually occur only when necessary after comprehensive testing has established the current function’s reliability and utility under different scenarios.

Expand Down
6 changes: 3 additions & 3 deletions backend/app/service/runtime_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,9 @@ func handleParams(create request.RuntimeCreate, projectDir string) (composeConte
if err != nil {
return
}
case constant.RuntimeDoNet:
case constant.RuntimeDotNet:
create.Params["CODE_DIR"] = create.CodeDir
create.Params["DONET_VERSION"] = create.Version
create.Params["DOTNET_VERSION"] = create.Version
create.Params["PANEL_APP_PORT_HTTP"] = create.Port
composeContent, err = handleCompose(env, composeContent, create, projectDir)
if err != nil {
Expand Down Expand Up @@ -408,7 +408,7 @@ func handleCompose(env gotenv.Env, composeContent []byte, create request.Runtime
ports = append(ports, "${HOST_IP}:${PANEL_APP_PORT_HTTP}:${JAVA_APP_PORT}")
case constant.RuntimeGo:
ports = append(ports, "${HOST_IP}:${PANEL_APP_PORT_HTTP}:${GO_APP_PORT}")
case constant.RuntimePython, constant.RuntimeDoNet:
case constant.RuntimePython, constant.RuntimeDotNet:
ports = append(ports, "${HOST_IP}:${PANEL_APP_PORT_HTTP}:${APP_PORT}")
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that there is no code difference or issue to discuss.

The provided code seems to be from a context where it handles parameters when creating Docker containers using various runtime environments (Go, Python, .NET, etc.). Here's what I can gather:

  • It uses constant for different environment versions and runtime types.
  • The variable names (create, port) remain consistent across multiple sections of the code.
  • Functions like handleCompose() appear to be used, likely for handling container creation based on input data such as configuration and port mapping requirements.

There does not seem to be an immediate need for optimization at this point; however, if performance enhancements are necessary given the complexity and number of configurations available, further analysis would likely indicate areas needing scrutiny rather than just observing existing patterns or variables in use.

If you have specific coding questions about particular parts of the code or want advice on more general strategies, feel free to ask!

Expand Down
2 changes: 1 addition & 1 deletion backend/app/service/website.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ func (w WebsiteService) CreateWebsite(create request.WebsiteCreate) (err error)
}
website.Proxy = proxy
}
case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo, constant.RuntimePython, constant.RuntimeDoNet:
case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo, constant.RuntimePython, constant.RuntimeDotNet:
website.Proxy = fmt.Sprintf("127.0.0.1:%d", runtime.Port)
}
}
Expand Down
2 changes: 1 addition & 1 deletion backend/app/service/website_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func configDefaultNginx(website *model.Website, domains []model.WebsiteDomain, a
server.UpdateRoot(rootIndex)
server.UpdatePHPProxy([]string{website.Proxy}, "")
}
case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo, constant.RuntimePython, constant.RuntimeDoNet:
case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo, constant.RuntimePython, constant.RuntimeDotNet:
proxy := fmt.Sprintf("http://127.0.0.1:%d", runtime.Port)
server.UpdateRootProxy([]string{proxy})
}
Expand Down
3 changes: 1 addition & 2 deletions backend/constant/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,9 @@ var WebUrlMap = map[string]struct{}{
"/websites/runtimes/php": {},
"/websites/runtimes/node": {},
"/websites/runtimes/java": {},
"/websites/runtimes/net": {},
"/websites/runtimes/go": {},
"/websites/runtimes/python": {},
"/websites/runtimes/donet": {},
"/websites/runtimes/dotnet": {},

"/login": {},

Expand Down
2 changes: 1 addition & 1 deletion backend/constant/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const (
RuntimeJava = "java"
RuntimeGo = "go"
RuntimePython = "python"
RuntimeDoNet = "donet"
RuntimeDotNet = "dotnet"

RuntimeProxyUnix = "unix"
RuntimeProxyTcp = "tcp"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lang/modules/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2428,7 +2428,7 @@ const message = {
goDirHelper: 'The directory must contain go files or binary files, subdirectories are also acceptable',
pythonHelper:
'Please fill in the complete startup command, for example: pip install -r requirements.txt && python manage.py runserver 0.0.0.0:5000',
donetHelper: 'Please fill in the complete startup comman, for example: dotnet MyWebApp.dll',
dotnetHelper: 'Please fill in the complete startup comman, for example: dotnet MyWebApp.dll',
},
process: {
pid: 'Process ID',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lang/modules/tw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2247,7 +2247,7 @@ const message = {
goDirHelper: '目錄中要包含 go 文件或者二進制文件,子目錄中包含也可',
pythonHelper:
'請填入完整啟動指令,例如:pip install -r requirements.txt && python manage.py runserver 0.0.0.0:5000',
donetHelper: '請填入完整啟動指令,例如 dotnet MyWebApp.dll',
dotnetHelper: '請填入完整啟動指令,例如 dotnet MyWebApp.dll',
},
process: {
pid: '進程ID',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lang/modules/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2249,7 +2249,7 @@ const message = {
goDirHelper: '目录中要包含 go 文件或者二进制文件,子目录中包含也可',
pythonHelper:
'请填写完整启动命令,例如:pip install -r requirements.txt && python manage.py runserver 0.0.0.0:5000',
donetHelper: '请填写完整启动命令,例如 dotnet MyWebApp.dll',
dotnetHelper: '请填写完整启动命令,例如 dotnet MyWebApp.dll',
},
process: {
pid: '进程ID',
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/routers/modules/website.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ const webSiteRouter = {
},
},
{
path: '/websites/runtimes/donet',
name: 'doNet',
path: '/websites/runtimes/dotnet',
name: 'dotNet',
hidden: true,
component: () => import('@/views/website/runtime/donet/index.vue'),
component: () => import('@/views/website/runtime/dotnet/index.vue'),
meta: {
activeMenu: '/websites/runtimes/php',
requiresAuth: false,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no known discrepancies, errors, or inefficiencies with the provided JavaScript code. However, if you need help optimizing it further, please let me know!

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/app-store/apps/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ const openInstall = (app: App.App) => {
case 'java':
case 'go':
case 'python':
case 'donet':
case 'dotnet':
router.push({ path: '/websites/runtimes/' + app.type });
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/app-store/detail/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const openInstall = () => {
case 'java':
case 'go':
case 'python':
case 'donet':
case 'dotnet':
router.push({ path: '/websites/runtimes/' + app.value.type });
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/home/app/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const goInstall = (key: string, type: string) => {
case 'java':
case 'go':
case 'python':
case 'donet':
case 'dotnet':
router.push({ path: '/websites/runtimes/' + type });
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
</ComplexTable>
</template>
</LayoutContent>
<OperateDonet ref="operateRef" @close="search" />
<OperateDotnet ref="operateRef" @close="search" />
<Delete ref="deleteRef" @close="search" />
<ComposeLogs ref="composeLogRef" />
<PortJumpDialog ref="dialogPortJumpRef" />
Expand All @@ -108,7 +108,7 @@ import { onMounted, onUnmounted, reactive, ref, computed } from 'vue';
import { Runtime } from '@/api/interface/runtime';
import { OperateRuntime, RuntimeDeleteCheck, SearchRuntimes, SyncRuntime } from '@/api/modules/runtime';
import { dateFormat } from '@/utils/util';
import OperateDonet from '@/views/website/runtime/donet/operate/index.vue';
import OperateDotnet from '@/views/website/runtime/dotnet/operate/index.vue';
import Status from '@/components/status/index.vue';
import Delete from '@/views/website/runtime/delete/index.vue';
import i18n from '@/lang';
Expand Down Expand Up @@ -147,7 +147,7 @@ const req = reactive<Runtime.RuntimeReq>({
name: '',
page: 1,
pageSize: 40,
type: 'donet',
type: 'dotnet',
});
const buttons = [
{
Expand Down Expand Up @@ -213,7 +213,7 @@ const sync = () => {
};

const openCreate = () => {
operateRef.value.acceptParams({ type: 'donet', mode: 'create' });
operateRef.value.acceptParams({ type: 'dotnet', mode: 'create' });
};

const openDetail = (row: Runtime.Runtime) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<el-form-item :label="$t('runtime.runScript')" prop="params.EXEC_SCRIPT">
<el-input v-model="runtime.params['EXEC_SCRIPT']"></el-input>
<span class="input-help">
{{ $t('runtime.donetHelper') }}
{{ $t('runtime.dotnetHelper') }}
</span>
</el-form-item>
<el-row :gutter="20">
Expand Down Expand Up @@ -174,7 +174,7 @@ const mode = ref('create');
const editParams = ref<App.InstallParams[]>();
const appVersions = ref<string[]>([]);
const appReq = reactive({
type: 'donet',
type: 'dotnet',
page: 1,
pageSize: 20,
resource: 'remote',
Expand All @@ -193,7 +193,7 @@ const initData = (type: string) => ({
port: 8080,
exposedPorts: [],
});
let runtime = reactive<Runtime.RuntimeCreate>(initData('donet'));
let runtime = reactive<Runtime.RuntimeCreate>(initData('dotnet'));
const rules = ref<any>({
name: [Rules.requiredInput, Rules.appName],
appID: [Rules.requiredSelect],
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/website/runtime/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const buttons = [
},
{
label: '.NET',
path: '/websites/runtimes/donet',
path: '/websites/runtimes/dotnet',
},
];
</script>