Skip to content

Commit be9a82b

Browse files
authored
GitHub #503: Add option to open URL links in a new tab in the domain designer UI (LabKey Issue: 54178) (#7304)
- update @labkey/components package version - Server side support for domain field URLTargetWindow property, saved with exp.PropertyDescriptor row - exp.PropertyDescriptor add column for URLTarget (sql upgrade script and version bump)
1 parent 3195a43 commit be9a82b

34 files changed

Lines changed: 134 additions & 45 deletions

api/gwtsrc/org/labkey/api/gwt/client/assay/model/GWTPropertyDescriptorMixin.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@
3838
})
3939
public abstract class GWTPropertyDescriptorMixin
4040
{
41-
GWTPropertyDescriptorMixin(@JsonProperty("PHI") StringProperty phi, @JsonProperty("URL") StringProperty url)
41+
GWTPropertyDescriptorMixin(@JsonProperty("PHI") StringProperty phi, @JsonProperty("URL") StringProperty url, @JsonProperty("URLTarget") StringProperty URLTarget)
4242
{ }
4343
@JsonProperty("PHI")
4444
abstract void setPHI(String phi); // rename property on deserialize
4545
@JsonProperty("URL")
4646
abstract void setURL(String url); // rename property on deserialize
47+
@JsonProperty("URLTarget")
48+
abstract void setURLTarget(String urlTarget); // rename property on deserialize
4749
}

api/gwtsrc/org/labkey/api/gwt/client/model/GWTPropertyDescriptor.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public class GWTPropertyDescriptor implements IsSerializable
5959
private final BooleanProperty mvEnabled = new BooleanProperty(false);
6060
private final StringProperty importAliases = new StringProperty();
6161
private final StringProperty url = new StringProperty();
62+
private final StringProperty urlTarget = new StringProperty();
6263
private final BooleanProperty shownInInsertView = new BooleanProperty(true);
6364
private final BooleanProperty shownInUpdateView = new BooleanProperty(true);
6465
private final BooleanProperty shownInDetailsView = new BooleanProperty(true);
@@ -137,6 +138,7 @@ public GWTPropertyDescriptor(GWTPropertyDescriptor s, boolean isNew)
137138
setDefaultDisplayValue(s.getDefaultDisplayValue());
138139
setImportAliases(s.getImportAliases());
139140
setURL(s.getURL());
141+
setURLTarget(s.getURLTarget());
140142
setFacetingBehaviorType(s.getFacetingBehaviorType());
141143
setPHI(s.getPHI());
142144
setExcludeFromShifting(s.isExcludeFromShifting());
@@ -662,6 +664,16 @@ public void setURL(String url)
662664
this.url.set(url);
663665
}
664666

667+
public String getURLTarget()
668+
{
669+
return urlTarget.toString();
670+
}
671+
672+
public void setURLTarget(String urlTarget)
673+
{
674+
this.urlTarget.set(urlTarget);
675+
}
676+
665677
public String getLookupDescription()
666678
{
667679
if (StringUtils.isEmpty(getLookupSchema()) || StringUtils.isEmpty(getLookupQuery()))

api/schemas/expTypes.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@
529529
<xs:element name="SemanticType" type="string" minOccurs="0" maxOccurs="1"/>
530530
<xs:element name="Format" type="string" minOccurs="0" maxOccurs="1"/>
531531
<xs:element name="URL" type="string" minOccurs="0" maxOccurs="1"/>
532+
<xs:element name="URLTarget" type="string" minOccurs="0" maxOccurs="1"/>
532533
<xs:element name="FK" minOccurs="0">
533534
<xs:annotation>
534535
<xs:documentation>A structure that describes a foreign key relationship between a column in the current table and a target column in another table. </xs:documentation>

api/src/org/labkey/api/data/AbstractWrappedColumnInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,9 +566,9 @@ public StringExpression getURL()
566566
}
567567

568568
@Override
569-
public String getURLTargetWindow()
569+
public String getURLTarget()
570570
{
571-
return delegate.getURLTargetWindow();
571+
return delegate.getURLTarget();
572572
}
573573

574574
@Override

