refactor: password not required for execute command

Usually, commands are executed in batches on multiple devices,
but the password for each device is different. Therefore, the
password parameter is removed.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
This commit is contained in:
Jianhui Zhao
2025-06-15 15:37:10 +08:00
parent ab87db1f7d
commit 7db180c749
2 changed files with 10 additions and 14 deletions
+5 -6
View File
@@ -95,17 +95,16 @@ func handleCmdReq(br *broker, c *gin.Context) {
params := jsoniter.Get(content, "params")
data := make([]string, 5)
data := make([]string, 4)
data[0] = jsoniter.Get(content, "username").ToString()
data[1] = jsoniter.Get(content, "password").ToString()
data[2] = jsoniter.Get(content, "cmd").ToString()
data[3] = token
data[4] = string(byte(params.Size()))
data[1] = jsoniter.Get(content, "cmd").ToString()
data[2] = token
data[3] = string(byte(params.Size()))
msg := []byte(strings.Join(data, string(byte(0))))
for i := 0; i < params.Size(); i++ {
for i := range params.Size() {
msg = append(msg, params.Get(i).ToString()...)
msg = append(msg, 0)
}
+5 -8
View File
@@ -45,9 +45,6 @@
<el-form-item :label="$t('Username')" prop="username">
<el-input v-model="cmdData.username"/>
</el-form-item>
<el-form-item :label="$t('Password')" prop="password">
<el-input type="password" v-model="cmdData.password" show-password/>
</el-form-item>
<el-form-item :label="$t('Command')" prop="cmd">
<el-input v-model.trim="cmdData.cmd"/>
</el-form-item>
@@ -130,7 +127,6 @@ export default {
},
cmdData: {
username: '',
password: '',
cmd: '',
params: [],
currentParam: '',
@@ -309,17 +305,18 @@ export default {
doCmd() {
(this.$refs['cmdForm']).validate(valid => {
if (valid) {
const selection = this.selection.filter(item => item.proto > 4)
this.cmdModal = false
this.cmdStatus.modal = true
this.cmdStatus.total = this.selection.length
this.cmdStatus.execing = this.selection.length
this.cmdStatus.total = selection.length
this.cmdStatus.execing = selection.length
this.cmdStatus.fail = 0
this.cmdStatus.responses = []
this.selection.forEach(item => {
selection.forEach(item => {
const data = {
username: this.cmdData.username,
password: this.cmdData.password,
cmd: this.cmdData.cmd,
params: this.cmdData.params
}