-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b94d3de
commit a0352cd
Showing
24 changed files
with
391 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,6 @@ | |
|
||
.angular | ||
|
||
/.nx/cache | ||
/.nx/cache | ||
|
||
*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...src/app/pages/portal/database/components/database-migration/backup-table-btn.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: ` | ||
<mix-button | ||
[loading]="loadingState() === 'Loading'" | ||
(click)="backupSingleTable()" | ||
>Backup table</mix-button | ||
> | ||
<div> | ||
When you activate this button, the system will automatically backup your | ||
data in case you need it in the future. | ||
</div> | ||
`, | ||
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(); | ||
} | ||
} |
53 changes: 0 additions & 53 deletions
53
...app/pages/portal/database/components/database-migration/database-migration.component.html
This file was deleted.
Oops, something went wrong.
Empty file.
78 changes: 37 additions & 41 deletions
78
...c/app/pages/portal/database/components/database-migration/database-migration.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) { | ||
<div class="mt-1 mb-2 notification --info"> | ||
Create your db first to run some migrations | ||
</div> | ||
} @else { | ||
<div class="mb-3 mt-1"> | ||
<mix-migrate-table-btn [dbSysName]="dbSysName"></mix-migrate-table-btn> | ||
</div> | ||
public updateSingleTable() { | ||
this.mixApi.databaseApi | ||
.updateDataTable(this.dbSysName!) | ||
.pipe(this.observerLoadingStateSignal()) | ||
.subscribe(); | ||
} | ||
<div class="mb-3"> | ||
<mix-backup-table-btn [dbSysName]="dbSysName"></mix-backup-table-btn> | ||
</div> | ||
public backupSingleTable() { | ||
this.mixApi.databaseApi | ||
.backupTable(this.dbSysName!) | ||
.pipe(this.observerLoadingStateSignal()) | ||
.subscribe(); | ||
} | ||
<div class="mb-3"> | ||
<mix-restore-table-btn [dbSysName]="dbSysName"></mix-restore-table-btn> | ||
</div> | ||
public restoreSingleTable() { | ||
this.mixApi.databaseApi | ||
.restoreTable(this.dbSysName!) | ||
.pipe(this.observerLoadingStateSignal()) | ||
.subscribe(); | ||
} | ||
<div class="mb-3"> | ||
<mix-update-table-btn [dbSysName]="dbSysName"></mix-update-table-btn> | ||
</div> | ||
} | ||
`, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class DatabaseMigrationComponent { | ||
@Input() public dbSysName?: string; | ||
} |
40 changes: 40 additions & 0 deletions
40
...rc/app/pages/portal/database/components/database-migration/migrate-table-btn.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: ` | ||
<mix-button | ||
[loading]="loadingState() === 'Loading'" | ||
(click)="migrateSingleTable()" | ||
>Migrate to single table</mix-button | ||
> | ||
<div> | ||
Before using a database that you have created for the first time, it must | ||
be migrated into a single table. | ||
</div> | ||
`, | ||
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(); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...rc/app/pages/portal/database/components/database-migration/restore-table-btn.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: ` | ||
<mix-button | ||
[type]="'danger'" | ||
[loading]="loadingState() === 'Loading'" | ||
(click)="restoreSingleTable()" | ||
>Restore table</mix-button | ||
> | ||
<div> | ||
Depending on when you last backed up the data, the system will restore it. | ||
</div> | ||
`, | ||
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(); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...src/app/pages/portal/database/components/database-migration/update-table-btn.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: ` | ||
<mix-button | ||
[loading]="loadingState() === 'Loading'" | ||
(click)="updateSingleTable()" | ||
>Update data table</mix-button | ||
> | ||
<div> | ||
When you wish to make changes to your database or add new columns, run | ||
this migration. | ||
</div> | ||
`, | ||
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(); | ||
} | ||
} |
Oops, something went wrong.
a0352cd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
mix-portal-angular – ./
mix-portal-angular.vercel.app
studio.mixcore.net
mix-portal-angular-mixcore.vercel.app
mix-portal-angular-git-master-mixcore.vercel.app
admin.mixcore.dev