-
Notifications
You must be signed in to change notification settings - Fork 463
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
Conversation
@@ -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 } |
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.
Looks like this type was defined in the MsgPublish.vue
, Why not set it to common?
<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> |
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.
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.
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)) | ||
} |
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.
Same here.
These properties are not important in this version. Just ignore them temporarily, but you can store them. |
I merge first, the next PR or Version modification. |
PR Checklist
If you have any questions, you can refer to the Contributing Guide
What is the current behavior?
TODO:
How to design the UI for both properties?
Issue Number
Example: #123
What is the new behavior?
Please describe the new behavior or provide screenshots.
Does this PR introduce a breaking change?
Specific Instructions
Are there any specific instructions or things that should be known prior to review?
Other information