예제 #1
0
        public ActionResult HAProxyAdminProxy(string group, string proxy, string server, HAProxyAdmin.Action act)
        {
            var haGroup = HAProxyGroup.GetGroup(group);
            var proxies = (haGroup != null ? haGroup.GetProxies() : HAProxyGroup.GetAllProxies()).Where(pr => pr.Name == proxy);

            return(Json(HAProxyAdmin.PerformProxyAction(proxies, server, act)));
        }
예제 #2
0
        public ActionResult HAProxyDetailed(string group, string node, string watch = null, bool norefresh = false)
        {
            var haGroup = HAProxyGroup.GetGroup(group ?? node);
            var vd      = new HAProxyModel
            {
                SelectedGroup = haGroup,
                Groups        = haGroup != null ? new List <HAProxyGroup> {
                    haGroup
                } : HAProxyGroup.AllGroups,
                Proxies    = (haGroup != null ? haGroup.GetProxies() : HAProxyGroup.GetAllProxies()),
                View       = HAProxyModel.Views.Detailed,
                Refresh    = !norefresh,
                WatchProxy = watch
            };

            return(View("HAProxy.Detailed", vd));
        }
예제 #3
0
        public async Task <ActionResult> HAProxyAdminProxy(string group, string proxy, string server, Action act)
        {
            // Entire server
            if (proxy.IsNullOrEmpty() && group.IsNullOrEmpty() && server.HasValue())
            {
                return(Json(await HAProxyAdmin.PerformServerActionAsync(server, act)));
            }
            // Entire group
            if (proxy.IsNullOrEmpty() && server.IsNullOrEmpty() && group.HasValue())
            {
                return(Json(await HAProxyAdmin.PerformGroupActionAsync(group, act)));
            }

            var haGroup = HAProxyGroup.GetGroup(group);
            var proxies = (haGroup != null ? haGroup.GetProxies() : HAProxyGroup.GetAllProxies()).Where(pr => pr.Name == proxy);

            return(Json(await HAProxyAdmin.PerformProxyActionAsync(proxies, server, act)));
        }
예제 #4
0
        public ActionResult Dashboard(string group, string node, string watch = null, bool norefresh = false)
        {
            var haGroup = HAProxyGroup.GetGroup(group ?? node);
            var proxies = haGroup != null?haGroup.GetProxies() : HAProxyGroup.GetAllProxies();

            proxies.RemoveAll(p => !p.HasServers);

            var vd = new HAProxyModel
            {
                SelectedGroup = haGroup,
                Groups        = haGroup != null ? new List <HAProxyGroup> {
                    haGroup
                } : HAProxyGroup.AllGroups,
                Proxies    = proxies,
                View       = HAProxyModel.Views.Dashboard,
                Refresh    = !norefresh,
                WatchProxy = watch
            };

            return(View("HAProxy.Dashboard", vd));
        }
예제 #5
0
        public ActionResult HAProxyAdminDashboard(string group, bool norefresh = false)
        {
            var haGroup = HAProxyGroup.GetGroup(group);
            var proxies = haGroup != null?haGroup.GetProxies() : HAProxyGroup.GetAllProxies();

            proxies.RemoveAll(p => !p.HasServers);

            var vd = new HAProxyModel
            {
                SelectedGroup = haGroup,
                Groups        = haGroup != null ? new List <HAProxyGroup> {
                    haGroup
                } : HAProxyGroup.AllGroups,
                Proxies   = proxies,
                View      = HAProxyModel.Views.Admin,
                Refresh   = !norefresh,
                AdminMode = true
            };

            return(View("HAProxy.Dashboard", vd));
        }