diff --git a/README.md b/README.md
index b968a196..54455b7d 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,6 @@


-
## Install
diff --git a/data/com.github.stsdc.monitor.gschema.xml b/data/com.github.stsdc.monitor.gschema.xml
index 4bc27dbf..f192bb83 100644
--- a/data/com.github.stsdc.monitor.gschema.xml
+++ b/data/com.github.stsdc.monitor.gschema.xml
@@ -99,11 +99,6 @@
2
Update time
This value sets update time for updating data and charts.
-
-
- false
- To show Containers view or not
- To show Containers view or not
diff --git a/debian/control b/debian/control
index ab9b29f2..27e985cc 100644
--- a/debian/control
+++ b/debian/control
@@ -16,7 +16,6 @@ Build-Depends: meson,
libudisks2-dev,
libxnvctrl0,
libxnvctrl-dev,
- libcurl4-gnutls-dev,
libjson-glib-dev,
libflatpak-dev,
sassc
@@ -25,4 +24,4 @@ Standards-Version: 4.1.1
Package: com.github.stsdc.monitor
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}
-Description: Manage processes and monitor system resources. And containers
+Description: Manage processes and monitor system resources
diff --git a/meson.build b/meson.build
index 8dfcf370..58ec8e1a 100644
--- a/meson.build
+++ b/meson.build
@@ -46,8 +46,6 @@ app_dependencies = [
meson.get_compiler('c').find_library('XNVCtrl'),
meson.get_compiler('c').find_library('X11'),
meson.get_compiler('vala').find_library('libxnvctrl', dirs: vapidir),
- meson.get_compiler('vala').find_library('libcurl', dirs: vapidir),
- meson.get_compiler('c').find_library('libcurl', dirs: vapidir),
]
diff --git a/src/MainWindow.vala b/src/MainWindow.vala
index eba8a92b..c216b18f 100644
--- a/src/MainWindow.vala
+++ b/src/MainWindow.vala
@@ -9,7 +9,6 @@ public class Monitor.MainWindow : Hdy.ApplicationWindow {
public ProcessView process_view;
public SystemView system_view;
- public ContainerView container_view;
private Gtk.Stack stack;
private Statusbar statusbar;
@@ -32,17 +31,12 @@ public class Monitor.MainWindow : Hdy.ApplicationWindow {
process_view = new ProcessView ();
system_view = new SystemView (resources);
- container_view = new ContainerView ();
stack = new Gtk.Stack ();
stack.set_transition_type (Gtk.StackTransitionType.SLIDE_LEFT_RIGHT);
stack.add_titled (process_view, "process_view", _("Processes"));
stack.add_titled (system_view, "system_view", _("System"));
- if (MonitorApp.settings.get_boolean ("containers-view-state")) {
- stack.add_titled (container_view, "container_view", _("Containers"));
- }
-
Gtk.StackSwitcher stack_switcher = new Gtk.StackSwitcher ();
stack_switcher.valign = Gtk.Align.CENTER;
@@ -79,10 +73,6 @@ public class Monitor.MainWindow : Hdy.ApplicationWindow {
Timeout.add_seconds (MonitorApp.settings.get_int ("update-time"), () => {
process_view.update ();
-
- container_view.update ();
-
-
Idle.add (() => {
system_view.update ();
dbusserver.indicator_state (MonitorApp.settings.get_boolean ("indicator-state"));
diff --git a/src/Managers/Container.vala b/src/Managers/Container.vala
deleted file mode 100644
index 2c30e693..00000000
--- a/src/Managers/Container.vala
+++ /dev/null
@@ -1,263 +0,0 @@
-namespace Monitor {
- enum DockerContainerType {
- GROUP,
- CONTAINER
- }
-
- public enum DockerContainerState {
- UNKNOWN,
- PAUSED,
- RUNNING,
- STOPPED,
- }
-
- public class DockerContainer : Object {
-
- public bool exists { get; private set; }
-
- public int64 mem_used { get; private set; }
- public int64 mem_available { get; private set; }
-
- public double mem_percentage {
- get {
- if (this.mem_used == 0) return 0;
- return (((double) mem_used / (double) mem_available) * 100.0);
- }
- }
-
- int64 total_usage;
- int64 pre_total_usage;
- int64 system_cpu_usage;
- int64 pre_system_cpu_usage;
- public int64 number_cpus;
-
- public double cpu_percentage {
- get {
- if (this.total_usage == 0) return -1;
- int64 cpu_delta = total_usage - this.pre_total_usage;
- int64 system_cpu_delta = system_cpu_usage - this.pre_system_cpu_usage;
- return ((double) cpu_delta / (double) system_cpu_delta) * (double) this.number_cpus * 100.0;
- }
- }
-
- const int HISTORY_BUFFER_SIZE = 30;
- public Gee.ArrayList cpu_percentage_history = new Gee.ArrayList ();
- public Gee.ArrayList mem_percentage_history = new Gee.ArrayList ();
-
-
- // public Container ? api_container { get; construct set; }
-
- public string id;
-
- private string _name;
- public string name {
- get {
- return _name;
- }
- set {
- _name = format_name (value);
- }
- }
- public string image;
- // public DockerContainerType type;
- public string state;
-
- public string compose_project;
- public string compose_service;
-
- public string ? config_path;
- public Gee.ArrayList ? services;
-
- public HttpClient http_client;
-
- private Cgroup cgroup;
-
- public DockerContainer (string id, ref HttpClient http_client) {
- this.id = id;
- this.cgroup = new Cgroup (this.id);
- this.http_client = http_client;
- this.exists = true;
- this.number_cpus = 1;
- // this.id = id;
- // this.type = DockerContainerType.CONTAINER;
- }
-
- public string format_name (string name) {
- var value = name;
-
- if (value[0] == '/') {
- value = value.splice (0, 1);
- }
-
- return value;
- }
-
- public DockerContainerState get_state (string state) {
- if (state == "running") {
- return DockerContainerState.RUNNING;
- }
- if (state == "paused") {
- return DockerContainerState.PAUSED;
- }
- if (state == "exited") {
- return DockerContainerState.STOPPED;
- }
-
- return DockerContainerState.UNKNOWN;
- }
-
- public static bool equal (DockerContainer a, DockerContainer b) {
- return a.id == b.id;
- }
-
- private static Json.Node parse_json (string data) throws ApiClientError {
- try {
- var parser = new Json.Parser ();
- parser.load_from_data (data);
-
- var node = parser.get_root ();
-
- if (node == null) {
- throw new ApiClientError.ERROR_JSON ("Cannot parse json from: %s", data);
- }
-
- return node;
- } catch (Error error) {
- throw new ApiClientError.ERROR_JSON (error.message);
- }
- }
-
- public async bool stats () throws ApiClientError {
- try {
- var resp = yield this.http_client.r_get (@"/containers/$(this.id)/stats?stream=false");
-
- if (resp.code == 400) {
- throw new ApiClientError.ERROR ("Bad parameter");
- }
- if (resp.code == 500) {
- throw new ApiClientError.ERROR ("Server error");
- }
-
- var json = yield resp.body_data_stream.read_line_utf8_async ();
-
- if (json == null || "No such container" in json) {
- debug ("Container cease to exist: %s", this.name);
- this.exists = false;
- return false;
- }
-
- // assert_nonnull (json);
-
- var root_node = parse_json (json);
- var root_object = root_node.get_object ();
- // assert_nonnull (root_object);
-
- var json_memory_stats = root_object.get_object_member ("memory_stats");
- if (json_memory_stats == null) throw new ApiClientError.ERROR ("json_memory_stats is null");
-
- // Newer version of json library has default values option
- if (json_memory_stats.has_member ("stats")) {
- var json_memory_stats_stats = json_memory_stats.get_object_member ("stats");
- this.mem_used = json_memory_stats.get_int_member_with_default ("usage", 0) - json_memory_stats_stats.get_int_member ("inactive_file");
- this.mem_available = json_memory_stats.get_int_member_with_default ("limit", 0);
- }
-
- var json_cpu_stats = root_object.get_object_member ("cpu_stats");
- assert_nonnull (json_cpu_stats);
- var json_precpu_stats = root_object.get_object_member ("precpu_stats");
-
- var json_cpu_usage = json_cpu_stats.get_object_member ("cpu_usage");
- this.total_usage = json_cpu_usage.get_int_member ("total_usage");
-
- var json_precpu_usage = json_precpu_stats.get_object_member ("cpu_usage");
- this.pre_total_usage = json_precpu_usage.get_int_member ("total_usage");
-
-
- if (json_cpu_stats.has_member ("system_cpu_usage")) {
- this.system_cpu_usage = json_cpu_stats.get_int_member_with_default ("system_cpu_usage", 0);
- this.pre_system_cpu_usage = json_precpu_stats.get_int_member_with_default ("system_cpu_usage", 0);
-
- this.number_cpus = json_cpu_stats.get_int_member_with_default ("online_cpus", 0);
- }
-
- // debug("%lld, %lld", total_usage, pretotal_usage);
-
- // Making RAM history
- if (mem_percentage_history.size == HISTORY_BUFFER_SIZE) {
- mem_percentage_history.remove_at (0);
- }
- mem_percentage_history.add (mem_percentage);
-
- // Making RAM history
- if (cpu_percentage_history.size == HISTORY_BUFFER_SIZE) {
- cpu_percentage_history.remove_at (0);
- }
- cpu_percentage_history.add (cpu_percentage);
-
- return true;
- } catch (HttpClientError error) {
- throw new ApiClientError.ERROR (error.message);
- } catch (IOError error) {
- throw new ApiClientError.ERROR (error.message);
- }
- }
-
- public void update () {
-
- this.stats.begin ();
-
- }
-
- // private uint64 get_mem_stat_total_inactive_file () {
- // var file = File.new_for_path ("/sys/fs/cgroup/memory/docker/%s/memory.stat".printf (id));
-
- ///* make sure that it exists, not an error if it doesn't */
- // if (!file.query_exists ()) {
- // warning ("File doesn't exist ???");
-
- // return 0;
- // }
-
- // string mem_stat_total_inactive_file = "bruh";
-
-
- // try {
- // var dis = new DataInputStream (file.read ());
- // string ? line;
- // while ((line = dis.read_line ()) != null) {
- // var splitted_line = line.split (" ");
- // switch (splitted_line[0]) {
- // case "total_inactive_file":
- // mem_stat_total_inactive_file = splitted_line[1];
- // break;
- // default:
- // break;
- // }
- // }
- // return uint64.parse (mem_stat_total_inactive_file);
- // } catch (Error e) {
- // warning ("Error reading file '%s': %s\n", file.get_path (), e.message);
- // return 0;
- // }
- // }
-
- // private uint64 get_mem_usage_file () {
- // var file = File.new_for_path ("/sys/fs/cgroup/memory/docker/%s/memory.usage_in_bytes".printf (id));
-
- ///* make sure that it exists, not an error if it doesn't */
- // if (!file.query_exists ()) {
- // warning ("File doesn't exist ???");
- // return 0;
- // }
-
- // try {
- // var dis = new DataInputStream (file.read ());
- // return uint64.parse (dis.read_line ());
- // } catch (Error e) {
- // warning ("Error reading file '%s': %s\n", file.get_path (), e.message);
- // return 0;
- // }
- // }
-
- }
-}
diff --git a/src/Managers/ContainerManager.vala b/src/Managers/ContainerManager.vala
deleted file mode 100644
index 9d04fae1..00000000
--- a/src/Managers/ContainerManager.vala
+++ /dev/null
@@ -1,338 +0,0 @@
-namespace Monitor {
- public errordomain ApiClientError {
- ERROR,
- ERROR_JSON,
- ERROR_ACCESS,
- ERROR_NO_ENTRY,
- }
-
- // struct Container {
- // public string id;
- // public string name;
- // public string image;
- // public string state;
- // public string ? label_project;
- // public string ? label_service;
- // public string ? label_config;
- // public string ? label_workdir;
- // }
-
- // struct ContainerInspectInfo {
- // public string name;
- // public string image;
- // public string status;
- // public string[] ? binds;
- // public string[] ? envs;
- // public string[] ? ports;
- // }
-
- // struct DockerVersionInfo {
- // public string version;
- // public string api_version;
- // }
-
- public class ContainerManager : Object {
- private static GLib.Once instance;
- public static unowned ContainerManager get_default () {
- return instance.once (() => { return new ContainerManager (); });
- }
-
- public HttpClient http_client;
-
- private Gee.Map container_list = new Gee.HashMap ();
-
- public signal void container_added (DockerContainer container);
- public signal void container_removed (string id);
- public signal void updated ();
-
- public ContainerManager () {
- this.http_client = new HttpClient ();
- this.http_client.verbose = false;
- this.http_client.base_url = "http://localhost/v1.41";
- this.http_client.unix_socket_path = "/run/docker.sock";
-
- this.update_containers.begin ();
-
- }
-
- private static Json.Node parse_json (string data) throws ApiClientError {
- try {
- var parser = new Json.Parser ();
- parser.load_from_data (data);
-
- var node = parser.get_root ();
-
- if (node == null) {
- throw new ApiClientError.ERROR_JSON ("Cannot parse json from: %s", data);
- }
-
- return node;
- } catch (Error error) {
- throw new ApiClientError.ERROR_JSON (error.message);
- }
- }
-
- public DockerContainer ? get_container (string id) {
- // if (!container_list.has_key (id)) return;
- return container_list[id];
- }
-
- public Gee.Map get_container_list () {
- return container_list.read_only_view;
- }
-
- private bool add_container (Json.Object json_container) {
- if (!container_list.has_key (json_container.get_string_member ("Id"))) {
-
- var container = new DockerContainer (json_container.get_string_member ("Id"), ref this.http_client) {
- image = json_container.get_string_member ("Image"),
- state = json_container.get_string_member ("State"),
- };
-
- var name_array = json_container.get_array_member ("Names");
- foreach (var name_node in name_array.get_elements ()) {
- container.name = container.format_name (name_node.get_string ());
- assert_nonnull (container.name);
- break;
- }
-
- var labels_object = json_container.get_object_member ("Labels");
- assert_nonnull (labels_object);
-
- if (labels_object.has_member ("com.docker.compose.project")) {
- container.compose_project = labels_object.get_string_member ("com.docker.compose.project");
- }
- if (labels_object.has_member ("com.docker.compose.service")) {
- container.compose_service = labels_object.get_string_member ("com.docker.compose.service");
- }
- // if (labels_object.has_member ("com.docker.compose.project.config_files")) {
- // container.label_config = labels_object.get_string_member ("com.docker.compose.project.config_files");
- // }
- // if (labels_object.has_member ("com.docker.compose.project.working_dir")) {
- // container.label_workdir = labels_object.get_string_member ("com.docker.compose.project.working_dir");
- // }
-
- container_list.set (container.id, container);
- this.container_added (container);
- return true;
- } else {
- return false;
- }
- }
-
- private void remove_container (DockerContainer container) {
- debug ("removing container: %s", container.name);
- var id = container.id;
- if (container_list.has_key (id)) {
- container_list.unset (id);
- this.container_removed (id);
- }
- }
-
- public async void update_containers () throws ApiClientError {
- try {
- var resp = yield this.http_client.r_get ("/containers/json?all=true");
-
- //
- if (resp.code == 400) {
- throw new ApiClientError.ERROR ("Bad parameter");
- }
- if (resp.code == 500) {
- throw new ApiClientError.ERROR ("Server error");
- }
-
- var json = "";
- string ? line = null;
-
- while ((line = resp.body_data_stream.read_line_utf8 ()) != null) {
- json += line;
- }
-
- var root_node = parse_json (json);
- var root_array = root_node.get_array ();
- assert_nonnull (root_array);
-
- foreach (var container_node in root_array.get_elements ()) {
- var container_object = container_node.get_object ();
- assert_nonnull (container_object);
-
- this.add_container (container_object);
-
-
- }
- var remove_me = new Gee.HashSet ();
- foreach (var container in this.container_list.values) {
- // debug ("CM updating %s", container.name);
- if (!container.exists) {
- remove_me.add (container);
- continue;
- }
- container.update ();
- }
-
- foreach (var container in remove_me) {
- debug (container.name);
- remove_container (container);
- }
- /* emit the updated signal so that subscribers can update */
-
- updated ();
-
- } catch (HttpClientError error) {
- if (error is HttpClientError.ERROR_NO_ENTRY) {
- throw new ApiClientError.ERROR_NO_ENTRY (error.message);
- } else if (error is HttpClientError.ERROR_ACCESS) {
- throw new ApiClientError.ERROR_ACCESS (error.message);
- } else {
- throw new ApiClientError.ERROR (error.message);
- }
- } catch (IOError error) {
- throw new ApiClientError.ERROR (error.message);
- }
- }
-
- // public async ContainerInspectInfo inspect_container (DockerContainer container) throws ApiClientError {
- // try {
- // var container_info = ContainerInspectInfo ();
- // var resp = yield this.http_client.r_get (@"/containers/$(container.id)/json");
-
- // if (resp.code == 404) {
- // throw new ApiClientError.ERROR ("No such container");
- // }
- // if (resp.code == 500) {
- // throw new ApiClientError.ERROR ("Server error");
- // }
-
- ////
- // if (resp.code == 404) {
- // throw new ApiClientError.ERROR ("No such container");
- // }
- // if (resp.code == 500) {
- // throw new ApiClientError.ERROR ("Server error");
- // }
-
- ////
- // var json = yield resp.body_data_stream.read_line_utf8_async ();
-
- // assert_nonnull (json);
-
- // var root_node = parse_json (json);
- // var root_object = root_node.get_object ();
- // assert_nonnull (root_object);
-
- ////
- // container_info.name = root_object.get_string_member ("Name");
-
- ////
- // var state_object = root_object.get_object_member ("State");
- // assert_nonnull (state_object);
-
- // container_info.status = state_object.get_string_member ("Status");
-
- ////
- // var config_object = root_object.get_object_member ("Config");
- // assert_nonnull (config_object);
-
- // container_info.image = config_object.get_string_member ("Image");
-
- ////
- // var env_array = config_object.get_array_member ("Env");
-
- // if (env_array != null && env_array.get_length () > 0) {
- // container_info.envs = new string[0];
-
- // foreach (var env_node in env_array.get_elements ()) {
- // container_info.envs += env_node.get_string () ?? _("Unknown");
- // }
- // }
-
- ////
- // var host_config_object = root_object.get_object_member ("HostConfig");
-
- // if (host_config_object != null) {
- // var binds_array = host_config_object.get_array_member ("Binds");
-
- // if (binds_array != null && binds_array.get_length () > 0) {
- // container_info.binds = new string[0];
-
- // foreach (var bind_node in binds_array.get_elements ()) {
- // container_info.binds += bind_node.get_string () ?? _("Unknown");
- // }
- // }
- // }
-
- ////
- // var port_bindings_object = host_config_object.get_object_member ("PortBindings");
-
- // if (port_bindings_object != null) {
- // port_bindings_object.foreach_member ((obj, key, port_binding_node) => {
- // var port_binding_array = port_binding_node.get_array ();
-
- // if (port_binding_array != null && port_binding_array.get_length () > 0) {
- // container_info.ports = new string[0];
-
- // foreach (var port_node in port_binding_array.get_elements ()) {
- // var port_object = port_node.get_object ();
- // assert_nonnull (port_object);
-
- //// *with_default () works only with > 1.6.0 of json-glib
- //// var ip = port_object.get_string_member_with_default ("HostIp", "");
- //// var port = port_object.get_string_member_with_default ("HostPort", "-");
- // var ip = port_object.get_string_member ("HostIp");
- // var port = port_object.get_string_member ("HostPort");
- // container_info.ports += key + (ip.length > 0 ? @"$ip:" : ":") + port;
- // }
- // }
- // });
- // }
-
- // return container_info;
- // } catch (HttpClientError error) {
- // throw new ApiClientError.ERROR (error.message);
- // } catch (IOError error) {
- // throw new ApiClientError.ERROR (error.message);
- // }
- // }
-
- // public async DockerVersionInfo version () throws ApiClientError {
- // try {
- // var version = DockerVersionInfo ();
- // var resp = yield this.http_client.r_get ("/version");
-
- ////
- // var json = yield resp.body_data_stream.read_line_utf8_async ();
-
- // assert_nonnull (json);
-
- // var root_node = parse_json (json);
- // var root_object = root_node.get_object ();
- // assert_nonnull (root_object);
-
- //// *with_default () works only with > 1.6.0 of json-glib
- //// version.version = root_object.get_string_member_with_default ("Version", "-");
- //// version.api_version = root_object.get_string_member_with_default ("ApiVersion", "-");
- // version.version = root_object.get_string_member ("Version");
- // version.api_version = root_object.get_string_member ("ApiVersion");
- // return version;
- // } catch (HttpClientError error) {
- // throw new ApiClientError.ERROR (error.message);
- // } catch (IOError error) {
- // throw new ApiClientError.ERROR (error.message);
- // }
- // }
-
- public async void ping () throws ApiClientError {
- try {
- this.http_client.r_get ("/_ping");
-
- } catch (HttpClientError error) {
- if (error is HttpClientError.ERROR_NO_ENTRY) {
- throw new ApiClientError.ERROR_NO_ENTRY (error.message);
- } else {
- throw new ApiClientError.ERROR (error.message);
- }
- }
- }
-
- }
-}
diff --git a/src/Managers/HttpClientAsync.vala b/src/Managers/HttpClientAsync.vala
deleted file mode 100644
index f5a222b0..00000000
--- a/src/Managers/HttpClientAsync.vala
+++ /dev/null
@@ -1,156 +0,0 @@
-namespace Monitor {
- public errordomain HttpClientError {
- ERROR,
- ERROR_ACCESS,
- ERROR_NO_ENTRY
- }
-
- public enum HttpClientMethod {
- GET,
- POST,
- DELETE,
- }
-
- public class HttpClient : Object {
- public bool verbose = false;
- public string ? unix_socket_path { get; set; }
- public string ? base_url;
-
- public async HttpClientResponse r_get (string url) throws HttpClientError {
- return yield this.request (HttpClientMethod.GET, url, new HttpClientResponse ());
-
- }
-
- public async HttpClientResponse r_post (string url) throws HttpClientError {
- return yield this.request (HttpClientMethod.POST, url, new HttpClientResponse ());
-
- }
-
- public async HttpClientResponse r_delete (string url) throws HttpClientError {
- return yield this.request (HttpClientMethod.DELETE, url, new HttpClientResponse ());
-
- }
-
- public async HttpClientResponse request (HttpClientMethod method, string url, HttpClientResponse response) throws HttpClientError {
- var curl = new Curl.EasyHandle ();
-
- Curl.Code r;
-
- r = curl.setopt (Curl.Option.VERBOSE, this.verbose ? 1 : 0);
- assert_true (r == Curl.Code.OK);
- r = curl.setopt (Curl.Option.URL, (this.base_url ?? "") + url);
- assert_true (r == Curl.Code.OK);
- r = curl.setopt (Curl.Option.UNIX_SOCKET_PATH, this.unix_socket_path);
- assert_true (r == Curl.Code.OK);
- r = curl.setopt (Curl.Option.CUSTOMREQUEST, this.get_request_method (method));
- assert_true (r == Curl.Code.OK);
- r = curl.setopt (Curl.Option.WRITEDATA, (void *) response.memory_stream);
- assert_true (r == Curl.Code.OK);
- r = curl.setopt (Curl.Option.WRITEFUNCTION, HttpClientResponse.read_body_data);
- assert_true (r == Curl.Code.OK);
-
- // debug ("call api method: %s - %s", this.get_request_method (method), url);
-
- yield this.perform (curl);
-
- long curl_errno = -1;
-
- r = curl.getinfo (Curl.Info.OS_ERRNO, &curl_errno);
- assert_true (r == Curl.Code.OK);
-
- if (curl_errno == Posix.ENOENT) {
- throw new HttpClientError.ERROR_NO_ENTRY (strerror ((int) curl_errno));
- } else if (curl_errno == Posix.EACCES) {
- throw new HttpClientError.ERROR_ACCESS (strerror ((int) curl_errno));
- } else if (curl_errno > 0) {
- throw new HttpClientError.ERROR ("Unknown error");
- }
-
- if (r == Curl.Code.OK) {
- curl.getinfo (Curl.Info.RESPONSE_CODE, &response.code);
-
- return response;
- }
-
- throw new HttpClientError.ERROR (Curl.Global.strerror (r));
- }
-
- public string get_request_method (HttpClientMethod method) {
- var result = "";
-
- switch (method) {
- case HttpClientMethod.GET:
- result = "GET";
- break;
-
- case HttpClientMethod.POST:
- result = "POST";
- break;
-
- case HttpClientMethod.DELETE:
- result = "DELETE";
- break;
- }
-
- return result;
- }
-
- private async Curl.Code perform (Curl.EasyHandle curl) throws HttpClientError {
- string ? err_msg = null;
- var r = Curl.Code.OK;
-
- var task = new Task (this, null, (obj, cl_task) => {
- try {
- r = (Curl.Code)cl_task.propagate_int ();
- } catch (Error error) {
- err_msg = error.message;
- } finally {
- this.perform.callback ();
- }
- });
-
- task.set_task_data (curl, null);
- task.run_in_thread ((task, http_client, curl, cancellable) => {
- unowned var cl_curl = (Curl.EasyHandle)curl;
-
- var cl_r = cl_curl.perform ();
- task.return_int (cl_r);
- });
-
- yield;
-
- if (err_msg != null) {
- throw new HttpClientError.ERROR (@"Curl perform error: $err_msg");
- }
-
- return r;
- }
-
- }
-
- public class HttpClientResponse : Object {
- public int code;
- public MemoryInputStream memory_stream { get; construct set; }
- public DataInputStream body_data_stream { get; construct set; }
-
- public HttpClientResponse () {
- this.code = 0;
- this.memory_stream = new MemoryInputStream ();
- this.body_data_stream = new DataInputStream (this.memory_stream);
- }
-
- public static size_t read_body_data (void * buf, size_t size, size_t nmemb, void * data) {
- size_t real_size = size * nmemb;
- uint8[] buffer = new uint8[real_size];
- var response_memory_stream = (MemoryInputStream) data;
-
- Posix.memcpy ((void *) buffer, buf, real_size);
- response_memory_stream.add_data (buffer);
-
- // debug ("http client bytes read: %d", (int)real_size);
-
- return real_size;
- }
-
- }
-}
diff --git a/src/Models/ContainersTreeViewModel.vala b/src/Models/ContainersTreeViewModel.vala
deleted file mode 100644
index 5fed849d..00000000
--- a/src/Models/ContainersTreeViewModel.vala
+++ /dev/null
@@ -1,160 +0,0 @@
-public enum Monitor.ContainerColumn {
- ICON,
- NAME,
- CPU,
- MEMORY,
- // STATE,
- ID
-}
-
-public class Monitor.ContainersTreeViewModel : Gtk.TreeStore {
- public ContainerManager container_manager;
- private Gee.HashMap container_rows = new Gee.HashMap ();
- private Gee.HashMap project_rows = new Gee.HashMap ();
- public signal void added_first_row ();
-
- construct {
- set_column_types (new Type[] {
- typeof (string),
- typeof (string),
- typeof (double),
- typeof (int64),
- typeof (string),
- });
-
- container_manager = ContainerManager.get_default ();
-
- container_manager.updated.connect (update_model);
- container_manager.container_added.connect ((container) => add_container (container));
- container_manager.container_removed.connect ((id) => remove_container (id));
-
- Idle.add (() => { add_running_containers (); return false; });
- }
-
- private void add_running_containers () {
- debug ("add_running_containers");
- var containers = container_manager.get_container_list ();
- foreach (var container in containers.values) {
- add_container (container);
- }
- }
-
- private bool add_container (DockerContainer container) {
- if (container != null && !container_rows.has_key (container.id)) {
- debug ("Add container %s %s", container.name, container.id);
- // add the process to the model
-
-
-
- if (container.compose_project != null) {
- if (!project_rows.has_key (container.compose_project)) {
- Gtk.TreeIter parent_iter;
- append (out parent_iter, null); // null means top-level
- set (parent_iter,
- ContainerColumn.ICON, "",
- ContainerColumn.NAME, container.compose_project,
- ContainerColumn.ID, Utils.NO_DATA,
- // ContainerColumn.STATE, 0,
- -1);
- project_rows.set (container.compose_project, parent_iter);
- }
- Gtk.TreeIter child_iter;
- append (out child_iter, project_rows[container.compose_project]);
- set (child_iter,
- ContainerColumn.ICON, "",
- ContainerColumn.NAME, container.compose_service,
- ContainerColumn.ID, container.id,
- // ContainerColumn.STATE, 0,
- -1);
-
- // add the process to our cache of process_rows
- container_rows.set (container.id, child_iter);
-
- } else {
- Gtk.TreeIter parent_iter;
- append (out parent_iter, null); // null means top-level
- set (parent_iter,
- ContainerColumn.ICON, "",
- ContainerColumn.NAME, container.name,
- ContainerColumn.ID, container.id,
- // ContainerColumn.STATE, 0,
- -1);
- // add the process to our cache of process_rows
- container_rows.set (container.id, parent_iter);
- }
-
-
- if (container_rows.size < 1) {
- added_first_row ();
- }
-
- return true;
- }
- return false;
- }
-
- private void get_children_total (Gtk.TreeIter iter, ref int64 memory, ref double cpu) {
- // go through all children and add up CPU/Memory usage
- // TODO: this is a naive way to do things
- Gtk.TreeIter child_iter;
-
- if (iter_children (out child_iter, iter)) {
- do {
- get_children_total (child_iter, ref memory, ref cpu);
- Value cpu_value;
- Value memory_value;
- get_value (child_iter, Column.CPU, out cpu_value);
- get_value (child_iter, Column.MEMORY, out memory_value);
- memory += memory_value.get_int64 ();
- cpu += cpu_value.get_double ();
- } while (iter_next (ref child_iter));
- }
- }
-
- private void update_model () {
- foreach (string id in container_rows.keys) {
- DockerContainer container = container_manager.get_container (id);
- // debug("%s, %lld", container.name, container.mem_used);
- Gtk.TreeIter iter = container_rows[id];
- set (iter,
- Column.CPU, container.cpu_percentage,
- Column.MEMORY, container.mem_used,
- -1);
- }
- var remove_me = new Gee.HashSet ();
- foreach (var project in project_rows) {
- Gtk.TreeIter child_iter;
- var project_iter = project.value;
-
- if (!iter_children (out child_iter, project_iter)) {
- debug ("Project %s has no services! Will be removed.", project.key);
- remove (ref project_iter);
- remove_me.add (project.key);
- continue;
- }
-
- int64 total_mem = 0;
- double total_cpu = 0;
- this.get_children_total (project_iter, ref total_mem, ref total_cpu);
- set (project_iter,
- Column.CPU, total_cpu,
- Column.MEMORY, total_mem,
- -1);
- }
-
- foreach (string project_name in remove_me) {
- project_rows.unset (project_name);
- }
- }
-
- private void remove_container (string id) {
- // if process rows has pid
- if (container_rows.has_key (id)) {
- debug ("remove container %s from model".printf (id));
- var cached_iter = container_rows.get (id);
- remove (ref cached_iter);
- container_rows.unset (id);
- }
- }
-
-}
diff --git a/src/Views/ContainerView/ContainerInfoView/ContainerInfoCharts.vala b/src/Views/ContainerView/ContainerInfoView/ContainerInfoCharts.vala
deleted file mode 100644
index 8ad2f651..00000000
--- a/src/Views/ContainerView/ContainerInfoView/ContainerInfoCharts.vala
+++ /dev/null
@@ -1,67 +0,0 @@
-public class Monitor.ContainerInfoCharts : Gtk.Grid {
- private Gtk.Label cpu_label;
- private Gtk.Label ram_label;
-
- private Chart cpu_chart;
- private Chart ram_chart;
-
- construct {
- column_spacing = 6;
- row_spacing = 6;
- vexpand = false;
- column_homogeneous = true;
- row_homogeneous = false;
-
- cpu_chart = new Chart (1);
- cpu_chart.set_serie_color (0, Utils.Colors.get_rgba_color (Utils.Colors.LIME_300));
-
- ram_chart = new Chart (1);
- ram_chart.set_serie_color (0, Utils.Colors.get_rgba_color (Utils.Colors.LIME_300));
-
- cpu_chart.height_request = 60;
- ram_chart.height_request = 60;
-
- var cpu_graph_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
- cpu_graph_box.add (cpu_chart);
-
- var mem_graph_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
- mem_graph_box.add (ram_chart);
-
- cpu_label = new Gtk.Label ("CPU: " + Utils.NO_DATA);
- cpu_label.get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL);
- cpu_label.halign = Gtk.Align.START;
-
- ram_label = new Gtk.Label ("RAM: " + Utils.NO_DATA);
- ram_label.get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL);
- ram_label.halign = Gtk.Align.START;
-
- attach (cpu_label, 0, 0, 1, 1);
- attach (ram_label, 1, 0, 1, 1);
-
- attach (cpu_graph_box, 0, 1, 1, 1);
- attach (mem_graph_box, 1, 1, 1, 1);
- }
-
- public void set_charts_data (DockerContainer container) {
- cpu_chart.preset_data (0, container.cpu_percentage_history);
- ram_chart.preset_data (0, container.mem_percentage_history);
- }
-
- public void update (DockerContainer container) {
- // If containers uses more then one core, graph skyrockets over top border
- // cpu_chart.config.y_axis.fixed_max = 100.0 * container.number_cpus;
-
- cpu_label.set_text ((_("CPU: %.1f%%")).printf (container.cpu_percentage > 0 ? container.cpu_percentage : 0));
- ram_label.set_text ((_("RAM: %.1f%%")).printf (container.mem_percentage));
-
- cpu_chart.update (0, container.cpu_percentage > 0 ? container.cpu_percentage / container.number_cpus : 0.0);
- ram_chart.update (0, container.mem_percentage);
- }
-
- public void clear_graphs () {
- cpu_chart.clear ();
- ram_chart.clear ();
-
- }
-
-}
diff --git a/src/Views/ContainerView/ContainerInfoView/ContainerInfoHeader.vala b/src/Views/ContainerView/ContainerInfoView/ContainerInfoHeader.vala
deleted file mode 100644
index bff68aa9..00000000
--- a/src/Views/ContainerView/ContainerInfoView/ContainerInfoHeader.vala
+++ /dev/null
@@ -1,102 +0,0 @@
-public class Monitor.ContainerInfoHeader : Gtk.Grid {
- private Gtk.Image icon;
- public Gtk.Label state;
- public Gtk.Label container_name;
- public Gtk.Label container_image;
- public LabelRoundy pid;
-
- public LabelRoundy ppid;
- public LabelRoundy pgrp;
- public LabelRoundy nice;
- public LabelRoundy priority;
- public LabelRoundy num_threads;
- public LabelRoundy username;
-
- private Regex ? regex;
-
- construct {
- column_spacing = 12;
-
- /* *INDENT-OFF* */
- regex = /(?i:^.*\.(xpm|png)$)/; // vala-lint=space-before-paren,
- /* *INDENT-ON* */
-
- icon = new Gtk.Image.from_icon_name ("application-x-executable", Gtk.IconSize.DIALOG);
- icon.set_pixel_size (64);
- icon.valign = Gtk.Align.END;
-
- state = new Gtk.Label ("?");
- state.halign = Gtk.Align.START;
- state.get_style_context ().add_class ("state_badge");
-
- var icon_container = new Gtk.Fixed ();
- icon_container.put (icon, 0, 0);
- icon_container.put (state, -5, 48);
-
- container_name = new Gtk.Label (_("N/A"));
- container_name.get_style_context ().add_class ("h2");
- container_name.ellipsize = Pango.EllipsizeMode.END;
- container_name.tooltip_text = _("N/A");
- container_name.halign = Gtk.Align.START;
- container_name.valign = Gtk.Align.START;
-
- pid = new LabelRoundy (_("PID"));
- nice = new LabelRoundy (_("NI"));
- priority = new LabelRoundy (_("PRI"));
- num_threads = new LabelRoundy (_("THR"));
- // ppid = new LabelRoundy (_("PPID"));
- // pgrp = new LabelRoundy (_("PGRP"));
-
- // TODO: tooltip_text UID
- username = new LabelRoundy ("");
-
- // var wrapper = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
- // wrapper.add (pid);
- // wrapper.add (priority);
- // wrapper.add (nice);
- // wrapper.add (num_threads);
- // wrapper.add (username);
-
- container_image = new Gtk.Label (Utils.NO_DATA);
-
- container_image.get_style_context ().add_class ("dim-label");
- container_image.get_style_context ().add_class ("image");
- container_image.max_width_chars = 48;
- container_image.ellipsize = Pango.EllipsizeMode.END;
- container_image.halign = Gtk.Align.START;
-
- attach (icon_container, 0, 0, 1, 2);
- attach (container_name, 1, 0, 3, 1);
- attach (container_image, 1, 1, 1, 1);
- }
-
- public void update (DockerContainer container) {
- container_name.set_text (container.name);
- container_name.tooltip_text = container.id;
- container_image.set_text (container.image);
- // pid.set_text (process.stat.pid.to_string ());
- // nice.set_text (process.stat.nice.to_string ());
- // priority.set_text (process.stat.priority.to_string ());
-
- // if (process.uid == 0) {
- // username.val.get_style_context ().add_class ("username-root");
- // username.val.get_style_context ().remove_class ("username-other");
- // username.val.get_style_context ().remove_class ("username-current");
- // } else if (process.uid == (int) Posix.getuid ()) {
- // username.val.get_style_context ().add_class ("username-current");
- // username.val.get_style_context ().remove_class ("username-other");
- // username.val.get_style_context ().remove_class ("username-root");
- // } else {
- // username.val.get_style_context ().add_class ("username-other");
- // username.val.get_style_context ().remove_class ("username-root");
- // username.val.get_style_context ().remove_class ("username-current");
- // }
-
- // username.set_text (process.username);
- // num_threads.set_text (process.stat.num_threads.to_string ());
- // state.set_text (process.stat.state);
- // state.tooltip_text = set_state_tooltip ();
- // num_threads.set_text (process.stat.num_threads.to_string ());
- // set_icon (process);
- }
-}
diff --git a/src/Views/ContainerView/ContainerInfoView/ContainerInfoView.vala b/src/Views/ContainerView/ContainerInfoView/ContainerInfoView.vala
deleted file mode 100644
index 7e38cf8f..00000000
--- a/src/Views/ContainerView/ContainerInfoView/ContainerInfoView.vala
+++ /dev/null
@@ -1,52 +0,0 @@
-public class Monitor.ContainerInfoView : Gtk.Grid {
-
- private DockerContainer _container;
- public DockerContainer ? container {
- get {
- return _container;
- }
- set {
- _container = value;
- this.container_charts.clear_graphs ();
- this.container_charts.set_charts_data (_container);
- this.container_header.update (container);
- }
- }
-
- private ContainerInfoHeader container_header = new ContainerInfoHeader ();
- private ContainerInfoCharts container_charts = new ContainerInfoCharts ();
-
- private Gtk.Label cpu_label;
- private Gtk.Label ram_label;
-
- construct {
- this.expand = false;
- this.width_request = 200;
-
- column_spacing = 6;
- row_spacing = 6;
- vexpand = false;
- margin = 12;
- column_homogeneous = true;
- row_homogeneous = false;
-
- cpu_label = new Gtk.Label ("CPU: " + Utils.NO_DATA);
- cpu_label.get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL);
- cpu_label.halign = Gtk.Align.START;
-
- ram_label = new Gtk.Label ("RAM: " + Utils.NO_DATA);
- ram_label.get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL);
- ram_label.halign = Gtk.Align.START;
-
- attach (container_header, 0, 0, 1, 1);
- attach (container_charts, 0, 1, 1, 1);
- }
-
- public void update () {
- if (container != null) {
- this.container_header.update (container);
- this.container_charts.update (container);
- }
- }
-
-}
diff --git a/src/Views/ContainerView/ContainerTreeView.vala b/src/Views/ContainerView/ContainerTreeView.vala
deleted file mode 100644
index 28d77c83..00000000
--- a/src/Views/ContainerView/ContainerTreeView.vala
+++ /dev/null
@@ -1,212 +0,0 @@
-public class Monitor.ContainerTreeView : Gtk.TreeView {
- private new ContainersTreeViewModel model;
- private Gtk.TreeViewColumn name_column;
- private Gtk.TreeViewColumn id_column;
- private Gtk.TreeViewColumn cpu_column;
- private Gtk.TreeViewColumn memory_column;
- private Regex ? regex;
-
- public signal void container_selected (DockerContainer container);
-
- public ContainerTreeView (ContainersTreeViewModel model) {
- this.model = model;
- /* *INDENT-OFF* */
- regex = /(?i:^.*\.(xpm|png)$)/; // vala-lint=space-before-paren,
- /* *INDENT-ON* */
-
- this.vexpand = true;
-
- // setup name column
- name_column = new Gtk.TreeViewColumn ();
- name_column.title = _("Container Name");
- name_column.expand = true;
- name_column.min_width = 250;
- name_column.set_sort_column_id (ContainerColumn.NAME);
-
- var icon_cell = new Gtk.CellRendererPixbuf ();
- name_column.pack_start (icon_cell, false);
- // name_column.add_attribute (icon_cell, "icon_name", Column.ICON);
- name_column.set_cell_data_func (icon_cell, icon_cell_layout);
-
- var name_cell = new Gtk.CellRendererText ();
- name_cell.ellipsize = Pango.EllipsizeMode.END;
- name_cell.set_fixed_height_from_font (1);
- name_column.pack_start (name_cell, false);
- name_column.add_attribute (name_cell, "text", ContainerColumn.NAME);
- insert_column (name_column, -1);
-
- // setup cpu column
- var cpu_cell = new Gtk.CellRendererText ();
- cpu_cell.xalign = 0.5f;
-
- cpu_column = new Gtk.TreeViewColumn.with_attributes (_("CPU"), cpu_cell);
- cpu_column.expand = false;
- cpu_column.set_cell_data_func (cpu_cell, cpu_usage_cell_layout);
- cpu_column.alignment = 0.5f;
- cpu_column.set_sort_column_id (ContainerColumn.CPU);
- insert_column (cpu_column, -1);
-
- // setup memory column
- var memory_cell = new Gtk.CellRendererText ();
- memory_cell.xalign = 0.5f;
-
- memory_column = new Gtk.TreeViewColumn.with_attributes (_("Memory"), memory_cell);
- memory_column.expand = false;
- memory_column.set_cell_data_func (memory_cell, memory_usage_cell_layout);
- memory_column.alignment = 0.5f;
- memory_column.set_sort_column_id (ContainerColumn.MEMORY);
- insert_column (memory_column, -1);
-
- // setup ID column
- var id_cell = new Gtk.CellRendererText ();
- id_cell.xalign = 0.5f;
- id_column = new Gtk.TreeViewColumn.with_attributes (_("ID"), id_cell);
- id_column.set_cell_data_func (id_cell, id_cell_layout);
- id_column.expand = false;
- id_column.alignment = 0.5f;
- id_column.set_sort_column_id (ContainerColumn.ID);
- id_column.add_attribute (id_cell, "text", ContainerColumn.ID);
- // insert_column (id_column, -1);
-
- // resize all of the columns
- columns_autosize ();
-
- set_model (model);
-
- model.added_first_row.connect (() => {
- focus_on_first_row ();
- });
-
- cursor_changed.connect (_cursor_changed);
- // model.process_manager.updated.connect (_cursor_changed);
- }
- public void icon_cell_layout (Gtk.CellLayout cell_layout, Gtk.CellRenderer icon_cell, Gtk.TreeModel model, Gtk.TreeIter iter) {
- Value icon_name;
- model.get_value (iter, ContainerColumn.ICON, out icon_name);
- string path = ((string) icon_name);
-
- if (regex.match (path)) {
- try {
- Gdk.Pixbuf icon = new Gdk.Pixbuf.from_file_at_size (path, 16, -1);
- ((Gtk.CellRendererPixbuf)icon_cell).pixbuf = icon;
- } catch (Error e) {
- warning (e.message);
- }
- } else {
- ((Gtk.CellRendererPixbuf)icon_cell).icon_name = path;
- }
- }
-
- public void cpu_usage_cell_layout (Gtk.CellLayout cell_layout, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) {
- // grab the value that was store in the model and convert it down to a usable format
- Value cpu_usage_value;
- model.get_value (iter, ContainerColumn.CPU, out cpu_usage_value);
- double cpu_usage = cpu_usage_value.get_double ();
-
- // format the double into a string
- if (cpu_usage < 0.0)
- ((Gtk.CellRendererText)cell).text = Utils.NO_DATA;
- else
- ((Gtk.CellRendererText)cell).text = "%.0f%%".printf (cpu_usage);
- }
-
- public void memory_usage_cell_layout (Gtk.CellLayout cell_layout, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) {
- // grab the value that was store in the model and convert it down to a usable format
- Value memory_usage_value;
- model.get_value (iter, ContainerColumn.MEMORY, out memory_usage_value);
- int64 memory_usage = memory_usage_value.get_int64 ();
- double memory_usage_double = (double) memory_usage;
- string units = _("B");
-
- // convert to MiB if needed
- if (memory_usage_double > 1024.0) {
- memory_usage_double /= 1024.0;
- units = _("KiB");
- }
-
- // convert to GiB if needed
- if (memory_usage_double > 1024.0) {
- memory_usage_double /= 1024.0;
- units = _("MiB");
- }
-
- // format the double into a string
- if (memory_usage == 0)
- ((Gtk.CellRendererText)cell).text = Utils.NO_DATA;
- else
- ((Gtk.CellRendererText)cell).text = "%.1f %s".printf (memory_usage_double, units);
- }
-
- private void id_cell_layout (Gtk.CellLayout cell_layout, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) {
- Value id_value;
- model.get_value (iter, ContainerColumn.ID, out id_value);
- string id = id_value.get_string ();
- // format the double into a string
- if (id == "") {
- ((Gtk.CellRendererText)cell).text = Utils.NO_DATA;
- }
- }
-
- public void focus_on_first_row () {
- Gtk.TreePath tree_path = new Gtk.TreePath.from_indices (0);
- this.set_cursor (tree_path, null, false);
- grab_focus ();
- }
-
- public void focus_on_child_row () {
- Gtk.TreePath tree_path = new Gtk.TreePath.from_indices (0, 0);
- this.set_cursor (tree_path, null, false);
- grab_focus ();
- }
-
- public int get_pid_of_selected () {
- Gtk.TreeIter iter;
- Gtk.TreeModel model;
- int pid = 0;
- var selection = this.get_selection ().get_selected_rows (out model).nth_data (0);
- model.get_iter (out iter, selection);
- model.get (iter, ContainerColumn.ID, out pid);
- return pid;
- }
-
- // How about GtkTreeSelection ?
-
- public void expanded () {
- Gtk.TreeModel model;
- var selection = this.get_selection ().get_selected_rows (out model).nth_data (0);
- this.expand_row (selection, false);
- }
-
- public void collapse () {
- Gtk.TreeModel model;
- var selection = this.get_selection ().get_selected_rows (out model).nth_data (0);
- this.collapse_row (selection);
- }
-
- // public void kill_process () {
- // int pid = get_pid_of_selected ();
- // model.kill_process (pid);
- // }
-
- // public void end_process () {
- // int pid = get_pid_of_selected ();
- // model.end_process (pid);
- // }
-
- // when row is selected send signal to update process_info_view
- public void _cursor_changed () {
- Gtk.TreeModel tree_model;
- Gtk.TreeIter iter;
- string id = "";
- var selection = get_selection ().get_selected_rows (out tree_model).nth_data (0);
-
- if (selection != null) {
- tree_model.get_iter (out iter, selection);
- tree_model.get (iter, ContainerColumn.ID, out id);
- DockerContainer container = model.container_manager.get_container (id);
- container_selected (container);
- // debug ("cursor changed");
- }
- }
-
-}
diff --git a/src/Views/ContainerView/ContainerView.vala b/src/Views/ContainerView/ContainerView.vala
deleted file mode 100644
index 3993f66f..00000000
--- a/src/Views/ContainerView/ContainerView.vala
+++ /dev/null
@@ -1,137 +0,0 @@
-public class Monitor.ContainerView : Gtk.Box {
- public ContainersTreeViewModel container_treeview_model = new ContainersTreeViewModel ();
- public ContainerTreeView container_treeview;
- private ContainerInfoView container_info_view = new ContainerInfoView ();
-
-
- construct {
- orientation = Gtk.Orientation.VERTICAL;
- hexpand = true;
-
- this.container_treeview = new ContainerTreeView (container_treeview_model);
- this.container_treeview.container_selected.connect (set_container_container_info_view);
-
- }
-
- public ContainerView () {
-
- var container_tree_view_scrolled = new Gtk.ScrolledWindow (null, null);
- container_tree_view_scrolled.add (container_treeview);
-
- var paned = new Gtk.Paned (Gtk.Orientation.HORIZONTAL);
- paned.pack1 (container_tree_view_scrolled, true, false);
- // paned.pack2 (container_info_view, true, false);
- paned.set_position (paned.max_position);
-
-
- add (paned);
- }
-
- private void set_container_container_info_view (DockerContainer container) {
- this.container_info_view.container = container;
- }
-
- public void update () {
- new Thread ("update-containers", () => {
- container_treeview_model.container_manager.update_containers.begin ();
- container_info_view.update ();
-
- return true;
- });
-
-
-
- // for (var i = 0; i < api_containers.length; i++) {
- // var container = api_containers[i];
-
- // debug("%s", container.name);
- // }
- }
-
- // private async void containers_load () throws ApiClientError {
- // this.containers.clear ();
-
- //// grouping containers into applications
- // var api_containers = yield this.api_client.list_containers ();
- // string[] projects = {};
-
- // for (var i = 0; i < api_containers.length; i++) {
- // var container = api_containers[i];
-
- // if (container.label_project == null) {
- //// single container
- // this.containers.add (new DockerContainer.from_docker_api_container (container));
- // } else {
- //// if the container has already been processed
- // if (container.label_project in projects) {
- // continue;
- // }
-
- //// create group
- // var container_group = new DockerContainer ();
-
- // var full_config_path = Path.build_filename (
- // container.label_workdir,
- // Path.get_basename (container.label_config)
- // );
-
- // container_group.id = full_config_path;
- // container_group.name = container_group.format_name (container.label_project);
- // container_group.image = "";
- // container_group.type = DockerContainerType.GROUP;
- // container_group.state = DockerContainerState.UNKNOWN;
- // container_group.config_path = full_config_path;
- // container_group.services = new Gee.ArrayList (DockerContainer.equal);
-
- //// search for containers with the same project
- // var is_all_running = true;
- // var is_all_paused = true;
- // var is_all_stopped = true;
-
- // for (var j = i; j < api_containers.length; j++) {
- // var service = api_containers[j];
-
- // if (service.label_project != null && service.label_project == container.label_project) {
- // var s = new DockerContainer.from_docker_api_container (service);
- // s.name = s.format_name (service.label_service);
-
- // is_all_running = is_all_running && s.state == DockerContainerState.RUNNING;
- // is_all_paused = is_all_paused && s.state == DockerContainerState.PAUSED;
- // is_all_stopped = is_all_stopped && s.state == DockerContainerState.STOPPED;
-
- // container_group.services.add (s);
- // }
- // }
-
- //// image
- // string?[] services = {};
-
- // foreach (var service in container_group.services) {
- // services += service.name;
- // }
-
- //// state
- // if (is_all_running) {
- // container_group.state = DockerContainerState.RUNNING;
- // }
- // if (is_all_paused) {
- // container_group.state = DockerContainerState.PAUSED;
- // }
- // if (is_all_stopped) {
- // container_group.state = DockerContainerState.STOPPED;
- // }
-
- // container_group.image = string.joinv (", ", services);
-
- //// mark that the application has already been processed
- // projects += container.label_project;
-
- //// saving the container to the resulting array
- // this.containers.add (container_group);
- // }
- // }
-
- // this.notify_property ("containers");
- // }
-
-}
diff --git a/src/Views/PreferencesView/PreferencesGeneralPage.vala b/src/Views/PreferencesView/PreferencesGeneralPage.vala
index bdcc4553..97f8d37b 100644
--- a/src/Views/PreferencesView/PreferencesGeneralPage.vala
+++ b/src/Views/PreferencesView/PreferencesGeneralPage.vala
@@ -7,7 +7,6 @@
public class Monitor.PreferencesGeneralPage : Granite.SettingsPage {
public Gtk.Switch background_switch;
public Gtk.Switch enable_smooth_lines_switch;
- public Gtk.Switch enable_containers_view_switch;
private Gtk.Adjustment update_time_adjustment;
@@ -57,15 +56,6 @@
update_time_scale.add_mark (4.0, Gtk.PositionType.BOTTOM, _("4s"));
update_time_scale.add_mark (5.0, Gtk.PositionType.BOTTOM, _("5s"));
- var enable_containers_view_label = new Gtk.Label (_("Show containers tab (requires restart):"));
- enable_containers_view_label.halign = Gtk.Align.START;
-
- enable_containers_view_switch = new Gtk.Switch () {
- state = MonitorApp.settings.get_boolean ("containers-view-state"),
- halign = Gtk.Align.END,
- hexpand = true
- };
-
var content_area = new Gtk.Grid ();
content_area.column_spacing = 12;
content_area.row_spacing = 12;
@@ -76,8 +66,6 @@
content_area.attach (enable_smooth_lines_switch, 1, 2, 1, 1);
content_area.attach (update_time_label, 0, 3, 1, 1);
content_area.attach (update_time_scale, 0, 4, 1, 1);
- content_area.attach (enable_containers_view_label, 0, 5, 1, 1);
- content_area.attach (enable_containers_view_switch, 1, 5, 1, 1);
add (content_area);
@@ -93,9 +81,5 @@
MonitorApp.settings.set_int ("update-time", (int) update_time_adjustment.get_value ());
});
- enable_containers_view_switch.notify["active"].connect (() => {
- MonitorApp.settings.set_boolean ("containers-view-state", enable_containers_view_switch.state);
- });
-
}
}
diff --git a/src/meson.build b/src/meson.build
index 24ef83a5..ae372820 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -20,12 +20,6 @@ source_app_files = [
'Views/SystemView/SystemStorageView.vala',
'Views/SystemView/SystemGPUView.vala',
- 'Views/ContainerView/ContainerView.vala',
- 'Views/ContainerView/ContainerTreeView.vala',
- 'Views/ContainerView/ContainerInfoView/ContainerInfoView.vala',
- 'Views/ContainerView/ContainerInfoView/ContainerInfoHeader.vala',
- 'Views/ContainerView/ContainerInfoView/ContainerInfoCharts.vala',
-
# Widgets related only to ProcessInfoView
'Views/ProcessView/ProcessInfoView/Preventor.vala',
'Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala',
@@ -46,7 +40,6 @@ source_app_files = [
# Models
'Models/TreeViewModel.vala',
'Models/OpenFilesTreeViewModel.vala',
- 'Models/ContainersTreeViewModel.vala',
# Other
# 'Managers/AppManager.vala',
@@ -54,9 +47,6 @@ source_app_files = [
'Managers/Process.vala',
'Managers/ProcessStructs.vala',
'Managers/ProcessUtils.vala',
- 'Managers/HttpClientAsync.vala',
- 'Managers/ContainerManager.vala',
- 'Managers/Container.vala',
# Services
'Services/Shortcuts.vala',