Skip to content

Commit

Permalink
remove useless code
Browse files Browse the repository at this point in the history
  • Loading branch information
yumiguan committed Dec 1, 2023
1 parent 8c9aff8 commit 918717f
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 65 deletions.
4 changes: 0 additions & 4 deletions frontend/src/components/DocumentTreeNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,6 @@ export default {
}
.toggle-icon-status {
transform:rotate(-90deg);
/* animation-name: loading-icon-rotate;
animation-duration: 800ms;
animation-timing-function: linear;
animation-iteration-count: infinite; */
}
.loading-icon {
animation-name: loading-icon-rotate;
Expand Down
24 changes: 12 additions & 12 deletions frontend/src/store/datamanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,33 +486,33 @@ export default {
})
},
// Temp mock
loadTempGroup ({ state, commit }) {
loadTempMockData ({ state, commit }) {
api.getGroupDetail(state.tempGroupId)
.then(response => {
commit('setTemporaryMockDataList', [response.data.data])
})
.catch(error => {
bus.$emit('msg.error', 'Load error: ' + error.data.message)
bus.$emit('msg.error', 'Load Temporary mock data error: ' + error.data.message)
})
},
temporaryMock ({ dispatch }, payload ) {
api.createData('tmp_group', payload)
createTempMockData ({ state, dispatch }, payload ) {
api.createData(state.tempGroupId, payload)
.then(_ => {
dispatch('loadTempGroup')
bus.$emit('msg.success', 'Temporary mock!')
dispatch('loadTempMockData')
bus.$emit('msg.success', 'Save temporary mock data success!')
})
.catch(error => {
bus.$emit('msg.error', 'Temporary mock error: ' + error.data.message)
bus.$emit('msg.error', 'Save temporary mock error: ' + error.data.message)
})
},
notTemporaryMock ({ dispatch }, payload) {
api.deleteByQuery([payload.id], 'tmp_group')
deleteTempMockData ({ state, dispatch }, payload) {
api.deleteByQuery([payload.id], state.tempGroupId)
.then(_ => {
dispatch('loadTempGroup')
bus.$emit('msg.success', 'Not temporary mock!')
dispatch('loadTempMockData')
bus.$emit('msg.success', `Delete temporary mock data ${payload.name} success!`)
})
.catch(error => {
bus.$emit('msg.error', 'Not temporary mock error: ' + error.data.message)
bus.$emit('msg.error', 'Delete temporary mock data error: ' + error.data.message)
})
}
}
Expand Down
6 changes: 1 addition & 5 deletions frontend/src/views/datamanager/DataDetailInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ import LabelDropdown from '@/components/LabelDropdown.vue'
import VueQr from 'vue-qr'
export default {
props: ['infoKey', 'editable', 'deletable', 'custom'],
props: ['infoKey', 'editable', 'deletable'],
components: {
svgIcon,
LabelDropdown,
Expand Down Expand Up @@ -215,10 +215,6 @@ export default {
},
infoValue () {
const value = this.$store.state.dataManager.groupDetail[this.infoKey]
if (value) {
return value
}
return this.$store.state.dataManager.groupDetail['触发MCD']['tab'][this.infoKey]
},
longListValue () {
if (this.isLongListShowAll) {
Expand Down
5 changes: 0 additions & 5 deletions frontend/src/views/datamanager/DataList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ export default {
DuplicateDialog,
DeleteDialog,
},
props: {
editable: {
default: true
}
},
computed: {
treeData () {
return this.$store.state.dataManager.groupList
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/inspector/FlowDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export default {
newData.id = this.editorCache.id
this.$store.dispatch('temporaryMock', newData)
this.$store.dispatch('createTempMockData', newData)
},
}
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/inspector/TempMockDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default {
DataListButtonBar
},
activated () {
this.$store.dispatch('loadTempGroup')
this.$store.dispatch('loadTempMockData')
},
data() {
return {
Expand Down
19 changes: 3 additions & 16 deletions frontend/src/views/inspector/TempMockTree.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="document-tree">
<div class="temp-mock-tree">

<v-treeview
:items="temporaryMockDataList"
Expand Down Expand Up @@ -64,12 +64,6 @@ export default {
props: {
'treeData': Array,
'searchStr': String,
'editable': {
default: true
},
'deletable': {
default: true
}
},
data() {
return {
Expand Down Expand Up @@ -120,23 +114,16 @@ export default {
this.openNode = this.rootOpen ? [] : ['tmp_group']
},
deleteData (payload) {
this.$store.dispatch('notTemporaryMock', payload)
this.$store.dispatch('deleteTempMockData', payload)
}
}
}
</script>

<style>
.document-tree .v-treeview--dense .v-treeview-node__root{
.temp-mock-tree .v-treeview--dense .v-treeview-node__root{
min-height: 32px;
padding: 0px;
margin-left: -28px;
}
.toggle-icon-status {
transform:rotate(-90deg);
/* animation-name: loading-icon-rotate;
animation-duration: 800ms;
animation-timing-function: linear;
animation-iteration-count: infinite; */
}
</style>
21 changes: 0 additions & 21 deletions tests/test_dm_temp.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,26 +142,6 @@ def test_match(data_manager):
assert len(flow_b_mock_data) == 1


def test_add(data_manager):
data = {
'request': {
'url': 'http://hostname.com/pathA/pathB?param=1'
},
'response': {}
}
new_data_id = data_manager.temp_mock_tree.add_data(data)
assert new_data_id

found_new_data = False
for child in data_manager.temp_mock_tree.root['children']:
if child['id'] == new_data_id:
found_new_data = True
break
assert found_new_data

assert new_data_id in data_manager.temp_mock_tree.activated_data


def test_add(data_manager):
data = {
'request': {
Expand Down Expand Up @@ -189,7 +169,6 @@ def test_add(data_manager):
assert f'(?=.*{parsed_url_path}\?)' == _new_data['rule']['request.url']


# new
def test_add_data_request_url_no_params(data_manager):
data = {
'request': {
Expand Down

0 comments on commit 918717f

Please sign in to comment.