Skip to content

Commit

Permalink
Merge branch 'improvement/ZKUI-430' into q/2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
bert-e committed Dec 29, 2023
2 parents 69ca5f5 + 8f27ce9 commit 26aaa0a
Show file tree
Hide file tree
Showing 43 changed files with 123 additions and 378 deletions.
10 changes: 5 additions & 5 deletions 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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"@hookform/resolvers": "^2.8.8",
"@js-temporal/polyfill": "^0.4.3",
"@monaco-editor/react": "^4.4.5",
"@scality/core-ui": "github:scality/core-ui#0.109.0",
"@scality/core-ui": "github:scality/core-ui#0.110.0",
"@scality/module-federation": "github:scality/module-federation#1.1.0",
"@types/react-table": "^7.7.10",
"@types/react-virtualized": "^9.21.20",
Expand Down
8 changes: 1 addition & 7 deletions src/react/ZenkoUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { Banner, Icon, ScrollbarWrapper } from '@scality/core-ui';
import ErrorHandlerModal from './ui-elements/ErrorHandlerModal';
import Loader from './ui-elements/Loader';
import Routes from './Routes';
import { ThemeProvider } from 'styled-components';
import { loadAppConfig } from './actions';
import { useConfig } from './next-architecture/ui/ConfigProvider';
import { useAuth } from './next-architecture/ui/AuthProvider';
Expand All @@ -22,7 +21,6 @@ function ZenkoUI() {
const configFailureErrorMessage = useSelector((state: AppState) =>
state.uiErrors.errorType === 'byComponent' ? state.uiErrors.errorMsg : '',
);
const theme = useSelector((state: AppState) => state.uiConfig.theme);
const dispatch = useDispatch();
const conf = useConfig();
const user = useAuth();
Expand Down Expand Up @@ -58,11 +56,7 @@ function ZenkoUI() {
return <Loader> Login in </Loader>;
}

return (
<ThemeProvider theme={theme}>
<ScrollbarWrapper>{content()}</ScrollbarWrapper>
</ThemeProvider>
);
return <ScrollbarWrapper>{content()}</ScrollbarWrapper>;
}

export default ZenkoUI;
12 changes: 6 additions & 6 deletions src/react/account/AccountDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DefaultTheme, useTheme } from 'styled-components';
import { useTheme } from 'styled-components';
import type { Account } from '../../types/account';
import { CustomTabs } from '../ui-elements/Tabs';
import Properties from './details/Properties';
Expand All @@ -20,7 +20,7 @@ const NotFound = () => (
);

