Skip to content

Commit ca18783

Browse files
committed
Merge remote-tracking branch 'bitbucket4science/dspace-cris-2024_02_x' into dspace-cris-2024_02_x
# Conflicts: # bitbucket-pipelines.yml
2 parents 7208566 + 9492792 commit ca18783

4 files changed

Lines changed: 57 additions & 18 deletions

File tree

bitbucket-pipelines.yml

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ definitions:
1818
- git config --global user.name "${BB_EMAIL}"
1919
- git clone https://x-token-auth:${E2ERUNNERS_ACCESS_TOKEN}@${E2E_VALUES_REPO}
2020
- cd e2erunners-values
21-
- sed "s#HASH_COMMIT#${HASH_COMMIT}#g" TPL >> ${HASH_COMMIT}
21+
- sed "s#HASH_COMMIT#${HASH_COMMIT}#g" TPL > ${HASH_COMMIT}
2222
- sed -i "s#BRANCH_NAME#${BRANCH_NAME}#g" TPL ${HASH_COMMIT}
2323
- git add ${HASH_COMMIT}
24-
- git commit -m "Add configuration for e2e-${HASH_COMMIT}"
24+
- git commit -m "Add configuration for e2e-${HASH_COMMIT}" || echo "No changes to commit"
2525
- git push
2626
- cd ..
2727
- git clone https://x-token-auth:${HELM_CHARTS_ACCESS_TOKEN}@${HELM_CHARTS_REPO}
2828
- cd helm-charts
2929
- PATH_VALUE=" e2e-$HASH_COMMIT"
3030
- printf " - name:%s\n" "$PATH_VALUE" >> ${E2E_VALUES}
3131
- git add e2e-ingress/values.yaml
32-
- git commit -m "Add ${HASH_COMMIT} to e2e-ingress values"
32+
- git commit -m "Add ${HASH_COMMIT} to e2e-ingress values" || echo "No changes to commit"
3333
- git push
3434
- cd ..
3535

@@ -44,18 +44,18 @@ definitions:
4444
- git config --global user.name "${BB_EMAIL}"
4545
- git clone https://x-token-auth:${E2ERUNNERS_ACCESS_TOKEN}@${E2E_VALUES_REPO}
4646
- cd e2erunners-values
47-
- sed "s#HASH_COMMIT#${HASH_COMMIT}#g" TPL >> ${HASH_COMMIT}
47+
- sed "s#HASH_COMMIT#${HASH_COMMIT}#g" TPL > ${HASH_COMMIT}
4848
- sed -i "s#BRANCH_NAME#${BRANCH_NAME}#g" TPL ${HASH_COMMIT}
4949
- git add ${HASH_COMMIT}
50-
- git commit -m "Add configuration for e2e-${HASH_COMMIT}"
50+
- git commit -m "Add configuration for e2e-${HASH_COMMIT}" || echo "No changes to commit"
5151
- git push
5252
- cd ..
5353
- git clone https://x-token-auth:${HELM_CHARTS_ACCESS_TOKEN}@${HELM_CHARTS_REPO}
5454
- cd helm-charts
5555
- PATH_VALUE=" e2e-$HASH_COMMIT"
5656
- printf " - name:%s\n" "$PATH_VALUE" >> ${E2E_VALUES}
5757
- git add e2e-ingress/values.yaml
58-
- git commit -m "Add ${HASH_COMMIT} to e2e-ingress values"
58+
- git commit -m "Add ${HASH_COMMIT} to e2e-ingress values" || echo "No changes to commit"
5959
- git push
6060
- cd ..
6161

@@ -163,10 +163,10 @@ definitions:
163163
- export BRANCH_FILE=$(echo "$BITBUCKET_BRANCH" | awk -F'/' '{if(NF==1)val=$1;else if(NF==2)val=$2;else if(NF==3)val=$2;else val=$3;gsub(/_/, "-", val);print tolower(val)}')
164164
- git clone https://x-token-auth:${DSPACE_VALUES_ACCESS_TOKEN}@${DSPACE_VALUES_REPO}
165165
- cd dspace-values
166-
- '[ -f "dev/${BRANCH_FILE}" ] && sed -i "/^angular:/,/^[^ ]/s/\(tag: \).*/\1${BRANCH_NAME}-${HASH_COMMIT}/" "dev/${BRANCH_FILE}"'
166+
- '[ -f "dev/${BRANCH_FILE}" ] && sed -i "/^angular:/,/^[^ ]/s/\(tag: \).*/\1${BRANCH_NAME}-${HASH_COMMIT}/" "dev/${BRANCH_FILE}" && sed -i "s/^\([[:space:]]*replicaCount:\) 0/\1 1/" "dev/${BRANCH_FILE}"'
167167
- git config --global user.email "${BB_EMAIL}"
168168
- git config --global user.name "${BB_USER}"
169-
- git commit -am "Update TAG with ${BRANCH_NAME}-${HASH_COMMIT}"
169+
- git commit -am "Update TAG with ${BRANCH_NAME}-${HASH_COMMIT}" || echo "No changes to commit"
170170
- git push
171171

