Skip to content

Commit

Permalink
fix(component/feature): Apps to Integrations name change
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikita Kavaliou committed Oct 28, 2024
1 parent ec115f7 commit d505d10
Show file tree
Hide file tree
Showing 9 changed files with 350 additions and 19 deletions.
28 changes: 28 additions & 0 deletions i18n/en-US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,8 @@ boxui.securityCloudGame.targetInRange = Target in range, you can drop the cloud
boxui.securityCloudGame.targetPosition = Target position: Row {row}, Column {column}.
# Name list of all applications download restriction applied to classification
boxui.securityControls.allAppNames = All applications: {appsList}
# Name list of all integrations download restriction applied to classification
boxui.securityControls.allIntegrationNames = All integrations: {appsList}
# Bullet point that summarizes application download restriction applied to classification
boxui.securityControls.appDownloadBlacklist = Download restricted for some applications: {appNames}
# Bullet point that summarizes application download restriction applied to classification. This variation is used when the list of applications is longer than the configured threshold
Expand All @@ -1420,6 +1422,16 @@ boxui.securityControls.downloadExternal = Download restricted on Box Drive for e
boxui.securityControls.externalCollabBlock = External collaboration restricted.
# Bullet point that summarizes external collaboration restriction applied to classification
boxui.securityControls.externalCollabDomainList = External collaboration limited to approved domains.
# Bullet point that summarizes integration download restriction applied to classification
boxui.securityControls.integrationDownloadAllowlist = Only select integrations are allowed: {appNames}
# Bullet point that summarizes integration download restriction applied to classification. This variation is used when the list of integrations is longer than the configured threshold
boxui.securityControls.integrationDownloadAllowlistOverflow = Only select integrations are allowed: {appNames} +{remainingAppCount} more
# Bullet point that summarizes integration download restriction applied to classification
boxui.securityControls.integrationDownloadDenylist = Download restricted for some integrations: {appNames}
# Bullet point that summarizes integration download restriction applied to classification. This variation is used when the list of integrations is longer than the configured threshold
boxui.securityControls.integrationDownloadDenylistOverflow = Download restricted for some integrations: {appNames} +{remainingAppCount} more
# Bullet point that summarizes integration download restriction applied to classification
boxui.securityControls.integrationDownloadRestricted = Download restricted for some integrations.
# Bullet point that summarizes mobile download restrictions applied to classification, when restriction applies to external users
boxui.securityControls.mobileDownloadExternal = Download restricted on mobile for external users.
# Bullet point that summarizes mobile download restrictions applied to classification, when restriction applies to external users and managed users except Owners/Co-Owners
Expand Down Expand Up @@ -1450,8 +1462,16 @@ boxui.securityControls.shortDownload = Download restrictions apply
boxui.securityControls.shortDownloadApp = Download and app restrictions apply
# Short summary displayed for items when download, app download and Sign restrictions are applied to them. Box Sign is a product name
boxui.securityControls.shortDownloadAppSign = Download, app and Sign restrictions apply
# Short summary displayed for classification when both download and integration download restrictions are applied to it
boxui.securityControls.shortDownloadIntegration = Download and integration restrictions apply
# Short summary displayed for items when download, integration download and Sign restrictions are applied to them. Box Sign is a product name
boxui.securityControls.shortDownloadIntegrationSign = Download, integration and Sign restrictions apply
# Short summary displayed for items when both download and Sign restrictions are applied to them. Box Sign is a product name
boxui.securityControls.shortDownloadSign = Download and Sign restrictions apply
# Short summary displayed for classification when an integration download restriction is applied to it
boxui.securityControls.shortIntegration = Integration restrictions apply
# Short summary displayed for items when both integration download and Sign restrictions are applied to them. Box Sign is a product name
boxui.securityControls.shortIntegrationSign = Integration and Sign restrictions apply
# Short summary displayed for classification when a sharing restriction is applied to it
boxui.securityControls.shortSharing = Sharing restriction applies
# Short summary displayed for classification when both sharing and app download restrictions are applied to it
Expand All @@ -1464,8 +1484,16 @@ boxui.securityControls.shortSharingDownload = Sharing and download restrictions
boxui.securityControls.shortSharingDownloadApp = Sharing, download and app restrictions apply
# Short summary displayed for items when sharing, download, app download and Sign restrictions are applied to them. Box Sign is a product name
boxui.securityControls.shortSharingDownloadAppSign = Sharing, download, app and Sign restrictions apply
# Short summary displayed for items when sharing, download and integration download restrictions are applied to them.
boxui.securityControls.shortSharingDownloadIntegration = Sharing, download and integration restrictions apply
# Short summary displayed for items when sharing, download, integration download and Sign restrictions are applied to them. Box Sign is a product name
boxui.securityControls.shortSharingDownloadIntegrationSign = Sharing, download, integration and Sign restrictions apply
# Short summary displayed for items when sharing, download and Sign restrictions are applied to them. Box Sign is a product name
boxui.securityControls.shortSharingDownloadSign = Sharing, download and Sign restrictions apply
# Short summary displayed for classification when both sharing and integration download restrictions are applied to it
boxui.securityControls.shortSharingIntegration = Sharing and integration restrictions apply
# Short summary displayed for items when sharing, integration download and Sign restrictions are applied to them. Box Sign is a product name
boxui.securityControls.shortSharingIntegrationSign = Sharing, integration and Sign restrictions apply
# Short summary displayed for items when both sharing and Sign restrictions are applied to them. Box Sign is a product name
boxui.securityControls.shortSharingSign = Sharing and Sign restrictions apply
# Short summary displayed for items when Sign restriction is applied to them. Box Sign is a product name
Expand Down
3 changes: 3 additions & 0 deletions src/features/classification/Classification.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type Props = {
modifiedBy?: string,
name?: string,
onClick?: (event: SyntheticEvent<HTMLButtonElement>) => void,
shouldDisplayAppsAsIntegrations?: boolean,
};

