Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IR generation button fixes #2979

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading