This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.serverchecker; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
@SpringBootApplication | |
public class Api { | |
/** | |
* @param args the command line arguments | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ServerInfo { | |
public final String name; | |
public final List<ServiceInfo> services; | |
public ServerInfo(String name, List<ServiceInfo> services) { | |
this.name = name; | |
this.services = services; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ServiceInfo { | |
public final String name; | |
public final boolean running; | |
public ServiceInfo(String name, boolean running) { | |
this.name = name; | |
this.running = running; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
datapath=./data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.serverchecker.service; | |
import com.serverchecker.dto.ServerInfo; | |
import com.serverchecker.dto.ServiceInfo; | |
import java.io.BufferedReader; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.InputStreamReader; | |
import java.util.ArrayList; | |
import java.util.HashMap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List<ServerInfo> getServerInfo() { | |
List<ServerInfo> result = new ArrayList<>(); | |
Map<String, String> serverData = getServerData(); | |
for (Map.Entry<String, String> info : serverData.entrySet()) { | |
result.add(new ServerInfo(info.getKey(), map(info.getValue()))); | |
} | |
return result; | |
} | |
private static List<ServiceInfo> map(String data) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.serverchecker; | |
import com.serverchecker.dto.ServerInfo; | |
import com.serverchecker.service.DataService; | |
import java.util.List; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.web.bind.annotation.RestController; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
@RestController | |
public class ApiController { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:myapp/serviceinfo.dart'; | |
class ServerInfo { | |
const ServerInfo({this.name, this.services}); | |
final String name; | |
final List<ServiceInfo> services; | |
factory ServerInfo.fromJson(Map<String, dynamic> json) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ServiceInfo { | |
const ServiceInfo({this.name, this.running}); | |
final String name; | |
final bool running; | |
String status() { | |
if (running) { | |
return "running"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:myapp/serverinfo.dart'; | |
import 'package:myapp/serviceinfo.dart'; | |
import 'package:myapp/utils.dart'; | |
class StartPage extends StatelessWidget { | |
StartPage({Key key, this.title, this.serverInfo}) : super(key: key); | |
final String title; | |
final Future<List<ServerInfo>> serverInfo; |
OlderNewer