Skip to content

Commit 28325f7

Browse files
Merge remote-tracking branch 'uxplus-angular/ux-plus-cris-2024_02_x' into task/ux-plus-cris-2024_02_x/UXP-295
# Conflicts: # bitbucket-pipelines.yml
2 parents 512556a + f320109 commit 28325f7

15 files changed

Lines changed: 43 additions & 47 deletions

File tree

src/app/app-routes.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,14 @@ export const APP_ROUTES: Route[] = [
188188
data: {
189189
isBackDoor: true,
190190
},
191-
canMatch: [() => environment.auth.disableStandardLogin],
191+
canMatch: [() => !environment.auth.disableStandardLogin],
192192
},
193193
{
194194
path: 'login',
195195
loadChildren: () => import('./login-page/login-page-routes').then((m) => m.ROUTES),
196196
data: {
197197
isBackDoor: false,
198198
},
199-
canMatch: [() => !environment.auth.disableStandardLogin],
200199
},
201200
{
202201
path: 'logout',

src/app/app.component.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ const initialState = {
7171
};
7272

7373
const itemPageUrl = '/entities/publication/3b6ef8e8-15a1-4607-abf8-2a6fbd572346';
74+
const itemPageCustomUrl = '/entities/publication/aCustomUrl';
7475

7576
export function getMockLocaleService(): LocaleService {
7677
return jasmine.createSpyObj('LocaleService', {
@@ -206,6 +207,14 @@ describe('App component', () => {
206207
expect(comp.isRouteLoading$.value).toBeTrue();
207208
}));
208209

210+
it('should show loading for item page administrative edit if custom url is used', fakeAsync(() => {
211+
routeServiceMock.getCurrentUrl.and.returnValue(of(itemPageCustomUrl));
212+
routerEventsObs.next(new NavigationStart(2, itemPageCustomUrl + '/edit'));
213+
fixture.detectChanges();
214+
tick();
215+
expect(comp.isRouteLoading$.value).toBeTrue();
216+
}));
217+
209218
it('should not show loading navigating between item pages in administrative edit', fakeAsync(() => {
210219
routeServiceMock.getCurrentUrl.and.returnValue(of(itemPageUrl + '/edit'));
211220
routerEventsObs.next(new NavigationStart(2, itemPageUrl + '/edit/status'));

src/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export class AppComponent implements OnInit, AfterViewInit {
226226
}
227227

228228
private isAdministrativeEditItemPageRoute(nextUrl: string, currentUrl: string): boolean {
229-
const editPageRegEx = /\/(entities\/[^\/]+|items)\/[0-9a-f-]{36}\/edit(?:\/.*)?$/;
229+
const editPageRegEx = /\/(entities\/[^/]+|items)\/[^/]+\/edit(?:\/.*)?$/;
230230
return editPageRegEx.test(nextUrl) && !editPageRegEx.test(currentUrl);
231231
}
232232

src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metadata/rendering-types/metadataGroup/table/table.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</tr>
2828
<tr *ngFor="let index of lastLimitedDataToBeRenderedMap?.keys();">
2929
<td *ngFor="let mdg of lastLimitedDataToBeRenderedMap.get(index)">
30-
<ds-metadata-render class="w-100"
30+
<ds-metadata-render class="w-100 auto-phrase"
3131
[item]="item"
3232
[field]="mdg.field"
3333
[metadataValue]="mdg.value"></ds-metadata-render>

src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metadata/rendering-types/metadataGroup/table/table.component.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
margin-left: -0.75rem !important;
33
margin-right: -0.75rem !important;
44
}
5+
6+
td {
7+
word-break: auto-phrase;
8+
}
9+
510
.more-collapse {
611
background-color: #f9f9f9;
7-
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
:host {
22
word-break: break-word;
3+
&.auto-phrase {
4+
word-break: auto-phrase;
5+
}
36
}

src/app/item-page/item-page.resolver.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ export const itemPageResolver: ResolveFn<RemoteData<Item>> = (
7575
map((rd: RemoteData<Item>) => {
7676
store.dispatch(new ResolvedAction(state.url, rd.payload));
7777
if (rd.hasSucceeded && hasValue(rd.payload)) {
78-
const itemRoute = router.parseUrl(getItemPageRoute(rd.payload)).toString();
78+
const isItemEditPage = state.url.includes('/edit');
79+
const itemRoute = isItemEditPage ? state.url : router.parseUrl(getItemPageRoute(rd.payload)).toString();
7980
// Check if custom url not empty and if the current id parameter is different from the custom url redirect to custom url
8081
if (hasValue(rd.payload.metadata) && isNotEmpty(rd.payload.metadata['cris.customurl'])) {
8182
if (route.params.id !== rd.payload.metadata['cris.customurl'][0].value) {

src/app/process-page/form/process-form.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export class ProcessFormComponent implements OnInit {
136136
* @param processParameter The parameter value to check
137137
*/
138138
private checkValue(processParameter: ProcessParameter): string {
139-
if (typeof processParameter.value === 'object') {
139+
if (processParameter?.value != null && typeof processParameter.value === 'object') {
140140
this.files = [...this.files, processParameter.value];
141141
return processParameter.value.name;
142142
}

src/app/process-page/form/process-parameters/process-parameters.component.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
EventEmitter,
88
Input,
99
OnChanges,
10-
OnInit,
1110
Optional,
1211
Output,
1312
SimpleChanges,
@@ -40,7 +39,7 @@ import { ParameterSelectComponent } from './parameter-select/parameter-select.co
4039
standalone: true,
4140
imports: [NgIf, NgFor, ParameterSelectComponent, TranslateModule],
4241
})
43-
export class ProcessParametersComponent implements OnChanges, OnInit {
42+
export class ProcessParametersComponent implements OnChanges {
4443
/**
4544
* The currently selected script
4645
*/
@@ -60,12 +59,6 @@ export class ProcessParametersComponent implements OnChanges, OnInit {
6059
*/
6160
parameterValues: ProcessParameter[];
6261

63-
ngOnInit(): void {
64-
if (hasValue(this.initialParams)) {
65-
this.parameterValues = this.initialParams;
66-
}
67-
}
68-
6962
/**
7063
* Makes sure the parameters are reset when the script changes
7164
* @param changes
@@ -82,7 +75,8 @@ export class ProcessParametersComponent implements OnChanges, OnInit {
8275
*/
8376
initParameters() {
8477
if (hasValue(this.initialParams)) {
85-
this.parameterValues = this.initialParams;
78+
this.parameterValues = [...this.initialParams];
79+
this.addParameter();
8680
} else {
8781
this.parameterValues = [];
8882
this.initializeParameter();

src/app/shared/form/builder/parsers/field-parser.ts

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,11 @@ import {
1111
import { TranslateService } from '@ngx-translate/core';
1212
import uniqueId from 'lodash/uniqueId';
1313

14-
import {
15-
SubmissionVisibilityType,
16-
SubmissionVisibilityValue,
17-
} from '../../../../core/config/models/config-submission-section.model';
14+
import { SubmissionVisibilityType } from '../../../../core/config/models/config-submission-section.model';
1815
import { MetadataValue } from '../../../../core/shared/metadata.models';
1916
import { Metadata } from '../../../../core/shared/metadata.utils';
20-
import { SubmissionScopeType } from '../../../../core/submission/submission-scope-type';
2117
import { VocabularyOptions } from '../../../../core/submission/vocabularies/models/vocabulary-options.model';
18+
import { SubmissionVisibility } from '../../../../submission/utils/visibility.util';
2219
import { isNgbDateStruct } from '../../../date.util';
2320
import {
2421
hasValue,
@@ -336,7 +333,7 @@ export abstract class FieldParser {
336333

337334
// Set read only option
338335
controlModel.readOnly = this.parserOptions.readOnly
339-
|| this.isFieldReadOnly(this.configData.visibility, 'test', this.parserOptions.submissionScope);
336+
|| this.isFieldReadOnly(this.configData.visibility, this.parserOptions.submissionScope);
340337
controlModel.disabled = controlModel.readOnly;
341338
controlModel.isModelOfInnerForm = this.parserOptions.isInnerForm;
342339
if (hasValue(this.configData.selectableRelationship)) {
@@ -378,23 +375,12 @@ export abstract class FieldParser {
378375
}
379376

380377
/**
381-
* Check if a field is read-only with the given scope
378+
* Check if a field is read-only within the given scope
382379
* @param visibility
383380
* @param submissionScope
384381
*/
385-
private isFieldReadOnly(visibility: SubmissionVisibilityType, fieldScope: string, submissionScope: string) {
386-
return isNotEmpty(submissionScope)
387-
&& isNotEmpty(fieldScope)
388-
&& isNotEmpty(visibility)
389-
&& ((
390-
submissionScope === SubmissionScopeType.WorkspaceItem.valueOf()
391-
&& visibility.main === SubmissionVisibilityValue.ReadOnly
392-
)
393-
||
394-
(visibility.other === SubmissionVisibilityValue.ReadOnly
395-
&& submissionScope === SubmissionScopeType.WorkflowItem.valueOf()
396-
)
397-
);
382+
private isFieldReadOnly(visibility: SubmissionVisibilityType, submissionScope) {
383+
return isNotEmpty(submissionScope) && SubmissionVisibility.isReadOnly(visibility, submissionScope);
398384
}
399385

400386
/**

0 commit comments

Comments
 (0)