Skip to content

Commit 9a7201a

Browse files
Issue 49544: Deprecate the ability to select specific objects to import and apply import to multiple folders under the advanced import options (#6419)
* Move 'Advanced Import Options' from admin-importFolder.view behind 'Deprecated' flag. * Move 'Show advanced import options' from pipeline-startFolderImport.view behind 'Deprecated' flag. * Display 'Create shared datasets' and 'Fail import for undefined visits' with tooltips on admin-importFolder.view page.
1 parent 214efdf commit 9a7201a

File tree

7 files changed

+146
-76
lines changed

7 files changed

+146
-76
lines changed

api/src/org/labkey/api/jsp/JspBase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ public HelpPopupBuilder helpPopup(String title, String helpText, boolean htmlHel
537537
return PageFlowUtil.popupHelp(HtmlString.unsafe(helpText), title);
538538
}
539539

540-
public HelpPopupBuilder helpPopup(String title, HtmlString helpHtml)
540+
public HelpPopupBuilder helpPopup(String title, Renderable helpHtml)
541541
{
542542
return PageFlowUtil.popupHelp(helpHtml, title);
543543
}
@@ -547,7 +547,7 @@ public HelpPopupBuilder helpPopup(String title, String helpText, boolean htmlHel
547547
return helpPopup(title, helpText, htmlHelpText).width(width);
548548
}
549549

550-
public HelpPopupBuilder helpPopup(String title, HtmlString helpHtml, int width)
550+
public HelpPopupBuilder helpPopup(String title, Renderable helpHtml, int width)
551551
{
552552
return PageFlowUtil.popupHelp(helpHtml, title).width(width);
553553
}

core/src/org/labkey/core/admin/AdminController.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5208,6 +5208,7 @@ public static class ImportFolderForm
52085208
{
52095209
private boolean _createSharedDatasets;
52105210
private boolean _validateQueries;
5211+
private boolean _failForUndefinedVisits;
52115212
private boolean _advancedImportOptions;
52125213
private String _sourceTemplateFolder;
52135214
private String _sourceTemplateFolderId;
@@ -5228,6 +5229,16 @@ public boolean isValidateQueries()
52285229
return _validateQueries;
52295230
}
52305231

5232+
public boolean isFailForUndefinedVisits()
5233+
{
5234+
return _failForUndefinedVisits;
5235+
}
5236+
5237+
public void setFailForUndefinedVisits(boolean failForUndefinedVisits)
5238+
{
5239+
_failForUndefinedVisits = failForUndefinedVisits;
5240+
}
5241+
52315242
public void setValidateQueries(boolean validateQueries)
52325243
{
52335244
_validateQueries = validateQueries;
@@ -5379,6 +5390,7 @@ public boolean handlePost(ImportFolderForm form, BindException errors) throws Ex
53795390
ImportOptions options = new ImportOptions(getContainer().getId(), user.getUserId());
53805391
options.setSkipQueryValidation(!form.isValidateQueries());
53815392
options.setCreateSharedDatasets(form.isCreateSharedDatasets());
5393+
options.setFailForUndefinedVisits(form.isFailForUndefinedVisits());
53825394
options.setAdvancedImportOptions(form.isAdvancedImportOptions());
53835395
options.setActivity(ComplianceService.get().getCurrentActivity(getViewContext()));
53845396

core/src/org/labkey/core/admin/importFolder.jsp

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
<%@ page import="org.labkey.api.view.HttpView" %>
2929
<%@ page import="org.labkey.api.view.template.ClientDependencies" %>
3030
<%@ page import="org.labkey.core.admin.AdminController.ImportFolderForm" %>
31+
<%@ page import="org.labkey.api.settings.OptionalFeatureService" %>
32+
<%@ page import="org.labkey.api.util.DOM" %>
33+
<%@ page import="static org.labkey.api.util.DOM.SPAN" %>
34+
<%@ page import="static org.labkey.api.util.DOM.Attribute.style" %>
3135
<%@ taglib prefix="labkey" uri="http://www.labkey.org/taglib" %>
3236
<%@ page extends="org.labkey.api.jsp.JspBase" %>
3337
<%!
@@ -42,10 +46,23 @@
4246
Container c = getViewContext().getContainerNoTab();
4347
Container project = c.getProject();
4448
String requestOrigin = (request.getParameter("origin") != null) ? request.getParameter("origin") : "here";
45-
boolean isStudyRequest = requestOrigin.equals("Study") || requestOrigin.equals("Reload");
4649
boolean canCreateSharedDatasets = false;
50+
boolean isAdvancedImportOptionEnabled = OptionalFeatureService.get().isFeatureEnabled("advancedImportFlag");
4751
48-
if (isStudyRequest && !c.isProject() && null != project && project != c)
52+
String sharedDatasetsHelpText = "By default, datasets will be created in this container. For Dataspace projects, shared " +
53+
"datasets are created at the project level so that they can be used by each of the study folders in the project.";
54+
DOM.Renderable sharedDatasetsTooltip = SPAN(DOM.at(style, "display: inline-block;width:300px;"), sharedDatasetsHelpText);
55+
56+
String validateQueriesHelpText = "By default, queries will be validated upon import of a folder archive and any failure to validate will " +
57+
"cause the import job to raise an error. To suppress this validation step, uncheck this box";
58+
DOM.Renderable validateQueriesTooltip = SPAN(DOM.at(style, "display: inline-block;width:300px;"), validateQueriesHelpText);
59+
60+
String failForUndefinedVisitsHelpText = "By default, new visit rows will be created in the study during import for any dataset or specimen rows " +
61+
"which have a new, undefined visit. If, instead, you would like for the import of the folder archive to fail when it encounters a visit that " +
62+
"is not already defined in the study or as part of the incoming visit map, check this box.";
63+
DOM.Renderable failForUndefinedVisitsTooltip = SPAN(DOM.at(style, "display: inline-block;width:300px;"), failForUndefinedVisitsHelpText);
64+
65+
if (!c.isProject() && null != project && project != c)
4966
{
5067
if (project.hasPermission(getViewContext().getUser(), AdminPermission.class))
5168
{
@@ -141,24 +158,42 @@
141158
%>
142159
<tr>
143160
<td style="padding-left: 15px; padding-top: 5px;">
144-
<label><input type="checkbox" name="createSharedDatasets" <%=h(form.isCreateSharedDatasets() ? "checked" : "")%> value="true"> Create shared datasets</label>
161+
<label><input type="checkbox" name="createSharedDatasets" <%=h(form.isCreateSharedDatasets() ? "checked" : "")%> value="true">
162+
Create shared datasets <%=helpPopup("Create Shared Datasets", sharedDatasetsTooltip) %>
163+
</label>
145164
</td>
146165
</tr>
147166
<%
148167
}
149168
%>
150169
<tr>
151170
<td style="padding-left: 15px; padding-top: 5px;">
152-
<label><input type="checkbox" name="validateQueries" <%=h(form.isValidateQueries() ? "checked" : "")%> value="true"> Validate all queries after <%=h(action.toLowerCase())%></label>
171+
<label><input type="checkbox" name="validateQueries" <%=h(form.isValidateQueries() ? "checked" : "")%> value="true">
172+
Validate all queries after <%=h(action.toLowerCase())%> <%=helpPopup("Validate all queries", validateQueriesTooltip) %>
173+
</label>
153174
</td>
154175
</tr>
155176
<tr>
156-
<td style="padding-left: 15px; padding-top: 5px; padding-bottom: 5px;">
157-
<label><input type="checkbox" name="advancedImportOptions" <%=h(form.isAdvancedImportOptions() ? "checked" : "")%> value="true"> Show advanced import options</label>
177+
<td style="padding-left: 15px; padding-top: 5px;">
178+
<label><input type="checkbox" name="failForUndefinedVisits" <%=h(form.isFailForUndefinedVisits() ? "checked" : "")%> value="true">
179+
Fail import for undefined visits <%= helpPopup("Fail import for undefined visits", failForUndefinedVisitsTooltip) %>
180+
</label>
158181
</td>
159182
</tr>
183+
<%
184+
if (isAdvancedImportOptionEnabled)
185+
{
186+
%>
187+
<tr>
188+
<td style="padding-left: 15px; padding-top: 5px; padding-bottom: 5px;">
189+
<label><input type="checkbox" name="advancedImportOptions" <%=h(form.isAdvancedImportOptions() ? "checked" : "")%> value="true"> Show advanced import options</label>
190+
</td>
191+
</tr>
192+
<%
193+
}
194+
%>
160195
<tr>
161-
<td>
196+
<td style="padding-top: 5px;">
162197
<%= button(action + " " + noun).submit(true) %>
163198
</td>
164199
</tr>

pipeline/src/org/labkey/pipeline/PipelineController.java

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
import org.labkey.api.security.roles.Role;
8686
import org.labkey.api.security.roles.RoleManager;
8787
import org.labkey.api.settings.AdminConsole;
88+
import org.labkey.api.settings.OptionalFeatureService;
8889
import org.labkey.api.trigger.TriggerConfiguration;
8990
import org.labkey.api.util.DateUtil;
9091
import org.labkey.api.util.FileUtil;
@@ -1222,14 +1223,17 @@ else if (form.getFilePath() == null)
12221223
{
12231224
_archiveFile = PipelineManager.validateFolderImportFileNioPath(form.getFilePath(), currentPipelineRoot, errors);
12241225

1225-
// Be sure that the set of folder to apply the import to match the setting to enable/disable them
1226-
if (form.isApplyToMultipleFolders() && (form.getFolderRowIds() == null || form.getFolderRowIds().isEmpty()))
1226+
if (OptionalFeatureService.get().isFeatureEnabled(PipelineModule.ADVANCED_IMPORT_FLAG))
12271227
{
1228-
errors.reject(ERROR_MSG, "At least one folder must be selected when 'apply to multiple folders' is enabled.");
1229-
}
1230-
else if (!form.isApplyToMultipleFolders() && form.getFolderRowIds() != null)
1231-
{
1232-
errors.reject(ERROR_MSG, "Folder RowIds provided when 'apply to multiple folders' not enabled.");
1228+
// Be sure that the set of folder to apply the import to match the setting to enable/disable them
1229+
if (form.isApplyToMultipleFolders() && (form.getFolderRowIds() == null || form.getFolderRowIds().isEmpty()))
1230+
{
1231+
errors.reject(ERROR_MSG, "At least one folder must be selected when 'apply to multiple folders' is enabled.");
1232+
}
1233+
else if (!form.isApplyToMultipleFolders() && form.getFolderRowIds() != null)
1234+
{
1235+
errors.reject(ERROR_MSG, "Folder RowIds provided when 'apply to multiple folders' not enabled.");
1236+
}
12331237
}
12341238

12351239
// Be sure that the user has admin permissions to all selected folders and that all selected folders exist
@@ -1262,14 +1266,17 @@ else if (!selectedContainer.hasPermission(getUser(), AdminPermission.class))
12621266
}
12631267
}
12641268

1265-
// Be sure that the provided data types to import match the setting to enable/disable them
1266-
if (form.isSpecificImportOptions() && (form.getDataTypes() == null || form.getDataTypes().isEmpty()))
1269+
if (OptionalFeatureService.get().isFeatureEnabled(PipelineModule.ADVANCED_IMPORT_FLAG))
12671270
{
1268-
errors.reject(ERROR_MSG, "At least one folder data type must be selected when 'select specific objects to import' is enabled.");
1269-
}
1270-
else if (!form.isSpecificImportOptions() && form.getDataTypes() != null)
1271-
{
1272-
errors.reject(ERROR_MSG, "Folder data types provided when 'select specific objects to import' not enabled.");
1271+
// Be sure that the provided data types to import match the setting to enable/disable them
1272+
if (form.isSpecificImportOptions() && (form.getDataTypes() == null || form.getDataTypes().isEmpty()))
1273+
{
1274+
errors.reject(ERROR_MSG, "At least one folder data type must be selected when 'select specific objects to import' is enabled.");
1275+
}
1276+
else if (!form.isSpecificImportOptions() && form.getDataTypes() != null)
1277+
{
1278+
errors.reject(ERROR_MSG, "Folder data types provided when 'select specific objects to import' not enabled.");
1279+
}
12731280
}
12741281
}
12751282
}