const Classification = ({
Expand All @@ -46,6 +47,7 @@ const Classification = ({
modifiedBy,
name,
onClick,
shouldDisplayAppsAsIntegrations = false,
}: Props) => {
const isClassified = !!name;
const hasDefinition = !!definition;
Expand Down Expand Up @@ -109,6 +111,7 @@ const Classification = ({
itemName={itemName}
maxAppCount={maxAppCount}
shouldRenderLabel
shouldDisplayAppsAsIntegrations={shouldDisplayAppsAsIntegrations}
/>
)}
{isControlsIndicatorEnabled && <LoadingIndicator />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ exports[`features/classification/Classification should render a classified badge
definition="fubar"
itemName=""
maxAppCount={3}
shouldDisplayAppsAsIntegrations={false}
shouldRenderLabel={true}
/>
</article>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type Props = {
itemName?: string,
maxAppCount?: number,
shouldRenderLabel?: boolean,
shouldDisplayAppsAsIntegrations?: boolean,
};

type State = {
Expand All @@ -39,6 +40,7 @@ class SecurityControls extends React.Component<Props, State> {
controlsFormat: SHORT,
maxAppCount: DEFAULT_MAX_APP_COUNT,
shouldRenderLabel: false,
shouldDisplayAppsAsIntegrations: false,
};

state = {
Expand All @@ -59,18 +61,19 @@ class SecurityControls extends React.Component<Props, State> {
itemName,
maxAppCount,
shouldRenderLabel,
shouldDisplayAppsAsIntegrations,
} = this.props;

let items = [];
let modalItems;

if (controlsFormat === FULL) {
items = getFullSecurityControlsMessages(controls, maxAppCount);
items = getFullSecurityControlsMessages(controls, maxAppCount, shouldDisplayAppsAsIntegrations);
} else {
items = getShortSecurityControlsMessage(controls);
items = getShortSecurityControlsMessage(controls, shouldDisplayAppsAsIntegrations);

if (items.length && controlsFormat === SHORT_WITH_BTN) {
modalItems = getFullSecurityControlsMessages(controls, maxAppCount);
modalItems = getFullSecurityControlsMessages(controls, maxAppCount, shouldDisplayAppsAsIntegrations);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ describe('features/classification/security-controls/SecurityControls', () => {
expect(wrapper).toMatchSnapshot();
});

test('should render SecurityControls with Integration label when using SHORT controlsFormat and shouldDisplayAppsAsIntegrations is true', () => {
wrapper.setProps({ controlsFormat: SHORT, shouldDisplayAppsAsIntegrations: true });
expect(wrapper.find('SecurityControlsItem').prop('message').id).toBe(
messages.shortSharingDownloadIntegration.id,
);
});

test('should render SecurityControls with single SecurityControlsItem and modal items when using SHORT_WITH_BTN controlsFormat and item, classification data is provided', () => {
wrapper.setProps({
controlsFormat: SHORT_WITH_BTN,
Expand All @@ -55,11 +62,38 @@ describe('features/classification/security-controls/SecurityControls', () => {
expect(wrapper).toMatchSnapshot();
});

test('should render SecurityControls with Integration label when SHORT_WITH_BTN controlsFormat and shouldDisplayAppsAsIntegrations is true', () => {
wrapper.setProps({
controlsFormat: SHORT_WITH_BTN,
classificationName: 'internal only',
definition: 'classification definition',
itemName: 'welcome.pdf',
shouldDisplayAppsAsIntegrations: true,
});
expect(
wrapper
.find('SecurityControlsModal')
.prop('modalItems')
.find(item => item.message.id === messages.integrationDownloadAllowlist.id),
).toBeDefined();
});

test('should render SecurityControls multiple SecurityControlsItem when using FULL controlsFormat', () => {
wrapper.setProps({ controlsFormat: FULL });
expect(wrapper).toMatchSnapshot();
});

test('should render SecurityControls with Integration label when FULL controlsFormat and shouldDisplayAppsAsIntegrations is true', () => {
wrapper.setProps({ controlsFormat: FULL, shouldDisplayAppsAsIntegrations: true });
expect(
wrapper.findWhere(
node =>
node.type() === 'SecurityControlsItem' &&
node.prop('message').id === messages.integrationDownloadAllowlist.id,
),
).toBeDefined();
});

test('should render label for security controls when shouldRenderLabel prop is set', () => {
wrapper.setProps({ controlsFormat: SHORT });
expect(wrapper.find('Label').length).toBe(0);
Expand Down
Loading

0 comments on commit d505d10

Please sign in to comment.