Skip to content
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
4 changes: 2 additions & 2 deletions packages/components/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@labkey/components",
"version": "6.57.0",
"version": "6.58.0",
"description": "Components, models, actions, and utility functions for LabKey applications and pages",
"sideEffects": false,
"files": [
Expand Down
5 changes: 5 additions & 0 deletions packages/components/releaseNotes/components.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# @labkey/components
Components, models, actions, and utility functions for LabKey applications and pages

### version 6.58.0
*Released*: 4 August 2025
- GitHub Issue 783: Hide domain designer field Advanced Settings that are not currently implemented in app
- GitHub Issue 788: Domain Designer better handling of invalid lookup query value for Sample data type

### version 6.57.0
*Released*: 30 July 2025
- Add file system audit events for apps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ import {
import { AdvancedSettings } from './AdvancedSettings';
import { DomainField } from './models';

// mock isApp() to return false for this test case, affects MV enabled checkbox and Default Value Type
jest.mock('../../app/utils', () => ({
...jest.requireActual('../../app/utils'),
isApp: () => false,
}));

describe('AdvancedSettings', () => {
const _fieldName = 'Marty';
const _title = 'Advanced Settings and Properties';
Expand Down Expand Up @@ -114,7 +120,7 @@ describe('AdvancedSettings', () => {
// Verify mvEnabled
id = createFormInputId(DOMAIN_FIELD_MVENABLED, _domainIndex, _index);
const mvEnabled = document.querySelector('#' + id);
expect(mvEnabled.getAttribute('checked')).toBeNull();
expect(mvEnabled.getAttribute('checked')).toBeNull(); // Note mock of isApp above

// Verify recommendedVariable
id = createFormInputId(DOMAIN_FIELD_RECOMMENDEDVARIABLE, _domainIndex, _index);
Expand All @@ -129,7 +135,7 @@ describe('AdvancedSettings', () => {
// Verify default type
id = createFormInputId(DOMAIN_FIELD_DEFAULT_VALUE_TYPE, _domainIndex, _index);
const defaultType = document.querySelector('#' + id);
expect(defaultType.textContent).toEqual('Editable defaultLast enteredFixed value');
expect(defaultType.textContent).toEqual('Editable defaultLast enteredFixed value'); // Note mock of isApp above

// Verify buttons
const btns = document.getElementsByClassName('btn');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { List } from 'immutable';
import { ActionURL } from '@labkey/api';

import { Modal } from '../../Modal';
import { getSubmitButtonClass } from '../../app/utils';
import { getSubmitButtonClass, isApp } from '../../app/utils';

import {
ADVANCED_FIELD_EDITOR_TOPIC,
Expand Down Expand Up @@ -60,15 +60,15 @@ interface AdvancedSettingsProps {
}

interface AdvancedSettingsState {
PHI?: string;
defaultDisplayValue?: string;
defaultValueType?: string;
dimension?: boolean;
excludeFromShifting?: boolean;
hidden?: boolean;
measure?: boolean;
mvEnabled?: boolean;
phiLevels?: Array<{ label: string; value: string; }>;
PHI?: string;
phiLevels?: { label: string; value: string }[];
recommendedVariable?: boolean;
shownInDetailsView?: boolean;
shownInInsertView?: boolean;
Expand Down Expand Up @@ -243,6 +243,9 @@ export class AdvancedSettings extends React.PureComponent<AdvancedSettingsProps,
showDefaultValues = () => {
const { field, showDefaultValueSettings } = this.props;

// GitHub Issue #783: we don't yet support default values in the App
if (isApp()) return false;

// some domains just don't support default values
if (!showDefaultValueSettings) return false;

Expand All @@ -262,37 +265,37 @@ export class AdvancedSettings extends React.PureComponent<AdvancedSettingsProps,
<div>These options configure how and in which views this field will be visible.</div>
<CheckboxLK
checked={hidden === false}
onChange={this.handleCheckbox}
name={createFormInputName(DOMAIN_FIELD_HIDDEN)}
id={createFormInputId(DOMAIN_FIELD_HIDDEN, domainIndex, index)}
name={createFormInputName(DOMAIN_FIELD_HIDDEN)}
onChange={this.handleCheckbox}
>
Show field on default view of the grid
</CheckboxLK>
{!field.isCalculatedField() && (
<>
<CheckboxLK
checked={shownInUpdateView === true}
onChange={this.handleCheckbox}
name={createFormInputName(DOMAIN_FIELD_SHOWNINUPDATESVIEW)}
id={createFormInputId(DOMAIN_FIELD_SHOWNINUPDATESVIEW, domainIndex, index)}
name={createFormInputName(DOMAIN_FIELD_SHOWNINUPDATESVIEW)}
onChange={this.handleCheckbox}
>
Show on update form when updating a single row of data
</CheckboxLK>
<CheckboxLK
checked={shownInInsertView === true}
onChange={this.handleCheckbox}
name={createFormInputName(DOMAIN_FIELD_SHOWNININSERTVIEW)}
id={createFormInputId(DOMAIN_FIELD_SHOWNININSERTVIEW, domainIndex, index)}
name={createFormInputName(DOMAIN_FIELD_SHOWNININSERTVIEW)}
onChange={this.handleCheckbox}
>
Show on insert form when updating a single row of data
</CheckboxLK>
</>
)}
<CheckboxLK
checked={shownInDetailsView === true}
onChange={this.handleCheckbox}
name={createFormInputName(DOMAIN_FIELD_SHOWNINDETAILSVIEW)}
id={createFormInputId(DOMAIN_FIELD_SHOWNINDETAILSVIEW, domainIndex, index)}
name={createFormInputName(DOMAIN_FIELD_SHOWNINDETAILSVIEW)}
onChange={this.handleCheckbox}
>
Show on details page for a single row
</CheckboxLK>
Expand All @@ -309,21 +312,23 @@ export class AdvancedSettings extends React.PureComponent<AdvancedSettingsProps,
<div className="domain-adv-misc-options">Default Value Options</div>
<div className="row domain-adv-thick-row">
<div className="col-xs-3">
<DomainFieldLabel label="Default Type" helpTipBody={this.getDefaultTypeHelpText()} />
<DomainFieldLabel helpTipBody={this.getDefaultTypeHelpText()} label="Default Type" />
</div>
<div className="col-xs-6">
<select
className="form-control"
name={createFormInputName(DOMAIN_FIELD_DEFAULT_VALUE_TYPE)}
id={createFormInputId(DOMAIN_FIELD_DEFAULT_VALUE_TYPE, domainIndex, index)}
name={createFormInputName(DOMAIN_FIELD_DEFAULT_VALUE_TYPE)}
onChange={this.handleChange}
value={defaultValueType}
>
{defaultValueOptions.map(level => (
<option key={level} value={level}>
{DOMAIN_DEFAULT_TYPES[level]}
</option>
)).toArray()}
{defaultValueOptions
.map(level => (
<option key={level} value={level}>
{DOMAIN_DEFAULT_TYPES[level]}
</option>
))
.toArray()}
</select>
</div>
<div className="col-xs-3" />
Expand All @@ -339,9 +344,9 @@ export class AdvancedSettings extends React.PureComponent<AdvancedSettingsProps,
: ''}
</span>
<a
style={{ marginLeft: '20px' }}
onClick={this.handleSetDefaultValues}
className="domain-adv-link"
onClick={this.handleSetDefaultValues}
style={{ marginLeft: '20px' }}
>
Set Default Values
</a>
Expand Down Expand Up @@ -375,16 +380,16 @@ export class AdvancedSettings extends React.PureComponent<AdvancedSettingsProps,
{!field.isCalculatedField() && (
<div className="row">
<div className="col-xs-3">
<DomainFieldLabel label="PHI Level" helpTipBody={this.getPhiHelpText()} />
<DomainFieldLabel helpTipBody={this.getPhiHelpText()} label="PHI Level" />
</div>
<div className="col-xs-6">
<select
className="form-control"
name={createFormInputName(DOMAIN_FIELD_PHI)}
disabled={disablePhiSelect}
id={createFormInputId(DOMAIN_FIELD_PHI, domainIndex, index)}
name={createFormInputName(DOMAIN_FIELD_PHI)}
onChange={this.handleChange}
value={PHI}
disabled={disablePhiSelect}
>
{!currentValueExists && (
<option key={PHI} value={PHI}>
Expand All @@ -404,9 +409,9 @@ export class AdvancedSettings extends React.PureComponent<AdvancedSettingsProps,
{field.dataType === DATETIME_TYPE && (
<CheckboxLK
checked={excludeFromShifting}
onChange={this.handleCheckbox}
name={createFormInputName(DOMAIN_FIELD_EXCLUDE_FROM_SHIFTING)}
id={createFormInputId(DOMAIN_FIELD_EXCLUDE_FROM_SHIFTING, domainIndex, index)}
name={createFormInputName(DOMAIN_FIELD_EXCLUDE_FROM_SHIFTING)}
onChange={this.handleCheckbox}
>
Exclude from "Participant Date Shifting" on export/publication
<LabelHelpTip title="Exclude from Date Shifting">
Expand All @@ -418,9 +423,9 @@ export class AdvancedSettings extends React.PureComponent<AdvancedSettingsProps,
{PropDescType.isMeasure(field.dataType.rangeURI) && (
<CheckboxLK
checked={measure}
onChange={this.handleCheckbox}
name={createFormInputName(DOMAIN_FIELD_MEASURE)}
id={createFormInputId(DOMAIN_FIELD_MEASURE, domainIndex, index)}
name={createFormInputName(DOMAIN_FIELD_MEASURE)}
onChange={this.handleCheckbox}
>
Make this field available as a measure
<LabelHelpTip title="Measure">
Expand All @@ -443,9 +448,9 @@ export class AdvancedSettings extends React.PureComponent<AdvancedSettingsProps,
{PropDescType.isDimension(field.dataType.rangeURI) && (
<CheckboxLK
checked={dimension}
onChange={this.handleCheckbox}
name={createFormInputName(DOMAIN_FIELD_DIMENSION)}
id={createFormInputId(DOMAIN_FIELD_DIMENSION, domainIndex, index)}
name={createFormInputName(DOMAIN_FIELD_DIMENSION)}
onChange={this.handleCheckbox}
>
Make this field available as a dimension
<LabelHelpTip title="Data Dimension">
Expand All @@ -467,9 +472,9 @@ export class AdvancedSettings extends React.PureComponent<AdvancedSettingsProps,
)}
<CheckboxLK
checked={recommendedVariable}
onChange={this.handleCheckbox}
name={createFormInputName(DOMAIN_FIELD_RECOMMENDEDVARIABLE)}
id={createFormInputId(DOMAIN_FIELD_RECOMMENDEDVARIABLE, domainIndex, index)}
name={createFormInputName(DOMAIN_FIELD_RECOMMENDEDVARIABLE)}
onChange={this.handleCheckbox}
>
Make this field a recommended variable
<LabelHelpTip title="Recommended Variable">
Expand All @@ -479,13 +484,13 @@ export class AdvancedSettings extends React.PureComponent<AdvancedSettingsProps,
</div>
</LabelHelpTip>
</CheckboxLK>
{PropDescType.isMvEnableable(field.dataType.rangeURI) && !field.isCalculatedField() && (
{PropDescType.isMvEnableable(field.dataType.rangeURI) && !field.isCalculatedField() && !isApp() && (
<CheckboxLK
checked={mvEnabled}
onChange={this.handleCheckbox}
name={createFormInputName(DOMAIN_FIELD_MVENABLED)}
id={createFormInputId(DOMAIN_FIELD_MVENABLED, domainIndex, index)}
disabled={domainFormDisplayOptions.disableMvEnabled}
id={createFormInputId(DOMAIN_FIELD_MVENABLED, domainIndex, index)}
name={createFormInputName(DOMAIN_FIELD_MVENABLED)}
onChange={this.handleCheckbox}
>
Track reason for missing data values
<LabelHelpTip title="Missing Value Indicators">
Expand All @@ -507,9 +512,9 @@ export class AdvancedSettings extends React.PureComponent<AdvancedSettingsProps,
<CheckboxLK
checked={uniqueConstraint || field.isPrimaryKey}
disabled={field.isPrimaryKey}
onChange={this.handleCheckbox}
name={createFormInputName(DOMAIN_FIELD_UNIQUECONSTRAINT)}
id={createFormInputId(DOMAIN_FIELD_UNIQUECONSTRAINT, domainIndex, index)}
name={createFormInputName(DOMAIN_FIELD_UNIQUECONSTRAINT)}
onChange={this.handleCheckbox}
>
Require all values to be unique
<LabelHelpTip title="Unique Constraint">
Expand All @@ -533,7 +538,7 @@ export class AdvancedSettings extends React.PureComponent<AdvancedSettingsProps,
>
Cancel
</button>
<HelpLink topic={ADVANCED_FIELD_EDITOR_TOPIC} className="domain-adv-footer domain-adv-link">
<HelpLink className="domain-adv-footer domain-adv-link" topic={ADVANCED_FIELD_EDITOR_TOPIC}>
Get help with field designer settings
</HelpLink>
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { LabelHelpTip } from '../base/LabelHelpTip';
import { isFieldFullyLocked } from './propertiesUtil';
import { fetchQueries } from './actions';
import { createFormInputId, createFormInputName } from './utils';
import { ALL_SAMPLES_DISPLAY_TEXT, DOMAIN_FIELD_SAMPLE_TYPE, DOMAIN_VALIDATOR_LOOKUP } from './constants';
import { DOMAIN_FIELD_SAMPLE_TYPE, DOMAIN_VALIDATOR_LOOKUP } from './constants';
import {
DomainField,
encodeLookup,
Expand All @@ -20,7 +20,7 @@ import {
ITypeDependentProps,
LOOKUP_VALIDATOR,
LookupInfo,
SAMPLE_TYPE_OPTION_VALUE,
SAMPLE_TYPE_ALL_OPTION_VALUE,
} from './models';

import { SectionHeading } from './SectionHeading';
Expand Down Expand Up @@ -88,8 +88,7 @@ export class SampleFieldOptions extends PureComponent<SampleFieldProps, State> {
};

render() {
const { index, label, lockType, value, domainIndex } = this.props;

const { index, label, lockType, value, domainIndex, field } = this.props;
const { loadingState, sampleTypes, validateLookup } = this.state;
const isLoaded = !isLoading(loadingState);

Expand Down Expand Up @@ -124,26 +123,38 @@ export class SampleFieldOptions extends PureComponent<SampleFieldProps, State> {
</div>
<select
className="form-control"
disabled={isFieldFullyLocked(lockType)}
id={id}
key={id}
disabled={isFieldFullyLocked(lockType)}
name={createFormInputName(DOMAIN_FIELD_SAMPLE_TYPE)}
onChange={this.onFieldChange}
value={value || ALL_SAMPLES_DISPLAY_TEXT}
value={value || SAMPLE_TYPE_ALL_OPTION_VALUE}
>
{!isLoaded && (
<option disabled key="_loading" value={value}>
Loading...
</option>
)}
{field && !field.lookupIsValid && (
<option
key={createFormInputId(
DOMAIN_FIELD_SAMPLE_TYPE + '-empty-' + index,
domainIndex,
index
)}
value={undefined}
>
&lt;Invalid sample type: {field?.lookupQuery}&gt;
</option>
)}
{isLoaded && (
<option
key={createFormInputId(
DOMAIN_FIELD_SAMPLE_TYPE + '-option-' + index,
domainIndex,
index
)}
value={SAMPLE_TYPE_OPTION_VALUE}
value={SAMPLE_TYPE_ALL_OPTION_VALUE}
>
All Samples
</option>
Expand All @@ -164,10 +175,10 @@ export class SampleFieldOptions extends PureComponent<SampleFieldProps, State> {
<div className="col-xs-6">
<div className="domain-field-label">Lookup Validator</div>
<DomainDesignerCheckbox
checked={validateLookup}
className="domain-field-checkbox-margin"
id={createFormInputId(DOMAIN_VALIDATOR_LOOKUP, domainIndex, index)}
name={createFormInputName(DOMAIN_VALIDATOR_LOOKUP)}
checked={validateLookup}
onChange={this.addLookupValidator}
>
<span className="domain-lookup-validator-text">Ensure Value Exists in Lookup Target</span>
Expand Down
Loading