diff --git a/.prettierignore b/.prettierignore
index ab639d33..27af2bf9 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -5,4 +5,6 @@
.angular
-/.nx/cache
\ No newline at end of file
+/.nx/cache
+
+ *.html
diff --git a/apps/mix-cms/src/app/pages/portal/database-data/database-data.component.ts b/apps/mix-cms/src/app/pages/portal/database-data/database-data.component.ts
index 64697911..742dfca5 100644
--- a/apps/mix-cms/src/app/pages/portal/database-data/database-data.component.ts
+++ b/apps/mix-cms/src/app/pages/portal/database-data/database-data.component.ts
@@ -36,7 +36,6 @@ import {
Subject,
debounceTime,
distinctUntilChanged,
- filter,
forkJoin,
map,
take,
@@ -45,7 +44,6 @@ import {
} from 'rxjs';
import { CMS_ROUTES } from '../../../app.routes';
-import { SuccessFilter } from '@mixcore/share/base';
import { ListPageKit } from '../../../shares/kits/list-page-kit.component';
import { DatabaseDataStore } from '../../../stores/database-data.store';
import { CustomActionCellComponent } from './components/custom-action-cell/custom-action-cell.component';
@@ -149,7 +147,6 @@ export class DatabaseDataComponent
public onGridReady(params: GridReadyEvent) {
this.gridApi = params.api;
this.rowData$ = this.store.vm$.pipe(
- filter(SuccessFilter),
tap((s) => {
if (s.db) {
this.allColumnDefs = s.db.columns.map(
@@ -162,7 +159,6 @@ export class DatabaseDataComponent
dataType: x.dataType,
columnType: 'value',
},
- editable: true,
}
);
this.columnNames = s.db.columns.map((x) => x.displayName);
@@ -175,7 +171,9 @@ export class DatabaseDataComponent
];
}
}),
- map((s) => s.data),
+ map((s) => {
+ return s.data;
+ }),
takeUntil(this.destroy$)
);
@@ -383,10 +381,7 @@ export class DatabaseDataComponent
});
dialogRef.afterClosed$.subscribe((value) => {
- if (value) {
- this.store.updateData(dataIndex, value);
- this.gridApi.refreshCells();
- }
+ if (value) this.store.updateData(dataIndex, value);
});
});
}
diff --git a/apps/mix-cms/src/app/pages/portal/database/components/database-migration/backup-table-btn.component.ts b/apps/mix-cms/src/app/pages/portal/database/components/database-migration/backup-table-btn.component.ts
new file mode 100644
index 00000000..b352a278
--- /dev/null
+++ b/apps/mix-cms/src/app/pages/portal/database/components/database-migration/backup-table-btn.component.ts
@@ -0,0 +1,40 @@
+import { CommonModule } from '@angular/common';
+import {
+ ChangeDetectionStrategy,
+ Component,
+ Input,
+ inject,
+} from '@angular/core';
+import { MixApiFacadeService } from '@mixcore/share/api';
+import { BaseComponent } from '@mixcore/share/base';
+import { MixButtonComponent } from '@mixcore/ui/button';
+
+@Component({
+ selector: 'mix-backup-table-btn',
+ standalone: true,
+ imports: [CommonModule, MixButtonComponent],
+ template: `
+ Backup table
+
+
+ When you activate this button, the system will automatically backup your
+ data in case you need it in the future.
+
+ `,
+ changeDetection: ChangeDetectionStrategy.OnPush,
+})
+export class BackupTableButtonComponent extends BaseComponent {
+ @Input() public dbSysName?: string;
+ public mixApi = inject(MixApiFacadeService);
+
+ public backupSingleTable() {
+ this.mixApi.databaseApi
+ .backupTable(this.dbSysName!)
+ .pipe(this.observerLoadingStateSignal())
+ .subscribe();
+ }
+}
diff --git a/apps/mix-cms/src/app/pages/portal/database/components/database-migration/database-migration.component.html b/apps/mix-cms/src/app/pages/portal/database/components/database-migration/database-migration.component.html
deleted file mode 100644
index ec5d402c..00000000
--- a/apps/mix-cms/src/app/pages/portal/database/components/database-migration/database-migration.component.html
+++ /dev/null
@@ -1,53 +0,0 @@
-@if (!dbSysName) {
-
- Create your db first to run some migrations
-
-} @else {
-
-
-
Migrate to single table
-
-
- Before using a database that you have created for the first time, it must
- be migrated into a single table.
-
-
-
-
-
Backup table
-
-
- When you activate this button, the system will automatically backup your
- data in case you need it in the future.
-
-
-
-
-
Restore table
-
-
- Depending on when you last backed up the data, the system will restore it.
-
-
-
-
-
Update data table
-
-
- When you wish to make changes to your database or add new columns, run
- this migration.
-
-
-
-}
diff --git a/apps/mix-cms/src/app/pages/portal/database/components/database-migration/database-migration.component.scss b/apps/mix-cms/src/app/pages/portal/database/components/database-migration/database-migration.component.scss
deleted file mode 100644
index e69de29b..00000000
diff --git a/apps/mix-cms/src/app/pages/portal/database/components/database-migration/database-migration.component.ts b/apps/mix-cms/src/app/pages/portal/database/components/database-migration/database-migration.component.ts
index 8621f563..f95f4d87 100644
--- a/apps/mix-cms/src/app/pages/portal/database/components/database-migration/database-migration.component.ts
+++ b/apps/mix-cms/src/app/pages/portal/database/components/database-migration/database-migration.component.ts
@@ -1,51 +1,47 @@
import { CommonModule } from '@angular/common';
-import {
- ChangeDetectionStrategy,
- Component,
- Input,
- inject,
-} from '@angular/core';
-import { MixApiFacadeService } from '@mixcore/share/api';
-import { BaseComponent } from '@mixcore/share/base';
+import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { MixButtonComponent } from '@mixcore/ui/button';
+import { BackupTableButtonComponent } from './backup-table-btn.component';
+import { MigrateTableButtonComponent } from './migrate-table-btn.component';
+import { RestoreTableButtonComponent } from './restore-table-btn.component';
+import { UpdateTableButtonComponent } from './update-table-btn.component';
@Component({
selector: 'mix-database-migration',
standalone: true,
- imports: [CommonModule, MixButtonComponent],
- templateUrl: './database-migration.component.html',
- styleUrl: './database-migration.component.scss',
- changeDetection: ChangeDetectionStrategy.OnPush,
-})
-export class DatabaseMigrationComponent extends BaseComponent {
- @Input() public dbSysName?: string;
- public mixApi = inject(MixApiFacadeService);
-
- public migrateSingleTable() {
- this.mixApi.databaseApi
- .migrateToSingleTable(this.dbSysName!)
- .pipe(this.observerLoadingStateSignal())
- .subscribe();
- }
+ imports: [
+ CommonModule,
+ MixButtonComponent,
+ UpdateTableButtonComponent,
+ MigrateTableButtonComponent,
+ BackupTableButtonComponent,
+ RestoreTableButtonComponent,
+ ],
+ template: `
+ @if (!dbSysName) {
+
+ Create your db first to run some migrations
+
+ } @else {
+
+
+
- public updateSingleTable() {
- this.mixApi.databaseApi
- .updateDataTable(this.dbSysName!)
- .pipe(this.observerLoadingStateSignal())
- .subscribe();
- }
+
+
+
- public backupSingleTable() {
- this.mixApi.databaseApi
- .backupTable(this.dbSysName!)
- .pipe(this.observerLoadingStateSignal())
- .subscribe();
- }
+
+
+
- public restoreSingleTable() {
- this.mixApi.databaseApi
- .restoreTable(this.dbSysName!)
- .pipe(this.observerLoadingStateSignal())
- .subscribe();
- }
+
+
+
+ }
+ `,
+ changeDetection: ChangeDetectionStrategy.OnPush,
+})
+export class DatabaseMigrationComponent {
+ @Input() public dbSysName?: string;
}
diff --git a/apps/mix-cms/src/app/pages/portal/database/components/database-migration/migrate-table-btn.component.ts b/apps/mix-cms/src/app/pages/portal/database/components/database-migration/migrate-table-btn.component.ts
new file mode 100644
index 00000000..ce388259
--- /dev/null
+++ b/apps/mix-cms/src/app/pages/portal/database/components/database-migration/migrate-table-btn.component.ts
@@ -0,0 +1,40 @@
+import { CommonModule } from '@angular/common';
+import {
+ ChangeDetectionStrategy,
+ Component,
+ Input,
+ inject,
+} from '@angular/core';
+import { MixApiFacadeService } from '@mixcore/share/api';
+import { BaseComponent } from '@mixcore/share/base';
+import { MixButtonComponent } from '@mixcore/ui/button';
+
+@Component({
+ selector: 'mix-migrate-table-btn',
+ standalone: true,
+ imports: [CommonModule, MixButtonComponent],
+ template: `
+ Migrate to single table
+
+
+ Before using a database that you have created for the first time, it must
+ be migrated into a single table.
+
+ `,
+ changeDetection: ChangeDetectionStrategy.OnPush,
+})
+export class MigrateTableButtonComponent extends BaseComponent {
+ @Input() public dbSysName?: string;
+ public mixApi = inject(MixApiFacadeService);
+
+ public migrateSingleTable() {
+ this.mixApi.databaseApi
+ .migrateToSingleTable(this.dbSysName!)
+ .pipe(this.observerLoadingStateSignal())
+ .subscribe();
+ }
+}
diff --git a/apps/mix-cms/src/app/pages/portal/database/components/database-migration/restore-table-btn.component.ts b/apps/mix-cms/src/app/pages/portal/database/components/database-migration/restore-table-btn.component.ts
new file mode 100644
index 00000000..99bebe55
--- /dev/null
+++ b/apps/mix-cms/src/app/pages/portal/database/components/database-migration/restore-table-btn.component.ts
@@ -0,0 +1,40 @@
+import { CommonModule } from '@angular/common';
+import {
+ ChangeDetectionStrategy,
+ Component,
+ Input,
+ inject,
+} from '@angular/core';
+import { MixApiFacadeService } from '@mixcore/share/api';
+import { BaseComponent } from '@mixcore/share/base';
+import { MixButtonComponent } from '@mixcore/ui/button';
+
+@Component({
+ selector: 'mix-restore-table-btn',
+ standalone: true,
+ imports: [CommonModule, MixButtonComponent],
+ template: `
+ Restore table
+
+
+ Depending on when you last backed up the data, the system will restore it.
+
+ `,
+ changeDetection: ChangeDetectionStrategy.OnPush,
+})
+export class RestoreTableButtonComponent extends BaseComponent {
+ @Input() public dbSysName?: string;
+ public mixApi = inject(MixApiFacadeService);
+
+ public restoreSingleTable() {
+ this.mixApi.databaseApi
+ .restoreTable(this.dbSysName!)
+ .pipe(this.observerLoadingStateSignal())
+ .subscribe();
+ }
+}
diff --git a/apps/mix-cms/src/app/pages/portal/database/components/database-migration/update-table-btn.component.ts b/apps/mix-cms/src/app/pages/portal/database/components/database-migration/update-table-btn.component.ts
new file mode 100644
index 00000000..4e05028a
--- /dev/null
+++ b/apps/mix-cms/src/app/pages/portal/database/components/database-migration/update-table-btn.component.ts
@@ -0,0 +1,40 @@
+import { CommonModule } from '@angular/common';
+import {
+ ChangeDetectionStrategy,
+ Component,
+ Input,
+ inject,
+} from '@angular/core';
+import { MixApiFacadeService } from '@mixcore/share/api';
+import { BaseComponent } from '@mixcore/share/base';
+import { MixButtonComponent } from '@mixcore/ui/button';
+
+@Component({
+ selector: 'mix-update-table-btn',
+ standalone: true,
+ imports: [CommonModule, MixButtonComponent],
+ template: `
+ Update data table
+
+
+ When you wish to make changes to your database or add new columns, run
+ this migration.
+
+ `,
+ changeDetection: ChangeDetectionStrategy.OnPush,
+})
+export class UpdateTableButtonComponent extends BaseComponent {
+ @Input() public dbSysName?: string;
+ public mixApi = inject(MixApiFacadeService);
+
+ public updateSingleTable() {
+ this.mixApi.databaseApi
+ .updateDataTable(this.dbSysName!)
+ .pipe(this.observerLoadingStateSignal())
+ .subscribe();
+ }
+}
diff --git a/apps/mix-cms/src/app/stores/database-data.store.ts b/apps/mix-cms/src/app/stores/database-data.store.ts
index 500a9cbe..7db2ed97 100644
--- a/apps/mix-cms/src/app/stores/database-data.store.ts
+++ b/apps/mix-cms/src/app/stores/database-data.store.ts
@@ -10,6 +10,7 @@ import {
} from '@mixcore/lib/model';
import { MixApiFacadeService } from '@mixcore/share/api';
import { BaseState } from '@mixcore/share/base';
+import { ObjectUtil } from '@mixcore/share/form';
import { ComponentStore } from '@ngrx/component-store';
import { catchError, filter, forkJoin, of } from 'rxjs';
@@ -30,6 +31,7 @@ export class DatabaseDataStore extends ComponentStore {
public dbSysName$ = this.select((s) => s.dbSysName).pipe(filter(Boolean));
public query$ = this.select((s) => s.request);
public vm$ = this.select((s) => s);
+ public data$ = this.select((s) => s.data);
constructor() {
super({
@@ -188,28 +190,23 @@ export class DatabaseDataStore extends ComponentStore {
}
public addData(data: MixDynamicData) {
- this.patchState((s) => ({
- ...s,
- data: [...s.data, data],
- }));
+ const current = this.get().data;
+ current.push(data);
+
+ this.patchState({ data: ObjectUtil.clone(current) });
}
public updateData(dataIndex: number, data: MixDynamicData) {
- this.patchState((s) => {
- const current = s.data;
- current[dataIndex] = data;
-
- return {
- ...s,
- data: [...current],
- };
- });
+ const current = this.get().data;
+ data[dataIndex] = data;
+
+ this.patchState({ data: ObjectUtil.clone(current) });
}
public removeData(dataId: number[]) {
- this.patchState((s) => ({
- ...s,
- data: s.data.filter((x) => !dataId.includes(x.id!)),
- }));
+ let current = this.get().data;
+ current = current.filter((x) => !dataId.includes(x.id!));
+
+ this.patchState({ data: ObjectUtil.clone(current) });
}
}
diff --git a/libs/mix-lib/src/model/core/mix-project.model.ts b/libs/mix-lib/src/model/core/mix-project.model.ts
new file mode 100644
index 00000000..86183679
--- /dev/null
+++ b/libs/mix-lib/src/model/core/mix-project.model.ts
@@ -0,0 +1,7 @@
+export interface MixProject {
+ id: number;
+ projectName: string;
+ projectNameDescription?: string;
+ startDate: Date;
+ endDate: Date;
+}
diff --git a/libs/mix-lib/src/model/index.ts b/libs/mix-lib/src/model/index.ts
index 96f81009..acd2f577 100644
--- a/libs/mix-lib/src/model/index.ts
+++ b/libs/mix-lib/src/model/index.ts
@@ -1,6 +1,7 @@
export * from './core/application.model';
export * from './core/database.model';
export * from './core/metadata.model';
+export * from './core/mix-project.model';
export * from './core/mix-task.model';
export * from './core/module.model';
export * from './core/order.model';
diff --git a/libs/mix-share/src/components/main-side-menu/main-side-menu.component.html b/libs/mix-share/src/components/main-side-menu/main-side-menu.component.html
index 126469ed..fb9afa41 100644
--- a/libs/mix-share/src/components/main-side-menu/main-side-menu.component.html
+++ b/libs/mix-share/src/components/main-side-menu/main-side-menu.component.html
@@ -6,8 +6,8 @@
+ @for(item of menu; track item) {
+ }