From 6e30a3eb70451e5df7b1a419c92ca997fade950c Mon Sep 17 00:00:00 2001 From: kevinpauer Date: Thu, 28 Apr 2022 20:30:13 +0200 Subject: [PATCH] Change Cron editor location to bot settings page --- .../bot-settings/bot-settings.component.html | 31 +++++++++++++-- .../bot-settings/bot-settings.component.scss | 17 ++++++++ .../bot-settings/bot-settings.component.ts | 39 ++++++++++++++++++- .../app/Views/profile/profile.component.html | 29 +------------- .../app/Views/profile/profile.component.ts | 31 +-------------- 5 files changed, 86 insertions(+), 61 deletions(-) diff --git a/frontend/src/app/Views/bot-settings/bot-settings.component.html b/frontend/src/app/Views/bot-settings/bot-settings.component.html index 3d84d5d..e548477 100644 --- a/frontend/src/app/Views/bot-settings/bot-settings.component.html +++ b/frontend/src/app/Views/bot-settings/bot-settings.component.html @@ -1,5 +1,5 @@ - - + + Keywords @@ -31,7 +31,32 @@ - + + + + Add automatic updates + + +
+ + +
+
+
+
+ Shares diff --git a/frontend/src/app/Views/bot-settings/bot-settings.component.scss b/frontend/src/app/Views/bot-settings/bot-settings.component.scss index aee2dde..a19ad87 100644 --- a/frontend/src/app/Views/bot-settings/bot-settings.component.scss +++ b/frontend/src/app/Views/bot-settings/bot-settings.component.scss @@ -24,3 +24,20 @@ mat-grid { .example-chip-list { width: 100%; } + +.placeholder { + height: 95%; +} + +.placeholderRHS { + height: 90%; +} + +.cron-content { + height: 70%; + overflow: auto; +} + +mat-card { + overflow: scroll; +} diff --git a/frontend/src/app/Views/bot-settings/bot-settings.component.ts b/frontend/src/app/Views/bot-settings/bot-settings.component.ts index 6974b24..063fae2 100644 --- a/frontend/src/app/Views/bot-settings/bot-settings.component.ts +++ b/frontend/src/app/Views/bot-settings/bot-settings.component.ts @@ -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 + }; } diff --git a/frontend/src/app/Views/profile/profile.component.html b/frontend/src/app/Views/profile/profile.component.html index d70e1b2..1b5b455 100644 --- a/frontend/src/app/Views/profile/profile.component.html +++ b/frontend/src/app/Views/profile/profile.component.html @@ -95,8 +95,8 @@ - - + + Connect Telegram Account @@ -137,29 +137,4 @@ - - - - Add automatic updates - - -
- - -
-
-
-
diff --git a/frontend/src/app/Views/profile/profile.component.ts b/frontend/src/app/Views/profile/profile.component.ts index babeb6f..6ee3bc0 100644 --- a/frontend/src/app/Views/profile/profile.component.ts +++ b/frontend/src/app/Views/profile/profile.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit } from '@angular/core'; -import { FormControl, PatternValidator, Validators } from '@angular/forms'; +import { FormControl, Validators } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; -import { CronOptions } from 'ngx-cron-editor'; import { ProfileService } from 'src/app/Services/profile.service'; import { ConfirmationDialogComponent } from './confirmation-dialog/confirmation-dialog.component'; import { HelpDialogComponent } from './help-dialog/help-dialog.component'; @@ -32,26 +31,6 @@ export class ProfileComponent implements OnInit { public dialog: MatDialog ) {} - 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 - }; - ngOnInit(): void { this.profileService.getUserData().subscribe((result) => { console.log(result); @@ -98,14 +77,6 @@ export class ProfileComponent implements OnInit { }); } - setCronString() { - this.profileService - .addCronString(this.cronForm.value) - .subscribe((result) => { - console.log(result); - }); - } - openHelp() { const dialogRef = this.dialog.open(HelpDialogComponent, { width: '50vw',