Skip to content

Commit

Permalink
feat(client): allow client id empty
Browse files Browse the repository at this point in the history
  • Loading branch information
ysfscream committed Sep 24, 2024
1 parent 80a3dd0 commit 968c249
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 63 deletions.
1 change: 1 addition & 0 deletions src/utils/mqttUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const getClientOptions = (record: ConnectionModel): IClientOptions => {
clientIdWithTime,
} = record
const protocolVersion = mqttVersionDict[mqttVersion as '3.1' | '3.1.1' | '5.0']

const options: IClientOptions = {
clientId,
keepalive,
Expand Down
60 changes: 29 additions & 31 deletions src/views/connections/ConnectionForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,35 +71,6 @@
</a>
</el-tooltip>
</el-col>
<el-col :span="22">
<el-form-item label-width="93px" label="Client ID" prop="clientId">
<el-input size="mini" v-model="record.clientId"></el-input>
</el-form-item>
</el-col>
<el-col :span="1">
<a href="javascript:;" class="icon-oper" @click="setClientID">
<i class="el-icon-refresh-right"></i>
</a>
</el-col>
<!-- add clientID timestamp check icon -->
<el-col :span="1">
<el-tooltip
placement="top"
:effect="theme !== 'light' ? 'light' : 'dark'"
:open-delay="500"
:offset="80"
:content="$t('connections.clientIdWithTimeTip')"
>
<a
href="javascript:;"
class="icon-oper-pure"
@click="reverseClientIDWithTime"
:class="{ 'icon-oper-active': clientIdWithTime }"
>
<i class="el-icon-time"></i>
</a>
</el-tooltip>
</el-col>
<el-col :span="22">
<el-form-item class="host-item" label-width="93px" :label="$t('connections.brokerIP')" prop="host">
<el-col :span="6">
Expand Down Expand Up @@ -129,7 +100,35 @@
</el-input-number>
</el-form-item>
</el-col>

<el-col :span="22">
<el-form-item label-width="93px" label="Client ID" prop="clientId">
<el-input size="mini" v-model="record.clientId" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="1">
<a href="javascript:;" class="icon-oper" @click="setClientID">
<i class="el-icon-refresh-right"></i>
</a>
</el-col>
<!-- add clientID timestamp check icon -->
<el-col :span="1">
<el-tooltip
placement="top"
:effect="theme !== 'light' ? 'light' : 'dark'"
:open-delay="500"
:offset="80"
:content="$t('connections.clientIdWithTimeTip')"
>
<a
href="javascript:;"
class="icon-oper-pure"
@click="reverseClientIDWithTime"
:class="{ 'icon-oper-active': clientIdWithTime }"
>
<i class="el-icon-time"></i>
</a>
</el-tooltip>
</el-col>
<template v-if="record.protocol === 'ws' || record.protocol === 'wss'">
<el-col :span="22">
<el-form-item label-width="93px" label="Path" prop="path">
Expand Down Expand Up @@ -656,7 +655,6 @@ export default class ConnectionForm extends Vue {
{ required: true, message: this.$t('common.inputRequired') },
{ validator: this.validateName, trigger: 'blur' },
],
clientId: [{ required: true, message: this.$t('common.inputRequired') }],
path: [{ required: true, message: this.$t('common.inputRequired') }],
host: [{ required: true, message: this.$t('common.inputRequired') }],
port: [{ required: true, message: this.$t('common.inputRequired') }],
Expand Down
1 change: 0 additions & 1 deletion src/views/connections/ConnectionInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ export default class ConnectionInfo extends Vue {
{ required: true, message: this.$t('common.inputRequired') },
{ validator: this.validateName, trigger: 'blur' },
],
clientId: [{ required: true, message: this.$t('common.inputRequired') }],
}
}
Expand Down
59 changes: 29 additions & 30 deletions web/src/views/connections/ConnectionForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,35 +61,6 @@
</a>
</el-tooltip>
</el-col>
<el-col :span="22">
<el-form-item label-width="93px" label="Client ID" prop="clientId">
<el-input size="mini" v-model="record.clientId"></el-input>
</el-form-item>
</el-col>
<el-col :span="1">
<a href="javascript:;" class="icon-oper" @click="setClientID">
<i class="el-icon-refresh-right"></i>
</a>
</el-col>
<!-- add clientID timestamp check icon -->
<el-col :span="1">
<el-tooltip
placement="top"
:effect="theme !== 'light' ? 'light' : 'dark'"
:open-delay="500"
:offset="80"
:content="$t('connections.clientIdWithTimeTip')"
>
<a
href="javascript:;"
class="icon-oper-pure"
@click="reverseClientIDWithTime"
:class="{ 'icon-oper-active': clientIdWithTime }"
>
<i class="el-icon-time"></i>
</a>
</el-tooltip>
</el-col>
<el-col :span="22">
<el-form-item class="host-item" label-width="93px" :label="$t('connections.brokerIP')" prop="host">
<el-col :span="6">
Expand Down Expand Up @@ -156,6 +127,35 @@
</el-input-number>
</el-form-item>
</el-col>
<el-col :span="22">
<el-form-item label-width="93px" label="Client ID" prop="clientId">
<el-input size="mini" v-model="record.clientId" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="1">
<a href="javascript:;" class="icon-oper" @click="setClientID">
<i class="el-icon-refresh-right"></i>
</a>
</el-col>
<!-- add clientID timestamp check icon -->
<el-col :span="1">
<el-tooltip
placement="top"
:effect="theme !== 'light' ? 'light' : 'dark'"
:open-delay="500"
:offset="80"
:content="$t('connections.clientIdWithTimeTip')"
>
<a
href="javascript:;"
class="icon-oper-pure"
@click="reverseClientIDWithTime"
:class="{ 'icon-oper-active': clientIdWithTime }"
>
<i class="el-icon-time"></i>
</a>
</el-tooltip>
</el-col>

<template v-if="record.protocol === 'ws' || record.protocol === 'wss'">
<el-col :span="22">
Expand Down Expand Up @@ -614,7 +614,6 @@ export default class ConnectionCreate extends Vue {
{ required: true, message: this.$t('common.inputRequired') },
{ validator: this.validateName, trigger: 'blur' },
],
clientId: [{ required: true, message: this.$t('common.inputRequired') }],
path: [{ required: true, message: this.$t('common.inputRequired') }],
host: [{ required: true, message: this.$t('common.inputRequired') }],
port: [{ required: true, message: this.$t('common.inputRequired') }],
Expand Down
1 change: 0 additions & 1 deletion web/src/views/connections/ConnectionInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ export default class ConnectionInfo extends Vue {
{ required: true, message: this.$t('common.inputRequired') },
{ validator: this.validateName, trigger: 'blur' },
],
clientId: [{ required: true, message: this.$t('common.inputRequired') }],
}
}
Expand Down

0 comments on commit 968c249

Please sign in to comment.