Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export interface FieldMapType {
otherCmsType: string;
uid: string;
id: string;
_invalid?: boolean;
_canFreezeCheckbox?: boolean;
_canSelect?: boolean;
}

export interface ItemStatus {
Expand Down
33 changes: 25 additions & 8 deletions ui/src/components/ContentMapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ const ContentMapper = () => {
stackStatus();

tableData?.forEach((field) => {
if (field?.otherCmsField === 'title' || field?.otherCmsField === 'url') {
field._invalid = true;
if (field?.otherCmsField === 'title') {
field._canFreezeCheckbox = true;
}
});
}, []);
Expand Down Expand Up @@ -400,6 +400,7 @@ const ContentMapper = () => {
maxWidth="290px"
isClearable={false}
options={option}
isDisabled={data?.otherCmsField === 'title' || data?.otherCmsField === 'url'}
/>
</div>
<Icon
Expand Down Expand Up @@ -637,7 +638,7 @@ const ContentMapper = () => {
if (!IsEmptyStack) {
columns?.push({
disableSortBy: true,
Header: `Contentstack: ${newMigrationData?.destination_stack?.selectedStack?.label}`,
Header: `Contentstack: ${OtherContentType?.label ?? ''}`,
// accessor: 'ct_field',
accessor: SelectAccessorOfColumn,
id: 'contentstack_field',
Expand All @@ -664,7 +665,23 @@ const ContentMapper = () => {
value: item?.title
}));

// console.log("==============", contentTypesList);
const [SelectedAssets, updateSelectedAssets] = useState({})
const [resetRowSelection, updateResetRowSelection] = useState(false)

const getSelectedRow = (singleSelectedRowIds: any, selectedData: any) => {
console.log("singleSelectedRowIds, selectedData", singleSelectedRowIds, selectedData);

}

const onRowSelectProp = [
{
label: 'Log selected Items',
cb: (data: any) => {
console.log('selected data', data)
updateResetRowSelection(true)
}
}
]

return (
<div className="step-container">
Expand Down Expand Up @@ -750,6 +767,7 @@ const ContentMapper = () => {
columnSelector={false}
initialRowSelectedData={tableData}
initialSelectedRowIds={rowIds}
// getSelectedRow={getSelectedRow}
withExportCta={{
component: (
<div style={{ display: 'flex', gap: '10px' }}>
Expand All @@ -771,10 +789,9 @@ const ContentMapper = () => {
),
showExportCta: true
}}
rowDisableProp={{
key: '_invalid',
value: true
}}
// onRowSelectProp={onRowSelectProp}
// rowSelectCheckboxProp={{ key: '_canSelect', value: true }}
v2Features={{ key: 'canFreezeCheckbox', value: true }}
/>
</div>

Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/LegacyCms/Actions/LoadSelectCms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ const LoadSelectCms = (props: LoadSelectCmsProps) => {
<Search
className="service_list_search_bar"
width="full"
placeholder="Search for connectors"
placeholder="Search for CMS"
debounceSearch
onClear
version="v2"
Expand Down
1 change: 0 additions & 1 deletion ui/src/components/LegacyCms/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import AutoVerticalStepper from '../Stepper/VerticalStepper/AutoVerticalStepper'
import { getLegacyCMSSteps } from './StepperSteps';
import { useNavigate, useParams } from 'react-router-dom';
import { Button } from '@contentstack/venus-components';
// import { getEntries } from '../../services/contentstackSDK';
import { CS_ENTRIES, PROJECT_STATUS } from '../../utilities/constants';
import { AppContext } from '../../context/app/app.context';
import {
Expand Down
20 changes: 9 additions & 11 deletions ui/src/pages/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,15 @@ const Home = () => {
const { cta, description, heading } = data;

return (
<div className="container">
<div className="d-flex vh-100 align-items-center justify-content-center flex-column">
{heading && <Heading tagName="h0" text={heading} className="pb-2" />}
{description && <p className="pb-5">{parse(description)}</p>}

{cta && cta?.title && (
<Link to={cta?.url as string} className="btn primary-btn">
<Button version="v2">{cta?.title}</Button>
</Link>
)}
</div>
<div className="d-flex vh-100 align-items-center justify-content-center flex-column">
{heading && <Heading tagName="h0" text={heading} className="pb-2" />}
{description && <p className="pb-4">{parse(description)}</p>}

{cta && cta?.title && (
<Link to={cta?.url as string} className="btn primary-btn pb-0">
<Button version="v2">{cta?.title}</Button>
</Link>
)}
</div>
);
};
Expand Down
34 changes: 23 additions & 11 deletions ui/src/pages/Login/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ import {
Heading,
ValidationMessage,
Paragraph,
Link
Link,
Notification
} from '@contentstack/venus-components';
import { Field as FinalField, Form as FinalForm } from 'react-final-form';

// Utilities
import { LOGIN_SUCCESSFUL_MESSAGE, TFA_MESSAGE, CS_ENTRIES } from '../../utilities/constants';
import { LOGIN_SUCCESSFUL_MESSAGE, TFA_MESSAGE, TFA_VIA_SMS_MESSAGE, CS_ENTRIES } from '../../utilities/constants';
import {
failtureNotification,
clearMarks,
Expand Down Expand Up @@ -85,7 +86,7 @@ const Login: FC<IProps> = (props: any) => {
}, []);

// ************* send SMS token ************
const sendSMS = async (): Promise<void> => {
const sendSMS = async () => {
const userAuth = {
user: {
email: loginStates?.user?.email,
Expand All @@ -94,14 +95,25 @@ const Login: FC<IProps> = (props: any) => {
}
};

requestSMSToken(userAuth?.user)
.then((res: UserRes) => {
if (res?.message === LOGIN_SUCCESSFUL_MESSAGE) {
setLoginStates((prev) => ({ ...prev, submitted: true }));
}
})
.catch((err: string) => console.error(err));
};
await requestSMSToken(userAuth?.user)
.then((res: UserRes) => {
if (res?.status === 200 && res?.data?.notice === TFA_VIA_SMS_MESSAGE) {
Notification({
notificationContent: { text: res?.data?.notice },
type: 'success'
});
}

if (res?.message === LOGIN_SUCCESSFUL_MESSAGE) {
setLoginStates((prev) => ({ ...prev, submitted: true }));
}

if (res?.status === 422) {
failtureNotification(res?.data?.error_message as string);
}
})
.catch((err: string) => console.error(err));
};

// ************* Login submit ************
const onSubmit = async (values: User) => {
Expand Down
7 changes: 7 additions & 0 deletions ui/src/pages/Login/login.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ export interface User {

export interface UserRes {
message?: string;
status?: number;
data?: Response;
}

interface Response {
notice?: string;
error_message?: string;
}

export interface SmsToken {
Expand Down
15 changes: 8 additions & 7 deletions ui/src/pages/RegionalLogin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,17 @@ const RegionalLogin = () => {
const { description, heading, regions } = data;

return (
<>
<div className="pb-6">
<div className="container mx-auto text-center">
<div className='d-flex vh-100 align-items-center justify-content-center flex-column'>
<div className="container mx-auto">
<div className='text-center'>
{heading && <Heading tagName="h0" text={heading} className="pb-2" />}
{description && description != '' && (
<div className="textStone600 pt-3">{parse(description as string)}</div>
)}
</div>
</div>
<div className="container">

<div className="mw-1100 mx-auto">
<div className="row">
<div className="row pt-6">
{regions &&
validateArray(regions) &&
regions?.map((region, index) => (
Expand Down Expand Up @@ -115,7 +114,9 @@ const RegionalLogin = () => {
</div>
</div>
</div>
</>


</div>
);
};

Expand Down
3 changes: 2 additions & 1 deletion ui/src/utilities/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const BASE_API_URL = 'http://localhost:5000/';
export const BASE_API_URL = 'http://localhost:5001/';
export const assetsRelativeUrl = 'v3/assets';
export const WEBSITE_BASE_URL = process.env.REACT_APP_WEBSITE_BASE_URL;
export const TOKEN_KEY = 'access_token';
Expand All @@ -10,6 +10,7 @@ export const AUTH_ROUTES = `${API_VERSION}/auth`;

export const LOGIN_SUCCESSFUL_MESSAGE = 'Login Successful.';
export const TFA_MESSAGE = 'Please login using the Two-Factor verification Token';
export const TFA_VIA_SMS_MESSAGE = 'Two-Factor Authentication Token sent via SMS.';

export const API_METHOD = {
GET: 'GET',
Expand Down
11 changes: 6 additions & 5 deletions ui/src/utilities/functions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Notification } from '@contentstack/venus-components';
import { WEBSITE_BASE_URL } from './constants';

export const Locales = {
en: 'en-us',
Expand Down Expand Up @@ -28,17 +29,17 @@ export const validateImage = (image: any) => image && image?.url;
export const validateLink = (link: any) => link && link?.url;

export const imageWithSiteDomainUrl = (url: string) => {
if (process?.env?.WEBSITE_BASE_URL && url?.indexOf('https://images.contentstack.io') > -1) {
return url.replace('https://images.contentstack.io', process.env.WEBSITE_BASE_URL);
if (WEBSITE_BASE_URL && url?.indexOf('https://images.contentstack.io') > -1) {
return url.replace('https://images.contentstack.io', WEBSITE_BASE_URL);
}
if (process?.env?.WEBSITE_BASE_URL && url?.indexOf('https://assets.contentstack.io/') > -1) {
return url.replace('https://assets.contentstack.io', process.env.WEBSITE_BASE_URL);
if (WEBSITE_BASE_URL && url?.indexOf('https://assets.contentstack.io/') > -1) {
return url.replace('https://assets.contentstack.io', WEBSITE_BASE_URL);
}
return url;
};

export const addDomainInPath = (path: string) => {
return `${process.env.REACT_APP_WEBSITE_BASE_URL}${path}`;
return `${WEBSITE_BASE_URL}${path}`;
};

export const failtureNotification = (errorMessage: string) => {
Expand Down