Skip to content

Commit

Permalink
Deploying to gh-pages from @ 45e64f8 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
passbolt-github committed Oct 23, 2024
1 parent cc868a7 commit 0cb31df
Show file tree
Hide file tree
Showing 78 changed files with 1,148 additions and 412 deletions.
1 change: 1 addition & 0 deletions css/themes/default/ext_app.css
Original file line number Diff line number Diff line change
Expand Up @@ -4857,6 +4857,7 @@ form.search label {
cursor: default;
pointer-events: none;
}
.navigation-secondary-tree .row.disabled .main-cell span.tag-name,
.navigation-secondary-tree .row.disabled .main-cell span.folder-name {
color: #888888;
text-shadow: none;
Expand Down
1 change: 1 addition & 0 deletions css/themes/midgar/ext_app.css
Original file line number Diff line number Diff line change
Expand Up @@ -4858,6 +4858,7 @@ form.search label {
cursor: default;
pointer-events: none;
}
.navigation-secondary-tree .row.disabled .main-cell span.tag-name,
.navigation-secondary-tree .row.disabled .main-cell span.folder-name {
color: #8B8B89;
text-shadow: none;
Expand Down
1 change: 1 addition & 0 deletions css/themes/solarized_dark/ext_app.css
Original file line number Diff line number Diff line change
Expand Up @@ -4858,6 +4858,7 @@ form.search label {
cursor: default;
pointer-events: none;
}
.navigation-secondary-tree .row.disabled .main-cell span.tag-name,
.navigation-secondary-tree .row.disabled .main-cell span.folder-name {
color: hsl(194, 14%, 51%);
text-shadow: none;
Expand Down
1 change: 1 addition & 0 deletions css/themes/solarized_light/ext_app.css
Original file line number Diff line number Diff line change
Expand Up @@ -4858,6 +4858,7 @@ form.search label {
cursor: default;
pointer-events: none;
}
.navigation-secondary-tree .row.disabled .main-cell span.tag-name,
.navigation-secondary-tree .row.disabled .main-cell span.folder-name {
color: hsl(44, 50%, 78%);
text-shadow: none;
Expand Down
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.ec146caa.iframe.bundle.js"></script><script src="903.b2de08ef.iframe.bundle.js"></script><script src="main.7dce1f46.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.ec146caa.iframe.bundle.js"></script><script src="903.b2de08ef.iframe.bundle.js"></script><script src="main.c8d3b4cf.iframe.bundle.js"></script></body></html>
1 change: 1 addition & 0 deletions less/components/navigation/navigation-tree.less
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
cursor: default;
pointer-events: none;
.main-cell {
span.tag-name,
span.folder-name{
color: @text-light-color;
text-shadow: none;
Expand Down

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":1729493011196,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":true,"hasStorybookEslint":false,"refCount":0,"packageManager":{"type":"npm","version":"10.7.0"},"language":"javascript","storybookPackages":{},"framework":{},"addons":{"@storybook/addon-links":{"version":"6.5.16"},"@storybook/addon-essentials":{"options":{"backgrounds":false},"version":"6.5.16"}}}
{"generatedAt":1729696839214,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":true,"hasStorybookEslint":false,"refCount":0,"packageManager":{"type":"npm","version":"10.7.0"},"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 @@ -4,20 +4,21 @@ import InputPassphrase from "./InputPassphrase";
import AppContext from "../../../../shared/context/AppContext/AppContext";
import SiteSettings from "../../../../shared/lib/Settings/SiteSettings";
import siteSettingsFixture from "../../../test/fixture/Settings/siteSettings";
import {defaultAppContext} from "../../../contexts/ExtAppContext.test.data";


export default {
title: 'Components/AuthenticationPassphrase/InputPassphrase',
component: InputPassphrase
};

const context = {
const context = defaultAppContext({
userSettings: {
getTrustedDomain: () => (new URL(window.location.href)).origin,
getSecurityToken: () => ({backgroundColor: '#a85632', code: "ABC", textColor: '#ffffff'}),
},
siteSettings: new SiteSettings(siteSettingsFixture)
};
});


const Template = args =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import {siteSettingsCe} from "../../../test/fixture/Settings/siteSettings";
import DisplayMainMenu from "../../Common/Menu/DisplayMainMenu";
import Footer from "../../Common/Footer/Footer";
import RbacContextProvider from "../../../../shared/context/Rbac/RbacContext";
import MetadataTypesSettingsLocalStorageContextProvider from "../../../../shared/context/MetadataTypesSettingsLocalStorageContext/MetadataTypesSettingsLocalStorageContext";
import ResourceTypesLocalStorageContextProvider from "../../../../shared/context/ResourceTypesLocalStorageContext/ResourceTypesLocalStorageContext";

/**
* DisplayResourcesWorkspace stories
Expand All @@ -47,21 +49,25 @@ const Template = ({...args}) =>
<NavigationContextProvider>
<ContextualMenuContextProvider>
<ResourceWorkspaceContextProvider>
<ResourcePasswordGeneratorContextProvider>
<ManageContextualMenu/>
<ManageDialogs/>
<DragContextProvider>
<div id="container" className="page password">
<div id="app" className="app ready" tabIndex="1000">
<div className="header first">
<DisplayMainMenu/>
<MetadataTypesSettingsLocalStorageContextProvider>
<ResourceTypesLocalStorageContextProvider>
<ResourcePasswordGeneratorContextProvider>
<ManageContextualMenu/>
<ManageDialogs/>
<DragContextProvider>
<div id="container" className="page password">
<div id="app" className="app ready" tabIndex="1000">
<div className="header first">
<DisplayMainMenu/>
</div>
<DisplayResourcesWorkspace {...args}/>
</div>
<Footer/>
</div>
<DisplayResourcesWorkspace {...args}/>
</div>
<Footer/>
</div>
</DragContextProvider>
</ResourcePasswordGeneratorContextProvider>
</DragContextProvider>
</ResourcePasswordGeneratorContextProvider>
</ResourceTypesLocalStorageContextProvider>
</MetadataTypesSettingsLocalStorageContextProvider>
</ResourceWorkspaceContextProvider>
</ContextualMenuContextProvider>
</NavigationContextProvider>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/**
* Passbolt ~ Open source password manager for teams
* Copyright (c) 2020 Passbolt SA (https://www.passbolt.com)
*
* Licensed under GNU Affero General Public License version 3 of the or any later version.
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) 2020 Passbolt SA (https://www.passbolt.com)
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
* @link https://www.passbolt.com Passbolt(tm)
* @since 2.11.0
*/

import MockPort from "../../../test/mock/MockPort";
import {ResourceWorkspaceFilterTypes} from "../../../contexts/ResourceWorkspaceContext";

Expand Down Expand Up @@ -37,17 +51,18 @@ export function defaultResourceWorkspaceContext(context) {

/**
* Default props
* @returns {any}
* @param {array} resources Dragged resources
* @returns {object}
*/
export function defaultProps() {
export function defaultProps(resources) {
return {
history: {
push: jest.fn()
},
dragContext: {
dragging: true,
draggedItems: {
resources: [resource]
resources: resources
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,39 +18,40 @@
import {
defaultAppContext,
defaultProps,
defaultResourceWorkspaceContext, resource,
defaultResourceWorkspaceContext,
tagsMock
} from "./FilterResourcesByTags.test.data";
import FilterResourcesByTags from "./FilterResourcesByTags.test.page";
import MockPort from "../../../test/mock/MockPort";
import {ResourceWorkspaceFilterTypes} from "../../../contexts/ResourceWorkspaceContext";
import PassboltApiFetchError from "../../../../shared/lib/Error/PassboltApiFetchError";
import {defaultResourceDto} from "../../../../shared/models/entity/resource/resourceEntity.test.data";
import expect from "expect";

beforeEach(() => {
jest.resetModules();
});

describe("See tags", () => {
let page; // The page to test against
const props = defaultProps(); // The props to pass
let page, // The page to test against
resources, // The resources handled
props; // The props to pass

describe('As LU I see the tags of my resources', () => {
resources = [
defaultResourceDto({tags: tagsMock}),
];
props = defaultProps(resources);
const appContext = {
port: new MockPort(),
resources: [
{
tags: tagsMock
},
{
tags: tagsMock
}
],
resources: resources,
};
const context = defaultAppContext(appContext); // The applicative context
const resourceWorkspaceContext = defaultResourceWorkspaceContext();
const requestMockImpl = jest.fn((message, data) => data);
const mockContextRequest = (context, implementation) => jest.spyOn(context.port, 'request').mockImplementation(implementation);
mockContextRequest(context, requestMockImpl);

/**
* Given an organization with 5 tags
* Then I should see the 5 tags on the left sidebar
Expand All @@ -77,10 +78,11 @@ describe("See tags", () => {

it('As LU I should be able to drop a resource on tag', async() => {
await page.sidebarTagFilterSection.onDropTag(3);
expect(context.port.request).toHaveBeenCalledWith("passbolt.tags.add-resources-tag", {"resources": [resource.id], "tag": tagsMock[1]});
expect(context.port.request).toHaveBeenCalledWith("passbolt.tags.add-resources-tag", {"resources": [resources[0].id], "tag": tagsMock[1]});
});

it('As LU I should see tags disabled if a resource is dragging', async() => {
it('As LU I should see tags disabled if a resource I am not owner is dragging on a shared tag', async() => {
resources[0].permission.type = 1;
await page.sidebarTagFilterSection.onDropTag(3);
expect(page.sidebarTagFilterSection.tagClassname(1)).toBe('row disabled');
expect(page.sidebarTagFilterSection.tagClassname(2)).toBe('row');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,16 @@ class FilterResourcesByTagsList extends React.Component {
isDisabled(tag) {
/*
* If the user is dragging content, disable the component if:
* - The user is not allowed to drop content in the shared tag.
* - The user is not allowed to drop content he has no owner permission for on shared tag..
* - The user is not allowed to drop dragged items except resources;
*/
if (this.isDragging()) {
if (tag.is_shared) {
return true;
const isOwnerOfAllResources = this.draggedItems.resources
.some(resource => resource.permission?.type !== 15);
if (isOwnerOfAllResources) {
return true;
}
}
if (!this.canDropInto()) {
return true;
Expand Down Expand Up @@ -314,7 +318,7 @@ class FilterResourcesByTagsList extends React.Component {
<em className="empty-content"><Trans>empty</Trans></em>
}
{!this.isLoading() && this.filteredTags.length > 0 &&
<ul className="tree ready">
<ul className="navigation-secondary-tree ready">
{this.filteredTags.map(tag =>
<li className="open node root tag-item" key={tag.id}>
<div className={`row ${this.isSelected(tag.id) ? "selected" : ""} ${this.isDisabled(tag) ? "disabled" : ""} ${this.showDropFocus(tag) ? "drop-focus" : ""}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class DisplayResourceDetails extends React.Component {
* Get the sidebar subtitle
*/
get subtitle() {
const defaultSubtitle = this.translate("Resource");
const resource = this.props.resourceWorkspaceContext.details.resource;

// Resources types might not be yet initialized at the moment this component is rendered.
Expand All @@ -63,7 +62,18 @@ class DisplayResourceDetails extends React.Component {
}

const resourceType = this.props.resourceTypes.getFirstById(resource.resource_type_id);
return resourceType?.hasSecretDescription ? this.translate("Resource with encrypted description") : defaultSubtitle;
switch (resourceType.slug) {
case "password-string":
return this.translate("Password");
case "password-and-description":
return this.translate("Password and Encrypted description");
case "password-description-totp":
return this.translate("Password, Encrypted description and TOTP");
case "totp":
return this.translate("TOTP");
default:
return this.translate("Resource");
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe("DisplayResourceDetails", () => {
it('I can see the name of the selected resource', async() => {
expect.assertions(2);
expect(page.name).toBe(props.resourceWorkspaceContext.details.resource.metadata.name);
expect(page.subtitle).toBe('Resource with encrypted description');
expect(page.subtitle).toBe('Password and Encrypted description');
});

it('I can copy the resource permalink', async() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import AppContext from "../../../../shared/context/AppContext/AppContext";
import PropTypes from "prop-types";
import DefineResourceFolderMoveStrategy from "./DefineResourceFolderMoveStrategy";
import MockPort from "../../../test/mock/MockPort";
import {defaultAppContext} from "../../../contexts/ExtAppContext.test.data";


export default {
Expand All @@ -16,9 +17,7 @@ const defaultContext = {
{id: 1, name: "My folder"}
],
folderMoveStrategyProps: {
folders: [
{id: 1}
]
folders: [1]
},
port: new MockPort(),
setContext: () => {}
Expand All @@ -37,7 +36,7 @@ Template.propTypes = {

export const Initial = Template.bind({});
Initial.args = {
context: defaultContext,
context: defaultAppContext(defaultContext),
onClose: () => {}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import {MemoryRouter, Route} from "react-router-dom";
import AppContext from "../../../../shared/context/AppContext/AppContext";
import DisplayResourceFolderDetailsInformation from "./DisplayResourceFolderDetailsInformation";
import {defaultAppContext, defaultProps} from "./DisplayResourceFolderDetailsInformation.test.data";


export default {
Expand All @@ -26,28 +27,6 @@ const Template = args =>

export const Initial = Template.bind({});
Initial.args = {
resourceWorkspaceContext: {
details: {
folder: {
"id": "9e03fd73-04c0-5514-95fa-1a6cf2c7c093",
"name": "Accounting",
"created": "2020-02-01T00:00:00+00:00",
"modified": "2020-02-01T00:00:00+00:00",
"created_by": "f848277c-5398-58f8-a82a-72397af2d450",
"modified_by": "f848277c-5398-58f8-a82a-72397af2d450",
"permission": {
"id": "6aada140-fe8b-5e69-a90f-ae0cec6d3dcf",
"aco": "Folder",
"aco_foreign_key": "9e03fd73-04c0-5514-95fa-1a6cf2c7c093",
"aro": "User",
"aro_foreign_key": "f848277c-5398-58f8-a82a-72397af2d450",
"type": 1,
"created": "2020-05-11T10:11:13+00:00",
"modified": "2020-05-11T10:11:13+00:00"
},
"folder_parent_id": null,
"personal": false
}
}
}
context: defaultAppContext(),
...defaultProps()
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import AppContext from "../../../../shared/context/AppContext/AppContext";
import {MemoryRouter, Route} from "react-router-dom";
import React from "react";
import GenerateResourcePassword from "./GenerateResourcePassword";
import MockPort from "../../../test/mock/MockPort";
import {defaultPasswordPoliciesDto} from "../../../../shared/models/passwordPolicies/PasswordPoliciesDto.test.data";
import {defaultProps} from "./GenerateResourcePassword.test.data";


export default {
Expand All @@ -27,19 +26,11 @@ export default {


const Template = args =>
<AppContext.Provider>
<AppContext.Provider value={args.context}>
<MemoryRouter initialEntries={['/']}>
<Route component={routerProps => <GenerateResourcePassword {...args} {...routerProps}/>}></Route>
</MemoryRouter>
</AppContext.Provider>;

export const Initial = Template.bind({});
Initial.args = {
resourcePasswordGeneratorContext: {
settings: defaultPasswordPoliciesDto()
},
onClose: () => {},
context: {
port: new MockPort()
}
};
Initial.args = defaultProps();
Loading

0 comments on commit 0cb31df

Please sign in to comment.