diff --git a/nezha-fronted/src/components/common/header.vue b/nezha-fronted/src/components/common/header.vue index 8d8a3b14c..245598cd2 100644 --- a/nezha-fronted/src/components/common/header.vue +++ b/nezha-fronted/src/components/common/header.vue @@ -55,6 +55,22 @@ + + + {{$t('overall.asset')}} + {{$t('overall.asset')}} + + + {{$t("overall.createDatacenter")}} + + + + {{item.name}} + + + + + {{$t('overall.project')}} @@ -72,22 +88,6 @@ - - - {{$t('overall.asset')}} - {{$t('overall.asset')}} - - - {{$t("overall.createDatacenter")}} - - - - {{item.name}} - - - - - {{$t('overall.alert')}} diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index 1e9a5585c..f84448920 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -74,6 +74,10 @@ const cn = { noData:'没有数据', tag: '标签', syncChart:'同步图表', + toolBox:{ + zoom:'区域缩放', + back:'区域缩放还原' + } }, webshell: { shellTitle: "本地 Shell", diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index fda0f9bd2..7c489f98e 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -80,6 +80,11 @@ const en = { tag: 'Tag', placeHolder:'please enter', syncChart:'Synchronize chart', + toolBox:{ + zoom:'Area scaling', + back:'Area scaling restore', + stack:'Show stack chart' + } }, pageSize: '/page', webshell:{ diff --git a/nezha-fronted/src/components/page/dashboard/explore/editor.vue b/nezha-fronted/src/components/page/dashboard/explore/editor.vue index 5f7ba0549..e5d802a4e 100644 --- a/nezha-fronted/src/components/page/dashboard/explore/editor.vue +++ b/nezha-fronted/src/components/page/dashboard/explore/editor.vue @@ -64,7 +64,9 @@ showType:false, showDescription:false, detailItem:{}, - + formatTimer:null, + userChangeTimer:null, + keyDownTimer:null, } }, created(){ @@ -78,14 +80,14 @@ this.changeSuggestions('type') this.dealSpecilChar(char,operation); - if(this.pivotalCursorIndex!=0){ - //console.log('pivotalCursorIndex',this.pivotalCursorIndex,'cursorIndex',this.cursorIndex) - newContent=newContent.substring(this.pivotalCursorIndex,this.cursorIndex); - } + if(this.pivotalCursorIndex!=0){ + //console.log('pivotalCursorIndex',this.pivotalCursorIndex,'cursorIndex',this.cursorIndex) + newContent=newContent.substring(this.pivotalCursorIndex,this.cursorIndex); + } this.filterItems(newContent); }, dealSpecilChar:function(char,operation){ - //console.log('specil char',char) + // console.log('specil char',char) if(/^[\{\(\[\,]$/g.test(char)){ if(operation=='insert'){ if(char == '{'||char==','){ @@ -136,7 +138,8 @@ tempIndex--; tempChar=this.content.charAt(tempIndex); } - this.pivotalCursorIndex=tempIndex+1; + // console.log('tempIndex =====',tempIndex) + this.pivotalCursorIndex=tempIndex==0?-1:tempIndex+1; //console.log('after del double char',this.pivotalCursorIndex) }, @@ -536,7 +539,7 @@ }, storeSuggestions:function(){ this.$nextTick(()=>{ - let suggestions=document.querySelectorAll('.popper-item'); + let suggestions=this.$el.querySelectorAll('.popper-item'); this.storedSuggestions=[...suggestions]; //console.log('storedSuggestions->',suggestions) }) @@ -667,7 +670,7 @@ }, registerKeydown:function(){ let $temp=this; - document.addEventListener('keydown',function(event){ + $temp.$el.addEventListener('keydown',function(event){ //console.log('keydown',event) $temp.toggleSelect(event); }) @@ -748,12 +751,19 @@ this.options.modules.keyboard={}; this.options.modules.keyboard.bindings=bindings; this.quill = new Quill(this.$refs.editor, this.options); - this.quill.on('blur',function(){ - //console.log('quill blur') + $temp.$el.addEventListener('paste', function(even) { + let text=''; + setTimeout(()=>{ + text=$temp.getContent(); + },100)//此值必须小于userChangeTimer的值 + setTimeout(()=>{ + $temp.setContent(text); + $temp.quill.setSelection($temp.cursorIndex+text.length); + },300)//此值必须大于userChangeTimer的值 }) this.quill.on('text-change',function(delta, oldDelta, source){ if(source != 'silent'){ - //console.log('delta',delta,'oldDelta',oldDelta,'source',source) + // console.log('delta',delta,'oldDelta',oldDelta,'source',source) let char='',operation=''; let oldContent=''; oldDelta.ops.forEach((item,index)=>{ @@ -785,15 +795,19 @@ let promise=$temp.storeCursor(char); if(source == 'user'){ //console.log(delta,oldDelta,oldContent) - let newContent=$temp.getContent() - promise.then(()=>{ //存储完光标后再进行后面的操作 - $temp.userChange(char,operation,newContent,oldContent) - }) + clearTimeout($temp.userChangeTimer) + $temp.userChangeTimer=setTimeout(()=>{ + let newContent=$temp.getContent() + promise.then(()=>{ //存储完光标后再进行后面的操作 + $temp.userChange(char,operation,newContent,oldContent) + }) + },200) } $temp.content=$temp.getContent(); //console.log('current content-->',$temp.content) $temp.getPosition(); - $temp.formatContent(); + clearTimeout($temp.formatTimer) + $temp.formatTimer=setTimeout($temp.formatContent,300) } //监听文本区域的高度 let lineHeight = 16; diff --git a/nezha-fronted/src/components/page/dashboard/overview/chart.vue b/nezha-fronted/src/components/page/dashboard/overview/chart.vue index 06150c8c9..4dee0597a 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/chart.vue +++ b/nezha-fronted/src/components/page/dashboard/overview/chart.vue @@ -89,6 +89,34 @@ this.option=chartConfig.getOption(this.chartType); } + if(this.chartType == 'map'){ + let geoObj=JSON.parse(this.map.geoJson.geoJson) + geoObj.features.forEach(item=>{ + if(this.option.geo.regions){ + this.option.geo.regions.push({ + name:item.properties.name, + itemStyle: { + normal: { + areaColor: randomcolor() + } + } + + }) + }else{ + this.option.geo.regions=[{ + name:item.properties.name, + itemStyle: { + normal: { + // areaColor: item.properties.stroke + areaColor: randomcolor() + } + } + + }] + } + }) + } + this.modifyOption('tooltip','position',this.defaultTooltipPosition) if (this.tooltipFormatter) { diff --git a/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue b/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue index cfb8024fc..bf2b7b8cb 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue +++ b/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue @@ -1,6 +1,12 @@