function AccountDetails({ account }: Props) {
const theme: DefaultTheme = useTheme();
const theme = useTheme();
const { accountName } = useParams<{ accountName: string }>();
const { isStorageManager } = useAuthGroups();

Expand All @@ -29,16 +29,16 @@ function AccountDetails({ account }: Props) {
}

const customTabStyle = {
inactiveTabColor: theme.brand.backgroundLevel2,
activeTabColor: theme.brand.backgroundLevel3,
tabContentColor: theme.brand.backgroundLevel3,
inactiveTabColor: theme.backgroundLevel2,
activeTabColor: theme.backgroundLevel3,
tabContentColor: theme.backgroundLevel3,
};

return (
<CustomTabs
{...customTabStyle}
style={{
backgroundColor: theme.brand.backgroundLevel2,
backgroundColor: theme.backgroundLevel2,
}}
>
<CustomTabs.Tab exact label="Properties" path={``}>
Expand Down
2 changes: 1 addition & 1 deletion src/react/account/AccountUserAccessKeys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import DeleteConfirmation from '../ui-elements/DeleteConfirmation';
import { getUserAccessKeysQuery } from '../queries';

const CustomIcon = styled.i`
color: ${(props) => props.color ?? props.theme.brand.infoPrimary};
color: ${(props) => props.color ?? props.theme.infoPrimary};
font-size: 32px;
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ function AttachmentConfirmationModal({
<Icon name="Link" /> Attach
</span>
) : (
<Box color={theme.brand.statusCritical}>
<Box color={theme.statusCritical}>
<Icon name="Unlink" /> Detach
</Box>
);
Expand Down
14 changes: 7 additions & 7 deletions src/react/account/iamAttachment/AttachmentTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const MenuContainer = styled.ul<{
isOpen: boolean;
searchInputIsFocused: boolean;
}>`
background-color: ${(props) => props.theme.brand.backgroundLevel1};
background-color: ${(props) => props.theme.backgroundLevel1};
background-clip: content-box;
padding: 0;
list-style: none;
Expand All @@ -70,18 +70,18 @@ const MenuContainer = styled.ul<{
border-top-right-radius: 0;
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
border: 1px solid ${props.theme.brand.selectedActive};
border: 1px solid ${props.theme.selectedActive};
`
: props.searchInputIsFocused
? `border-bottom: 1px solid ${props.theme.brand.selectedActive};`
? `border-bottom: 1px solid ${props.theme.selectedActive};`
: ''}
border-top: 0;
li {
padding: ${spacing.sp8};
cursor: pointer;
border-top: 1px solid ${(props) => props.theme.brand.backgroundLevel2};
border-top: 1px solid ${(props) => props.theme.backgroundLevel2};
&[aria-selected='true'] {
background: ${(props) => props.theme.brand.highlight};
background: ${(props) => props.theme.highlight};
}
}
`;
Expand All @@ -107,12 +107,12 @@ const StyledSearchInput = styled(SearchInput)`

const AttachmentTableContainer = styled.div`
height: 80%;
background: ${(props) => props.theme.brand.backgroundLevel3};
background: ${(props) => props.theme.backgroundLevel3};
padding: ${spacing.sp24};
`;

const StyledTable = styled.div`
background: ${(props) => props.theme.brand.backgroundLevel4};
background: ${(props) => props.theme.backgroundLevel4};
height: 100%;
`;

Expand Down
2 changes: 1 addition & 1 deletion src/react/account/iamAttachment/AttachmentTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const AttachmentTabs = ({
},
{ user: [], role: [], policy: [], group: [] },
);
const { backgroundLevel3, backgroundLevel4 } = theme.brand;
const { backgroundLevel3, backgroundLevel4 } = theme;
const customTabStyle = {
inactiveTabColor: backgroundLevel4,
activeTabColor: backgroundLevel3,
Expand Down
4 changes: 2 additions & 2 deletions src/react/account/iamAttachment/Attachments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const AttachmentContainer = styled.div`
`;

const AttachmentFooterContainer = styled.div`
border-top: 1px solid ${(props) => props.theme.brand.backgroundLevel2};
border-top: 1px solid ${(props) => props.theme.backgroundLevel2};
margin-top: 3%;
padding-top: 1%;
padding-left: 1%;
Expand All @@ -36,7 +36,7 @@ const TitleBlock = styled(LargerText)`
padding: 1rem 0;
margin-bottom: 1rem;
gap: 2rem;
border-bottom: 1px solid ${(props) => props.theme.brand.backgroundLevel2};
border-bottom: 1px solid ${(props) => props.theme.backgroundLevel2};
`;

const DescriptiveBlock = styled(BasicText)`
Expand Down
6 changes: 0 additions & 6 deletions src/react/actions/__tests__/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
APP_CONFIG,
INSTANCE_ID,
LOGOUT_MOCK,
THEME,
initState,
testActionFunction,
testDispatchFunction,
Expand Down Expand Up @@ -50,11 +49,6 @@ describe.skip('auth actions', () => {
fn: actions.configAuthFailure(),
expectedActions: [dispatchAction.CONFIG_AUTH_FAILURE_ACTION],
},
{
it: 'should return SET_THEME action',
fn: actions.setTheme(THEME),
expectedActions: [dispatchAction.SET_THEME_ACTION],
},
{
it: 'should return SET_OIDC_LOGOUT action',
fn: actions.setOIDCLogout(LOGOUT_MOCK),
Expand Down
6 changes: 0 additions & 6 deletions src/react/actions/__tests__/utils/dispatchActionsList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import type {
SetManagementClientAction,
SetOIDCLogoutAction,
SetSTSClientAction,
SetThemeAction,
SetZenkoClientAction,
ToggleAllObjectsAction,
ToggleObjectAction,
Expand Down Expand Up @@ -68,7 +67,6 @@ import {
INSTANCE_STATUS_RUNNINGv2,
LATEST_OVERLAY,
LOGOUT_MOCK,
THEME,
} from './testUtil';
// auth actions
export const SET_MANAGEMENT_CLIENT_ACTION: SetManagementClientAction = {
Expand Down Expand Up @@ -108,10 +106,6 @@ export const SELECT_ACCOUNT_ACTION: SelectAccountAction = {
type: 'SELECT_ACCOUNT',
account: ACCOUNT,
};
export const SET_THEME_ACTION: SetThemeAction = {
type: 'SET_THEME',
theme: THEME,
};
export const SET_OIDC_LOGOUT_ACTION: SetOIDCLogoutAction = {
type: 'SET_OIDC_LOGOUT',
logout: LOGOUT_MOCK,
Expand Down
44 changes: 1 addition & 43 deletions src/react/actions/__tests__/utils/testUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,49 +123,7 @@ export const INSTANCE_STATUS_RUNNINGv2 = {
...instanceStatus,
state: { ...instanceStatus.state, runningConfigurationVersion: 2 },
};
export const THEME = {
brand: {
statusHealthy: '#0AADA6',
statusWarning: '#F8F32B',
statusCritical: '#E84855',
selectedActive: '#037AFF',
highlight: '#1A3C75',
border: '#313131',
buttonPrimary: '#2F4185',
buttonSecondary: '#595A78',
buttonDelete: '#3D0808',
infoPrimary: '#8E8EAC',
infoSecondary: '#333366',
backgroundLevel1: '#121219',
backgroundLevel2: '#323245',
backgroundLevel3: '#232331',
backgroundLevel4: '#171721',
textPrimary: '#FFFFFF',
textSecondary: '#EAEAEA',
textTertiary: '#B5B5B5',
textReverse: '#000000',
textLink: '#71AEFF',
// degraded colors
alert: '#FFE508',
base: '#7B7B7B',
primary: '#1D1D1D',
primaryDark1: '#171717',
primaryDark2: '#0A0A0A',
secondary: '#0F7FFF',
secondaryDark1: '#1C3D59',
secondaryDark2: '#1C2E3F',
success: '#006F62',
healthy: '#30AC26',
healthyLight: '#69E44C',
warning: '#FFC10A',
danger: '#AA1D05',
critical: '#BE321F',
background: '#121212',
backgroundBluer: '#192A41',
borderLight: '#A5A5A5',
info: '#434343',
},
};

export function errorManagementState(): AppState {
const state = initState;
return {
Expand Down
9 changes: 1 addition & 8 deletions src/react/actions/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ import type {
SetManagementClientAction,
SetOIDCLogoutAction,
SetSTSClientAction,
SetThemeAction,
ThunkNonStateAction,
ThunkStatePromisedAction,
} from '../../types/actions';
import type { OidcLogoutFunction } from '../../types/auth';
import type { AppConfig, InstanceId, Theme } from '../../types/entities';
import type { AppConfig, InstanceId } from '../../types/entities';
import type { ManagementClient as ManagementClientInterface } from '../../types/managementClient';
import type { STSClient as STSClientInterface } from '../../types/sts';
import {
Expand Down Expand Up @@ -73,12 +72,6 @@ export function configAuthFailure(): ConfigAuthFailureAction {
type: 'CONFIG_AUTH_FAILURE',
};
}
export function setTheme(theme: Theme): SetThemeAction {
return {
type: 'SET_THEME',
theme,
};
}
export function loadAppConfig(config: AppConfig, user): ThunkNonStateAction {
return (dispatch) => {
dispatch(addOIDCUser(user.original));
Expand Down
16 changes: 4 additions & 12 deletions src/react/databrowser/objects/ObjectDelete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const Files = styled.div`
width: 31.25rem;
overflow-y: scroll;
margin: ${spacing.sp8} 0rem;
border: ${spacing.sp1} solid ${(props) => props.theme.brand.border};
border: ${spacing.sp1} solid ${(props) => props.theme.border};
`;
const VersionId = styled.div`
font-size: ${fontSize.small};
Expand Down Expand Up @@ -323,23 +323,15 @@ const ObjectDelete = ({ bucketName, toggled, prefixWithSlash }: Props) => {
if (s3Object.lockStatus === 'LOCKED' && s3Object.versionId) {
if (s3Object.objectRetention?.mode === 'COMPLIANCE') {
return (
<Box
display="flex"
color={theme.brand?.textTertiary}
gap={spacing.sp4}
>
<Box display="flex" color={theme?.textTertiary} gap={spacing.sp4}>
<Icon color="buttonSecondary" name="Lock" />
<span>Protected (compliance), won't be deleted</span>
</Box>
);
}
if (s3Object.objectRetention?.mode === 'GOVERNANCE') {
return (
<Box
display="flex"
color={theme.brand?.textTertiary}
gap={spacing.sp4}
>
<Box display="flex" color={theme?.textTertiary} gap={spacing.sp4}>
<Icon color="buttonSecondary" name="Lock" />
<span>Protected (governance), will be deleted</span>
</Box>
Expand All @@ -348,7 +340,7 @@ const ObjectDelete = ({ bucketName, toggled, prefixWithSlash }: Props) => {
}
if (s3Object.isLegalHoldEnabled && s3Object.versionId) {
return (
<Box display="flex" color={theme.brand?.textTertiary} gap={spacing.sp4}>
<Box display="flex" color={theme?.textTertiary} gap={spacing.sp4}>
<Icon color="buttonSecondary" name="Lock" />
<span>Protected (legal hold), won't be deleted</span>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion src/react/databrowser/objects/ObjectUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const DropZone = styled.div`
padding: ${spacing.sp20};
border-width: ${spacing.sp2};
border-radius: ${spacing.sp2};
border-color: ${(props) => props.theme.brand.border};
border-color: ${(props) => props.theme.border};
border-style: dashed;
`;
const RemoveCell = styled(T.Cell)`
Expand Down
2 changes: 2 additions & 0 deletions src/react/databrowser/objects/__tests__/FolderCreate.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
} from '../../../actions/__tests__/utils/testUtil';
import FolderCreate from '../FolderCreate';
import { reduxMount, renderWithRouterMatch } from '../../../utils/testUtil';
import { ThemeProvider } from 'styled-components';
import { coreUIAvailableThemes } from '@scality/core-ui/dist/style/theme';

describe('FolderCreate', () => {
const modalTitle = 'Create a folder';
Expand Down
Loading

0 comments on commit 26aaa0a

Please sign in to comment.