-
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.
Merge pull request #8 from xpert-ai/develop
Feat: workspace general page & npm action
- Loading branch information
Showing
25 changed files
with
758 additions
and
443 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
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
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
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
64 changes: 64 additions & 0 deletions
64
apps/cloud/src/app/features/xpert/workspace/settings/general/general.component.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<div class="sticky top-0 px-6 py-4 flex items-center h-14 mb-4 bg-white text-base font-medium text-gray-900 z-20"> | ||
<div class="shrink-0 text-xl">{{'PAC.Xpert.General' | translate: {Default: 'General'} }}</div> | ||
<div class="grow flex justify-end"> | ||
</div> | ||
</div> | ||
|
||
<div class="relative flex-1 flex flex-col justify-between items-stretch px-8 py-4"> | ||
<div class="pt-2"> | ||
<div class="pb-2"> | ||
<label class="py-2 font-medium leading-[20px] text-gray-900">{{ 'PAC.Xpert.Name' | translate: {Default: 'Name'} }}</label> | ||
<input class="w-full h-10 px-3 text-sm font-normal bg-gray-100 rounded-lg border border-transparent outline-none appearance-none caret-primary-600 placeholder:text-gray-400 hover:bg-gray-50 hover:border hover:border-gray-300 focus:bg-gray-50 focus:border focus:border-gray-300 focus:shadow-xs" | ||
[placeholder]="'PAC.Xpert.EnterWorkspaceName' | translate: {Default: 'Enter workspace name'}" | ||
[(ngModel)]="name" | ||
> | ||
</div> | ||
<button type="button" class="btn btn-large btn-primary pressable" (click)="update()"> | ||
{{ 'PAC.ACTIONS.Update' | translate: {Default: 'Update'} }} | ||
</button> | ||
</div> | ||
|
||
<div> | ||
<div class="text-xl font-semibold text-orange-500 pb-2"> | ||
{{ 'PAC.KEY_WORDS.DangerZone' | translate: {Default: 'Danger zone'} }} | ||
</div> | ||
|
||
<div class="border border-solid border-orange-500 rounded-xl flex flex-col"> | ||
<div class="w-full flex justify-between items-center p-4"> | ||
<div class="flex flex-col"> | ||
<div class="font-semibold"> | ||
{{ 'PAC.Xpert.ArchiveWorkspace' | translate: {Default: 'Archive this workspace'} }} | ||
</div> | ||
<div> | ||
{{ 'PAC.Xpert.ArchiveWorkspaceDesc' | translate: {Default: 'Mark this workspace and all its xperts and toolsets as archived and read-only'} }}. | ||
</div> | ||
</div> | ||
|
||
<button type="button" class="btn btn-large danger pressable" (click)="archive()"> | ||
{{ 'PAC.Xpert.ArchiveWorkspace' | translate: {Default: 'Archive this workspace'} }} | ||
</button> | ||
</div> | ||
|
||
<div class="border-b border-solid border-divider-regular"></div> | ||
|
||
<div class="w-full flex justify-between items-center p-4"> | ||
<div class="flex flex-col"> | ||
<div class="font-semibold"> | ||
{{ 'PAC.Xpert.DeleteWorkspace' | translate: {Default: 'Delete this workspace'} }} | ||
</div> | ||
<div> | ||
{{ 'PAC.Xpert.DeleteWorkspaceDesc' | translate: {Default: 'Once deleted, it will be gone forever. Please be certain'} }}. | ||
</div> | ||
</div> | ||
|
||
<button type="button" class="btn btn-large danger pressable" (click)="delete()"> | ||
{{ 'PAC.Xpert.DeleteWorkspace' | translate: {Default: 'Delete this workspace'} }} | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
@if (loading()) { | ||
<ngm-spin class="absolute top-0 left-0 w-full h-full"></ngm-spin> | ||
} | ||
</div> |
3 changes: 3 additions & 0 deletions
3
apps/cloud/src/app/features/xpert/workspace/settings/general/general.component.scss
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,3 @@ | ||
:host { | ||
@apply flex flex-col; | ||
} |
98 changes: 98 additions & 0 deletions
98
apps/cloud/src/app/features/xpert/workspace/settings/general/general.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,98 @@ | ||
import { CdkListboxModule } from '@angular/cdk/listbox' | ||
import { CommonModule } from '@angular/common' | ||
import { Component, effect, input, model, output, signal } from '@angular/core' | ||
import { FormsModule } from '@angular/forms' | ||
import { NgmSpinComponent } from '@metad/ocap-angular/common' | ||
import { TranslateModule } from '@ngx-translate/core' | ||
import { | ||
getErrorMessage, | ||
IfAnimation, | ||
injectToastr, | ||
injectWorkspaceService, | ||
IXpertWorkspace | ||
} from 'apps/cloud/src/app/@core' | ||
|
||
@Component({ | ||
selector: 'xpert-workspace-settings-general', | ||
standalone: true, | ||
imports: [CommonModule, FormsModule, CdkListboxModule, TranslateModule, NgmSpinComponent], | ||
templateUrl: './general.component.html', | ||
styleUrl: './general.component.scss', | ||
animations: [IfAnimation] | ||
}) | ||
export class XpertWorkspaceSettingsGeneralComponent { | ||
readonly workspaceService = injectWorkspaceService() | ||
readonly #toastr = injectToastr() | ||
|
||
// Inputs | ||
readonly workspace = input<IXpertWorkspace>() | ||
|
||
// Outputs | ||
readonly deleted = output() | ||
readonly archived = output() | ||
|
||
readonly name = model<string>() | ||
|
||
readonly loading = signal(false) | ||
|
||
constructor() { | ||
effect( | ||
() => { | ||
if (this.workspace()) { | ||
this.name.set(this.workspace().name) | ||
} | ||
}, | ||
{ allowSignalWrites: true } | ||
) | ||
} | ||
|
||
update() { | ||
this.loading.set(true) | ||
this.workspaceService | ||
.update(this.workspace().id, { | ||
name: this.name() | ||
}) | ||
.subscribe({ | ||
next: () => { | ||
this.loading.set(false) | ||
this.#toastr.success('PAC.Messages.UpdatedSuccessfully', { Default: 'Updated successfully' }) | ||
}, | ||
error: (error) => { | ||
this.loading.set(false) | ||
this.#toastr.error(getErrorMessage(error)) | ||
} | ||
}) | ||
} | ||
|
||
archive() { | ||
this.loading.set(true) | ||
this.workspaceService.archive(this.workspace().id) | ||
.subscribe({ | ||
next: () => { | ||
this.loading.set(false) | ||
this.archived.emit() | ||
this.#toastr.success('PAC.Messages.ArchivedSuccessfully', { Default: 'Archived successfully' }) | ||
}, | ||
error: (error) => { | ||
this.loading.set(false) | ||
this.#toastr.error(getErrorMessage(error)) | ||
} | ||
}) | ||
} | ||
|
||
delete() { | ||
this.loading.set(true) | ||
this.workspaceService.delete(this.workspace().id) | ||
.subscribe({ | ||
next: () => { | ||
this.loading.set(false) | ||
this.deleted.emit() | ||
this.#toastr.success('PAC.Messages.DeletedSuccessfully', { Default: 'Deleted successfully' }) | ||
}, | ||
error: (error) => { | ||
this.loading.set(false) | ||
this.#toastr.error(getErrorMessage(error)) | ||
} | ||
}) | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
.../workspace/members/members.component.html → ...e/settings/members/members.component.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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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
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
Oops, something went wrong.