Change Cron editor location to bot settings page

This commit is contained in:
kevinpauer
2022-04-28 20:30:13 +02:00
parent 79dfd6e5a1
commit 6e30a3eb70
5 changed files with 86 additions and 61 deletions

View File

@@ -1,8 +1,13 @@
import { Component, OnInit } from '@angular/core';
import { C, COMMA, ENTER, F } from '@angular/cdk/keycodes';
import { MatChipInputEvent } from '@angular/material/chips';
import { CronOptions } from 'ngx-cron-editor';
import { BotService } from 'src/app/Services/bot.service';
import { HelperService } from 'src/app/Helpers/helper.service';
import { ProfileService } from 'src/app/Services/profile.service';
import { FormControl } from '@angular/forms';
export interface Fruit {
name: string;
@@ -25,7 +30,11 @@ export class BotSettingsComponent implements OnInit {
keywords: Keyword[] = [];
shares: Share[] = [];
constructor(private botService: BotService, private helper: HelperService) {}
constructor(
private botService: BotService,
private helper: HelperService,
private profileService: ProfileService
) {}
ngOnInit(): void {
this.shares = this.helper.formatShareData();
@@ -99,4 +108,32 @@ export class BotSettingsComponent implements OnInit {
this.shares = [];
this.shares = this.helper.formatShareData();
}
setCronString() {
this.profileService
.addCronString(this.cronForm.value)
.subscribe((result) => {
console.log(result);
});
}
cronForm = new FormControl('0 0 1/1 * *');
public cronOptions: CronOptions = {
defaultTime: '00:00:00',
hideMinutesTab: true,
hideHourlyTab: true,
hideDailyTab: false,
hideWeeklyTab: true,
hideMonthlyTab: true,
hideYearlyTab: true,
hideAdvancedTab: true,
hideSpecificWeekDayTab: true,
hideSpecificMonthWeekTab: true,
use24HourTime: true,
hideSeconds: true,
cronFlavor: 'quartz', //standard or quartz
};
}