-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '1.x' of https://github.com/Laserfiche/laserfiche-sharep…
…oint-integration into alex/simplify-mapping-page
- Loading branch information
Showing
10 changed files
with
493 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,89 @@ | ||
import * as React from 'react'; | ||
import { Navigation } from 'spfx-navigation'; | ||
import styles from './SendToLaserFiche.module.scss'; | ||
import { SPComponentLoader } from '@microsoft/sp-loader'; | ||
import { SavedToLaserficheDocumentData } from './SaveDocumentToLaserfiche'; | ||
|
||
const SAVING_DOCUMENT_TO_LASERFICHE = 'Saving your document to Laserfiche'; | ||
const SAVING_DOCUMENT_TO_LASERFICHE = 'Saving document to Laserfiche...'; | ||
|
||
export default function LoadingDialog() { | ||
return ( | ||
<> | ||
<img | ||
style={{ marginLeft: '28%' }} | ||
src='/_layouts/15/images/progress.gif' | ||
id='imgid' | ||
/> | ||
<div> | ||
<p className={styles.text}>{SAVING_DOCUMENT_TO_LASERFICHE}</p> | ||
</div> | ||
<img src='/_layouts/15/images/progress.gif' /> | ||
<br /> | ||
<div>{SAVING_DOCUMENT_TO_LASERFICHE}</div> | ||
</> | ||
); | ||
} | ||
|
||
const DOCUMENT_UPLOADED = 'Document uploaded'; | ||
const DOCUMENT_UPLOADED_METADATA_FAILED = | ||
'Document uploaded to repository, updating metadata failed due to constraint mismatch'; | ||
const DOCUMENT_SUCCESSFULLY_UPLOADED_TO_LASERFICHE_WITH_NAME = | ||
'Document successfully uploaded to Laserfiche with name:'; | ||
const METADATA_FAILED_TO_SAVE_INVALID_FIELD = | ||
'All metadata failed to save due to at least one invalid field'; | ||
const TEMPLATE_FIELDS_NOT_APPLIED = | ||
'The Laserfiche template and fields were not applied to this document.'; | ||
const CLOSE = 'Close'; | ||
const GO_TO_FILE = 'Go to File'; | ||
const GO_TO_LIBRARY = 'Go to Library'; | ||
const CLICK_HERE_VIEW_FILE_LASERFICHE = | ||
'Click here to view the file in Laserfiche'; | ||
const CLICK_HERE_GO_SHAREPOINT_LIBRARY = | ||
'Click here to go back to your SharePoint library'; | ||
const VIEW_FILE_IN_LASERFICHE = 'View file in Laserfiche'; | ||
|
||
export function SavedToLaserficheSuccessDialog(props: { | ||
closeClick: () => Promise<void>; | ||
successfulSave: { | ||
fileLink: string; | ||
pathBack: string; | ||
metadataSaved: boolean; | ||
}; | ||
export function SavedToLaserficheSuccessDialogText(props: { | ||
successfulSave: SavedToLaserficheDocumentData; | ||
}) { | ||
React.useEffect(() => { | ||
SPComponentLoader.loadCss( | ||
'https://cdn.jsdelivr.net/npm/@laserfiche/lf-ui-components@14/cdn/indigo-pink.css' | ||
); | ||
SPComponentLoader.loadCss( | ||
'https://cdn.jsdelivr.net/npm/@laserfiche/lf-ui-components@14/cdn/lf-ms-office-lite.css' | ||
); | ||
}, []); | ||
|
||
const metadataFailedNotice: JSX.Element = ( | ||
<span> | ||
{DOCUMENT_UPLOADED_METADATA_FAILED} | ||
{METADATA_FAILED_TO_SAVE_INVALID_FIELD} | ||
<br /> <p style={{ color: 'red' }}>{TEMPLATE_FIELDS_NOT_APPLIED}</p> | ||
</span> | ||
); | ||
|
||
return ( | ||
<> | ||
<div> | ||
{`${DOCUMENT_SUCCESSFULLY_UPLOADED_TO_LASERFICHE_WITH_NAME} ${props.successfulSave.fileName}.`} | ||
{!props.successfulSave.metadataSaved && metadataFailedNotice} | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export function SavedToLaserficheSuccessDialogButtons(props: { | ||
closeClick: () => Promise<void>; | ||
successfulSave: SavedToLaserficheDocumentData; | ||
}) { | ||
React.useEffect(() => { | ||
SPComponentLoader.loadCss( | ||
'https://cdn.jsdelivr.net/npm/@laserfiche/lf-ui-components@14/cdn/indigo-pink.css' | ||
); | ||
SPComponentLoader.loadCss( | ||
'https://cdn.jsdelivr.net/npm/@laserfiche/lf-ui-components@14/cdn/lf-ms-office-lite.css' | ||
); | ||
}, []); | ||
|
||
function viewFile() { | ||
window.open(props.successfulSave.fileLink); | ||
} | ||
|
||
function redirect() { | ||
Navigation.navigate(props.successfulSave.pathBack, true); | ||
} | ||
|
||
return ( | ||
<> | ||
<div> | ||
<p className={styles.text}> | ||
{props.successfulSave.metadataSaved | ||
? DOCUMENT_UPLOADED | ||
: metadataFailedNotice} | ||
</p> | ||
</div> | ||
|
||
<div className={styles.button}> | ||
<button className={styles.button1} onClick={props.closeClick}> | ||
{CLOSE} | ||
</button> | ||
{props.successfulSave.fileLink && ( | ||
<button | ||
className={styles.button2} | ||
title={CLICK_HERE_VIEW_FILE_LASERFICHE} | ||
onClick={viewFile} | ||
> | ||
{GO_TO_FILE} | ||
</button> | ||
)} | ||
{props.successfulSave?.fileLink && ( | ||
<button | ||
className={styles.button2} | ||
title={CLICK_HERE_GO_SHAREPOINT_LIBRARY} | ||
onClick={redirect} | ||
className={`lf-button primary-button ${styles.actionButton}`} | ||
title={VIEW_FILE_IN_LASERFICHE} | ||
onClick={viewFile} | ||
> | ||
{GO_TO_LIBRARY} | ||
{VIEW_FILE_IN_LASERFICHE} | ||
</button> | ||
</div> | ||
)} | ||
<button className='lf-button sec-button' onClick={props.closeClick}> | ||
{CLOSE} | ||
</button> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.