public async Task <IActionResult> Index(string JobId)
        {
            using var channel = GrpcChannel.ForAddress("http://" + Environment.GetEnvironmentVariable("BACKEND_API_HOST") + ":5000");
            var client = new Job.JobClient(channel);
            var reply  = await client.GetProcessingResultAsync(new GetProcessingResultRequest { Id = JobId });

            return(View("Task", new TaskViewModel {
                Id = JobId, Rank = reply.Rank, Status = reply.Status
            }));
        }
Example #2
0
        public async Task <IActionResult> Index(string JobId)
        {
            using var channel = GrpcChannel.ForAddress("http://localhost:" + _configuration["BackendApiPort"]);
            var client = new Job.JobClient(channel);
            var reply  = await client.GetProcessingResultAsync(new RegisterResponse { Id = JobId });

            return(View("Task", new TaskViewModel {
                Rank = reply.Response, Status = reply.Status, Id = JobId
            }));
        }
Example #3
0
        public async Task <IActionResult> Index(string JobId)
        {
            using var channel = GrpcChannel.ForAddress("http://" + Environment.GetEnvironmentVariable("BACKEND_API_HOST") + ":" + Environment.GetEnvironmentVariable("BACKEND_API_PORT"));

            var client = new Job.JobClient(channel);
            var reply  = await client.GetProcessingResultAsync(new GetProcessingResultRequest { Id = JobId });

            ViewBag.Id          = JobId;
            ViewBag.Text        = reply.Text;
            ViewBag.Description = reply.Description;
            ViewBag.Rank        = reply.Rank;
            ViewBag.Status      = reply.Status;

            return(View("Task"));
        }
Example #4
0
        public async Task <IActionResult> OnGetAsync()
        {
            AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
            var config = new ConfigurationBuilder()
                         .SetBasePath(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.FullName + "/config")
                         .AddJsonFile("config.json", optional: false)
                         .Build();

            using var channel = GrpcChannel.ForAddress($"http://localhost:{config.GetValue<int>("BackendAPI:port")}");
            string taskId = HttpContext.Request.Query["jobId"].ToString();
            var    client = new Job.JobClient(channel);
            var    reply  = await client.GetProcessingResultAsync(new RegisterResponse { Id = taskId });

            Rating = reply.Response;
            return(Page());
        }
Example #5
0
        public async Task <IActionResult> TextDetailsAsync(string jobId)
        {
            string status = String.Empty;

            using var channel = GrpcChannel.ForAddress($"http://localhost:{_config.GetValue<int>("BackendApiPort")}");
            var client = new Job.JobClient(channel);

            try
            {
                var reply = await client.GetProcessingResultAsync(new GetProcessingResultRequest { Id = jobId });

                ViewBag.Status     = reply.Status;
                ViewBag.ResultRank = reply.Rank;
            }
            catch (RpcException)
            {
                ViewBag.TaskResult = "Подключение не установлено, т.к. конечный компьютер отверг запрос на подключение";
            }

            return(View());
        }