Browse Source
			
			
			Merge pull request #287 from Ponkhy/dns-monitor
			
				[Before 1.5.0] Show latest dns result in Details.vue
			
			
				pull/280/head
			
			
		 
		
			
				
					
						 Louis Lam
					
					4 years ago
						Louis Lam
					
					4 years ago
					
						
							committed by
							
								 GitHub
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: 4AEE18F83AFDEB23
						
					
				
			
		
		
		
	
		
			
				 7 changed files with 
28 additions and 
4 deletions
			 
			
		 
		
			
				- 
					
					
					 
					db/patch7.sql
				
- 
					
					
					 
					db/patch8.sql
				
- 
					
					
					 
					server/database.js
				
- 
					
					
					 
					server/model/monitor.js
				
- 
					
					
					 
					src/languages/de-DE.js
				
- 
					
					
					 
					src/languages/en.js
				
- 
					
					
					 
					src/pages/Details.vue
				
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -7,4 +7,7 @@ ALTER TABLE monitor | 
			
		
	
		
			
				
					|  |  |  | ALTER TABLE monitor | 
			
		
	
		
			
				
					|  |  |  | 	ADD dns_resolve_server VARCHAR(255); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | ALTER TABLE monitor | 
			
		
	
		
			
				
					|  |  |  | 	ADD dns_last_result VARCHAR(255);	 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | COMMIT; | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -0,0 +1,7 @@ | 
			
		
	
		
			
				
					|  |  |  | -- You should not modify if this have pushed to Github, unless it does serious wrong with the db. | 
			
		
	
		
			
				
					|  |  |  | BEGIN TRANSACTION; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | ALTER TABLE monitor | 
			
		
	
		
			
				
					|  |  |  |     ADD dns_last_result VARCHAR(255); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | COMMIT; | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -6,7 +6,7 @@ class Database { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     static templatePath = "./db/kuma.db" | 
			
		
	
		
			
				
					|  |  |  |     static path = "./data/kuma.db"; | 
			
		
	
		
			
				
					|  |  |  |     static latestVersion = 7; | 
			
		
	
		
			
				
					|  |  |  |     static latestVersion = 8; | 
			
		
	
		
			
				
					|  |  |  |     static noReject = true; | 
			
		
	
		
			
				
					|  |  |  |     static sqliteInstance = null; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -50,6 +50,7 @@ class Monitor extends BeanModel { | 
			
		
	
		
			
				
					|  |  |  |             accepted_statuscodes: this.getAcceptedStatuscodes(), | 
			
		
	
		
			
				
					|  |  |  |             dns_resolve_type: this.dns_resolve_type, | 
			
		
	
		
			
				
					|  |  |  |             dns_resolve_server: this.dns_resolve_server, | 
			
		
	
		
			
				
					|  |  |  |             dns_last_result: this.dns_last_result, | 
			
		
	
		
			
				
					|  |  |  |             notificationIDList, | 
			
		
	
		
			
				
					|  |  |  |         }; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
	
		
			
				
					|  |  | @ -207,6 +208,13 @@ class Monitor extends BeanModel { | 
			
		
	
		
			
				
					|  |  |  |                         dnsMessage = dnsMessage.slice(0, -2) | 
			
		
	
		
			
				
					|  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                     if (this.dnsLastResult !== dnsMessage) { | 
			
		
	
		
			
				
					|  |  |  |                         R.exec("UPDATE `monitor` SET dns_last_result = ? WHERE id = ? ", [ | 
			
		
	
		
			
				
					|  |  |  |                             dnsMessage, | 
			
		
	
		
			
				
					|  |  |  |                             this.id | 
			
		
	
		
			
				
					|  |  |  |                         ]); | 
			
		
	
		
			
				
					|  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                     bean.msg = dnsMessage; | 
			
		
	
		
			
				
					|  |  |  |                     bean.status = UP; | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -102,4 +102,6 @@ export default { | 
			
		
	
		
			
				
					|  |  |  |     resoverserverDescription: "Cloudflare ist der Standardserver, dieser kann jederzeit geändern werden.", | 
			
		
	
		
			
				
					|  |  |  |     "Resolver Server": "Auflösungsserver", | 
			
		
	
		
			
				
					|  |  |  |     rrtypeDescription: "Wähle den RR-Typ aus, welchen du überwachen möchtest.", | 
			
		
	
		
			
				
					|  |  |  |     "Last Result": "Letztes Ergebnis", | 
			
		
	
		
			
				
					|  |  |  |     pauseMonitorMsg: "Bist du sicher das du den Monitor pausieren möchtest?", | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -15,4 +15,5 @@ export default { | 
			
		
	
		
			
				
					|  |  |  |     deleteNotificationMsg: "Are you sure want to delete this notification for all monitors?", | 
			
		
	
		
			
				
					|  |  |  |     resoverserverDescription: "Cloudflare is the default server, you can change the resolver server anytime.", | 
			
		
	
		
			
				
					|  |  |  |     rrtypeDescription: "Select the RR-Type you want to monitor", | 
			
		
	
		
			
				
					|  |  |  |     pauseMonitorMsg: "Are you sure want to pause?", | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -10,7 +10,10 @@ | 
			
		
	
		
			
				
					|  |  |  |                     <br> | 
			
		
	
		
			
				
					|  |  |  |                     <span>{{ $t("Keyword") }}:</span> <span class="keyword">{{ monitor.keyword }}</span> | 
			
		
	
		
			
				
					|  |  |  |                 </span> | 
			
		
	
		
			
				
					|  |  |  |                 <span v-if="monitor.type === 'dns'">[{{ monitor.dns_resolve_type }}] {{ monitor.hostname }}</span> | 
			
		
	
		
			
				
					|  |  |  |                 <span v-if="monitor.type === 'dns'">[{{ monitor.dns_resolve_type }}] {{ monitor.hostname }} | 
			
		
	
		
			
				
					|  |  |  |                     <br> | 
			
		
	
		
			
				
					|  |  |  |                     <span>{{ $t("Last Result") }}:</span> <span class="keyword">{{ monitor.dns_last_result }}</span> | 
			
		
	
		
			
				
					|  |  |  |                 </span> | 
			
		
	
		
			
				
					|  |  |  |             </p> | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             <div class="functions"> | 
			
		
	
	
		
			
				
					|  |  | @ -162,8 +165,8 @@ | 
			
		
	
		
			
				
					|  |  |  |                 </div> | 
			
		
	
		
			
				
					|  |  |  |             </div> | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             <Confirm ref="confirmPause" @yes="pauseMonitor"> | 
			
		
	
		
			
				
					|  |  |  |                 Are you sure want to pause? | 
			
		
	
		
			
				
					|  |  |  |             <Confirm ref="confirmPause" :yes-text="$t('Yes')" :no-text="$t('No')" @yes="pauseMonitor"> | 
			
		
	
		
			
				
					|  |  |  |                 {{ $t("pauseMonitorMsg") }} | 
			
		
	
		
			
				
					|  |  |  |             </Confirm> | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             <Confirm ref="confirmDelete" btn-style="btn-danger" :yes-text="$t('Yes')" :no-text="$t('No')" @yes="deleteMonitor"> | 
			
		
	
	
		
			
				
					|  |  | 
 |