-
{{$t('asset.createAssetTab.password')}}
+
+
+
{{$t('asset.createAssetTab.sshProtocol')}}
-
-
{{$t('asset.createAssetTab.ssh')}}
+
+
{{$t('asset.createAssetTab.telnetProtocol')}}
-
- {{account.authType==1?$t('asset.createAssetTab.password'):$t('asset.createAssetTab.ssh')}}
+
+ {{account.protocol=='SSH'?$t('asset.createAssetTab.sshProtocol'):$t('asset.createAssetTab.telnetProtocol')}}
+
+
+
-
- {{account.user}}
+
+ {{account.user}}
-
+
+
+ {{$t('asset.createAssetTab.password')}}
+ {{$t('asset.createAssetTab.ssh')}}
+
+
+
-
- {{account.port}}
+
+ {{account.port}}
-
+
+
+
+
login option
+
+
+
+
+
+
+
+
+
+
+
@@ -48,7 +71,8 @@ export default {
name: "accountConfig",
props:{
account:{type:Object},
- isEdit:{type:Boolean,default:true}
+ isEdit:{type:Boolean,default:true},
+ isAllowedChangeProtocol:{type:Boolean,default:true}
},
created() {
},
@@ -63,7 +87,7 @@ export default {
{ validator: port, trigger: 'blur'}
],
},
- uploadTip:''
+ showTelnetOption:false
}
},
methods:{
@@ -72,25 +96,43 @@ export default {
id:null,
user:"",
authType:1,
+ protocol:'SSH',
pwd:"",
port:null,
privateKey:null,
- uploadFile:null
+ userTip:"",
+ passwordTip:'',
+ reloginPasswordTip:''
}
},
- changeLoginType:function(loginType){
- this.account.authType=loginType;
- if(loginType == 1){//密码登录
- this.clearPrivateKey();
+ isShowTelnetOption:function(){
+ this.showTelnetOption=!this.showTelnetOption;
+ if(!this.showTelnetOption){
+ this.account.userTip="";
+ this.account.passwordTip="";
+ this.account.reloginPasswordTip="";
}
- if(loginType == 2){//公钥登录
- this.account.pwd='';
+ },
+ telnetOptionState:function(){
+ if(this.account.userTip != ''|| this.account.passwordTip != '' || this.account.reloginPasswordTip != ''){
+ this.showTelnetOption=true;
+ }
+ },
+ changeProtocolType:function(protocolType){
+ if(this.isAllowedChangeProtocol){
+ this.account.protocol=protocolType;
+ }else{
+ return ;
}
},
clearPrivateKey:function(){
this.account.privateKey=null;
},
-
+ clearTelnetOptions:function(){
+ this.account.userTip='';
+ this.account.passwordTip='';
+ this.account.reloginPasswordTip='';
+ },
handleChange(file,fileList) {
if (fileList.length > 0) {
this.uploadFileList = [fileList[fileList.length - 1]]
@@ -111,11 +153,19 @@ export default {
immediate:true,
deep:true,
handler(n,o){
- // if (n && n.id) {
- // this.account=n;
- // } else {
- // this.resetData();
- // }
+ if(n.authType == 1){//密码登录
+ this.clearPrivateKey();
+ }
+ if(n.authType == 2){//公钥登录
+ this.account.pwd='';
+ }
+ if(n.protocol == 'SSH'){
+ this.showTelnetOption=false;
+ this.clearTelnetOptions();
+ }else{
+ this.clearPrivateKey();
+ }
+ this.telnetOptionState();
}
}
}
@@ -143,4 +193,21 @@ export default {
height: 40px;
}
/*去除上传文件动画end*/
+ .telnet-option{
+ position: relative;
+ }
+ .telnet-option:before{
+ content: "";
+ display: inline-block;
+ width: 79.9%;
+ height: 1px;
+ background-color: lightgrey;
+ vertical-align: middle;
+ margin-bottom: 18px;
+ }
+ .telnet-option .telnet-option_title{
+ display: inline-block;
+ vertical-align: middle;
+ margin-bottom: 18px;
+ }
diff --git a/nezha-fronted/src/components/page/dashboard/chartBox.vue b/nezha-fronted/src/components/page/dashboard/chartBox.vue
index 515d25664..fe8491bc2 100644
--- a/nezha-fronted/src/components/page/dashboard/chartBox.vue
+++ b/nezha-fronted/src/components/page/dashboard/chartBox.vue
@@ -350,10 +350,12 @@
}).then(() => {
this.$delete("panel/"+this.panelId+"/charts?ids="+cloneChart.id).then(response => {
if (response.code === 200) {
+ if(this.$refs.chartForm){
+ this.$refs.chartForm.resetFields();//清空表单
+ }
this.esc();
this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")});
//this.getTableData();//删除相关图表后,刷新面板数据---调用panel的方法刷新
- this.$refs.chartForm.resetFields();//清空表单
this.chart.id='';//不清除,再次打开创建图表,会显示删除按钮
this.$emit('on-delete-success');
} else {
diff --git a/nezha-fronted/src/components/page/dashboard/panel.vue b/nezha-fronted/src/components/page/dashboard/panel.vue
index bb0f65fcd..72c55c57b 100644
--- a/nezha-fronted/src/components/page/dashboard/panel.vue
+++ b/nezha-fronted/src/components/page/dashboard/panel.vue
@@ -352,7 +352,7 @@
this.$refs.addChartModal.editData(data, this.showPanel.id);
},
// 移除图表:弹出确认框询问
- removeData(data) {
+ removeData(data,from) {
this.$confirm(this.$t("tip.confirmDelete"), {
confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"),
@@ -361,11 +361,18 @@
this.$delete("panel/" + data.panelId + "/charts?ids=" + data.id).then(response => {
if (response.code === 200) {
this.$message({
- duration: 1000,
+ duration: 2000,
type: 'success',
message: this.$t("tip.deleteSuccess")
});
- this.getTableData(); //删除相关图表后,刷新面板数据
+ let chartList=this.$refs.chartList.dataList;
+ for (let i =0;i< chartList.length;i++){
+ if(chartList[i].id === data.id){
+ chartList.splice(i,1);
+ break;
+ }
+ }
+ // this.getTableData(); //删除相关图表后,刷新面板数据
} else {
this.$message.error(response.msg);
}
diff --git a/nezha-fronted/src/components/page/project/project.vue b/nezha-fronted/src/components/page/project/project.vue
index 501472a17..59a565f08 100644
--- a/nezha-fronted/src/components/page/project/project.vue
+++ b/nezha-fronted/src/components/page/project/project.vue
@@ -145,7 +145,7 @@