Skip to content

Commit

Permalink
feat: add stage(ctx) as queryparam
Browse files Browse the repository at this point in the history
  • Loading branch information
StephGit committed Dec 10, 2024
1 parent f96c9ca commit bf1b984
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@ export class ResourceEditPageComponent {
private route = inject(ActivatedRoute);

resource: Signal<Resource> = this.resourceService.resource;
resourceId = toSignal(
this.route.paramMap.pipe(
map((params) => +params.get('id')),
ids = toSignal(
this.route.queryParamMap.pipe(
map((params) => params),
distinctUntilChanged(),
),
-1,
[],
);

isLoading = computed(() => {
if (this.resourceId() > -1) {
this.resourceService.getResource(this.resourceId());
if (this.ids().keys) {
// TODO show correct STAGE by context id
this.resourceService.getResource(Number(this.ids().get('id')));
return false;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ <h1>{{ resourceType().name }}</h1>
>
<app-button [variant]="'primary'" [size]="'sm'"> <app-icon icon="pencil"></app-icon></app-button>
</a>
<a [routerLink]="['/resource/edit', resource.defaultResourceId ? resource.defaultResourceId : resource.id]">
<a
[routerLink]="['/resource/edit']"
[queryParams]="{ ctx: 1, id: resource.defaultResourceId ? resource.defaultResourceId : resource.id }"
>
<app-button [variant]="'primary'" [size]="'sm'"> <app-icon icon="rocket-takeoff"></app-icon></app-button>
</a>
</td>
Expand Down
4 changes: 2 additions & 2 deletions AMW_angular/io/src/app/resources/resources.route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ResourcesPageComponent } from './resources-page.component';
import { ResourceEditPageComponent } from './resource-edit/resource-edit-page.component';
import { ResourceEditPageComponent } from './resource-edit-page/resource-edit-page.component';

export const resourcesRoute = [
{ path: 'resources', component: ResourcesPageComponent },
{ path: 'resource/edit/:id', component: ResourceEditPageComponent },
{ path: 'resource/edit', component: ResourceEditPageComponent },
];

0 comments on commit bf1b984

Please sign in to comment.