diff --git a/api/src/org/labkey/api/admin/ImportOptions.java b/api/src/org/labkey/api/admin/ImportOptions.java
index 020a175dbc3..2f917d84f5d 100644
--- a/api/src/org/labkey/api/admin/ImportOptions.java
+++ b/api/src/org/labkey/api/admin/ImportOptions.java
@@ -34,7 +34,6 @@ public class ImportOptions
{
private boolean _skipQueryValidation;
private boolean _createSharedDatasets;
- private boolean _advancedImportOptions;
private boolean _failForUndefinedVisits;
private boolean _includeSubfolders = true; // default to true, unless explicitly disabled (i.e. advanced import to multiple folders option)
private String _containerId;
@@ -83,16 +82,6 @@ public void setCreateSharedDatasets(boolean createSharedDatasets)
_createSharedDatasets = createSharedDatasets;
}
- public boolean isAdvancedImportOptions()
- {
- return _advancedImportOptions;
- }
-
- public void setAdvancedImportOptions(boolean advancedImportOptions)
- {
- _advancedImportOptions = advancedImportOptions;
- }
-
public boolean isFailForUndefinedVisits()
{
return _failForUndefinedVisits;
diff --git a/core/src/org/labkey/core/admin/AdminController.java b/core/src/org/labkey/core/admin/AdminController.java
index a24b9b65076..e993f7dbdf4 100644
--- a/core/src/org/labkey/core/admin/AdminController.java
+++ b/core/src/org/labkey/core/admin/AdminController.java
@@ -5215,7 +5215,6 @@ public static class ImportFolderForm
private boolean _createSharedDatasets;
private boolean _validateQueries;
private boolean _failForUndefinedVisits;
- private boolean _advancedImportOptions;
private String _sourceTemplateFolder;
private String _sourceTemplateFolderId;
private String _origin;
@@ -5250,16 +5249,6 @@ public void setValidateQueries(boolean validateQueries)
_validateQueries = validateQueries;
}
- public boolean isAdvancedImportOptions()
- {
- return _advancedImportOptions;
- }
-
- public void setAdvancedImportOptions(boolean advancedImportOptions)
- {
- _advancedImportOptions = advancedImportOptions;
- }
-
public String getSourceTemplateFolder()
{
return _sourceTemplateFolder;
@@ -5397,17 +5386,8 @@ public boolean handlePost(ImportFolderForm form, BindException errors) throws Ex
options.setSkipQueryValidation(!form.isValidateQueries());
options.setCreateSharedDatasets(form.isCreateSharedDatasets());
options.setFailForUndefinedVisits(form.isFailForUndefinedVisits());
- options.setAdvancedImportOptions(form.isAdvancedImportOptions());
options.setActivity(ComplianceService.get().getCurrentActivity(getViewContext()));
- // if the option is selected to show the advanced import options, redirect to there
- if (form.isAdvancedImportOptions())
- {
- // archiveFile is the zip of the source template folder located in the current container's unzip dir
- _successURL = pipelineUrlProvider.urlStartFolderImport(getContainer(), fiConfig.archiveFile, options, fiConfig.fromTemplateSourceFolder);
- return true;
- }
-
// finally, create the study or folder import pipeline job
_successURL = pipelineUrlProvider.urlBegin(container);
PipelineService.get().runFolderImportJob(container, user, url, archiveXml, fiConfig.originalFileName, pipelineRoot, options);
diff --git a/core/src/org/labkey/core/admin/importFolder.jsp b/core/src/org/labkey/core/admin/importFolder.jsp
index 98ce9fc6bc8..7407d28a65c 100644
--- a/core/src/org/labkey/core/admin/importFolder.jsp
+++ b/core/src/org/labkey/core/admin/importFolder.jsp
@@ -47,7 +47,6 @@
Container project = c.getProject();
String requestOrigin = (request.getParameter("origin") != null) ? request.getParameter("origin") : "here";
boolean canCreateSharedDatasets = false;
- boolean isAdvancedImportOptionEnabled = OptionalFeatureService.get().isFeatureEnabled("advancedImportFlag");
String sharedDatasetsHelpText = "By default, datasets will be created in this container. For Dataspace projects, shared " +
"datasets are created at the project level so that they can be used by each of the study folders in the project.";
@@ -180,18 +179,6 @@
- <%
- if (isAdvancedImportOptionEnabled)
- {
- %>
-
|
<%= button(action + " " + noun).submit(true) %>
diff --git a/pipeline/src/org/labkey/pipeline/PipelineController.java b/pipeline/src/org/labkey/pipeline/PipelineController.java
index c2e296f1c4b..a3eb64035ad 100644
--- a/pipeline/src/org/labkey/pipeline/PipelineController.java
+++ b/pipeline/src/org/labkey/pipeline/PipelineController.java
@@ -43,7 +43,6 @@
import org.labkey.api.collections.IntHashMap;
import org.labkey.api.compliance.ComplianceService;
import org.labkey.api.data.Container;
-import org.labkey.api.data.ContainerFilter;
import org.labkey.api.data.ContainerManager;
import org.labkey.api.data.SimpleFilter;
import org.labkey.api.data.TableSelector;
@@ -84,7 +83,6 @@
import org.labkey.api.security.roles.Role;
import org.labkey.api.security.roles.RoleManager;
import org.labkey.api.settings.AdminConsole;
-import org.labkey.api.settings.OptionalFeatureService;
import org.labkey.api.trigger.TriggerConfiguration;
import org.labkey.api.util.DateUtil;
import org.labkey.api.util.FileUtil;
@@ -1202,8 +1200,6 @@ protected ModelAndView getErrorView(Exception e, BindException errors) throws Ex
@RequiresPermission(AdminPermission.class)
public class StartFolderImportAction extends FormViewAction
{
- private final List _importContainers = new ArrayList<>();
-
private String _navTrail = "Import Folder";
private java.nio.file.Path _archiveFile;
@@ -1223,60 +1219,11 @@ else if (form.getFilePath() == null)
{
_archiveFile = PipelineManager.validateFolderImportFileNioPath(form.getFilePath(), currentPipelineRoot, errors);
- if (OptionalFeatureService.get().isFeatureEnabled(PipelineModule.ADVANCED_IMPORT_FLAG))
- {
- // Be sure that the set of folder to apply the import to match the setting to enable/disable them
- if (form.isApplyToMultipleFolders() && (form.getFolderRowIds() == null || form.getFolderRowIds().isEmpty()))
- {
- errors.reject(ERROR_MSG, "At least one folder must be selected when 'apply to multiple folders' is enabled.");
- }
- else if (!form.isApplyToMultipleFolders() && form.getFolderRowIds() != null)
- {
- errors.reject(ERROR_MSG, "Folder RowIds provided when 'apply to multiple folders' not enabled.");
- }
- }
-
- // Be sure that the user has admin permissions to all selected folders and that all selected folders exist
- if (form.getFolderRowIds() != null)
- {
- for (Integer rowId : form.getFolderRowIds())
- {
- Container selectedContainer = ContainerManager.getForRowId(rowId);
- if (selectedContainer == null)
- errors.reject(ERROR_MSG, "Folder does not exist for selected RowId: " + rowId + ".");
- else if (!selectedContainer.hasPermission(getUser(), AdminPermission.class))
- errors.reject(ERROR_MSG, "You do not have the required permissions for the selected folder: " + selectedContainer.getTitle() + ".");
- else
- _importContainers.add(selectedContainer);
- }
- }
- else
- {
- // default to importing the archive to the current container
- _importContainers.add(getContainer());
- }
-
- // Be sure that each import container has a valid pipeline root
- for (Container container : _importContainers)
- {
- PipeRoot pipelineRoot = PipelineService.get().findPipelineRoot(container);
- if (!PipelineService.get().hasValidPipelineRoot(container) || null == pipelineRoot)
- {
- errors.reject(ERROR_MSG, "Pipeline root not found for selected container: " + container.getTitle() + ".");
- }
- }
-
- if (OptionalFeatureService.get().isFeatureEnabled(PipelineModule.ADVANCED_IMPORT_FLAG))
+ // Be sure that import container has a valid pipeline root
+ PipeRoot pipelineRoot = PipelineService.get().findPipelineRoot(getContainer());
+ if (!PipelineService.get().hasValidPipelineRoot(getContainer()) || null == pipelineRoot)
{
- // Be sure that the provided data types to import match the setting to enable/disable them
- if (form.isSpecificImportOptions() && (form.getDataTypes() == null || form.getDataTypes().isEmpty()))
- {
- errors.reject(ERROR_MSG, "At least one folder data type must be selected when 'select specific objects to import' is enabled.");
- }
- else if (!form.isSpecificImportOptions() && form.getDataTypes() != null)
- {
- errors.reject(ERROR_MSG, "Folder data types provided when 'select specific objects to import' not enabled.");
- }
+ errors.reject(ERROR_MSG, "Pipeline root not found for selected container: " + getContainer().getTitle() + ".");
}
}
}
@@ -1302,32 +1249,23 @@ public boolean handlePost(StartFolderImportForm form, BindException errors) thro
if (Files.exists(_archiveFile))
{
- // iterate over the selected containers, or just the current container in the default case, and unzip the archive if necessary
- for (Container container : _importContainers)
- {
- java.nio.file.Path archiveXml = PipelineManager.getArchiveXmlFile(container, _archiveFile, "folder.xml", errors);
- if (errors.hasErrors())
- return false;
- containerArchiveXmlMap.put(container, archiveXml);
- }
+ java.nio.file.Path archiveXml = PipelineManager.getArchiveXmlFile(getContainer(), _archiveFile, "folder.xml", errors);
+ if (errors.hasErrors())
+ return false;
- // create a new pipeline import job for applying the imported archive to each selected container
- for (Container container : _importContainers)
- {
- ImportOptions options = new ImportOptions(container.getId(), getUser().getUserId());
- options.setSkipQueryValidation(!form.isValidateQueries());
- options.setCreateSharedDatasets(form.isCreateSharedDatasets());
- options.setFailForUndefinedVisits(form.isFailForUndefinedVisits());
- options.setDataTypes(form.getDataTypes());
- options.setIncludeSubfolders(!form.isApplyToMultipleFolders());
-
- ComplianceService complianceService = ComplianceService.get();
- if (null != complianceService)
- options.setActivity(complianceService.getCurrentActivity(getViewContext()));
-
- success = success && createImportPipelineJob(container, user, options, containerArchiveXmlMap.get(container));
- }
+ containerArchiveXmlMap.put(getContainer(), archiveXml);
+
+ ImportOptions options = new ImportOptions(getContainer().getId(), getUser().getUserId());
+ options.setSkipQueryValidation(!form.isValidateQueries());
+ options.setCreateSharedDatasets(form.isCreateSharedDatasets());
+ options.setFailForUndefinedVisits(form.isFailForUndefinedVisits());
+ options.setDataTypes(form.getDataTypes());
+
+ ComplianceService complianceService = ComplianceService.get();
+ options.setActivity(complianceService.getCurrentActivity(getViewContext()));
+
+ success = createImportPipelineJob(getContainer(), user, options, containerArchiveXmlMap.get(getContainer()));
}
// the original archive file would have been placed in the current container unzip dir, clean that up
@@ -1353,19 +1291,8 @@ private boolean createImportPipelineJob(Container container, User user, ImportOp
@Override
public URLHelper getSuccessURL(StartFolderImportForm form)
{
- // default case, go to the pipeline jobs page for the current container
- // otherwise go to the pipeline jobs page for the project and show all subfolders
- Container c = getContainer();
- if (_importContainers.size() == 1 && _importContainers.get(0).equals(c))
- {
- return urlProvider(PipelineStatusUrls.class).urlBegin(c);
- }
- else
- {
- ActionURL url = urlProvider(PipelineStatusUrls.class).urlBegin(c.getProject());
- url.addParameter("StatusFiles.containerFilterName", ContainerFilter.Type.CurrentAndSubfolders.name());
- return url;
- }
+ // go to the pipeline jobs page for the current container
+ return urlProvider(PipelineStatusUrls.class).urlBegin(getContainer());
}
@Override
@@ -1382,8 +1309,6 @@ public static class StartFolderImportForm
private String _filePath;
private boolean _validateQueries;
private boolean _createSharedDatasets;
- private boolean _specificImportOptions;
- private boolean _applyToMultipleFolders;
private boolean _isCloudRoot; // Remove as part of Issue #43835
private boolean _failForUndefinedVisits;
private Set _dataTypes;
@@ -1419,26 +1344,6 @@ public void setCreateSharedDatasets(boolean createSharedDatasets)
_createSharedDatasets = createSharedDatasets;
}
- public boolean isSpecificImportOptions()
- {
- return _specificImportOptions;
- }
-
- public void setSpecificImportOptions(boolean specificImportOptions)
- {
- _specificImportOptions = specificImportOptions;
- }
-
- public boolean isApplyToMultipleFolders()
- {
- return _applyToMultipleFolders;
- }
-
- public void setApplyToMultipleFolders(boolean applyToMultipleFolders)
- {
- _applyToMultipleFolders = applyToMultipleFolders;
- }
-
public boolean isFailForUndefinedVisits()
{
return _failForUndefinedVisits;
@@ -1749,7 +1654,6 @@ private ActionURL addStartImportParameters(ActionURL url, @NotNull java.nio.file
url.addParameter("createSharedDatasets", options == null || options.isCreateSharedDatasets());
if (options != null)
{
- url.addParameter("advancedImportOptions", options.isAdvancedImportOptions());
url.addParameter("fromZip", true);
url.addParameter("fromTemplateSourceFolder", fromTemplateSourceFolder);
}
diff --git a/pipeline/src/org/labkey/pipeline/PipelineModule.java b/pipeline/src/org/labkey/pipeline/PipelineModule.java
index 570227f29fc..bc3fcda9dcc 100644
--- a/pipeline/src/org/labkey/pipeline/PipelineModule.java
+++ b/pipeline/src/org/labkey/pipeline/PipelineModule.java
@@ -47,8 +47,6 @@
import org.labkey.api.pipeline.trigger.PipelineTriggerRegistry;
import org.labkey.api.pipeline.trigger.PipelineTriggerType;
import org.labkey.api.security.User;
-import org.labkey.api.settings.OptionalFeatureFlag;
-import org.labkey.api.settings.OptionalFeatureService;
import org.labkey.api.usageMetrics.UsageMetricsService;
import org.labkey.api.util.ContextListener;
import org.labkey.api.util.PageFlowUtil;
@@ -105,7 +103,6 @@
public class PipelineModule extends SpringModule implements ContainerManager.ContainerListener
{
private static final Logger _log = LogHelper.getLogger(PipelineModule.class, "Module responsible for managing pipeline jobs and logs");
- public static final String ADVANCED_IMPORT_FLAG = "advancedImportFlag";
@Override
public String getName()
@@ -216,15 +213,6 @@ protected void startupAfterSpringConfig(ModuleContext moduleContext)
AuditLogService.get().registerAuditType(new ProtocolManagementAuditProvider());
- OptionalFeatureService.get().addFeatureFlag(
- new OptionalFeatureFlag(
- ADVANCED_IMPORT_FLAG,
- "Restore 'Advanced Import Options' during Folder import",
- "This option will be removed in LabKey Server v25.11.",
- false, false, OptionalFeatureService.FeatureType.Deprecated
- )
- );
-
UsageMetricsService.get().registerUsageMetrics(getName(), () -> {
DbSchema pipelineSchema = PipelineSchema.getInstance().getSchema();
SqlDialect dialect = PipelineSchema.getInstance().getSchema().getSqlDialect();
diff --git a/pipeline/src/org/labkey/pipeline/startPipelineImport.jsp b/pipeline/src/org/labkey/pipeline/startPipelineImport.jsp
index 05dc0d1fad4..97efcf710e3 100644
--- a/pipeline/src/org/labkey/pipeline/startPipelineImport.jsp
+++ b/pipeline/src/org/labkey/pipeline/startPipelineImport.jsp
@@ -59,7 +59,6 @@
Study study = studyService != null ? studyService.getStudy(getContainer()) : null;
TimepointType timepointType = study != null ? study.getTimepointType() : null;
- boolean isAdvancedImportOptionEnabled = OptionalFeatureService.get().isFeatureEnabled(PipelineModule.ADVANCED_IMPORT_FLAG);
%>
@@ -92,9 +91,6 @@ Ext4.onReady(function()
canCreateSharedDatasets: <%=canCreateSharedDatasets%>,
isCreateSharedDatasets: <%=bean.isCreateSharedDatasets()%>,
isValidateQueries: <%=bean.isValidateQueries()%>,
- showAdvancedImportOptions: <%=isAdvancedImportOptionEnabled%>,
- isSpecificImportOptions: <%=bean.isSpecificImportOptions()%>,
- isApplyToMultipleFolders: <%=bean.isApplyToMultipleFolders()%>,
isFailForUndefinedVisits: <%=bean.isFailForUndefinedVisits()%>,
isCloudRoot: <%=bean.isCloudRoot()%>, // Remove as part of Issue #43835
showFailForUndefinedVisits: <%=(timepointType == null || timepointType == TimepointType.VISIT) && ((study == null) || !study.isFailForUndefinedTimepoints())%>
diff --git a/pipeline/webapp/pipeline/ImportAdvancedOptions.js b/pipeline/webapp/pipeline/ImportAdvancedOptions.js
index 93c2d3e3f32..9f968b2700b 100644
--- a/pipeline/webapp/pipeline/ImportAdvancedOptions.js
+++ b/pipeline/webapp/pipeline/ImportAdvancedOptions.js
@@ -18,12 +18,9 @@ Ext4.define('LABKEY.import.OptionsPanel', {
canCreateSharedDatasets: false,
isCreateSharedDatasets: false,
isValidateQueries: true,
- isSpecificImportOptions: false,
- isApplyToMultipleFolders: false,
isFailForUndefinedVisits: false,
showFailForUndefinedVisits: true,
isCloudRoot: false,
- showAdvancedImportOptions: false,
initComponent: function()
{
@@ -131,32 +128,6 @@ Ext4.define('LABKEY.import.OptionsPanel', {
});
}
- if (this.showAdvancedImportOptions) {
- data.push({
- header: 'Advanced Import Options',
- description: 'By default, all objects and settings from the import archive will be used. If you would '
- + 'like to select a subset of those import objects, check the box below to see the full list of '
- + 'folder archive objects to be imported.',
- name: 'specificImportOptions',
- initChecked: this.isSpecificImportOptions ? "checked" : "",
- isChecked: this.isSpecificImportOptions,
- label: 'Select specific objects to import',
- optionsForm: this.getSpecificImportOptionsForm
- });
- data.push({
- header: null,
- description: 'By default, the imported archive is only applied to the current folder. If you would like to '
- + 'apply this imported archive to multiple folders, check the box below to see additional folders for this project. '
- + 'The import archive will be applied to all selected folders.',
- name: 'applyToMultipleFolders',
- initChecked: this.isApplyToMultipleFolders ? "checked" : "",
- isChecked: this.isApplyToMultipleFolders,
- hidden: this.isCloudRoot, // Remove Cloud flag as part of fix Issue #43835
- label: 'Apply to multiple folders',
- optionsForm: this.getApplyToMultipleFoldersForm
- });
- }
-
this.optionsStore = Ext4.create('Ext.data.Store', {
fields: ['header', 'description', 'name', 'initChecked', 'isChecked', 'label', 'hidden', 'optionsForm'],
data: data
@@ -166,53 +137,12 @@ Ext4.define('LABKEY.import.OptionsPanel', {
return this.optionsStore;
},
- getSpecificImportOptionsForm : function(renderTo)
- {
- if (renderTo)
- {
- this.specificImportOptionsForm = Ext4.create('LABKEY.import.SpecificImportOptions', {
- importers: this.importers,
- hidden: !this.isSpecificImportOptions
- });
-
- this.specificImportOptionsForm.on('render', this.updatePanelHeight, this);
- this.specificImportOptionsForm.render(renderTo);
- }
-
- return this.specificImportOptionsForm;
- },
-
- getApplyToMultipleFoldersForm : function(renderTo)
- {
- if (renderTo)
- {
- this.applyToMultipleFoldersForm = Ext4.create('LABKEY.import.ApplyToMultipleFolders', {
- formId: this.formId,
- hidden: !this.isApplyToMultipleFolders,
- rootVisible: this.isProjectAdmin
- });
-
- this.applyToMultipleFoldersForm.on('render', this.updatePanelHeight, this);
- this.applyToMultipleFoldersForm.render(renderTo);
- }
-
- return this.applyToMultipleFoldersForm;
- },
-
updatePanelHeight : function()
{
if (this.baseHeight == null)
this.baseHeight = this.getHeight();
- var specificImportOptionsHeight = 0;
- if (Ext4.isDefined(this.getSpecificImportOptionsForm()) && this.getSpecificImportOptionsForm().isVisible())
- specificImportOptionsHeight = this.getSpecificImportOptionsForm().getHeight();
-
- var applyMultipleFoldersHeight = 0;
- if (Ext4.isDefined(this.getApplyToMultipleFoldersForm()) && this.getApplyToMultipleFoldersForm().isVisible())
- applyMultipleFoldersHeight = this.getApplyToMultipleFoldersForm().getHeight();
-
- this.setHeight(this.baseHeight + specificImportOptionsHeight + applyMultipleFoldersHeight + this.getSubmitButton().getHeight());
+ this.setHeight(this.baseHeight + this.getSubmitButton().getHeight());
},
getSubmitButton : function()
@@ -260,383 +190,6 @@ Ext4.define('LABKEY.import.OptionsPanel', {
}
});
-Ext4.define('LABKEY.import.SpecificImportOptions', {
- extend: 'Ext.form.Panel',
-
- cls: 'advanced-options-panel',
- layout: 'anchor',
- width: 335,
-
- importers: [],
-
- initComponent: function()
- {
- var advancedImportItems = [this.getImportOptionsHeaderConfig('Folder')],
- additionalImportItems = [];
-
- Ext4.each(this.importers, function(importer)
- {
- var dataType = importer['dataType'],
- children = importer['children'],
- showDisabled = !importer['isValidForImportArchive'];
-
- if (!Ext4.isArray(children))
- {
- advancedImportItems.push(this.getImportOptionInputConfig(dataType, showDisabled));
- }
- else
- {
- additionalImportItems.push(this.getImportOptionsHeaderConfig(dataType));
- additionalImportItems.push(this.getImportOptionInputConfig(dataType, showDisabled, null, true));
- Ext4.each(children, function(child)
- {
- additionalImportItems.push(this.getImportOptionInputConfig(child.dataType, !child.isValidForImportArchive, dataType));
- }, this);
- }
- }, this);
-
- // change the form panel layout based on how many columns we have
- var items = advancedImportItems;
- if (additionalImportItems.length > 0)
- {
- this.width = this.width + 335;
- this.layout = 'column';
-
- items = [{
- border: false,
- width: 315,
- bodyStyle: 'padding-right: 20px;',
- items: advancedImportItems
- },{
- border: false,
- width: 315,
- items: additionalImportItems
- }];
- }
-
- this.items = items;
-
- this.callParent();
- },
-
- toggleState : function(checked)
- {
- this.setVisible(checked);
-
- // set all folder import type checkboxes to match this checked state
- Ext4.each(this.getAllVisibleInputBoxes(), function(box)
- {
- var cb = this.getInputFromBox(box);
-
- // don't update checked state of the disabled checkbox inputs
- if (!cb.disabled)
- cb.checked = checked;
- }, this);
- },
-
- getAllVisibleInputBoxes : function()
- {
- return this.query('box[cls=advanced-options-input]');
- },
-
- getInputFromBox : function(box)
- {
- return Ext4.dom.Query.selectNode('input', box.getEl().dom);
- },
-
- getImportOptionsHeaderConfig : function(header)
- {
- return {
- xtype: 'box',
- cls: 'advanced-options-header',
- html: ' ' + header + ' objects to import: '
- + ''
- };
- },
-
- getImportOptionInputConfig : function(dataType, showDisabled, parent, hide)
- {
- var checked = hide || this.hidden || showDisabled ? '' : ' checked',
- disabled = !showDisabled ? '' : ' disabled',
- parentAttr = parent ? 'parentDataType="' + parent + '"' : '';
-
- return {
- xtype: 'box',
- cls: hide ? 'advanced-options-hide' : 'advanced-options-input',
- html: '',
- listeners: {
- render: function(b) {
- if (showDisabled)
- {
- Ext4.create('Ext.tip.ToolTip', {
- target: b.getEl(),
- showDelay: 1000,
- html: 'This object is disabled because the import archive does not contain ' + dataType.toLowerCase() + '.'
- });
- }
- }
- }
- }
- },
-
- beforeSubmit : function()
- {
- // check any hidden parent dataType checkboxes that should be checked (i.e. has at least one child checked)
- Ext4.each(this.query('box[cls=advanced-options-hide]'), function(hiddenBox)
- {
- var hiddenInput = this.getInputFromBox(hiddenBox);
- Ext4.each(this.getAllVisibleInputBoxes(), function(box)
- {
- var visibleInput = this.getInputFromBox(box),
- parentDataType = visibleInput.getAttribute('parentDataType');
-
- if (parentDataType == hiddenInput.value && visibleInput.checked)
- {
- hiddenInput.checked = true;
- return false; // break;
- }
- }, this);
- }, this);
-
- // no confirmation msg for this advanced import option section
- return null;
- }
-});
-
-Ext4.define('LABKEY.import.ApplyToMultipleFolders', {
- extend: 'Ext.tree.Panel',
-
- cls: 'apply-multiple-panel',
- width: 670,
- height: 300,
- autoScroll: true,
- rootVisible: true,
-
- formId: null,
- projectRoot: null,
- store: null,
-
- initComponent: function()
- {
- this.dockedItems = [this.getTopDockedPanel(), this.getBottomDockedPanel()];
- this.callParent();
- this.on('checkchange', this.onCheckchange, this);
- // load the tree root information the first time the section is shown
- if (!this.hidden)
- this.getProjectRootNode();
- },
-
- getTopDockedPanel : function()
- {
- if (!this.topDockedPanel)
- {
- this.topDockedPanel = Ext4.create('Ext.panel.Panel', {
- dock: 'top',
- border: false,
- cls: 'multiple-folder-footer',
- items: [{
- xtype: 'checkbox',
- boxLabel: 'Selecting parent folders selects all children',
- checked: false,
- inputValue: 'parentSelectsAllChildren',
- id : 'folderautoselect'
- }]
- });
- }
- return this.topDockedPanel;
- },
-
- getBottomDockedPanel : function()
- {
- if (!this.bottomDockedPanel)
- {
- this.bottomDockedPanel = Ext4.create('Ext.panel.Panel', {
- dock: 'bottom',
- border: false,
- cls: 'multiple-folder-footer',
- html: 'Note: any subfolders from the imported archive will not be applied when multiple folders are selected.'
- });
- }
-
- return this.bottomDockedPanel;
- },
-
- getProjectFolderTreeStore : function()
- {
- if (!this.treeStore)
- {
- this.treeStore = Ext4.create('Ext.data.TreeStore', {
- model: 'LABKEY.import.FolderTreeStore',
- root: this.projectRoot,
- proxy: {
- type: 'ajax',
- url: LABKEY.ActionURL.buildURL('core', 'getExtContainerAdminTree.api', null, {
- requiredPermission: 'org.labkey.api.security.permissions.AdminPermission',
- useTitles: true,
- annotateLeaf: true
- })
- }
- });
- }
-
- return this.treeStore
- },
-
- getProjectRootNode : function()
- {
- LABKEY.Ajax.request({
- url : LABKEY.ActionURL.buildURL('core', 'getContainerTreeRootInfo.api'),
- scope: this,
- success: function(response)
- {
- var resp = Ext4.decode(response.responseText),
- projectInfo = resp.project ? resp.project : resp.current;
-
- this.currentRowId = resp.current.id;
-
- this.projectRoot = {
- id: projectInfo.id,
- expanded: true,
- containerPath: projectInfo.path,
- text: projectInfo.title,
- isProject: true
- };
-
- // by default, select the current container node in the tree
- this.getProjectFolderTreeStore().on('load', function(store, node){
- var record = store.getNodeById(resp.current.id);
- if (record)
- this.setChecked(record);
- }, this, {single: true});
-
- this.bindStore(this.getProjectFolderTreeStore());
- }
- });
- },
-
- setChecked : function(record)
- {
- record.set('checked', true);
- },
-
- clearChildRecords: function(record)
- {
- if(!record.isLeaf()){
- record.cascadeBy(function(record){
- record.set('checked', false);
- });
- }
- },
-
- clearParentRecords: function(record)
- {
- if(record.parentNode){
- record.parentNode.set('checked', false);
- this.clearParentRecords(record.parentNode);
- }
- },
-
- selectChildRecords: function(record)
- {
- // first expand all child folders so the user can see what folders are being auto checked
- record.cascadeBy(function(record){
- if(!record.isLeaf())
- record.expand();
- });
-
- // check all child folders
- if (!record.isLeaf()){
- record.cascadeBy(function(record){
- record.set('checked', true);
- });
- }
- },
-
- onCheckchange : function(record, checked, opts)
- {
- if (Ext4.getCmp('folderautoselect').getValue(true)) {
- // user has enabled the 'Selecting parent folders selects all children' option
- // selecting parent folder autoselects all children folders
- // [disabled pending customer feedback] deselecting a child folder deselects the parent folder
- if(!checked){
- this.clearChildRecords(record);
- // this.clearParentRecords(record);
- }
- else {
- this.selectChildRecords(record);
- }
- }
- },
-
- toggleState : function(checked)
- {
- // load the tree root information the first time the section is shown
- if (checked && this.projectRoot == null)
- this.getProjectRootNode();
-
- this.setVisible(checked);
-
- // on state hide, remove all checked records
- if (!checked && this.projectRoot != null)
- {
- Ext4.each(this.getView().getChecked(), function(record)
- {
- record.set('checked', false);
- }, this);
-
- // reselect the current container node
- this.getSelectionModel().deselectAll();
- var currentNode = this.getProjectFolderTreeStore().getNodeById(this.currentRowId);
- currentNode.set('checked', true);
-
- // expand the tree to the parent of the selected currentNode
- if (currentNode.parentNode)
- this.expandPath(currentNode.parentNode.getPath());
- }
- },
-
- beforeSubmit : function()
- {
- var targetFolderCount = 0;
-
- // remove any previously added hidden inputs, if this function was previously called
- Ext4.each(Ext4.dom.Query.select('input.advanced-import-target'), function(hiddenInput)
- {
- Ext4.removeNode(hiddenInput);
- });
-
- // add hidden form elements for each of the selected folders
- if (!this.hidden && this.formId != null)
- {
- var form = Ext4.get(this.formId);
-
- Ext4.each(this.getView().getChecked(), function(record)
- {
- targetFolderCount++;
-
- form.createChild({
- tag: 'input',
- type: 'hidden',
- name: 'folderRowIds',
- "class": 'advanced-import-target',
- value: record.get('id')
- });
- }, this);
- }
-
- // return confirmation msg about how many target folders are selected
- if (targetFolderCount > 0)
- {
- return "The import archive will be applied to " + targetFolderCount + " selected target folder"
- + (targetFolderCount > 1 ? "s" : "") + ". A separate pipeline import job will be created for each. "
- + "This action cannot be undone.";
- }
- else
- return null;
- }
-});
-
Ext4.define('LABKEY.import.FolderTreeStore', {
extend: 'Ext.data.Model',
fields: [
|