pipeline/src/org/labkey/pipeline/PipelineModule.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
import org.labkey.api.pipeline.trigger.PipelineTriggerRegistry;
4848
import org.labkey.api.pipeline.trigger.PipelineTriggerType;
4949
import org.labkey.api.security.User;
50+
import org.labkey.api.settings.AdminConsole;
51+
import org.labkey.api.settings.OptionalFeatureService;
5052
import org.labkey.api.usageMetrics.UsageMetricsService;
5153
import org.labkey.api.util.ContextListener;
5254
import org.labkey.api.util.PageFlowUtil;
@@ -105,6 +107,7 @@
105107
public class PipelineModule extends SpringModule implements ContainerManager.ContainerListener
106108
{
107109
private static final Logger _log = LogHelper.getLogger(PipelineModule.class, "Module responsible for managing pipeline jobs and logs");
110+
public static final String ADVANCED_IMPORT_FLAG = "advancedImportFlag";
108111

109112
@Override
110113
public String getName()
@@ -215,6 +218,12 @@ protected void startupAfterSpringConfig(ModuleContext moduleContext)
215218

216219
AuditLogService.get().registerAuditType(new ProtocolManagementAuditProvider());
217220

221+
AdminConsole.addOptionalFeatureFlag(new AdminConsole.OptionalFeatureFlag(ADVANCED_IMPORT_FLAG,
222+
"Restore 'Advanced Import Options' during Folder import",
223+
"This option will be removed in LabKey Server v25.7.",
224+
false, false, OptionalFeatureService.FeatureType.Deprecated
225+
));
226+
218227
UsageMetricsService.get().registerUsageMetrics(getName(), () -> {
219228
DbSchema pipelineSchema = PipelineSchema.getInstance().getSchema();
220229
SqlDialect dialect = PipelineSchema.getInstance().getSchema().getSqlDialect();

pipeline/src/org/labkey/pipeline/startPipelineImport.jsp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
<%@ page import="org.labkey.api.view.template.ClientDependencies" %>
2626
<%@ page import="org.labkey.pipeline.PipelineController.StartFolderImportAction" %>
2727
<%@ page import="org.labkey.pipeline.PipelineController.StartFolderImportForm" %>
28+
<%@ page import="org.labkey.api.settings.OptionalFeatureService" %>
29+
<%@ page import="org.labkey.pipeline.PipelineModule" %>
2830
<%@ taglib prefix="labkey" uri="http://www.labkey.org/taglib" %>
2931
<%@ page extends="org.labkey.api.jsp.JspBase" %>
3032
<%!
@@ -57,6 +59,7 @@
5759
5860
Study study = studyService != null ? studyService.getStudy(getContainer()) : null;
5961
TimepointType timepointType = study != null ? study.getTimepointType() : null;
62+
boolean isAdvancedImportOptionEnabled = OptionalFeatureService.get().isFeatureEnabled(PipelineModule.ADVANCED_IMPORT_FLAG);
6063
%>
6164

6265
<labkey:errors/>
@@ -89,6 +92,7 @@ Ext4.onReady(function()
8992
canCreateSharedDatasets: <%=canCreateSharedDatasets%>,
9093
isCreateSharedDatasets: <%=bean.isCreateSharedDatasets()%>,
9194
isValidateQueries: <%=bean.isValidateQueries()%>,
95+
showAdvancedImportOptions: <%=isAdvancedImportOptionEnabled%>,
9296
isSpecificImportOptions: <%=bean.isSpecificImportOptions()%>,
9397
isApplyToMultipleFolders: <%=bean.isApplyToMultipleFolders()%>,
9498
isFailForUndefinedVisits: <%=bean.isFailForUndefinedVisits()%>,

0 commit comments

Comments
 (0)