Пример #1
0
        public object NavigateToHost(string metabasePath)
        {
            var host = Metabase.CatalogReg[metabasePath] as Metabank.SectionHost;

            if (host != null)
            {
                string hostURL;
                try
                {
                    hostURL = Metabase.ResolveNetworkServiceToConnectString(
                        metabasePath,
                        SysConsts.NETWORK_INTERNOC,
                        host.IsZGov ? SysConsts.NETWORK_SVC_ZGOV_WEB_MANAGER : SysConsts.NETWORK_SVC_HGOV_WEB_MANAGER);
                    return(new Redirect(hostURL));
                }
                catch (Exception ex)
                {
                    log(MessageType.Error, ".NavigateToHost(metabasePath='{0}')".Args(metabasePath), ex.ToMessageWithType(), ex);
                }
            }

            WorkContext.Response.StatusCode        = WebConsts.STATUS_404;
            WorkContext.Response.StatusDescription = WebConsts.STATUS_404_DESCRIPTION;
            return("Couldn't navigate to host/zone '{0}'".Args(metabasePath));
        }
Пример #2
0
        internal object makeChildren(IEnumerable <Metabank.SectionRegionBase> children)
        {
            var res = new List <JSONDataMap>();

            foreach (var child in children)
            {
                var d = new JSONDataMap();

                d["name"]  = child.Name;
                d["path"]  = child.RegionPath;
                d["me"]    = child.IsLogicallyTheSame(App.GetThisHostMetabaseSection());
                d["tp"]    = child.SectionMnemonicType;
                d["descr"] = child.Description;

                var host = child as Metabank.SectionHost;
                if (host != null)
                {
                    var isZGov = host.IsZGov;
                    d["role"]    = host.RoleName;
                    d["dynamic"] = host.Dynamic;
                    d["os"]      = host.OS;
                    d["apps"]    = host.Role.AppNames.OrderBy(a => a).ToArray();
                    d["isZGov"]  = isZGov;
                    d["myZGov"]  = child.IsLogicallyTheSame(host.ParentZoneGovernorPrimaryHost());

                    string adminURL = null;
                    try
                    {
                        adminURL = Metabase.ResolveNetworkServiceToConnectString(host.RegionPath,
                                                                                 SysConsts.NETWORK_INTERNOC,
                                                                                 isZGov ? SysConsts.NETWORK_SVC_ZGOV_WEB_MANAGER : SysConsts.NETWORK_SVC_HGOV_WEB_MANAGER);
                    }
                    catch (Exception ex)
                    {
                        log(MessageType.Error, "LoadLevel.makeLevel()", ex.ToMessageWithType(), ex);
                    }

                    d["adminURL"] = adminURL;
                }
                else
                {
                    d["geo"] = new { lat = child.EffectiveGeoCenter.Lat, lng = child.EffectiveGeoCenter.Lng };
                }

                res.Add(d);
            }

            return(res);
        }
Пример #3
0
        public object Navigate(string metabasePath, string appName)
        {
            var svc = SysConsts.NETWORK_SVC_WEB_MANAGER_PREFIX + appName;

            try
            {
                var url = Metabase.ResolveNetworkServiceToConnectString(metabasePath,
                                                                        SysConsts.NETWORK_INTERNOC,
                                                                        svc);

                return(new Redirect(url));
            }
            catch
            {
                WorkContext.Response.StatusCode        = WebConsts.STATUS_404;
                WorkContext.Response.StatusDescription = WebConsts.STATUS_404_DESCRIPTION;
                return("Web Manager service in application '{0}' on host '{1}' netsvc '{2}' is not available".Args(appName, metabasePath, svc));
            }
        }