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

add help panel to init workflow #1407 #1426

Merged
merged 15 commits into from
Nov 13, 2023
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 @@ -7,12 +7,59 @@ define([
], function(ko, arches, afsSettings, JsonErrorAlertViewModel, initWorkflowTemplate) {

var InitWorkflow = function(params) {
this.workflows = params.workflows.map(function(wf){
wf.url = arches.urls.plugin(wf.slug);
return wf;
}, this);
this.workflows = ko.observableArray([]);
this.helpTemplateData = ko.observableArray([]);

fetch(arches.urls.api_plugins).then(resp => {
if (resp.ok) {
return resp.json();
}
else {
params.alert(new JsonErrorAlertViewModel('ep-alert-red', resp.responseJSON));
}
}).then(respJSON => {
let workflows = respJSON.reduce((acc, plugin) => {
if (plugin.config.is_workflow) {
plugin.url = arches.urls.plugin(plugin.slug);
acc.push(plugin);
}
return acc;
}, []);

// filters out the chemical analysis and chemical image workflows if cloud storage is not enabled.
if(!afsSettings.cloudStorage.enabled){
workflows = workflows.filter(
workflow => {
return !['c206cfc6-6b4a-481e-a018-8da72aeb7074', "af06e949-5e16-49f0-b23e-e8529e8ce321"].includes(workflow.pluginid);
}
);
}

this.shouldShowIncompleteWorkflowsModal = ko.observable(false);
this.workflows(workflows);
this.helpTemplateData(workflows.reduce((acc, workflow) => {
if (workflow.helptemplate) {
acc.push({'text': workflow.name, 'id': workflow.helptemplate});
}

return acc;
}, []));
});

this.shouldShowWorkflowHelp = ko.observable(false);
this.helpTemplateUrl = ko.observable();
this.isHelpTemplateLoading = ko.observable();
this.selectedHelpTemplate = ko.observable();
this.selectedHelpTemplate.subscribe(helpTemplateName => {
if (helpTemplateName) {
this.isHelpTemplateLoading(true);
this.helpTemplateUrl(arches.urls.help_template + `?template=${helpTemplateName}`);
}
else {
this.helpTemplateUrl(null);
}
})
chrabyrd marked this conversation as resolved.
Show resolved Hide resolved

this.shouldShowIncompleteWorkflowsModal = ko.observable(false);
this.requestingUserIsSuperuser = ko.observable(false);

this.incompleteWorkflows = ko.observableArray([]);
Expand All @@ -27,7 +74,7 @@ define([
return resp.json();
}
else {
params.alert(new JsonErrorAlertViewModel('ep-alert-red', resp.responseJSON))
params.alert(new JsonErrorAlertViewModel('ep-alert-red', resp.responseJSON));
}
}).then(respJSON => {
this.incompleteWorkflows(respJSON['incomplete_workflows'].map(workflowData => {
Expand All @@ -39,11 +86,6 @@ define([

this.requestingUserIsSuperuser(respJSON['requesting_user_is_superuser']);
});

// filters out the chemical image workflow, if cloud storage is not enabled.
if(!afsSettings.cloudStorage.enabled){
this.workflows = this.workflows.filter(workflow => workflow.workflowid != 'c206cfc6-6b4a-481e-a018-8da72aeb7074');
}
};

return ko.components.register('init-workflow', {
Expand Down
Loading
Loading