diff --git a/src/app/my-dspace-page/my-dspace-page.component.html b/src/app/my-dspace-page/my-dspace-page.component.html
index 1a45922576b..614cb540a01 100644
--- a/src/app/my-dspace-page/my-dspace-page.component.html
+++ b/src/app/my-dspace-page/my-dspace-page.component.html
@@ -2,24 +2,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
=
})
export class MyDSpacePageComponent implements OnInit {
- subscribeStats: Boolean;
+ subscribeStats: boolean = false;
/**
* The list of available configuration options
@@ -67,8 +65,8 @@ export class MyDSpacePageComponent implements OnInit {
private serverLocation = environment.serverLocation;
constructor(private service: SearchService,
- private http: HttpClient,
- @Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: MyDSpaceConfigurationService) {
+ private http: HttpClient,
+ @Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: MyDSpaceConfigurationService) {
this.service.setServiceOptions(MyDSpaceResponseParsingService, MyDSpaceRequest);
}
@@ -93,25 +91,27 @@ export class MyDSpacePageComponent implements OnInit {
});
this.http.get(this.serverLocation + '/api/eperson/groups/issubscribed', {responseType: 'text'}).subscribe((data: any) => {
- this.subscribeStats = false;
- if ( data === "true")
- {
- this.subscribeStats = true;
- }
+ this.subscribeStats = data === "true";
});
+ }
+ public toggleSubscription() {
+ if (this.subscribeStats) {
+ this.unsubscribeToDepositStats();
+ } else {
+ this.subscribeToDepositStats();
+ }
}
public subscribeToDepositStats() {
- this.http.get(this.serverLocation + '/api/eperson/groups/subscribe', {responseType: 'text'}).subscribe((data: any) => {
- });
- this.subscribeStats = true;
+ this.http.get(this.serverLocation + '/api/eperson/groups/subscribe', {responseType: 'text'}).subscribe(() => {
+ this.subscribeStats = true;
+ });
}
public unsubscribeToDepositStats() {
- this.http.get(this.serverLocation + '/api/eperson/groups/unsubscribe', {responseType: 'text'}).subscribe((data: any) => {
+ this.http.get(this.serverLocation + '/api/eperson/groups/unsubscribe', {responseType: 'text'}).subscribe(() => {
+ this.subscribeStats = false;
});
- this.subscribeStats = false;
}
-
-}
+}
\ No newline at end of file
diff --git a/src/app/shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.html b/src/app/shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.html
index 3316ecaf1cb..ee3808ea1e8 100644
--- a/src/app/shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.html
+++ b/src/app/shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.html
@@ -1,61 +1,38 @@
-
-
{{ type + '.edit.head' | translate }}
-
-
-
-
-
-
-
-
-
+
{{ type + '.edit.head' | translate }}
+
+
+
+
-
@@ -79,4 +56,4 @@
{{ type + '.edit.head' | translate }}
-
+
\ No newline at end of file
diff --git a/src/app/shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.ts b/src/app/shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.ts
index d858121df36..42f81fc28f9 100644
--- a/src/app/shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.ts
+++ b/src/app/shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.ts
@@ -1,16 +1,12 @@
import { Component, OnInit } from '@angular/core';
-
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
-
import { ActivatedRoute, Router } from '@angular/router';
import { RemoteData } from '../../../../core/data/remote-data';
import { isNotEmpty } from '../../../empty.util';
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
-
-import { HttpClient} from '@angular/common/http';
+import { HttpClient } from '@angular/common/http';
import { Collection } from '../../../../core/shared/collection.model';
-
import { ChangeDetectorRef } from '@angular/core';
// UM Used for global config paramter - location of backend.
@@ -21,17 +17,12 @@ import { environment } from '../../../../../environments/environment';
*/
@Component({
selector: 'ds-edit-comcol',
- template: ''
+ templateUrl: './edit-comcol-page.component.html'
})
export class EditComColPageComponent implements OnInit {
- // public subscribeStats$: Promise;
-
- subscribeStats: Boolean;
- showContent: boolean;
-
-
-cd: ChangeDetectorRef;
+ subscribeStats: boolean = false; // Ensure this reflects the current subscription state
+ showContent: boolean = false;
/**
* The type of DSpaceObject (used to create i18n messages)
@@ -64,7 +55,7 @@ cd: ChangeDetectorRef;
public hideReturnButton: boolean;
public constructor(
- protected http: HttpClient,
+ protected http: HttpClient,
protected router: Router,
protected route: ActivatedRoute
) {
@@ -73,7 +64,6 @@ cd: ChangeDetectorRef;
}
ngOnInit(): void {
-
this.initPageParamsByRoute();
this.pages = this.route.routeConfig.children
@@ -85,38 +75,38 @@ cd: ChangeDetectorRef;
this.dsoRD$.subscribe((value: any) => {
let id = value.payload.uuid;
this.type = value.payload.type;
-
- this.http.get(this.serverLocation + '/api/eperson/groups/issubscribed_admin/' + id, {responseType: 'text'}).subscribe((data: any) => {
- if ( data === "true")
- {
- this.subscribeStats = true;
- }
- else {
- this.subscribeStats = false;
- }
+
+ this.http.get(this.serverLocation + '/api/eperson/groups/issubscribed_admin/' + id, { responseType: 'text' }).subscribe((data: any) => {
+ this.subscribeStats = data === "true";
});
});
}
public goToCollectionAdminStats(id: string) {
- var link = document.createElement('a');
- var working_href = 'https://angular.io/guide/router?restrict=1' + 'collid=' + id;
- link.href = working_href;
- link.click();
+ var link = document.createElement('a');
+ var working_href = 'https://angular.io/guide/router?restrict=1' + 'collid=' + id;
+ link.href = working_href;
+ link.click();
}
public subscribeToAdminStats(id: string) {
- this.http.get(this.serverLocation + '/api/eperson/groups/subscribe_admin/' + id, {responseType: 'text'}).subscribe((data: any) => {
+ this.http.get(this.serverLocation + '/api/eperson/groups/subscribe_admin/' + id, { responseType: 'text' }).subscribe(() => {
+ this.subscribeStats = true;
});
-
- this.subscribeStats = true;
}
public unsubscribeToAdminStats(id: string) {
- this.http.get(this.serverLocation + '/api/eperson/groups/unsubscribe_admin/' + id, {responseType: 'text'}).subscribe((data: any) => {
+ this.http.get(this.serverLocation + '/api/eperson/groups/unsubscribe_admin/' + id, { responseType: 'text' }).subscribe(() => {
+ this.subscribeStats = false;
});
+ }
- this.subscribeStats = false;
+ public toggleSubscription(isSubscribed: boolean, coll_uuid: string) {
+ if (isSubscribed) {
+ this.subscribeToAdminStats(coll_uuid);
+ } else {
+ this.unsubscribeToAdminStats(coll_uuid);
+ }
}
/**
@@ -136,4 +126,4 @@ cd: ChangeDetectorRef;
this.hideReturnButton = this.route.routeConfig.children
.find((child: any) => child.path === this.currentPage).data.hideReturnButton;
}
-}
+}
\ No newline at end of file