Skip to content

Commit

Permalink
feat(4ps): add create job
Browse files Browse the repository at this point in the history
  • Loading branch information
develite98 committed Jan 8, 2024
1 parent 8a933cd commit 75172fe
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<div class="mix-dialog__content">
<div class="grid grid-cols-2 gap-3 w-full">
<div class="col-span-1">
<div class="mb-1 content-label">Job Name</div>
<mix-input formControlName="jobName"></mix-input>
<div class="mb-1 content-label">Name</div>
<mix-input formControlName="name"></mix-input>
</div>

<div class="col-span-1">
<div class="mb-1 content-label">Group</div>
<mix-input formControlName="groupName"></mix-input>
<div class="mb-1 content-label">Description</div>
<mix-input formControlName="description"></mix-input>
</div>

<div class="col-span-1">
Expand All @@ -22,8 +22,8 @@
</div>

<div class="col-span-1">
<div class="mb-1 content-label">Interval</div>
<mix-input-number formControlName="interval"></mix-input-number>
<!-- <div class="mb-1 content-label">Interval</div>
<mix-input-number formControlName="interval"></mix-input-number> -->
</div>

<div class="col-span-1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ export class JobFormComponent extends BaseComponent {
cronExpression: ['5 * * * *'],
description: [''],
groupName: [''],
interval: [7],
intervalType: [],
interval: [null],
intervalType: ['Minute'],
isStartNow: [true],
jobData: [],
jobName: [''],
jobName: ['Mix.Scheduler.Domain.Jobs.KeepPoolAliveJob'],
name: [''],
repeatCount: [7],
repeatCount: [null],
startAt: [null],
endAt: [null],
});
Expand All @@ -67,7 +67,7 @@ export class JobFormComponent extends BaseComponent {
this.toast.success('Successfully create new job');
this.ref.close({ data: result });
},
error: (error) => {
error: () => {
this.toast.error('Something error, please try again later');
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@
<tr>
<th class="px-6 py-3"
scope="col">
Jobs name
Job name
</th>
<th class="px-6 py-3"
scope="col">
Color
Job Type
</th>
<th class="px-6 py-3"
scope="col">
Category
Start At
</th>
<th class="px-6 py-3"
scope="col">
Price
End At
</th>
<th class="px-6 py-3"
scope="col">
Expand All @@ -52,99 +52,20 @@
</tr>
</thead>
<tbody>
<tr class="odd:bg-white odd:dark:bg-gray-900 even:bg-gray-50 even:dark:bg-gray-800 border-b dark:border-gray-700">
<tr *ngFor="let job of state.data"
class="odd:bg-white odd:dark:bg-gray-900 even:bg-gray-50 even:dark:bg-gray-800 border-b dark:border-gray-700">
<th class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white"
scope="row">
Apple MacBook Pro 17"
{{ job.name }}
</th>
<td class="px-6 py-4">
Silver
{{ job.jobName }}
</td>
<td class="px-6 py-4">
Laptop
</td>
<td class="px-6 py-4">
$2999
</td>
<td class="px-6 py-4">
<a class="font-medium text-blue-600 dark:text-blue-500 hover:underline"
href="#">Edit</a>
</td>
</tr>
<tr class="odd:bg-white odd:dark:bg-gray-900 even:bg-gray-50 even:dark:bg-gray-800 border-b dark:border-gray-700">
<th class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white"
scope="row">
Microsoft Surface Pro
</th>
<td class="px-6 py-4">
White
</td>
<td class="px-6 py-4">
Laptop PC
</td>
<td class="px-6 py-4">
$1999
</td>
<td class="px-6 py-4">
<a class="font-medium text-blue-600 dark:text-blue-500 hover:underline"
href="#">Edit</a>
</td>
</tr>
<tr class="odd:bg-white odd:dark:bg-gray-900 even:bg-gray-50 even:dark:bg-gray-800 border-b dark:border-gray-700">
<th class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white"
scope="row">
Magic Mouse 2
</th>
<td class="px-6 py-4">
Black
</td>
<td class="px-6 py-4">
Accessories
</td>
<td class="px-6 py-4">
$99
</td>
<td class="px-6 py-4">
<a class="font-medium text-blue-600 dark:text-blue-500 hover:underline"
href="#">Edit</a>
</td>
</tr>
<tr class="odd:bg-white odd:dark:bg-gray-900 even:bg-gray-50 even:dark:bg-gray-800 border-b dark:border-gray-700">
<th class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white"
scope="row">
Google Pixel Phone
</th>
<td class="px-6 py-4">
Gray
</td>
<td class="px-6 py-4">
Phone
</td>
<td class="px-6 py-4">
$799
</td>
<td class="px-6 py-4">
<a class="font-medium text-blue-600 dark:text-blue-500 hover:underline"
href="#">Edit</a>
</td>
</tr>
<tr>
<th class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white"
scope="row">
Apple Watch 5
</th>
<td class="px-6 py-4">
Red
</td>
<td class="px-6 py-4">
Wearables
</td>
<td class="px-6 py-4">
$999
</td>
<td class="px-6 py-4">
<a class="font-medium text-blue-600 dark:text-blue-500 hover:underline"
href="#">Edit</a>
</td>
</tr>
</tbody>
Expand Down
28 changes: 28 additions & 0 deletions libs/mix-share/src/modules/scheduler/stores/schedulers.store.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Injectable } from '@angular/core';
import { MixScheduler, PaginationRequestModel } from '@mixcore/lib/model';
import { BaseCRUDStore } from '@mixcore/share/base';
import { tapResponse } from '@ngrx/component-store';
import { Observable, of, switchMap } from 'rxjs';

@Injectable({ providedIn: 'root' })
export class SchedulerStore extends BaseCRUDStore<MixScheduler> {
Expand All @@ -12,4 +14,30 @@ export class SchedulerStore extends BaseCRUDStore<MixScheduler> {
public override searchColumnsDict: { [key: string]: string } = {
Name: 'name',
};

public override loadData = this.effect(
(request$: Observable<PaginationRequestModel>) =>
request$.pipe(
switchMap((request) => {
this.cacheKey = this.buildCacheKey(request);
if (!this.cacheService.has(this.cacheKey)) {
this.patchState({ status: 'Loading' });
}

return of(request);
}),
switchMap((request) => this.silentFetchData(request)),
tapResponse(
(result) => {
this.cacheService.delete(this.cacheKey);
this.cacheService.set(this.cacheKey, result);

this.patchState({
data: result as unknown as MixScheduler[],
});
},
() => this.patchState({ status: 'Error' })
)
)
);
}
2 changes: 1 addition & 1 deletion libs/mix-ui/src/input-cron/input-cron.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class MixInputCronComponent implements OnChanges, OnInit {
allowedPeriods = NgxCronService.PERIODKEYS;

@Input()
allowQuartz = false;
allowQuartz = true;

@Input()
language = 'en';
Expand Down

1 comment on commit 75172fe

@vercel
Copy link

@vercel vercel bot commented on 75172fe Jan 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.