api/src/org/labkey/api/data/BaseColumnInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ public void copyURLFrom(ColumnInfo col, @Nullable FieldKey parent, @Nullable Map
559559
}
560560
setURL(url);
561561
}
562-
setURLTargetWindow(col.getURLTargetWindow());
562+
setURLTarget(col.getURLTarget());
563563
setURLCls(col.getURLCls());
564564
setOnClick(col.getOnClick());
565565
}
@@ -1166,7 +1166,7 @@ public void loadFromXml(ColumnType xmlCol, boolean merge)
11661166
if (xmlCol.isSetUrl())
11671167
setURL(StringExpressionFactory.fromXML(xmlCol.getUrl(), false));
11681168
if (xmlCol.isSetUrlTarget())
1169-
setURLTargetWindow(xmlCol.getUrlTarget());
1169+
setURLTarget(xmlCol.getUrlTarget());
11701170
if (xmlCol.isSetIsAutoInc())
11711171
_isAutoIncrement = xmlCol.getIsAutoInc();
11721172
if (xmlCol.isSetHasDbSequence())

api/src/org/labkey/api/data/ColumnRenderProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public interface ColumnRenderProperties extends ImportAliasable
8484

8585
StringExpression getURL();
8686

87-
String getURLTargetWindow();
87+
String getURLTarget();
8888

8989
String getURLCls();
9090

api/src/org/labkey/api/data/ColumnRenderPropertiesImpl.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public abstract class ColumnRenderPropertiesImpl implements MutableColumnRenderP
8686
protected boolean _shownInDetailsView = true;
8787
protected boolean _shownInLookupView = false;
8888
protected StringExpression _url;
89-
protected String _urlTargetWindow;
89+
protected String _urlTarget;
9090
protected String _urlCls;
9191
protected String _onClick;
9292
// methods use Set<>, but I'm using a List<> here because it is simpler and more thread safe and explicitly preserves order
@@ -157,6 +157,7 @@ public void copyTo(ColumnRenderPropertiesImpl to)
157157
to._recommendedVariable = _recommendedVariable;
158158
to._defaultScale = _defaultScale;
159159
to._url = _url;
160+
to._urlTarget = _urlTarget;
160161
to._importAliases = copyFixedList(_importAliases);
161162
to._facetingBehaviorType = _facetingBehaviorType;
162163
to._crosstabColumnMember = _crosstabColumnMember;
@@ -422,16 +423,22 @@ public void setURL(StringExpression url)
422423
}
423424

424425
@Override
425-
public String getURLTargetWindow()
426+
public String getURLTarget()
426427
{
427-
return _urlTargetWindow;
428+
return _urlTarget;
428429
}
429430

430431
@Override
431-
public void setURLTargetWindow(String urlTargetWindow)
432+
public void setURLTarget(String urlTarget)
432433
{
433434
assert _checkLocked();
434-
_urlTargetWindow = urlTargetWindow;
435+
_urlTarget = urlTarget;
436+
}
437+
438+
@Override
439+
public void setURLTargetWindow(String urlTarget)
440+
{
441+
setURLTarget(urlTarget);
435442
}
436443

437444
@Override

api/src/org/labkey/api/data/DataColumn.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public DataColumn(ColumnInfo col, boolean withLookups)
116116
StringExpression url = withLookups ? _boundColumn.getEffectiveURL() : _boundColumn.getURL();
117117
if (null != url)
118118
super.setURLExpression(url);
119-
setLinkTarget(_boundColumn.getURLTargetWindow());
119+
setLinkTarget(_boundColumn.getURLTarget());
120120
setLinkCls(_boundColumn.getURLCls());
121121
setOnClick(_boundColumn.getOnClick());
122122
setFormatString(_displayColumn.getFormat());

api/src/org/labkey/api/data/MutableColumnRenderProperties.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ public interface MutableColumnRenderProperties extends ColumnRenderProperties, M
4646

4747
void setURL(StringExpression url);
4848

49-
void setURLTargetWindow(String urlTargetWindow);
49+
void setURLTarget(String urlTarget);
50+
void setURLTargetWindow(String urlTarget);
5051

5152
void setURLCls(String urlCls);
5253

api/src/org/labkey/api/data/WrappedColumnInfo.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,23 @@ public StringExpression getURL()
392392
}
393393

394394
@Override
395-
public void setURLTargetWindow(String urlTargetWindow)
395+
public void setURLTarget(String urlTarget)
396396
{
397397
checkLocked();
398-
throw new UnsupportedOperationException();
398+
delegate = new AbstractWrappedColumnInfo(delegate)
399+
{
400+
@Override
401+
public String getURLTarget()
402+
{
403+
return urlTarget;
404+
}
405+
};
406+
}
407+
408+
@Override
409+
public void setURLTargetWindow(String urlTarget)
410+
{
411+
setURLTarget(urlTarget);
399412
}
400413

401414
@Override

0 commit comments

Comments
 (0)