Commit f7f15286 authored by Florent Poittevin's avatar Florent Poittevin
Browse files

feat: 722 move edit pages as children of detail

parent 3ac72ae5
......@@ -37,13 +37,6 @@ export class AdminHomeRoutable extends SharedAbstractPresentational {
path: RoutesEnum.adminSubmissionPolicy,
isVisible: () => true,
},
{
avatarIcon: "copyright",
titleToTranslate: TRANSLATE("admin.license.home.title"),
subtitleToTranslate: TRANSLATE("admin.license.home.subtitle"),
path: RoutesEnum.adminLicense,
isVisible: () => true,
},
{
avatarIcon: "history",
titleToTranslate: TRANSLATE("admin.preservationPolicy.home.title"),
......@@ -51,6 +44,13 @@ export class AdminHomeRoutable extends SharedAbstractPresentational {
path: RoutesEnum.adminPreservationPolicy,
isVisible: () => true,
},
{
avatarIcon: "copyright",
titleToTranslate: TRANSLATE("admin.license.home.title"),
subtitleToTranslate: TRANSLATE("admin.license.home.subtitle"),
path: RoutesEnum.adminLicense,
isVisible: () => true,
},
{
avatarIcon: "university",
titleToTranslate: TRANSLATE("admin.institution.home.title"),
......
<div class="button-toolbar">
<button mat-button
color="accent"
(click)="backToList()"
>
<mat-icon>navigate_before</mat-icon>
{{KEY_BACK_BUTTON | translate}}
</button>
<button mat-button
color="primary"
(click)="edit()"
>
<mat-icon>edit</mat-icon>
{{KEY_EDIT_BUTTON | translate}}
</button>
<button mat-button
color="accent"
[disabled]="!(currentObs| async)"
(click)="delete()"
>
<mat-icon>delete</mat-icon>
{{KEY_DELETE_BUTTON | translate}}
</button>
</div>
<dlcm-button-toolbar-detail [isEdit]="isEdit"
[currentModel]="currentObs | async"
(editChange)="edit()"
(deleteChange)="delete()"
(backToDetailChange)="backToDetail()"
(backToListChange)="backToList()"
>
</dlcm-button-toolbar-detail>
<div class="wrapper"
[dlcmSpinner]="isLoadingWithDependencyObs | async"
>
<dlcm-admin-funding-agencies-form *ngIf="isReadyToBeDisplayedObs | async"
<dlcm-admin-funding-agencies-form #formPresentational
*ngIf="isReadyToBeDisplayedObs | async"
[model]="currentObs| async"
[selectedOrgUnits]="selectedOrgUnitsObs | async"
[listOrgUnits]="listOrgUnitsObs | async"
[readonly]="true"
[readonly]="!isEdit"
(submitChange)="update($event)"
>
</dlcm-admin-funding-agencies-form>
......
......@@ -6,6 +6,7 @@ import {
import {AdminFundingAgenciesOrgUnitAction} from "@admin/funding-agencies/stores/organizational-unit/admin-organizational-unit-preservation-policy.action";
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
} from "@angular/core";
import {MatDialog} from "@angular/material";
......@@ -16,6 +17,7 @@ import {
} from "@app/generated-api";
import {OrganizationalUnitExtended} from "@deposit/models/organizational-unit-extended.model";
import {
Actions,
Select,
Store,
} from "@ngxs/store";
......@@ -23,7 +25,6 @@ import {SharedAbstractDetailRoutable} from "@shared/components/routables/shared-
import {LocalStateEnum} from "@shared/enums/local-state.enum";
import {LocalStateModel} from "@shared/models/local-state.model";
import {Observable} from "rxjs";
import {TRANSLATE} from "solidify-frontend";
@Component({
selector: "dlcm-admin-funding-agency-detail-routable",
......@@ -38,16 +39,16 @@ export class AdminFundingAgenciesDetailRoutable extends SharedAbstractDetailRout
@Select((state: LocalStateModel) => state.admin.admin_fundingAgencies.admin_fundingAgencies_organizationalUnit.selected) selectedOrgUnitsObs: Observable<OrganizationalUnit[]>;
readonly KEY_PARAM_NAME: string = "name";
readonly KEY_DELETE_BUTTON: string = TRANSLATE("admin.funding-agencies.button.delete");
readonly KEY_EDIT_BUTTON: string = TRANSLATE("admin.funding-agencies.button.edit");
constructor(protected store: Store,
constructor(protected _store: Store,
protected route: ActivatedRoute,
protected readonly _actions$: Actions,
protected readonly _changeDetector: ChangeDetectorRef,
public dialog: MatDialog) {
super(store, route, dialog, LocalStateEnum.admin_fundingAgencies, adminFundingAgenciesActionNameSpace, LocalStateEnum.admin);
super(_store, route, _actions$, _changeDetector, dialog, LocalStateEnum.admin_fundingAgencies, adminFundingAgenciesActionNameSpace, LocalStateEnum.admin);
}
getSubResourceWithParentId(id: string): void {
this.store.dispatch(new AdminFundingAgenciesOrgUnitAction.GetAll(id));
this._store.dispatch(new AdminFundingAgenciesOrgUnitAction.GetAll(id));
}
}
......@@ -22,7 +22,6 @@ import {SharedAbstractEditRoutable} from "@shared/components/routables/shared-ab
import {LocalStateEnum} from "@shared/enums/local-state.enum";
import {LocalStateModel} from "@shared/models/local-state.model";
import {Observable} from "rxjs";
import {TRANSLATE} from "solidify-frontend";
@Component({
selector: "dlcm-admin-funding-agency-edit-routable",
......@@ -37,8 +36,6 @@ export class AdminFundingAgenciesEditRoutable extends SharedAbstractEditRoutable
@Select((state: LocalStateModel) => state.admin.admin_fundingAgencies.admin_fundingAgencies_organizationalUnit.selected) selectedOrgUnitsObs: Observable<OrganizationalUnit[]>;
readonly KEY_PARAM_NAME: string = "name";
readonly KEY_DELETE_BUTTON: string = TRANSLATE("admin.funding-agencies.button.delete");
readonly KEY_EDIT_BUTTON: string = TRANSLATE("admin.funding-agencies.button.edit");
constructor(protected store: Store,
protected route: ActivatedRoute) {
......
import {AdminFundingAgenciesCreateRoutable} from "@admin/funding-agencies/components/routables/admin-funding-agencies-create/admin-funding-agencies-create.routable";
import {AdminFundingAgenciesDetailRoutable} from "@admin/funding-agencies/components/routables/admin-funding-agencies-detail/admin-funding-agencies-detail.routable";
import {AdminFundingAgenciesEditRoutable} from "@admin/funding-agencies/components/routables/admin-funding-agencies-edit/admin-funding-agencies-edit.routable";
import {AdminFundingAgenciesListRoutable} from "@admin/funding-agencies/components/routables/admin-funding-agencies-list/admin-funding-agencies-list.routable";
import {NgModule} from "@angular/core";
import {
......@@ -28,14 +27,15 @@ const routes: Routes = [
breadcrumb: TRANSLATE("breadcrumb.admin.funding-agencies.detail"),
breadcrumbMemoizedSelector: AdminFundingAgenciesState.currentTitle,
},
},
{
path: AdminRoutesEnum.fundingAgenciesEdit + AppRoutesEnum.separator + AppRoutesEnum.paramId,
component: AdminFundingAgenciesEditRoutable,
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.funding-agencies.edit"),
},
canDeactivate: [CanDeactivateGuard],
children: [
{
path: AdminRoutesEnum.fundingAgenciesEdit,
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.funding-agencies.edit"),
},
canDeactivate: [CanDeactivateGuard],
},
],
},
{
component: AdminFundingAgenciesCreateRoutable,
......
<div class="button-toolbar">
<button mat-button
color="accent"
(click)="backToList()"
>
<mat-icon>navigate_before</mat-icon>
{{KEY_BACK_BUTTON | translate}}
</button>
<button mat-button
color="primary"
(click)="edit()"
>
<mat-icon>edit</mat-icon>
{{KEY_EDIT_BUTTON | translate}}
</button>
<button mat-button
color="accent"
[disabled]="!(currentObs| async)"
(click)="delete()"
>
<mat-icon>delete</mat-icon>
{{KEY_DELETE_BUTTON | translate}}
</button>
</div>
<dlcm-button-toolbar-detail [isEdit]="isEdit"
[currentModel]="currentObs | async"
(editChange)="edit()"
(deleteChange)="delete()"
(backToDetailChange)="backToDetail()"
(backToListChange)="backToList()"
>
</dlcm-button-toolbar-detail>
<div class="wrapper"
[dlcmSpinner]="isLoadingWithDependencyObs | async"
......@@ -29,7 +13,8 @@
<dlcm-admin-institution-form #formPresentational
*ngIf="isReadyToBeDisplayedObs | async"
[model]="currentObs| async"
[readonly]="true"
[readonly]="!isEdit"
(submitChange)="update($event)"
></dlcm-admin-institution-form>
</div>
......
......@@ -5,19 +5,20 @@ import {
} from "@admin/institution/stores/admin-institution.state";
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
} from "@angular/core";
import {MatDialog} from "@angular/material";
import {ActivatedRoute} from "@angular/router";
import {Institution} from "@app/generated-api";
import {
Actions,
Select,
Store,
} from "@ngxs/store";
import {SharedAbstractDetailRoutable} from "@shared/components/routables/shared-abstract-detail/shared-abstract-detail.routable";
import {LocalStateEnum} from "@shared/enums/local-state.enum";
import {Observable} from "rxjs";
import {TRANSLATE} from "solidify-frontend";
@Component({
selector: "dlcm-admin-institution-detail-routable",
......@@ -30,13 +31,13 @@ export class AdminInstitutionDetailRoutable extends SharedAbstractDetailRoutable
@Select(AdminInstitutionState.isReadyToBeDisplayed) isReadyToBeDisplayedObs: Observable<boolean>;
readonly KEY_PARAM_NAME: string = "name";
readonly KEY_DELETE_BUTTON: string = TRANSLATE("admin.institution.button.delete");
readonly KEY_EDIT_BUTTON: string = TRANSLATE("admin.institution.button.edit");
constructor(protected store: Store,
constructor(protected _store: Store,
protected route: ActivatedRoute,
protected readonly _actions$: Actions,
protected readonly _changeDetector: ChangeDetectorRef,
public dialog: MatDialog) {
super(store, route, dialog, LocalStateEnum.admin_institution, adminInstitutionActionNameSpace, LocalStateEnum.admin);
super(_store, route, _actions$, _changeDetector, dialog, LocalStateEnum.admin_institution, adminInstitutionActionNameSpace, LocalStateEnum.admin);
}
getSubResourceWithParentId(id: string): void {
......
import {AdminInstitutionCreateRoutable} from "@admin/institution/components/routables/admin-institution-create/admin-institution-create.routable";
import {AdminInstitutionDetailRoutable} from "@admin/institution/components/routables/admin-institution-detail/admin-institution-detail.routable";
import {AdminInstitutionEditRoutable} from "@admin/institution/components/routables/admin-institution-edit/admin-institution-edit.routable";
import {AdminInstitutionListRoutable} from "@admin/institution/components/routables/admin-institution-list/admin-institution-list.routable";
import {AdminInstitutionState} from "@admin/institution/stores/admin-institution.state";
import {NgModule} from "@angular/core";
......@@ -28,6 +27,15 @@ const routes: Routes = [
breadcrumb: TRANSLATE("breadcrumb.admin.institution.detail"),
breadcrumbMemoizedSelector: AdminInstitutionState.currentTitle,
},
children: [
{
path: AdminRoutesEnum.institutionEdit,
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.institution.edit"),
},
canDeactivate: [CanDeactivateGuard],
},
],
},
{
path: AdminRoutesEnum.institutionCreate,
......@@ -37,14 +45,6 @@ const routes: Routes = [
},
canDeactivate: [CanDeactivateGuard],
},
{
path: AdminRoutesEnum.institutionEdit + AppRoutesEnum.separator + AppRoutesEnum.paramId,
component: AdminInstitutionEditRoutable,
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.institution.edit"),
},
canDeactivate: [CanDeactivateGuard],
},
];
@NgModule({
......
<div class="button-toolbar">
<button mat-button
color="accent"
(click)="backToList()"
>
<mat-icon>navigate_before</mat-icon>
{{KEY_BACK_BUTTON | translate}}
</button>
<button mat-button
color="primary"
(click)="edit()"
>
<mat-icon>edit</mat-icon>
{{KEY_EDIT_BUTTON | translate}}
</button>
<button mat-button
color="accent"
[disabled]="!(currentObs| async)"
(click)="delete()"
>
<mat-icon>delete</mat-icon>
{{KEY_DELETE_BUTTON | translate}}
</button>
</div>
<dlcm-button-toolbar-detail [isEdit]="isEdit"
[currentModel]="currentObs | async"
(editChange)="edit()"
(deleteChange)="delete()"
(backToDetailChange)="backToDetail()"
(backToListChange)="backToList()"
>
</dlcm-button-toolbar-detail>
<div class="wrapper"
[dlcmSpinner]="isLoadingWithDependencyObs | async"
......@@ -29,7 +13,8 @@
<dlcm-admin-license-form #formPresentational
*ngIf="isReadyToBeDisplayedObs | async"
[model]="currentObs| async"
[readonly]="true"
[readonly]="!isEdit"
(submitChange)="update($event)"
></dlcm-admin-license-form>
</div>
......@@ -5,19 +5,20 @@ import {
} from "@admin/license/stores/admin-license.state";
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
} from "@angular/core";
import {MatDialog} from "@angular/material";
import {ActivatedRoute} from "@angular/router";
import {License} from "@app/generated-api";
import {
Actions,
Select,
Store,
} from "@ngxs/store";
import {SharedAbstractDetailRoutable} from "@shared/components/routables/shared-abstract-detail/shared-abstract-detail.routable";
import {LocalStateEnum} from "@shared/enums/local-state.enum";
import {Observable} from "rxjs";
import {TRANSLATE} from "solidify-frontend";
@Component({
selector: "dlcm-admin-license-detail-routable",
......@@ -30,13 +31,13 @@ export class AdminLicenseDetailRoutable extends SharedAbstractDetailRoutable<Lic
@Select(AdminLicenseState.isReadyToBeDisplayed) isReadyToBeDisplayedObs: Observable<boolean>;
readonly KEY_PARAM_NAME: string = "name";
readonly KEY_DELETE_BUTTON: string = TRANSLATE("admin.license.button.delete");
readonly KEY_EDIT_BUTTON: string = TRANSLATE("admin.license.button.edit");
constructor(protected store: Store,
constructor(protected _store: Store,
protected route: ActivatedRoute,
protected readonly _actions$: Actions,
protected readonly _changeDetector: ChangeDetectorRef,
public dialog: MatDialog) {
super(store, route, dialog, LocalStateEnum.admin_license, adminLicenseActionNameSpace, LocalStateEnum.admin);
super(_store, route, _actions$, _changeDetector, dialog, LocalStateEnum.admin_license, adminLicenseActionNameSpace, LocalStateEnum.admin);
}
getSubResourceWithParentId(id: string): void {
......
import {AdminLicenseCreateRoutable} from "@admin/license/components/routables/admin-license-create/admin-license-create.routable";
import {AdminLicenseDetailRoutable} from "@admin/license/components/routables/admin-license-detail/admin-license-detail.routable";
import {AdminLicenseEditRoutable} from "@admin/license/components/routables/admin-license-edit/admin-license-edit.routable";
import {AdminLicenseListRoutable} from "@admin/license/components/routables/admin-license-list/admin-license-list.routable";
import {AdminLicenseState} from "@admin/license/stores/admin-license.state";
import {NgModule} from "@angular/core";
......@@ -29,14 +28,6 @@ const routes: Routes = [
},
canDeactivate: [CanDeactivateGuard],
},
{
path: AdminRoutesEnum.licenseEdit + AppRoutesEnum.separator + AppRoutesEnum.paramId,
component: AdminLicenseEditRoutable,
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.license.edit"),
},
canDeactivate: [CanDeactivateGuard],
},
{
path: AdminRoutesEnum.licenseDetail + AppRoutesEnum.separator + AppRoutesEnum.paramId,
component: AdminLicenseDetailRoutable,
......@@ -44,6 +35,15 @@ const routes: Routes = [
breadcrumb: TRANSLATE("breadcrumb.admin.license.detail"),
breadcrumbMemoizedSelector: AdminLicenseState.currentTitle,
},
children: [
{
path: AdminRoutesEnum.licenseEdit,
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.license.edit"),
},
canDeactivate: [CanDeactivateGuard],
},
],
},
];
......
......@@ -4,32 +4,31 @@
>
<div class="two-columns-wrapper">
<div class="left-part">
<mat-form-field>
<mat-form-field *ngIf="getFormControl(formDefinition.name) as fd">
<mat-label>{{'admin.oauth2.form.name' | translate }}</mat-label>
<input matInput
[formControlName]="formDefinition.name"
[required]="isRequired(formDefinition.name)"
[formControl]="fd"
[solidifyValidation]="errors"
[required]="formValidationHelper.hasRequiredField(fd)"
>
<mat-error *ngIf="getFormControl(formDefinition.name).invalid">{{'required' | translate}}</mat-error>
<mat-error *ngFor="let error of getFormControl(formDefinition.name).errors?.errorsFromBackend">{{error}}</mat-error>
<mat-error #errors></mat-error>
</mat-form-field>
<mat-form-field>
<mat-form-field *ngIf="getFormControl(formDefinition.clientId) as fd">
<mat-label>{{'admin.oauth2.form.clientId' | translate }}</mat-label>
<input matInput
[formControlName]="formDefinition.clientId"
[required]="isRequired(formDefinition.clientId)"
[formControl]="fd"
[solidifyValidation]="errors"
[required]="formValidationHelper.hasRequiredField(fd)"
>
<mat-error *ngIf="getFormControl(formDefinition.clientId).invalid">{{'required' | translate}}</mat-error>
<mat-error
*ngFor="let error of getFormControl(formDefinition.clientId).errors?.errorsFromBackend"
>{{error}}</mat-error>
<mat-error #errors></mat-error>
</mat-form-field>
<mat-form-field>
<mat-form-field *ngIf="getFormControl(formDefinition.secret) as fd">
<input matInput
[formControlName]="formDefinition.secret"
[required]="isRequired(formDefinition.secret)"
[formControl]="fd"
[solidifyValidation]="errors"
[required]="formValidationHelper.hasRequiredField(fd)"
[type]="hide ? 'password' : 'text'"
>
<button mat-icon-button
......@@ -42,54 +41,51 @@
icon="{{hide ? 'eye-slash' : 'eye'}}"
></fa-icon>
</button>
<mat-error #errors></mat-error>
</mat-form-field>
<mat-form-field>
<mat-form-field *ngIf="getFormControl(formDefinition.redirectUri) as fd">
<mat-label>{{'admin.oauth2.form.redirectUri' | translate }}</mat-label>
<input matInput
[formControlName]="formDefinition.redirectUri"
[required]="isRequired(formDefinition.redirectUri)"
[formControl]="fd"
[solidifyValidation]="errors"
[required]="formValidationHelper.hasRequiredField(fd)"
>
<mat-error *ngIf="getFormControl(formDefinition.redirectUri).invalid">{{'required' | translate}}</mat-error>
<mat-error
*ngFor="let error of getFormControl(formDefinition.redirectUri).errors?.errorsFromBackend"
>{{error}}</mat-error>
<mat-error #errors></mat-error>
</mat-form-field>
<mat-form-field>
<mat-form-field *ngIf="getFormControl(formDefinition.scope) as fd">
<mat-label>{{'admin.oauth2.form.scope' | translate }}</mat-label>
<input matInput
[formControlName]="formDefinition.scope"
[required]="isRequired(formDefinition.scope)"
[formControl]="fd"
[solidifyValidation]="errors"
[required]="formValidationHelper.hasRequiredField(fd)"
>
<mat-error *ngIf="getFormControl(formDefinition.scope).invalid">{{'required' | translate}}</mat-error>
<mat-error *ngFor="let error of getFormControl(formDefinition.name).errors?.errorsFromBackend">{{error}}</mat-error>
<mat-error #errors></mat-error>
</mat-form-field>
</div>
<div class="right-part">
<mat-form-field>
<mat-form-field *ngIf="getFormControl(formDefinition.accessTokenValiditySeconds) as fd">
<mat-label>{{'admin.oauth2.form.accessTokenValiditySeconds' | translate }}</mat-label>
<input matInput
type="number"
[formControlName]="formDefinition.accessTokenValiditySeconds"
[required]="isRequired(formDefinition.accessTokenValiditySeconds)"
[formControl]="fd"
[solidifyValidation]="errors"
[required]="formValidationHelper.hasRequiredField(fd)"
>
<mat-error
*ngFor="let error of getFormControl(formDefinition.accessTokenValiditySeconds).errors?.errorsFromBackend"
>{{error}}</mat-error>
<mat-error #errors></mat-error>
</mat-form-field>
<mat-form-field>
<mat-form-field *ngIf="getFormControl(formDefinition.refreshTokenValiditySeconds) as fd">
<mat-label>{{'admin.oauth2.form.refreshTokenValiditySeconds' | translate }}</mat-label>
<input matInput
type="number"
[formControlName]="formDefinition.refreshTokenValiditySeconds"
[required]="isRequired(formDefinition.refreshTokenValiditySeconds)"
[formControl]="fd"
[solidifyValidation]="errors"
[required]="formValidationHelper.hasRequiredField(fd)"
>
<mat-error
*ngFor="let error of getFormControl(formDefinition.refreshTokenValiditySeconds).errors?.errorsFromBackend"
>{{error}}</mat-error>
<mat-error #errors></mat-error>
</mat-form-field>
<div>
......
<div class="button-toolbar">
<button mat-button
color="accent"
(click)="backToList()"
>
<mat-icon>navigate_before</mat-icon>
{{KEY_BACK_BUTTON | translate}}
</button>
<button mat-button
color="primary"
(click)="edit()"