Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

WIP: feat(connection): support rest connection props #795

Merged
merged 1 commit into from
Dec 1, 2021

Conversation

oceanlvr
Copy link
Contributor

PR Checklist

If you have any questions, you can refer to the Contributing Guide

What is the current behavior?

image

TODO:

  • Persist the userProps storage
  • Design the UI of the Autthentication Methoddd data Data

How to design the UI for both properties?

  interface ClientPropertiesModel {
    authenticationMethod?: string
    authenticationData?: Buffer
  }

Issue Number

Example: #123

What is the new behavior?

Please describe the new behavior or provide screenshots.

Does this PR introduce a breaking change?

  • Yes
  • No

Specific Instructions

Are there any specific instructions or things that should be known prior to review?

Other information

@oceanlvr oceanlvr added the feature This pr is a feature label Nov 30, 2021
@oceanlvr oceanlvr requested a review from ysfscream November 30, 2021 04:18
@oceanlvr oceanlvr self-assigned this Nov 30, 2021
@@ -485,6 +543,8 @@ import _ from 'lodash'
import time from '@/utils/time'
import useServices from '@/database/useServices'

type UserPairObect = { key: string; value: string; checked: boolean }
Copy link
Member

Choose a reason for hiding this comment

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

Looks like this type was defined in the MsgPublish.vue, Why not set it to common?

Comment on lines +371 to +394
<el-form-item :label="$t('connections.userProperties')">
<div class="user-props">
<el-button icon="el-icon-plus" class="btn-props-plus" type="text" @click="addItem" />
<div v-for="(item, index) in listData" class="user-props-row" :key="index">
<a class="btn-check" @click="checkItem(index)">
<i v-if="item.checked" class="iconfont el-icon-check"></i>
<i v-else class="iconfont el-icon-check disable-icon"></i>
</a>
<el-input
placeholder="key"
size="mini"
v-model="item.key"
class="input-user-prop user-prop-key"
/>
<el-input
placeholder="value"
size="mini"
v-model="item.value"
class="input-user-prop user-prop-value"
/>
<el-button icon="el-icon-delete" class="btn-delete" type="text" @click="deleteItem(index)" />
</div>
</div>
</el-form-item>
Copy link
Member

Choose a reason for hiding this comment

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

This part of the form item was used on the meta card. And the add & delete logics were the same. So, I think making it to a common component is better. Just need a bind value.

Comment on lines +579 to +595
public listData: UserPairObect[] = [_.cloneDeep(this.defaultPropObj)]

private checkItem(index: number) {
this.listData[index].checked = !this.listData[index].checked
}

private deleteItem(index: number) {
if (this.listData.length > 1) {
this.listData.splice(index, 1)
} else if (this.listData.length === 1) {
this.listData = [_.cloneDeep(this.defaultPropObj)]
}
}

private addItem() {
this.listData.push(_.cloneDeep(this.defaultPropObj))
}
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

@ysfscream
Copy link
Member

How to design the UI for both properties?
interface ClientPropertiesModel {
authenticationMethod?: string
authenticationData?: Buffer
}

These properties are not important in this version. Just ignore them temporarily, but you can store them.

@ysfscream
Copy link
Member

I merge first, the next PR or Version modification.

@ysfscream ysfscream merged commit 4d4abc9 into emqx:master Dec 1, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature This pr is a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants