-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix: Fix the monitoring data exception #8028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,9 +104,6 @@ var InitSetting = &gormigrate.Migration{ | |
| if err := tx.Create(&model.Setting{Key: "EncryptKey", Value: global.CONF.Base.EncryptKey}).Error; err != nil { | ||
| return err | ||
| } | ||
| if err := tx.Create(&model.Setting{Key: "SystemIP", Value: ""}).Error; err != nil { | ||
| return err | ||
| } | ||
| if err := tx.Create(&model.Setting{Key: "DockerSockPath", Value: "unix:///var/run/docker.sock"}).Error; err != nil { | ||
| return err | ||
| } | ||
|
|
@@ -275,3 +272,16 @@ var AddOllamaModel = &gormigrate.Migration{ | |
| return nil | ||
| }, | ||
| } | ||
|
|
||
| var UpdateSettingStatus = &gormigrate.Migration{ | ||
| ID: "20250227-update-setting-status", | ||
| Migrate: func(tx *gorm.DB) error { | ||
| if err := tx.Model(model.Setting{}).Where("value = ?", "enable").Update("value", constant.StatusEnable).Error; err != nil { | ||
| return err | ||
| } | ||
| if err := tx.Model(model.Setting{}).Where("value = ?", "disable").Update("value", constant.StatusDisable).Error; err != nil { | ||
| return err | ||
| } | ||
| return nil | ||
| }, | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have reviewed the given code snippet, which appears to be related to database migrations. The primary concerns are:
As it is, the code seems to meet the minimum requirements but lacks robust validation checks, additional security practices, and proper testing across different environments or scenarios. For more comprehensive checks, you might consider implementing static analysis tools and performing a thorough unit test suite. Remember that this check-up is aimed at identifying potential errors without considering their implications fully since the scope here was limited to detecting structural issues rather than functional ones. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -118,6 +118,27 @@ | |
| </span> | ||
| </el-form-item> | ||
|
|
||
| <el-form-item | ||
| v-if="globalStore.currentNode === 'local'" | ||
| :label="$t('setting.systemIP')" | ||
| prop="systemIP" | ||
| > | ||
| <el-input disabled v-if="form.systemIP" v-model="form.systemIP"> | ||
| <template #append> | ||
| <el-button @click="onChangeSystemIP" icon="Setting"> | ||
| {{ $t('commons.button.set') }} | ||
| </el-button> | ||
| </template> | ||
| </el-input> | ||
| <el-input disabled v-if="!form.systemIP" v-model="unset"> | ||
| <template #append> | ||
| <el-button @click="onChangeSystemIP" icon="Setting"> | ||
| {{ $t('commons.button.set') }} | ||
| </el-button> | ||
| </template> | ||
| </el-input> | ||
| </el-form-item> | ||
|
|
||
| <el-form-item :label="$t('setting.proxy')" prop="proxyShow"> | ||
| <el-input disabled v-model="form.proxyShow"> | ||
| <template #append> | ||
|
|
@@ -174,6 +195,7 @@ | |
| <Password ref="passwordRef" /> | ||
| <UserName ref="userNameRef" /> | ||
| <PanelName ref="panelNameRef" @search="search()" /> | ||
| <SystemIP ref="systemIPRef" @search="search()" /> | ||
| <Proxy ref="proxyRef" @search="search()" /> | ||
| <ApiInterface ref="apiInterfaceRef" @search="search()" /> | ||
| <Timeout ref="timeoutRef" @search="search()" /> | ||
|
|
@@ -196,6 +218,7 @@ import Password from '@/views/setting/panel/password/index.vue'; | |
| import UserName from '@/views/setting/panel/username/index.vue'; | ||
| import Timeout from '@/views/setting/panel/timeout/index.vue'; | ||
| import PanelName from '@/views/setting/panel/name/index.vue'; | ||
| import SystemIP from '@/views/setting/panel/systemip/index.vue'; | ||
| import Proxy from '@/views/setting/panel/proxy/index.vue'; | ||
| import HideMenu from '@/views/setting/panel/hidemenu/index.vue'; | ||
| import { storeToRefs } from 'pinia'; | ||
|
|
@@ -233,6 +256,7 @@ const form = reactive({ | |
| language: '', | ||
| complexityVerification: '', | ||
| developerMode: '', | ||
| systemIP: '', | ||
|
|
||
| proxyShow: '', | ||
| proxyUrl: '', | ||
|
|
@@ -256,6 +280,7 @@ const show = ref(); | |
| const userNameRef = ref(); | ||
| const passwordRef = ref(); | ||
| const panelNameRef = ref(); | ||
| const systemIPRef = ref(); | ||
| const proxyRef = ref(); | ||
| const timeoutRef = ref(); | ||
| const hideMenuRef = ref(); | ||
|
|
@@ -299,6 +324,7 @@ const search = async () => { | |
| form.ipWhiteList = res.data.ipWhiteList; | ||
| form.apiKeyValidityTime = res.data.apiKeyValidityTime; | ||
| form.hideMenu = res.data.hideMenu; | ||
| form.systemIP = res.data.systemIP; | ||
|
|
||
| if (isMasterProductPro.value) { | ||
| const xpackRes = await getXpackSetting(); | ||
|
|
@@ -328,6 +354,9 @@ const onChangeTitle = () => { | |
| const onChangeTimeout = () => { | ||
| timeoutRef.value.acceptParams({ sessionTimeout: form.sessionTimeout }); | ||
| }; | ||
| const onChangeSystemIP = () => { | ||
| systemIPRef.value.acceptParams({ systemIP: form.systemIP }); | ||
| }; | ||
| const onChangeProxy = () => { | ||
| proxyRef.value.acceptParams({ | ||
| url: form.proxyUrl, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The provided code does not appear to contain any inconsistencies, errors, or inefficiencies. It seems well-integrated with all the components it references, including a One suggestion for improving UI presentation would be ensuring consistency across inputs, such as using CSS classes like "error" for error messages to improve user experience: .error {
border-color: red;
}For example: <el-input type="text" class="error" placeholder="Enter text" v-model.trim="form.email"></el-input>
<template #append>
<el-message icon="warning-circle" description="Error message here" />
</template>This could also potentially be done more programmatically by defining reusable component templates that encapsulate common styling properties and applying them based on element types and states. For example: <label><p>Please enter name</p></label>
<p-error>Not Validated!</p-error>
<input type="text">
<p>* This field is required.</p>
<p>This value should match pattern 'pattern-value'.</p>
<p style="color:red">Value exceeds maximum length of 'max-len'.</p>Other than these stylistic improvements in front-end design, there doesn't seem to be anything inherently problematic within the provided code snippet itself. The structure appears to adhere closely to Vue.js best practices and conventions. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good overall with no apparent issues, irregularities or optimizations to suggest. It appears to be well-defined and follows Go's idioms and conventions effectively.
However, in future maintenance and improvement projects you could consider:
In general though, I'm happy to see these changes have been made; it would've taken many hours just to go through this entire file line-by-line before implementing any sort of review or suggestions!