Skip to content

Commit

Permalink
feat(4ps): add job page
Browse files Browse the repository at this point in the history
  • Loading branch information
develite98 committed Jan 6, 2024
1 parent bb9a137 commit fd607ca
Show file tree
Hide file tree
Showing 23 changed files with 376 additions and 16 deletions.
8 changes: 8 additions & 0 deletions apps/mix-database/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ export const CMS_ROUTES = {
path: 'roles',
fullPath: 'app/cam/roles',
},
events: {
path: 'events',
fullPath: 'app/events',
},
schedulers: {
path: 'schedulers',
fullPath: 'app/events/schedulers',
},
},
};

Expand Down
11 changes: 6 additions & 5 deletions apps/mix-database/src/app/pages/portal/portal.routes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Routes } from '@angular/router';
import { CMS_ROUTES, breadcrumbName } from '../../app.routes';
import { CMS_ROUTES } from '../../app.routes';

export const PortalRoutes: Routes = [
{
Expand All @@ -8,20 +8,21 @@ export const PortalRoutes: Routes = [
import('./dashboard/dashboard.component').then(
(m) => m.DashboardComponent
),
data: breadcrumbName('Dashboard'),
},
{
path: CMS_ROUTES.portal.database.path,
data: breadcrumbName('Workspace'),
loadChildren: () =>
import('@mixcore/module/database').then((m) => m.routes),
},

{
path: CMS_ROUTES.portal.cam.path,
data: breadcrumbName('CAM'),
loadChildren: () => import('@mixcore/module/account').then((m) => m.ROUTES),
},
{
path: CMS_ROUTES.portal.events.path,
loadChildren: () =>
import('@mixcore/module/scheduler').then((m) => m.SchedulerRoute),
},
{
path: '',
redirectTo: CMS_ROUTES.portal.dashboard.path,
Expand Down
13 changes: 13 additions & 0 deletions apps/mix-database/src/app/shares/consts/app.menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,19 @@ export const APP_MENU: MenuItem[] = [
},
],
},
{
title: 'Events',
url: CMS_ROUTES.portal.events.fullPath,
iconColor: '#22d3ee',
icon: 'schedule_send',
children: [
{
icon: 'sort',
title: 'schedulers',
url: CMS_ROUTES.portal.schedulers.fullPath,
},
],
},
];

export const APP_NOT_SUPPER_ADMIN_MENU = [
Expand Down
12 changes: 12 additions & 0 deletions libs/mix-lib/src/model/core/schedulers.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export interface MixScheduler {
cronExpression: string;
name: string;
groupName: string;
jobName: string;
description: string;
startAt: any;
isStartNow: boolean;
interval: any;
intervalType: string;
repeatCount: number;
}
1 change: 1 addition & 0 deletions libs/mix-lib/src/model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export * from './core/portal-menu.model';
export * from './core/post.model';
export * from './core/register.model';
export * from './core/roles.model';
export * from './core/schedulers.model';
export * from './core/settings.model';
export * from './core/template.model';
export * from './core/user-vm.model';
Expand Down
3 changes: 3 additions & 0 deletions libs/mix-lib/src/swagger/mix.swagger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ export const MixSwagger = {
permission: '/api/v2/rest/mix-services/permission',
delete: '/api/v2/rest/auth/user/remove-user',
},
events: {
scheduler: '/api/v2/scheduler/trigger',
},
ecommerce: {
updateDeliveryCode: '/api/v2/ecommerce/update-delivery-code',
},
Expand Down
6 changes: 6 additions & 0 deletions libs/mix-share/src/api-service/mix-api-facade.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
MixPage,
MixPermission,
MixRole,
MixScheduler,
MixSettings,
MixTemplate,
} from '@mixcore/lib/model';
Expand Down Expand Up @@ -83,6 +84,11 @@ export class MixApiFacadeService {
MixSwagger.content.databaseContext
);

