示例#1
0
 public ActionResult Commit()
 {
     _logger.LogInformation("User '{UserId}' navigated to Server Configuration and commited changes to DSC '{userAction}'", User.Identity.Name);
     JsonService = new JsonFileServices();
     //return View(JsonService.GetServerList());
     return(View(JsonService.GetServerList(HttpContext.Session.GetString("Customer"), "CurrentConfig")));
 }
 public IActionResult Index()
 {
     ServerService = new JsonFileServices();
     //Server = ServerService.GetServer("Server100");
     ServerDefinition = ServerService.GetServers();
     return(View(ServerDefinition));
 }
示例#3
0
 public ActionResult Details(string serverName)
 {
     _logger.LogInformation("User '{UserId}' navigated to Server Configuration and choose Details for server '{server}'", User.Identity.Name, serverName);
     JsonService = new JsonFileServices();
     foreach (var s in JsonService.GetServer(HttpContext.Session.GetString("Customer"), "CurrentConfig", serverName))
     {
         server = s;
         setServerToSession(server);
     }
     return(View(server));
 }
        public IActionResult Submit(VmW_AddNewServerDSCModel _NewDSC)
        {
            JsonService = new JsonFileServices();
            ChangeRecordModel changeRecord = new ChangeRecordModel();

            changeRecord        = _NewDSC.ChangeRecord;
            NewDSC              = new VmW_AddNewServerDSCModel();
            NewDSC.Server       = getServerFromSession();
            NewDSC.ChangeRecord = changeRecord;
            JsonService.SetNewServerDSC(NewDSC);
            NewDSC.ChangeRecord.ChangeNumber = "";
            return(Redirect(nameof(Index)));
        }
示例#5
0
        public bool compareServerConfig(Server toCompare)
        {
            JsonService = new JsonFileServices();
            foreach (var s in JsonService.GetServer(HttpContext.Session.GetString("Customer"), "CurrentConfig", toCompare.ServerName))
            {
                originalServer = s;
            }
            var comparer = new ObjectsComparer.Comparer <Server>();
            var isEqual  = comparer.Compare(originalServer, toCompare, out differences);

            setDifferencesToSession(differences);
            return(isEqual);
        }
        public async Task <IActionResult> Bluecare(string userAction, string serverName)
        {
            JsonService = new JsonFileServices();
            foreach (var s in JsonService.GetServer(HttpContext.Session.GetString("Customer"), "CurrentConfig", serverName))
            {
                Server = s;
                setServerToSession(Server);
            }
            JsonService = new JsonFileServices();
            Server      = getServerFromSession();
            GitHubIssueModel issue         = new GitHubIssueModel();
            GitHubService    gitHubService = new GitHubService(Configuration);

            if (userAction == "ServiceResponsability")
            {
                issue.Title = Server.Customer + " - Configure new service responsability for server " + Server.ServerName;
                string _Body = "Configure new service responsability for server " + Server.ServerName;
                _Body         += "\n\nCustomer: " + Server.Customer;
                _Body         += "\nOperating System: " + Server.OperatingSystem;
                _Body         += "\nEnvironment: " + Server.Environment;
                _Body         += "\nSeverity value: ";
                _Body         += "\nChange record: ";
                issue.Body     = _Body;
                issue.Provider = Provider;
                issue.Label    = "enhancement;";
                setIssueToSession(issue);
                TempData["issue"] = JsonConvert.SerializeObject(issue);
                return(RedirectToAction("Edit", "SubmitGitHubIssue"));
            }
            if (userAction == "NewNode")
            {
                issue.Title = Server.Customer + " - Create new bluecare node for server " + Server.ServerName;
                string _Body = "Create new bluecare node for server " + Server.ServerName;
                _Body         += "\n\nCustomer: " + Server.Customer;
                _Body         += "\nOperating System: " + Server.OperatingSystem;
                _Body         += "\nEnvironment: " + Server.Environment;
                _Body         += "\nIP: ";
                _Body         += "\nAlert source: ";
                _Body         += "\nChange record:";
                issue.Body     = _Body;
                issue.Provider = Provider;
                issue.Label    = "enhancement;";
                setIssueToSession(issue);
                TempData["issue"] = JsonConvert.SerializeObject(issue);
                return(RedirectToAction("Edit", "SubmitGitHubIssue"));
            }
            else
            {
                return(RedirectToAction(nameof(Index)));
            }
        }