172172
- step: &deploy-on-staging
@@ -178,10 +178,40 @@ definitions:
178178
- export BRANCH_FILE=$(echo "$BITBUCKET_BRANCH" | awk -F'/' '{if(NF==1)val=$1;else if(NF==2)val=$2;else if(NF==3)val=$2;else val=$3;gsub(/_/, "-", val);print tolower(val)}')
179179
- git clone https://x-token-auth:${DSPACE_VALUES_ACCESS_TOKEN}@${DSPACE_VALUES_REPO}
180180
- cd dspace-values
181-
- '[ -f "staging/${BRANCH_FILE}" ] && sed -i "/^angular:/,/^[^ ]/s/\(tag: \).*/\1${BRANCH_NAME}-${HASH_COMMIT}/" "staging/${BRANCH_FILE}"'
181+
- '[ -f "staging/${BRANCH_FILE}" ] && sed -i "/^angular:/,/^[^ ]/s/\(tag: \).*/\1${BRANCH_NAME}-${HASH_COMMIT}/" "staging/${BRANCH_FILE}" && sed -i "s/^\([[:space:]]*replicaCount:\) 0/\1 1/" "staging/${BRANCH_FILE}"'
182182
- git config --global user.email "${BB_EMAIL}"
183183
- git config --global user.name "${BB_USER}"
184-
- git commit -am "Update TAG with ${BRANCH_NAME}-${HASH_COMMIT}"
184+
- git commit -am "Update TAG with ${BRANCH_NAME}-${HASH_COMMIT}" || echo "No changes to commit"
185+
- git push
186+
187+
- step: &turn-on-dev
188+
name: Turn On Dev environment
189+
image: alpine/git:latest
190+
script:
191+
- export HASH_COMMIT=${BITBUCKET_COMMIT:0:8}
192+
- export BRANCH_NAME=$(echo "$BITBUCKET_BRANCH" | tr '[:upper:]' '[:lower:]' | sed 's|/|--|g')
193+
- export BRANCH_FILE=$(echo "$BITBUCKET_BRANCH" | awk -F'/' '{if(NF==1)val=$1;else if(NF==2)val=$2;else if(NF==3)val=$2;else val=$3;gsub(/_/, "-", val);print tolower(val)}')
194+
- git clone https://x-token-auth:${DSPACE_VALUES_ACCESS_TOKEN}@${DSPACE_VALUES_REPO}
195+
- cd dspace-values
196+
- '[ -f "dev/${BRANCH_FILE}" ] && sed -i "s/^\([[:space:]]*replicaCount:\) 0/\1 1/" "dev/${BRANCH_FILE}"'
197+
- git config --global user.email "${BB_USER}"
198+
- git config --global user.name "${BB_EMAIL}"
199+
- git commit -am "Enable dev environment for ${BRANCH_NAME}" || echo "No changes to commit"
200+
- git push
201+
202+
- step: &turn-on-staging
203+
name: Turn On Staging environment
204+
image: alpine/git:latest
205+
script:
206+
- export HASH_COMMIT=${BITBUCKET_COMMIT:0:8}
207+
- export BRANCH_NAME=$(echo "$BITBUCKET_BRANCH" | tr '[:upper:]' '[:lower:]' | sed 's|/|--|g')
208+
- export BRANCH_FILE=$(echo "$BITBUCKET_BRANCH" | awk -F'/' '{if(NF==1)val=$1;else if(NF==2)val=$2;else if(NF==3)val=$2;else val=$3;gsub(/_/, "-", val);print tolower(val)}')
209+
- git clone https://x-token-auth:${DSPACE_VALUES_ACCESS_TOKEN}@${DSPACE_VALUES_REPO}
210+
- cd dspace-values
211+
- '[ -f "staging/${BRANCH_FILE}" ] && sed -i "s/^\([[:space:]]*replicaCount:\) 0/\1 1/" "staging/${BRANCH_FILE}"'
212+
- git config --global user.email "${BB_USER}"
213+
- git config --global user.name "${BB_EMAIL}"
214+
- git commit -am "Enable staging environment for ${BRANCH_NAME}" || echo "No changes to commit"
185215
- git push
186216

