Example #1
0
        public virtual async Task SaveDAFApp(ApplicationDeveloperClient appDev, ApplicationManagerClient appMgr, string entLookup,
                                             string host, DataDAFAppDetails dafAppDetails)
        {
            log.LogInformation($"Saving DAF Application for {entLookup}");

            var saveRes = await appDev.SaveAppAndDAFApps(new SaveAppAndDAFAppsRequest()
            {
                Application = new Application()
                {
                    ID           = dafAppDetails.ID,
                    Name         = dafAppDetails.Name,
                    Description  = dafAppDetails.Description,
                    PathRegex    = $"{dafAppDetails.Path.TrimEnd('/')}*",
                    AccessRights = dafAppDetails.Security.AccessRights,
                    Licenses     = dafAppDetails.Security.Licenses,
                    IsPrivate    = dafAppDetails.Security.IsPrivate,
                    Priority     = dafAppDetails.Priority
                },
                DAFApps = dafAppDetails.Configs.Select(dafAppConfig =>
                {
                    return(new DAFApplication()
                    {
                        Lookup = dafAppConfig.Key,
                        Details = dafAppConfig.Value,
                        Priority = 500
                    });
                }).ToList()
            }, entLookup, host);

            State.ActiveDAFAppID = null;

            await LoadApplications(appMgr, entLookup);
        }
Example #2
0
        protected virtual async Task <DataDAFAppDetails> getDetailsFromDAFApp(ApplicationManagerClient appMgr, string entLookup, Guid appId,
                                                                              List <DAFApplication> dafApps)
        {
            var appResp = await appMgr.GetApplication(entLookup, appId);

            var app = appResp.Model;

            var dafAppStatus = new DataDAFAppStatus()
            {
                Name     = "Public",
                AppCount = dafApps.Count,
                Code     = Status.Success.Code,
                Message  = "All applications are running well.",
                Icon     = new LCUIcon()
                {
                    Icon = app.IsPrivate ? "security" : "public"
                }
            };

            DataDAFAppTypes?dafAppType = null;
            var             configs    = (dafApps ?? new List <DAFApplication>()).ToDictionary(dafApp =>
            {
                return(dafApp.Lookup.IsNullOrEmpty() ? "" : dafApp.Lookup.Trim());
            }, dafApp =>
            {
                return(loadDafConfig(dafApp, out dafAppType));
            });

            var dafAppDetails = new DataDAFAppDetails()
            {
                AppStatus   = dafAppStatus,
                Configs     = configs,
                DAFAppType  = dafAppType,
                Description = app.Description,
                ID          = app.ID,
                Name        = $"{app.Name}",
                Priority    = app.Priority,
                Path        = app.PathRegex.Replace("*", ""),
                Security    = new DataAppSecurityDetails()
                {
                    AccessRights = app.AccessRights,
                    IsPrivate    = app.IsPrivate,
                    Licenses     = app.Licenses
                }
            };

            return(dafAppDetails);
        }