示例#7
0
 public ActionResult Index(string userAction)
 {
     _logger.LogInformation("User '{UserId}' navigated to Server Configuration and choose '{userAction}'", User.Identity.Name, userAction);
     if (userAction == "Commit")
     {
         return(View(JsonService.GetServerList(HttpContext.Session.GetString("Customer"), "CurrentConfig")));
     }
     if (userAction == "Discard")
     {
         JsonService = new JsonFileServices();
         foreach (var s in JsonService.GetServer(HttpContext.Session.GetString("Customer"), "CurrentConfig", getServerFromSession().ServerName))
         {
             originalServer = s;
         }
         setServerToSession(originalServer);
         return(RedirectToAction(nameof(Details)));
     }
     else
     {
         return(View(JsonService.GetServerList(HttpContext.Session.GetString("Customer"), "CurrentConfig")));
     }
 }
示例#8
0
 public IEnumerable <SensorData> Getjson()
 {
     return(JsonFileServices.GetJson1());
 }
示例#9
0
 public string GetRawJson()
 {
     return(JsonFileServices.GetJson2());
 }
示例#10
0
 public string GetJsonEachLines(int step)
 {
     //return JsonFileServices.ReadJsonEachLines(step);
     return(JsonFileServices.ReadJsonEachLines2(step));
 }
