Skip to content

Commit

Permalink
Deploying to gh-pages from @ 372af59 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
dlen committed Feb 1, 2024
1 parent 1e58e6e commit 81eaf2e
Show file tree
Hide file tree
Showing 22 changed files with 62 additions and 30 deletions.
2 changes: 1 addition & 1 deletion iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -363,4 +363,4 @@



window['STORIES'] = [{"titlePrefix":"","directory":"./.storybook/stories","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:\\.storybook\\/stories(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./.storybook/stories","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:\\.storybook\\/stories(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(js|jsx|ts|tsx))$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(js|jsx|ts|tsx))$"}];</script><script src="runtime~main.d29908dc.iframe.bundle.js"></script><script src="483.71011450.iframe.bundle.js"></script><script src="main.98c816d4.iframe.bundle.js"></script></body></html>
window['STORIES'] = [{"titlePrefix":"","directory":"./.storybook/stories","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:\\.storybook\\/stories(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./.storybook/stories","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:\\.storybook\\/stories(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(js|jsx|ts|tsx))$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(js|jsx|ts|tsx))$"}];</script><script src="runtime~main.d29908dc.iframe.bundle.js"></script><script src="483.71011450.iframe.bundle.js"></script><script src="main.bce63db8.iframe.bundle.js"></script></body></html>

Large diffs are not rendered by default.

