Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
echoyang7 committed Sep 20, 2024
2 parents 33fd475 + 3646880 commit e7c8d92
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion frontend/src/views/datamanager/DataDetailPlainConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export default {
save () {
const newData = {}
Object.assign(newData, JSON.parse(this.editorCache.info))
newData['json'] = this.editorCache.json
newData['json'] = JSON.parse(this.editorCache.json)
this.$store.dispatch('saveDataDetail', newData)
},
onJsonPathChange (payload) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/datamanager/DataDetailPlainJSON.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export default {
save () {
const newData = {}
Object.assign(newData, JSON.parse(this.editorCache.info))
newData['json'] = this.editorCache.json
newData['json'] = JSON.parse(this.editorCache.json)
this.$store.dispatch('saveDataDetail', newData)
},
onJsonPathChange (payload) {
Expand Down
13 changes: 9 additions & 4 deletions lyrebird/mock/dm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1415,10 +1415,15 @@ def activate(self, search_id, **kwargs):
self.activated_group[search_id] = group_info
# Apply config
if config:
try:
self.activate_config = json.loads(config)
except Exception as e:
logger.error('Failed to parse the config, the config did not take effect!')
if isinstance(config, str):
try:
self.activate_config = json.loads(config)
except json.JSONDecodeError:
logger.error('Failed to parse the config, the config did not take effect!')
elif isinstance(config, dict):
self.activate_config = config
else:
logger.error('Config must be a JSON string or a JSON object!')
application._cm.add_config(self.activate_config, type='dm', level=-1, apply_now=True)
# TODO:After activate
self._check_activated_data_rules_contains_request_data()
Expand Down

0 comments on commit e7c8d92

Please sign in to comment.