Browse Source

fix selfhosted healtcheck import issue

CauseFX 4 years ago
parent
commit
2581519f7c
1 changed files with 7 additions and 3 deletions
  1. 7 3
      api/plugins/healthChecks/settings.js

+ 7 - 3
api/plugins/healthChecks/settings.js

@@ -44,9 +44,13 @@ $(document).on('click', '.importNewHCService', function() {
 					}
 					$.each(checks, function(i,v) {
 						let alreadySetup = false;
-						let uuid = v.ping_url;
-						uuid = uuid.match(/([0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12})/g);
-						uuid = uuid[0];
+						if(typeof v.unique_key !== 'undefined'){
+							var uuid = v.unique_key;
+						}else{
+							var uuid = v.ping_url;
+							uuid = uuid.match(/([0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12})/g);
+							uuid = uuid[0];
+						}
 						if(uuid){
 							if(checksAlreadySetup){
 								$.each(checksAlreadySetup, function(index,val) {