Skip to content

Commit

Permalink
feature/datamanager-display-super-by (#664)
Browse files Browse the repository at this point in the history
* DataManager displays super_by

* update version
  • Loading branch information
yumiguan authored Jun 9, 2022
1 parent f5b031f commit 9bf8690
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 6 deletions.
8 changes: 4 additions & 4 deletions frontend/src/store/datamanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ export default {
dataListSelectedLabel: [],
isLabelDisplay: true,
isReloadTreeWhenUpdate: false,
undisplayedKey: ['children', 'type', 'parent_id'],
undeletableKey: ['id', 'rule', 'name', 'label', 'category'],
uneditableKey: ['id', 'rule'],
stickyTopKey: ['id', 'rule', 'super_id', 'name', 'label'],
undisplayedKey: ['children', 'type', 'parent_id', 'abs_parent_path', 'parent'],
undeletableKey: ['id', 'rule', 'name', 'label', 'category', 'super_by'],
uneditableKey: ['id', 'rule', 'super_by'],
stickyTopKey: ['id', 'rule', 'super_id', 'name', 'label', 'super_by'],
displayCopyKey: ['id']
},
mutations: {
Expand Down
28 changes: 27 additions & 1 deletion frontend/src/views/datamanager/DataDetailInfo.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<Row type="flex" align="middle" @mouseover.native="isMouseOver=true" @mouseout.native="isMouseOver=false" style="margin-bottom:10px;word-break:break-all;">
<Row type="flex" align="top" @mouseover.native="isMouseOver=true" @mouseout.native="isMouseOver=false" style="margin-bottom:10px;word-break:break-all;">
<Col span="4" align="right" style="padding:0px 10px 0px 0px">
<Tooltip :content="deletable ? 'Delete': 'Undeletable key'" :delay="500" placement="bottom-start">
<Icon
Expand Down Expand Up @@ -44,6 +44,19 @@
<Option v-for="item in infoValue.allItem" :value="item.value" :key="item.value">{{ item.value }}</Option>
</Select>
</span>
<span v-else-if="inputValueType === 'longList'">
<div class="row no-gutters mb-1" v-for="listItem in longListValue">
<div class="col-5">
<span>{{listItem.id}}</span>
</div>
<div class="col-7 text-truncate">
<span>{{listItem.name}}</span>
</div>
</div>
<v-btn v-show="infoValue.length > longListShowLessCount" plain class="px-0" height="20" color="primary" @click="changeTextLongListShowAll">
<span>{{isLongListShowAll ? 'Show Less': 'Show More'}}</span>
</v-btn>
</span>
<span v-else-if="inputValueType === 'input'">
<Input v-model="inputValue" type="textarea" :autosize="{ minRows: 1 }" size="small"/>
</span>
Expand Down Expand Up @@ -82,6 +95,8 @@ export default {
imgData: '',
isDisplayPoptip: false,
isMouseOver: false,
isLongListShowAll: false,
longListShowLessCount: 5,
copyIcon: 'mdi-content-copy'
}
},
Expand All @@ -104,6 +119,12 @@ export default {
infoValue () {
return this.$store.state.dataManager.groupDetail[this.infoKey]
},
longListValue () {
if (this.isLongListShowAll) {
return this.infoValue
}
return this.infoValue.slice(0, this.longListShowLessCount)
},
buttonClass () {
if (this.deletable) {
return ['enable-button']
Expand All @@ -123,6 +144,8 @@ export default {
return 'label'
} else if (this.infoKey === 'category') {
return 'category'
} else if (this.infoKey === 'super_by') {
return 'longList'
} else if (this.$store.state.dataManager.displayCopyKey.indexOf(this.infoKey) !== -1) {
return 'textWithCopy'
} else if (this.editable) {
Expand Down Expand Up @@ -185,6 +208,9 @@ export default {
return 382
}
},
changeTextLongListShowAll () {
this.isLongListShowAll = !this.isLongListShowAll
},
onUrlCopy () {
const originCopyIcon = this.copyIcon
this.copyIcon = 'mdi-check'
Expand Down
16 changes: 16 additions & 0 deletions lyrebird/mock/dm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def set_root(self, uri):
def reload(self):
self._adapter._reload()
self.add_parent_into_node()
self.add_super_by()

def add_parent_into_node(self):
for node in self.id_map.values():
Expand All @@ -87,6 +88,21 @@ def add_parent_into_node(self):
})
self.unsave_keys.update(['parent', 'abs_parent_path'])

def add_super_by(self):
for node in self.id_map.values():
if not node.get('super_id'):
continue
super_parent_node = self.id_map.get(node['super_id'])
if not super_parent_node:
continue
if not super_parent_node.get('super_by'):
super_parent_node['super_by'] = []
super_parent_node['super_by'].append({
'id': node['id'],
'name': node['name']
})
self.unsave_keys.add('super_by')

def get(self, _id):
"""
Get mock group or data by id
Expand Down
2 changes: 1 addition & 1 deletion lyrebird/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
IVERSION = (2, 5, 4)
IVERSION = (2, 6, 0)
VERSION = ".".join(str(i) for i in IVERSION)
LYREBIRD = "Lyrebird " + VERSION

0 comments on commit 9bf8690

Please sign in to comment.