// Scheduler Context
public schedulerApi = new MixRestfulApi<MixScheduler>(
MixSwagger.events.scheduler
);

// Appsetting Api
public appSettingApi = new MixRestfulApi<MixSettings>(
MixSwagger.settings.config,
Expand Down
17 changes: 17 additions & 0 deletions libs/mix-share/src/bases/base-crud.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
switchMap,
tap,
} from 'rxjs';
import { ObjectUtil } from '../form/object.helper';
import { CacheService } from '../services/index';

export interface BaseState<T> {
Expand Down Expand Up @@ -219,6 +220,22 @@ export class BaseCRUDStore<T> extends ComponentStore<BaseState<T>> {
}));
}

public addData(data: T) {
const current = this.get().data;
current.unshift(data);

this.patchState({ data: ObjectUtil.clone(current) });
this.reUpdateCache();
}

public removeData(dataId: number) {
let current = this.get().data;
current = current.filter((x) => dataId !== (x as any).id);

this.patchState({ data: ObjectUtil.clone(current) });
this.reUpdateCache();
}

constructor() {
super({
status: 'Pending',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class RolesComponent extends BasePageComponent {
this.mixApi.roleApi
.deleteById(role.id)
.pipe(toastObserverProcessing(this.toast))
.subscribe(() => this.store.removeData(role.id));
.subscribe(() => this.store.removeData(role.id as unknown as number));
}
);
}
Expand Down
8 changes: 0 additions & 8 deletions libs/mix-share/src/modules/account/stores/roles.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,4 @@ export class RolesStore extends BaseCRUDStore<MixRole> {
this.patchState({ data: ObjectUtil.clone(current) });
this.reUpdateCache();
}

public removeData(dataId: string) {
let current = this.get().data;
current = current.filter((x) => dataId !== x.id);

this.patchState({ data: ObjectUtil.clone(current) });
this.reUpdateCache();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="mix-dialog --default-padding">
<div class="mix-dialog__header">
New Job
</div>

<div class="mix-dialog__content">
asd
</div>

<div class="mix-dialog__footer">
<mix-button class="mr-auto"
type="outline">Close</mix-button>

<mix-button>Add</mix-button>
</div>
</div>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { CommonModule } from '@angular/common';
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { MixButtonComponent } from '@mixcore/ui/button';
import { MixDatePickerComponent } from '@mixcore/ui/date-picker';
import { MixInputComponent } from '@mixcore/ui/input';

@Component({
selector: 'job-form',
standalone: true,
imports: [
CommonModule,
ReactiveFormsModule,
MixInputComponent,
MixDatePickerComponent,
MixButtonComponent,
],
templateUrl: './job-form.component.html',
styleUrl: './job-form.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class JobFormComponent {
public static dialogOption = {
windowClass: 'mix-record-form-dialog top-align-modal interact-modal',
minWidth: '800px',
maxWidth: '95vw',
};
}
1 change: 1 addition & 0 deletions libs/mix-share/src/modules/scheduler/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './schedule.route';
5 changes: 5 additions & 0 deletions libs/mix-share/src/modules/scheduler/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
18 changes: 18 additions & 0 deletions libs/mix-share/src/modules/scheduler/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@mixcore/share/scheduler",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"sourceRoot": "libs/mix-share/src/scheduler",
"targets": {
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"libs/mix-share/src/scheduler/**/*.ts",
"libs/mix-share/src/scheduler/**/*.html"
]
}
}
}
}
16 changes: 16 additions & 0 deletions libs/mix-share/src/modules/scheduler/schedule.route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Routes } from '@angular/router';

export const SchedulerRoute: Routes = [
{
path: 'schedulers',
loadComponent: () =>
import('./schedulers/schedulers.component').then(
(c) => c.SchedulersComponent
),
},
{
path: '',
redirectTo: 'schedulers',
pathMatch: 'full',
},
];
Loading

1 comment on commit fd607ca

@vercel
Copy link

@vercel vercel bot commented on fd607ca Jan 6, 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.