public Task Dispatch([NotNull] Dashboard.DashboardContext context)
        {
            var jobId = context.Request.GetQuery("jobId");

            _periodicJobRepository.StopPeriodicJob(jobId);

            return(Task.CompletedTask);
        }
Esempio n. 2
0
        public async Task Dispatch([NotNull] Dashboard.DashboardContext context)
        {
            if (!"GET".Equals(context.Request.Method, StringComparison.InvariantCultureIgnoreCase))
            {
                context.Response.StatusCode = 405;

                return;
            }

            var periodicJob = new List <PeriodicJob>();

            periodicJob.AddRange(_periodicJobRepository.GetPeriodicJobs());

            await context.Response.WriteAsync(JsonConvert.SerializeObject(periodicJob));
        }
Esempio n. 3
0
        public async Task Dispatch([NotNull] Dashboard.DashboardContext context)
        {
            var job = new PeriodicJob();

            job.Id         = (await context.Request.GetFormValuesAsync("Id").ConfigureAwait(false)).FirstOrDefault();
            job.Cron       = (await context.Request.GetFormValuesAsync("Cron").ConfigureAwait(false)).FirstOrDefault();
            job.Queue      = (await context.Request.GetFormValuesAsync("Queue").ConfigureAwait(false)).FirstOrDefault();
            job.TimeZoneId = (await context.Request.GetFormValuesAsync("TimeZoneId").ConfigureAwait(false)).FirstOrDefault();

            job.ClassFullName = (await context.Request.GetFormValuesAsync("ClassFullName").ConfigureAwait(false)).FirstOrDefault();
            job.MethodName    = (await context.Request.GetFormValuesAsync("MethodName").ConfigureAwait(false)).FirstOrDefault();

            _periodicJobRepository.AddOrUpdate(job);

            context.Response.StatusCode = (int)HttpStatusCode.OK;
        }
Esempio n. 4
0
        public async Task Dispatch([NotNull] Dashboard.DashboardContext context)
        {
            if (!"GET".Equals(context.Request.Method, StringComparison.InvariantCultureIgnoreCase))
            {
                context.Response.StatusCode = 405;

                return;
            }


            var recurringJob = _connection.GetRecurringJobs();
            var periodicJob  = new List <PeriodicJob>();



            if (recurringJob.Count > 0)
            {
                recurringJob.ForEach((x) =>
                {
                    periodicJob.Add(new PeriodicJob
                    {
                        Id            = x.Id,
                        Cron          = x.Cron,
                        CreatedAt     = x.CreatedAt,
                        Error         = x.Error,
                        LastExecution = x.LastExecution.HasValue ? x.LastExecution.Value.ToString("G") : "N/A",//x.LastExecution,
                        Method        = x.Job.Method.Name,
                        JobState      = "Running",
                        Class         = x.Job.Type.Name,
                        Queue         = x.Queue,
                        LastJobId     = x.LastJobId,
                        LastJobState  = x.LastJobState,
                        NextExecution = x.NextExecution.HasValue ? x.NextExecution.Value.ToString("G") : "N/A",
                        Removed       = x.Removed,
                        TimeZoneId    = x.TimeZoneId
                    });
                });
            }

            //Add job was stopped:
            periodicJob.AddRange(JobAgent.GetAllJobStopped());

            await context.Response.WriteAsync(JsonConvert.SerializeObject(periodicJob));
        }
Esempio n. 5
0
 public async Task Dispatch([NotNull] Dashboard.DashboardContext context)
 {
     await context.Response.WriteAsync(JsonConvert.SerializeObject(Utility.GetTimeZones()));
 }