187217
- step: &find-and-invalidate-cloudfront-dev
@@ -219,6 +249,10 @@ pipelines:
219249
- step: *build-and-push
220250
- step: *deploy-on-dev
221251
- step: *find-and-invalidate-cloudfront-dev
252+
turn-on-dev:
253+
- step: *turn-on-dev
254+
turn-on-staging:
255+
- step: *turn-on-staging
222256
branches:
223257
'dspace-cris-2024_02_x':
224258
- step: *preliminary-operation

src/app/admin/admin-routes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const ROUTES: Route[] = [
5757
resolve: { breadcrumb: i18nBreadcrumbResolver },
5858
component: ThemedMetadataImportPageComponent,
5959
data: { title: 'admin.metadata-import.title', breadcrumbKey: 'admin.metadata-import' },
60-
canActivate: [siteAdministratorGuard],
60+
canActivate: [genericAdministratorGuard],
6161
},
6262
{
6363
path: 'batch-import',

src/app/app-routes.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import { COMMUNITY_MODULE_PATH } from './community-page/community-page-routing-p
3030
import { authBlockingGuard } from './core/auth/auth-blocking.guard';
3131
import { authenticatedGuard } from './core/auth/authenticated.guard';
3232
import { groupAdministratorGuard } from './core/data/feature-authorization/feature-authorization-guard/group-administrator.guard';
33-
import { siteAdministratorGuard } from './core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
3433
import { siteRegisterGuard } from './core/data/feature-authorization/feature-authorization-guard/site-register.guard';
3534
import { endUserAgreementCurrentUserGuard } from './core/end-user-agreement/end-user-agreement-current-user.guard';
3635
import { reloadGuard } from './core/reload/reload.guard';
@@ -172,7 +171,7 @@ export const APP_ROUTES: Route[] = [
172171
path: ADMIN_MODULE_PATH,
173172
loadChildren: () => import('./admin/admin-routes')
174173
.then((m) => m.ROUTES),
175-
canActivate: [siteAdministratorGuard, endUserAgreementCurrentUserGuard],
174+
canActivate: [authenticatedGuard, endUserAgreementCurrentUserGuard],
176175
},
177176
{
178177
path: NOTIFICATIONS_MODULE_PATH,

src/app/shared/context-menu/request-correction/request-correction-menu.component.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
Component,
77
Inject,
88
OnDestroy,
9+
OnInit,
910
} from '@angular/core';
1011
import { Router } from '@angular/router';
1112
import {
@@ -24,6 +25,7 @@ import {
2425
} from 'rxjs';
2526
import {
2627
catchError,
28+
share,
2729
switchMap,
2830
take,
2931
} from 'rxjs/operators';
@@ -58,7 +60,7 @@ import { ContextMenuEntryType } from '../context-menu-entry-type';
5860
BtnDisabledDirective,
5961
],
6062
})
61-
export class RequestCorrectionMenuComponent extends ContextMenuEntryComponent implements OnDestroy {
63+
export class RequestCorrectionMenuComponent extends ContextMenuEntryComponent implements OnInit,OnDestroy {
6264

6365
canCreateCorrection$: Observable<boolean>;
6466
/**
@@ -101,6 +103,14 @@ export class RequestCorrectionMenuComponent extends ContextMenuEntryComponent im
101103
super(injectedContextMenuObject, injectedContextMenuObjectType, ContextMenuEntryType.RequestCorrection);
102104
}
103105

106+
107+
ngOnInit(): void {
108+
this.canCreateCorrection$ = this.notificationService.claimedProfile.pipe(
109+
switchMap(() => this.canCreateCorrection(false)),
110+
share(),
111+
);
112+
}
113+
104114
/**
105115
* Open modal
106116
*
@@ -136,10 +146,6 @@ export class RequestCorrectionMenuComponent extends ContextMenuEntryComponent im
136146
this.router.navigate(['workspaceitems', response.id, 'edit']);
137147
}
138148
});
139-
140-
this.canCreateCorrection$ = this.notificationService.claimedProfile.pipe(
141-
switchMap(() => this.canCreateCorrection(false)),
142-
);
143149
}
144150

145151
/**

0 commit comments

Comments
 (0)