Skip to content

Commit 0d20d8c

Browse files
Merge remote-tracking branch 'origin/maven/fixes/9.1' into maven/release/9.1
2 parents c3105c6 + 14a8012 commit 0d20d8c

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

Frontend/src/app/pages/render-page/render-page.component.ts

+9-12
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ import {
4242
TemporaryStorageService,
4343
TranslationsService,
4444
UIAnimation,
45-
UIConstants,
4645
} from 'ngx-edu-sharing-ui';
4746
import { BehaviorSubject, Subject } from 'rxjs';
4847
import { filter, first, skipWhile, takeUntil } from 'rxjs/operators';
@@ -441,11 +440,11 @@ export class RenderPageComponent implements EventListener, OnInit, OnDestroy, Af
441440
download.elementType = OptionsHelperService.DownloadElementTypes;
442441
// use callback since isEnabled gets ignored
443442
download.customEnabledCallback = async (nodes) => {
444-
return (
445-
this._node.downloadUrl != null &&
446-
(!this._node.properties[RestConstants.CCM_PROP_IO_WWWURL] ||
447-
!this._fromHomeRepository)
448-
);
443+
return this.downloadUrl
444+
? true
445+
: this._node.downloadUrl != null &&
446+
(!this._node.properties[RestConstants.CCM_PROP_IO_WWWURL] ||
447+
!this._fromHomeRepository);
449448
};
450449
download.group = DefaultGroups.View;
451450
download.priority = 25;
@@ -664,6 +663,7 @@ export class RenderPageComponent implements EventListener, OnInit, OnDestroy, Af
664663
this.nodeApi
665664
.getNodeChildobjects(this.sequenceParent.ref.id, this.sequenceParent.ref.repo)
666665
.subscribe((data: NodeList) => {
666+
console.log('add', 'download', download);
667667
this.downloadButton = download;
668668
const options: OptionItem[] = [];
669669
options.splice(0, 0, download);
@@ -687,14 +687,11 @@ export class RenderPageComponent implements EventListener, OnInit, OnDestroy, Af
687687
this.initOptions();
688688
});
689689
}
690-
setDownloadUrl(url: string) {
691-
console.info('url from rendering', url);
692-
if (this.downloadButton != null) {
693-
this.downloadButton.customEnabledCallback = async () => url != null;
694-
}
695690

691+
async setDownloadUrl(url: string) {
692+
console.info('url from rendering', url);
696693
this.downloadUrl = url;
697-
this.initOptions();
694+
this.optionsHelper.refreshComponents();
698695
}
699696

700697
private getSequence(onFinish: () => void) {

Frontend/src/app/services/options-helper.service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ export class OptionsHelperService extends OptionsHelperServiceAbstract implement
221221
// console.info('options helper refresh called but no data previously bound');
222222
return;
223223
}
224+
this.enabledCache = {};
224225
if (this.subscriptions?.length) {
225226
this.subscriptions.forEach((s) => s.unsubscribe());
226227
this.subscriptions = [];

0 commit comments

Comments
 (0)