feat(website): Restrict unhealthy application selection during websit…#8269
feat(website): Restrict unhealthy application selection during websit…#8269f2c-ci-robot[bot] merged 1 commit intodev-v2from
Conversation
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
| </el-option> | ||
| </el-select> | ||
| </el-form-item> | ||
| <div v-if="website.appType == 'new'"> |
There was a problem hiding this comment.
In the provided code change, it has been updated to make the el-select wider (300px instead of 200px) and ensure that only installed apps with a status of "Running" appear in the dropdown. Additionally, each option now includes a div containing both the app name and its corresponding status, formatted using the <Status> component.
OptimizationSuggestions:
- Use Vue's computed property for dynamic data binding if
appInstallslist frequently changes. - Ensure that there is an appropriate error state handling in case no running installations exist.
- Consider caching the result of checking the application status rather than calling a new API on every render for better performance.
| MsgError(res.message); | ||
| } | ||
| loginVerify(); | ||
| } finally { |
There was a problem hiding this comment.
The code provided has several minor changes and suggestions to improve it:
-
Import Update: The
MsgSuccessimport statement was updated from'@/utils/message'to'@/utils/message'. This is unnecessary since the same module is being imported again. -
Console Log Removal: The comment about logging an error during login (
console.log('loiin syc');) should be removed as it serves no purpose. -
Return Statements:
- In both cases where the response message is "ErlAuth" or another authentication error, return statements are added after handling these scenarios. This ensures that the function does not proceed past the error checks.
Here's the optimized version of the code:
const login = async (formEl: FormInstance | undefined) => {
if (!formEl)
return;
await formEl.validate((valid) => {
if (valid) {
try {
await loginApi({
username: loginForm.username,
password: encryptedPassword(loginForm.password),
// Add other necessary parameters here if required
});
tabsStore.removeAllTabs();
globalStore.currentNode = 'local';
MsgSuccess(i18n.t('commons.msg.loginSuccess'));
router.push({ name: 'home' });
document.onkeydown = null;
} catch (res) {
if (res.message === 'ErrCaptcha') {
loginForm.captcha = '';
errCaptcha.value = true;
errAuthInfo.value = false;
return;
}
if (res.message === 'ErrAuth' || res.message.includes("error occurred")) {
globalStore.ignoreCaptcha = false;
errCaptcha.value = false;
errAuthInfo.value = true;
return;
}
MsgError(res.message);
}
loginVerify();
}
});
};Key Changes and Suggestions:
- Removed Import Duplicates: Eliminated redundant imports for readability.
- Console Logging Removal: Removed unneeded console log statement.
- Added Return Statements: Ensured functions terminate early when appropriate authentication errors occur.
- Improved variable names and formatting for better readability.
| if msgKey == "ErrAuth" || msgKey == "ErrEntrance" { | ||
| helper.BadAuth(c, msgKey, err) | ||
| return | ||
| } |
There was a problem hiding this comment.
There seems to be an issue with the SaveLoginLogs function call. The method expects a single argument, but you are passing two arguments (c and err). You should modify it to correctly pass just the one required parameter.
Additionally, there's no need to use go keyword here; calling this function directly will suffice. Here is the corrected line:
saveLoginLogs(c, err)Here's the updated Go function:
func (b *BaseApi) Login(c *gin.Context) {
user, msgKey, err := authService.Login(c, req, string(entrance))
if msgKey == "ErrAuth" || msgKey == "ErrEntrance" {
helper.BadAuth(c, msgKey, err)
return
}
// Optionally, handle other scenarios based on msgKey
}This ensures that the function saveLoginLogs receives only the necessary parameter.
|
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: wanghe-fit2cloud The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |



No description provided.