示例#11
0
        public string GetWriteJson()
        {
            int dataQuantity = 86400;

            return(JsonFileServices.WriteJsonFile(dataQuantity));
        }
        public async Task<IActionResult> Create(string userAction, string serverName)
        {
            JsonService = new JsonFileServices();
            foreach (var s in JsonService.GetServer(HttpContext.Session.GetString("Customer"), "CurrentConfig", serverName))
            {
                Server = s;
                setServerToSession(Server);
            }
            JsonService = new JsonFileServices();
            if (userAction == "NewNode")
            {
                Server = getServerFromSession();
                GitHubIssueModel issue = new GitHubIssueModel();
                issue.Title = Server.Customer + " - Create new backup node for server " + Server.ServerName;
                string _Body = "Create new backup node for server " + Server.ServerName;
                _Body += "\n\nCustomer: " + Server.Customer;
                _Body += "\nOperating System: " + Server.OperatingSystem;
                _Body += "\nEnvironment: " + Server.Environment;
                _Body += "\nChange record:";
                issue.Body = _Body;
                issue.Provider = Provider;
                issue.Label = "enhancement;";
                GitHubService gitHubService = new GitHubService(Configuration);
                issue = await gitHubService.SettIssue(issue, Provider);
                if (issue.HtmlUrl != null)
                {
                    ModelState.Clear();
                    TempData["Success"] = "Service request for server "+Server.ServerName +" created with success.Request id: " + issue.IssueID + " . Link para o issue: " + issue.HtmlUrl;
                }
                else
                {
                    ModelState.Clear();
                    TempData["Error"] = "Error while creating the request " +  issue.Exception;
                }
                return RedirectToAction(nameof(Index));
            }
            if (userAction == "BlockNode")
            {
                Server = getServerFromSession();
                GitHubIssueModel issue = new GitHubIssueModel();
                issue.Title = Server.Customer + " - Lock backup node for server " + Server.ServerName;
                string _Body = "Lock backup node for server " + Server.ServerName;
                _Body += "\n\nCustomer: " + Server.Customer;
                _Body += "\nOperating System: " + Server.OperatingSystem;
                _Body += "\nEnvironment: " + Server.Environment;
                _Body += "\nChange record:";
                issue.Body = _Body;
                issue.Provider = Provider;
                issue.Label = "enhancement;";
                setIssueToSession(issue);
                TempData["issue"] = JsonConvert.SerializeObject(issue);
                return RedirectToAction("Edit", "SubmitGitHubIssue");
            }
            if (userAction == "StandByNode")
            {
                Server = getServerFromSession();
                GitHubIssueModel issue = new GitHubIssueModel();
                issue.Title = Server.Customer + " - Standby node for server " + Server.ServerName;
                string _Body = "Standby node for server " + Server.ServerName;
                _Body += "\n\nCustomer: " + Server.Customer;
                _Body += "\nOperating System: " + Server.OperatingSystem;
                _Body += "\nEnvironment: " + Server.Environment;
                _Body += "\nChange record:";
                issue.Body = _Body;
                issue.Provider = Provider;
                issue.Label = "enhancement;";
                setIssueToSession(issue);
                TempData["issue"] = JsonConvert.SerializeObject(issue);
                return RedirectToAction("Edit", "SubmitGitHubIssue");
            }
            if (userAction == "Activate")
            {
                Server = getServerFromSession();
                GitHubIssueModel issue = new GitHubIssueModel();
                issue.Title = Server.Customer + " - Activate backup node for server " + Server.ServerName;
                string _Body = "Activate backup node for server " + Server.ServerName;
                _Body += "\n\nCustomer: " + Server.Customer;
                _Body += "\nOperating System: " + Server.OperatingSystem;
                _Body += "\nEnvironment: " + Server.Environment;
                _Body += "\nChange record:";
                issue.Body = _Body;
                issue.Provider = Provider;
                issue.Label = "enhancement;";
                setIssueToSession(issue);
                TempData["issue"] = JsonConvert.SerializeObject(issue);
                return RedirectToAction("Edit", "SubmitGitHubIssue");
            }
            if (userAction == "RobotInventory")
            {
                Server = getServerFromSession();
                GitHubIssueModel issue = new GitHubIssueModel();
                issue.Title = Server.Customer + " - Get Robot inventory for RobotSN: ";
                string _Body = "Get Robot inventory for RobotSN: <write the Robot serial number>";
                _Body += "\n\nCustomer: " + Server.Customer;
                issue.Body = _Body;
                issue.Provider = Provider;
                issue.Label = "enhancement;";
                setIssueToSession(issue);
                TempData["issue"] = JsonConvert.SerializeObject(issue);
                return RedirectToAction("Edit", "SubmitGitHubIssue");
            }
            else
            {
                return RedirectToAction(nameof(Index));
            }

        }
        public IActionResult Index()
        {
            JsonService = new JsonFileServices();

            return View(JsonService.GetServerList(HttpContext.Session.GetString("Customer"), "CurrentConfig"));
        }