File renamed without changes.
2 changes: 1 addition & 1 deletion project.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"generatedAt":1706533872434,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":true,"hasStorybookEslint":false,"refCount":0,"packageManager":{"type":"npm","version":"10.2.3"},"language":"javascript","storybookPackages":{},"framework":{},"addons":{"@storybook/addon-links":{"version":"6.5.16"},"@storybook/addon-essentials":{"options":{"backgrounds":false},"version":"6.5.16"}}}
{"generatedAt":1706803636414,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":true,"hasStorybookEslint":false,"refCount":0,"packageManager":{"type":"npm","version":"10.2.3"},"language":"javascript","storybookPackages":{},"framework":{},"addons":{"@storybook/addon-links":{"version":"6.5.16"},"@storybook/addon-essentials":{"options":{"backgrounds":false},"version":"6.5.16"}}}
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class ConfirmSaveAccountRecoverySettings extends Component {
<label htmlFor="accountPolicy">
<span className="name">
{{
mandatory: <Trans>Mandatory</Trans>,
mandatory: <Trans>Prompt</Trans>,
'opt-out': <Trans>Optional, Opt-out</Trans>,
'opt-in': <Trans>Optional, Opt-in</Trans>,
disabled: <Trans>Disable</Trans>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe("See the Confirm Save Account Recovery Settings", () => {
page = new ConfirmSaveAccountRecoverySettingsPage(props);

// Policy label
expect(page.accountRecoveryPolicy).toBe('Mandatory');
expect(page.accountRecoveryPolicy).toBe('Prompt');
expect(page.accountRecoveryPolicyInfo).toBe("Every user is required to provide a copy of their private key and passphrase during setup.Warning: You should inform your users not to store personal passwords.");

// organization recovery key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class DisplayAdministrationPasswordExpiryAdvanced extends React.PureComponent {
* @returns {void}
*/
handleInputChange(event) {
event.preventDefault();
const {type, checked, value, name} = event.target;
const filedValue = type === "checkbox" ? checked : parseInt(value, 10);
this.props.adminPasswordExpiryContext.setSettingsBulk({[name]: filedValue});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class ManageAccountRecoveryAdministrationSettings extends React.Component {
id="accountRecoveryPolicyMandatory"
disabled={this.hasAllInputDisabled()}/>
<label htmlFor="accountRecoveryPolicyMandatory">
<span className="name"><Trans>Mandatory</Trans></span>
<span className="name"><Trans>Prompt</Trans></span>
<span className="info">
<Trans>Every user is required to provide a copy of their private key and passphrase during setup.</Trans><br/>
<Trans>You should inform your users not to store personal passwords.</Trans>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,16 @@ class DisplayResourcesList extends React.Component {
* Returns true if the component should be re-rendered
*/
shouldComponentUpdate(nextProps, nextState) {
const {filteredResources, selectedResources, sorter, scrollTo, columnsResourceSetting} = this.props.resourceWorkspaceContext;
const {filteredResources, selectedResources, sorter, scrollTo, columnsResourceSetting} = nextProps.resourceWorkspaceContext;
const hasFilteredResourcesChanged = nextProps.resourceWorkspaceContext.filteredResources !== filteredResources;
const hasBothSingleSelection = selectedResources.length === 1 && nextProps.resourceWorkspaceContext.selectedResources.length === 1;
const hasBothSingleSelection = selectedResources.length === 1 && this.props.resourceWorkspaceContext.selectedResources.length === 1;
const hasSingleSelectedResourceChanged = hasBothSingleSelection && selectedResources[0].id !== nextProps.resourceWorkspaceContext.selectedResources[0].id;
const hasSelectedResourcesLengthChanged = nextProps.resourceWorkspaceContext.selectedResources.length !== selectedResources.length;
const hasSorterChanged = sorter !== nextProps.resourceWorkspaceContext.sorter;
const hasSelectedResourcesLengthChanged = this.props.resourceWorkspaceContext.selectedResources.length !== selectedResources.length;
const hasSorterChanged = sorter !== this.props.resourceWorkspaceContext.sorter;
const hasResourceToScrollChange = Boolean(scrollTo.resource && scrollTo.resource.id);
const hasResourcePreviewSecretChange = nextState.previewedCellule !== this.state.previewedCellule;
const hasResourceColumnsChange = nextState.columns !== this.state.columns;
const hasColumnsResourceViewChange = nextProps.resourceWorkspaceContext.columnsResourceSetting?.hasDifferentShowValue(columnsResourceSetting);
const hasColumnsResourceViewChange = this.props.resourceWorkspaceContext.columnsResourceSetting?.hasDifferentShowValue(columnsResourceSetting);
const mustHidePreviewPassword = hasFilteredResourcesChanged || hasSingleSelectedResourceChanged || hasSelectedResourcesLengthChanged || hasSorterChanged;
if (mustHidePreviewPassword) {
this.hidePreviewedCellule();
Expand Down Expand Up @@ -684,6 +684,10 @@ class DisplayResourcesList extends React.Component {
this.props.actionFeedbackContext.displayError(message);
}

/**
* Triggers a scroll of the grid to a resource given its id, if the resource is not visible yet.
* @param {string} resourceId
*/
scrollTo(resourceId) {
const resourceIndex = this.resources.findIndex(resource => resource.id === resourceId);
const [visibleStartIndex, visibleEndIndex] = this.listRef.current.getVisibleRange();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {withProgress} from "../../../contexts/ProgressContext";
import {TotpCodeGeneratorService} from "../../../../shared/services/otp/TotpCodeGeneratorService";
import {TotpWorkflowMode} from "../HandleTotpWorkflow/HandleTotpWorkflowMode";
import {withWorkflow} from "../../../contexts/WorkflowContext";
import {HandleTotpWorkflow} from "../HandleTotpWorkflow/HandleTotpWorkflow";
import HandleTotpWorkflow from "../HandleTotpWorkflow/HandleTotpWorkflow";
import {withPasswordExpiry} from "../../../contexts/PasswordExpirySettingsContext";
import {formatDateForApi} from "../../../../shared/utils/dateUtils";
import {DateTime} from "luxon";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
plaintextSecretPasswordDescriptionTotpDto,
plaintextSecretPasswordStringDto
} from "../../../../shared/models/entity/plaintextSecret/plaintextSecretEntity.test.data";
import {HandleTotpWorkflow} from "../HandleTotpWorkflow/HandleTotpWorkflow";
import HandleTotpWorkflow from "../HandleTotpWorkflow/HandleTotpWorkflow";
import {TotpWorkflowMode} from "../HandleTotpWorkflow/HandleTotpWorkflowMode";
import PasswordExpiryDialog from "../PasswordExpiryDialog/PasswordExpiryDialog";
import {defaultPasswordExpirySettingsContext} from "../../../contexts/PasswordExpirySettingsContext.test.data";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,15 @@ class DisplayResourceDetailsInformation extends React.Component {
if (error.name !== "UserAbortsOperationError") {
this.props.actionFeedbackContext.displayError(error.message);
}
return;
}
}

this.props.progressContext.close();

if (!plaintextSecretDto) {
return;
}

if (!plaintextSecretDto?.password?.length) {
await this.props.actionFeedbackContext.displayError(this.translate("The password is empty and cannot be copied to clipboard."));
return;
Expand Down
12 changes: 11 additions & 1 deletion react-extension/contexts/ResourceWorkspaceContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,17 @@ export class ResourceWorkspaceContextProvider extends React.Component {
}
const sorter = gridUserSettingEntity?.sorter || this.state.sorter;
// process the search after the grid setting is loaded
this.setState({columnsResourceSetting, sorter}, () => this.search(this.state.filter));
this.setState({columnsResourceSetting, sorter}, () => {
this.search(this.state.filter);
/*
* we run scrollTo again here as all data is loaded and the previous sort is loaded as well.
* This make sure that the computed scroll position takes into account the sort and scolls the grid where it should
*/
const selectedResource = this.state.selectedResources;
if (selectedResource.length === 1) {
this.scrollTo(selectedResource[0]);
}
});
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class ConfirmSaveAccountRecoverySettings extends Component {
<label htmlFor="accountPolicy">
<span className="name">
{{
mandatory: <Trans>Mandatory</Trans>,
mandatory: <Trans>Prompt</Trans>,
'opt-out': <Trans>Optional, Opt-out</Trans>,
'opt-in': <Trans>Optional, Opt-in</Trans>,
disabled: <Trans>Disable</Trans>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe("See the Confirm Save Account Recovery Settings", () => {
page = new ConfirmSaveAccountRecoverySettingsPage(props);

// Policy label
expect(page.accountRecoveryPolicy).toBe('Mandatory');
expect(page.accountRecoveryPolicy).toBe('Prompt');
expect(page.accountRecoveryPolicyInfo).toBe("Every user is required to provide a copy of their private key and passphrase during setup.Warning: You should inform your users not to store personal passwords.");

// organization recovery key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class DisplayAdministrationPasswordExpiryAdvanced extends React.PureComponent {
* @returns {void}
*/
handleInputChange(event) {
event.preventDefault();
const {type, checked, value, name} = event.target;
const filedValue = type === "checkbox" ? checked : parseInt(value, 10);
this.props.adminPasswordExpiryContext.setSettingsBulk({[name]: filedValue});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class ManageAccountRecoveryAdministrationSettings extends React.Component {
id="accountRecoveryPolicyMandatory"
disabled={this.hasAllInputDisabled()}/>
<label htmlFor="accountRecoveryPolicyMandatory">
<span className="name"><Trans>Mandatory</Trans></span>
<span className="name"><Trans>Prompt</Trans></span>
<span className="info">
<Trans>Every user is required to provide a copy of their private key and passphrase during setup.</Trans><br/>
<Trans>You should inform your users not to store personal passwords.</Trans>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,16 @@ class DisplayResourcesList extends React.Component {
* Returns true if the component should be re-rendered
*/
shouldComponentUpdate(nextProps, nextState) {
const {filteredResources, selectedResources, sorter, scrollTo, columnsResourceSetting} = this.props.resourceWorkspaceContext;
const {filteredResources, selectedResources, sorter, scrollTo, columnsResourceSetting} = nextProps.resourceWorkspaceContext;
const hasFilteredResourcesChanged = nextProps.resourceWorkspaceContext.filteredResources !== filteredResources;
const hasBothSingleSelection = selectedResources.length === 1 && nextProps.resourceWorkspaceContext.selectedResources.length === 1;
const hasBothSingleSelection = selectedResources.length === 1 && this.props.resourceWorkspaceContext.selectedResources.length === 1;
const hasSingleSelectedResourceChanged = hasBothSingleSelection && selectedResources[0].id !== nextProps.resourceWorkspaceContext.selectedResources[0].id;
const hasSelectedResourcesLengthChanged = nextProps.resourceWorkspaceContext.selectedResources.length !== selectedResources.length;
const hasSorterChanged = sorter !== nextProps.resourceWorkspaceContext.sorter;
const hasSelectedResourcesLengthChanged = this.props.resourceWorkspaceContext.selectedResources.length !== selectedResources.length;
const hasSorterChanged = sorter !== this.props.resourceWorkspaceContext.sorter;
const hasResourceToScrollChange = Boolean(scrollTo.resource && scrollTo.resource.id);
const hasResourcePreviewSecretChange = nextState.previewedCellule !== this.state.previewedCellule;
const hasResourceColumnsChange = nextState.columns !== this.state.columns;
const hasColumnsResourceViewChange = nextProps.resourceWorkspaceContext.columnsResourceSetting?.hasDifferentShowValue(columnsResourceSetting);
const hasColumnsResourceViewChange = this.props.resourceWorkspaceContext.columnsResourceSetting?.hasDifferentShowValue(columnsResourceSetting);
const mustHidePreviewPassword = hasFilteredResourcesChanged || hasSingleSelectedResourceChanged || hasSelectedResourcesLengthChanged || hasSorterChanged;
if (mustHidePreviewPassword) {
this.hidePreviewedCellule();
Expand Down Expand Up @@ -684,6 +684,10 @@ class DisplayResourcesList extends React.Component {
this.props.actionFeedbackContext.displayError(message);
}

/**
* Triggers a scroll of the grid to a resource given its id, if the resource is not visible yet.
* @param {string} resourceId
*/
scrollTo(resourceId) {
const resourceIndex = this.resources.findIndex(resource => resource.id === resourceId);
const [visibleStartIndex, visibleEndIndex] = this.listRef.current.getVisibleRange();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {withProgress} from "../../../contexts/ProgressContext";
import {TotpCodeGeneratorService} from "../../../../shared/services/otp/TotpCodeGeneratorService";
import {TotpWorkflowMode} from "../HandleTotpWorkflow/HandleTotpWorkflowMode";
import {withWorkflow} from "../../../contexts/WorkflowContext";
import {HandleTotpWorkflow} from "../HandleTotpWorkflow/HandleTotpWorkflow";
import HandleTotpWorkflow from "../HandleTotpWorkflow/HandleTotpWorkflow";
import {withPasswordExpiry} from "../../../contexts/PasswordExpirySettingsContext";
import {formatDateForApi} from "../../../../shared/utils/dateUtils";
import {DateTime} from "luxon";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
plaintextSecretPasswordDescriptionTotpDto,
plaintextSecretPasswordStringDto
} from "../../../../shared/models/entity/plaintextSecret/plaintextSecretEntity.test.data";
import {HandleTotpWorkflow} from "../HandleTotpWorkflow/HandleTotpWorkflow";
import HandleTotpWorkflow from "../HandleTotpWorkflow/HandleTotpWorkflow";
import {TotpWorkflowMode} from "../HandleTotpWorkflow/HandleTotpWorkflowMode";
import PasswordExpiryDialog from "../PasswordExpiryDialog/PasswordExpiryDialog";
import {defaultPasswordExpirySettingsContext} from "../../../contexts/PasswordExpirySettingsContext.test.data";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,15 @@ class DisplayResourceDetailsInformation extends React.Component {
if (error.name !== "UserAbortsOperationError") {
this.props.actionFeedbackContext.displayError(error.message);
}
return;
}
}

this.props.progressContext.close();

if (!plaintextSecretDto) {
return;
}

if (!plaintextSecretDto?.password?.length) {
await this.props.actionFeedbackContext.displayError(this.translate("The password is empty and cannot be copied to clipboard."));
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,17 @@ export class ResourceWorkspaceContextProvider extends React.Component {
}
const sorter = gridUserSettingEntity?.sorter || this.state.sorter;
// process the search after the grid setting is loaded
this.setState({columnsResourceSetting, sorter}, () => this.search(this.state.filter));
this.setState({columnsResourceSetting, sorter}, () => {
this.search(this.state.filter);
/*
* we run scrollTo again here as all data is loaded and the previous sort is loaded as well.
* This make sure that the computed scroll position takes into account the sort and scolls the grid where it should
*/
const selectedResource = this.state.selectedResources;
if (selectedResource.length === 1) {
this.scrollTo(selectedResource[0]);
}
});
}

/**
Expand Down

0 comments on commit 81eaf2e

Please sign in to comment.