Skip to content

Commit

Permalink
IR generation button fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonysena authored and chrisknoll committed Nov 14, 2024
1 parent 14679de commit 5d9c82a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,24 @@ <h3 data-bind="css: classes('report-title'), text: getSourceName()"></h3>
<div class="generation-buttons">
<span data-bind="tooltip: $component.isExecutionDisabled($data.source)() ? $component.executionDisabledReason() : null" data-placement="left">
<button class="btn btn-sm btn-primary"
data-bind="attr: {'disabled': $component.isExecutionDisabled($data.source) }, click: (data, event) => $component.runGenerations([$data.source])">
data-bind="attr: {'disabled': $component.isExecutionDisabled($data.source) },
visible: !$component.isInProgress($data),
click: (data, event) => $component.runGenerations([$data.source])">
<i class="fa fa-play"></i>&nbsp;<span data-bind="text: ko.i18n('cohortDefinitions.cohortDefinitionManager.panels.generate', 'Generate')"></span>
</button>
<a role="button" class="btn btn-sm btn-danger"
data-bind="click: (data, event) => $component.cancelExecution($data.source.sourceKey),
visible: $component.isInProgress($data),
attr: {'disabled': $component.isStopping($data)}">
<i class="fa fa-spinner fa-spin"></i>
<span data-bind="text: ko.i18n('common.cancel', 'Cancel')"></span>
</a>
</span>
<span data-bind="tooltip: $component.reportDisabledReason($data.source)">
<button class="btn btn-sm btn-primary" data-bind="attr: {'disabled': !$data.info() || !$data.info().executionInfo.isValid || !$component.hasSourceAccess($data.source.sourceKey)}, click: () => $component.selectSource($data)">
<button class="btn btn-sm btn-primary" data-bind="attr: {'disabled': $component.isInProgress($data) || !$component.hasSourceAccess($data.source.sourceKey)}, click: () => $component.selectSource($data)">
<i class="fa fa-eye"></i> <span data-bind="text: 'View Reports'"></span>
</button>
<button data-bind="attr: {'disabled': !$data.info() || !$data.info().executionInfo.isValid || !$component.hasSourceAccess($data.source.sourceKey)}, visible: $component.isEditable()" class="btn btn-sm btn-danger removeResult">
<button data-bind="attr: {'disabled': $component.isInProgress($data) || !$component.hasSourceAccess($data.source.sourceKey)}, visible: $component.isEditable()" class="btn btn-sm btn-danger removeResult">
<i class="fa fa-trash"></i>
</button>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,7 @@ define([
this.selectedSourceId = sharedState.IRAnalysis.selectedSourceId;
this.selectedSourceId.subscribe(() => this.expandSelectedSource());
this.hasSourceAccess = authApi.hasSourceAccess;
this.generationSources = ko.computed(() => params.sources().map(s => ({
...s.source,
disabled: this.isInProgress(s) || !this.hasSourceAccess(s.source.sourceKey),
disabledReason: this.isInProgress(s)
? ko.i18n('ir.results.generationInProgress', 'Generation is in progress')()
: !this.hasSourceAccess(s.source.sourceKey) ? ko.i18n('ir.results.accessDenied', 'Access denied')() : null,
})));

this.execute = params.execute;
this.cancelExecution = params.cancelExecution;
this.stoppingSources = params.stoppingSources;
Expand Down Expand Up @@ -165,6 +159,16 @@ define([
return (sourceItem.info() && constants.isInProgress(sourceItem.info().executionInfo.status));
}

isStopping(sourceItem) {
return ko.pureComputed(() => {
if (sourceItem.info() && Object.keys(this.stoppingSources()).length > 0) {
return(this.stoppingSources()[sourceItem.source.sourceKey]);
} else {
return(false);
}
});
}

isSummaryLoading(sourceItem) {
return sourceItem.source && this.loadingSummary && this.loadingSummary().find(sourceKey => sourceKey === sourceItem.source.sourceKey);
}
Expand Down

0 comments on commit 5d9c82a

Please sign in to comment.