示例#14
0
        public async Task <IActionResult> ITM(string userAction, string serverName)
        {
            JsonService = new JsonFileServices();
            foreach (var s in JsonService.GetServer(HttpContext.Session.GetString("Customer"), "CurrentConfig", serverName))
            {
                Server = s;
                setServerToSession(Server);
            }
            JsonService = new JsonFileServices();
            Server      = getServerFromSession();
            GitHubIssueModel issue         = new GitHubIssueModel();
            GitHubService    gitHubService = new GitHubService(Configuration);

            if (userAction == "SOAgentInstall")
            {
                issue.Title = Server.Customer + " - Install new ITM agent for server " + Server.ServerName;
                string _Body = "Install new ITM agent for server " + Server.ServerName;
                _Body         += "\n\nCustomer: " + Server.Customer;
                _Body         += "\nOperating System: " + Server.OperatingSystem;
                _Body         += "\nEnvironment: " + Server.Environment;
                _Body         += "\nInstallation path (if diferent from standard): ";
                _Body         += "\nChange record:";
                issue.Body     = _Body;
                issue.Provider = Provider;
                issue.Label    = "enhancement;";
                setIssueToSession(issue);
                TempData["issue"] = JsonConvert.SerializeObject(issue);
                return(RedirectToAction("Edit", "SubmitGitHubIssue"));
            }
            if (userAction == "SubsysAgentInstall")
            {
                issue.Title = Server.Customer + " - Install new ITM subsystem agent for server " + Server.ServerName;
                string _Body = "Install new ITM subsystem agent for server " + Server.ServerName;
                _Body         += "\n\nCustomer: " + Server.Customer;
                _Body         += "\nOperating System: " + Server.OperatingSystem;
                _Body         += "\nEnvironment: " + Server.Environment;
                _Body         += "\nSubsystem name: ";
                _Body         += "\nSubsystem version: ";
                _Body         += "\nInstallation path (if diferent from standard): ";
                _Body         += "\nService account: ";
                _Body         += "\nChange record:";
                issue.Body     = _Body;
                issue.Provider = Provider;
                issue.Label    = "enhancement;";
                setIssueToSession(issue);
                TempData["issue"] = JsonConvert.SerializeObject(issue);
                return(RedirectToAction("Edit", "SubmitGitHubIssue"));
            }
            if (userAction == "NewSituation")
            {
                issue.Title = Server.Customer + " - Create new situation for server " + Server.ServerName;
                string _Body = "Create new situation for server " + Server.ServerName;
                _Body         += "\n\nCustomer: " + Server.Customer;
                _Body         += "\nOperating System: " + Server.OperatingSystem;
                _Body         += "\nEnvironment: " + Server.Environment;
                _Body         += "\nSituation name: ";
                _Body         += "\nThreshold: ";
                _Body         += "\nChange record: ";
                issue.Body     = _Body;
                issue.Provider = Provider;
                issue.Label    = "enhancement;";
                setIssueToSession(issue);
                TempData["issue"] = JsonConvert.SerializeObject(issue);
                return(RedirectToAction("Edit", "SubmitGitHubIssue"));
            }
            if (userAction == "ModifyThreshold")
            {
                issue.Title = Server.Customer + " - Modify threshold on situation for server " + Server.ServerName;
                string _Body = "Modify threshold on situation for server " + Server.ServerName;
                _Body         += "\n\nCustomer: " + Server.Customer;
                _Body         += "\nOperating System: " + Server.OperatingSystem;
                _Body         += "\nEnvironment: " + Server.Environment;
                _Body         += "\nSituation name: ";
                _Body         += "\nNew threshold: ";
                _Body         += "\nChange record: ";
                issue.Body     = _Body;
                issue.Provider = Provider;
                issue.Label    = "enhancement;";
                setIssueToSession(issue);
                TempData["issue"] = JsonConvert.SerializeObject(issue);
                return(RedirectToAction("Edit", "SubmitGitHubIssue"));
            }
            else
            {
                return(RedirectToAction(nameof(Index)));
            }
        }
示例#15
0
        //public IViewComponentResult Invoke()
        //{
        //    JsonService = new JsonFileServices();
        //    OpcoesMenu = JsonService.GetLeftMenu();
        //    foreach (var item in OpcoesMenu)
        //    {
        //        leftMenu = item;
        //    }
        //    setMenuToSession(leftMenu);
        //    return View(OpcoesMenu);
        //}


        public IViewComponentResult Invoke()
        {
            JsonService = new JsonFileServices();
            return(View(JsonService.GetLeftMenu()));
        }
 public IActionResult Index(string servername)
 {
     ServerService    = new JsonFileServices();
     ServerDefinition = ServerService.GetServers(servername);
     return(View(ServerDefinition));
 }