Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Configuration, WebPart and Page names #26

Merged
merged 4 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/extensions/savetoLaserfiche/GetDocumentDataDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { BaseComponentContext } from '@microsoft/sp-component-base';
import LoadingDialog from './CommonDialogs';
import { SPComponentLoader } from '@microsoft/sp-loader';

const signInPageRoute = '/SitePages/LaserficheSpSignIn.aspx';
const signInPageRoute = '/SitePages/LaserficheSignIn.aspx';

export class GetDocumentDataCustomDialog extends BaseDialog {
successful = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,10 @@
"requiresCustomScript": false,

"items": {
"COMMAND_1": {
"SAVE_TO_LASERFICHE": {
"title": { "default": "Save to Laserfiche" },
"iconImageUrl": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAMAAAAKE/YAAAAAUVBMVEXSXyj////HYzL/+/T/+Or/9d+yaUa9ZT2yaUj/9OG7Zj3SXybRYCj/+/b///3LYS/OYCvEZDS2aEL/89jAZTnMYS3/8dO7Zzusa02+ZTn/78wyF0DsAAABnUlEQVR4nO3ci26CMABGYQcoLRS5OTf2/g86R+KSLYUm2vxcPB8RTYzxkADRajkcAAAAAAAAAADYgbJcusCvqdtLnhfeJR/a96X7vOriarNJ/cUtHeiTnI7p26TsY+XRZ190sXSfVyA6X7rP6xZdzeweREeTGDt3IBIdTeCUR3Q0wQOxLNf3CWSr0ZvcPYiWIFqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVV4zeok/379m9BL2HO1Ckymlky0jRQc3Kqoou4f6YHzdaLX56PRzak757/JjfDS0dbOK6HM6Paf8P3st6lVE/9mAwPOpNcnqokOIJppoookmmmiiiSaaaKKJ3k30OfTFdU3RXZ+lT6qq6rbO+k4VXQ9fvT2OrH30Zo+3u/5rUI17NO3QmdPImIduxoyrUze0khEm5w6uqZNIRKNi91Hl5661dH+tdow6wts5J//BaJPRwH6IT1NxbDJ6vVc+nrXJaAAAAADALn0DBosqnCStFi4AAAAASUVORK5CYII=",
"type": "command"
}
/* "COMMAND_2": {
"title": { "default": "Command Two" },
"iconImageUrl": "icons/cancel.png",
"type": "command"
} */
}
}
15 changes: 4 additions & 11 deletions src/extensions/savetoLaserfiche/SavetoLaserficheCommandSet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ export interface ISendToLfCommandSetProperties {
}

enum SpWebPartNames {
'LaserficheSpAdministration' = 'LaserficheSpAdministration',
'LaserficheSpSignIn' = 'LaserficheSpSignIn',
'LaserficheSignIn' = 'LaserficheSignIn',
}

const LOG_SOURCE = 'SendToLfCommandSet';
Expand All @@ -44,7 +43,7 @@ export default class SendToLfCommandSet extends BaseListViewCommandSet<ISendToLf
public onListViewUpdated(
event: IListViewCommandSetListViewUpdatedParameters
): void {
const compareOneCommand: Command = this.tryGetCommand('COMMAND_1');
const compareOneCommand: Command = this.tryGetCommand('SAVE_TO_LASERFICHE');
if (compareOneCommand) {
// This command should be hidden unless exactly one row is selected.
compareOneCommand.visible =
Expand Down Expand Up @@ -86,11 +85,7 @@ export default class SendToLfCommandSet extends BaseListViewCommandSet<ISendToLf
alert('Please select a file below 100MB size');
} else if (!this.hasSignInPage) {
alert(
'Missing "LaserficheSpSignIn" SharePoint page. Please refer to the admin guide and complete configuration steps exactly as described.'
);
} else if (!this.hasAdminPage) {
alert(
'Missing "LaserficheSpAdministration" SharePoint page. Please refer to the admin guide and complete configuration steps exactly as described.'
'Missing "LaserficheSignIn" SharePoint page. Please refer to the admin guide and complete configuration steps exactly as described.'
);
} else {
await this.trySaveToLaserficheAsync({
Expand Down Expand Up @@ -118,10 +113,8 @@ export default class SendToLfCommandSet extends BaseListViewCommandSet<ISendToLf
console.log(sitePages);
for (let o = 0; o < sitePages.value.length; o++) {
const pageName = sitePages.value[o].Title;
if (pageName === SpWebPartNames.LaserficheSpSignIn) {
if (pageName === SpWebPartNames.LaserficheSignIn) {
this.hasSignInPage = true;
} else if (pageName === SpWebPartNames.LaserficheSpAdministration) {
this.hasAdminPage = true;
}
}
} catch (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@
"preconfiguredEntries": [{
"groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Other
"group": { "default": "Other" },
"title": { "default": "Repository Access" },
"description": { "default": "View Laserfiche repository documents in SharePoint" },
"title": { "default": "Laserfiche Repository Explorer" },
"description": { "default": "View Laserfiche repository documents from within SharePoint" },
"iconImageUrl":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAMAAAAKE/YAAAAAUVBMVEXSXyj////HYzL/+/T/+Or/9d+yaUa9ZT2yaUj/9OG7Zj3SXybRYCj/+/b///3LYS/OYCvEZDS2aEL/89jAZTnMYS3/8dO7Zzusa02+ZTn/78wyF0DsAAABnUlEQVR4nO3ci26CMABGYQcoLRS5OTf2/g86R+KSLYUm2vxcPB8RTYzxkADRajkcAAAAAAAAAADYgbJcusCvqdtLnhfeJR/a96X7vOriarNJ/cUtHeiTnI7p26TsY+XRZ190sXSfVyA6X7rP6xZdzeweREeTGDt3IBIdTeCUR3Q0wQOxLNf3CWSr0ZvcPYiWIFqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVV4zeok/379m9BL2HO1Ckymlky0jRQc3Kqoou4f6YHzdaLX56PRzak757/JjfDS0dbOK6HM6Paf8P3st6lVE/9mAwPOpNcnqokOIJppoookmmmiiiSaaaKKJ3k30OfTFdU3RXZ+lT6qq6rbO+k4VXQ9fvT2OrH30Zo+3u/5rUI17NO3QmdPImIduxoyrUze0khEm5w6uqZNIRKNi91Hl5661dH+tdow6wts5J//BaJPRwH6IT1NxbDJ6vVc+nrXJaAAAAADALn0DBosqnCStFi4AAAAASUVORK5CYII=",
"officeFabricIconFontName": "Page",
"properties": {
"WebPartTitle":"Laserfiche Repository",
"LaserficheRedirectUrl":"/SitePages/LaserficheSpApp.aspx"
}
"properties": {}
}]
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { Version } from '@microsoft/sp-core-library';
import {
IPropertyPaneConfiguration,
PropertyPaneTextField,
IPropertyPaneGroup,
} from '@microsoft/sp-property-pane';
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import * as strings from 'LaserficheRepositoryAccessWebPartWebPartStrings';
import LaserficheRepositoryAccessWebPart from './components/LaserficheRepositoryAccessWebPart';
import { ILaserficheRepositoryAccessWebPartProps } from './components/ILaserficheRepositoryAccessWebPartProps';

export interface ILaserficheRepositoryAccessWebPartWebPartProps {
WebPartTitle: string;
LaserficheRedirectUrl: string;
}

export default class LaserficheRepositoryAccessWebPartWebPart extends BaseClientSideWebPart<ILaserficheRepositoryAccessWebPartWebPartProps> {
export default class LaserficheRepositoryAccessWebPartWebPart extends BaseClientSideWebPart<{}> {
public render(): void {
const element: React.ReactElement<ILaserficheRepositoryAccessWebPartProps> =
React.createElement(LaserficheRepositoryAccessWebPart, {
context: this.context,
webPartTitle: this.properties.WebPartTitle,
laserficheRedirectPage: this.properties.LaserficheRedirectUrl,
});

ReactDom.render(element, this.domElement);
Expand All @@ -35,34 +22,4 @@ export default class LaserficheRepositoryAccessWebPartWebPart extends BaseClient
protected get dataVersion(): Version {
return Version.parse('1.0');
}

protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
let conditionalGroupFields: IPropertyPaneGroup['groupFields'] = [];


conditionalGroupFields = [
PropertyPaneTextField('WebPartTitle', {
label: strings.WebPartTitle,
}),
PropertyPaneTextField('LaserficheRedirectUrl', {
label: strings.LaserficheRedirectUrl,
}),
];

return {
pages: [
{
header: {
description: strings.PropertyPaneDescription,
},
groups: [
{
groupName: strings.BasicGroupName,
groupFields: conditionalGroupFields,
},
],
},
],
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ import { WebPartContext } from '@microsoft/sp-webpart-base';

export interface ILaserficheRepositoryAccessWebPartProps {
context: WebPartContext;
webPartTitle: string;
laserficheRedirectPage: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ export default function LaserficheRepositoryAccessWebPart(

const region = getRegion();

const redirectPage =
props.context.pageContext.web.absoluteUrl + props.laserficheRedirectPage;
const redirectPage = window.location.origin + window.location.pathname;

useEffect(() => {
const ensureRepoClientInitializedAsync: () => Promise<void> = async () => {
Expand Down Expand Up @@ -89,9 +88,6 @@ export default function LaserficheRepositoryAccessWebPart(
};
const logoutCompleted: () => Promise<void> = async () => {
setLoggedIn(false);
window.location.href =
props.context.pageContext.web.absoluteUrl +
props.laserficheRedirectPage;
};

loginComponent.current.addEventListener('loginCompleted', loginCompleted);
Expand Down Expand Up @@ -130,7 +126,6 @@ export default function LaserficheRepositoryAccessWebPart(
<RepositoryViewComponent
webClientUrl={webClientUrl}
repoClient={repoClient}
webPartTitle={props.webPartTitle}
loggedIn={loggedIn}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ const folderExists = 'Object already exists';

export default function RepositoryViewComponent(props: {
repoClient: IRepositoryApiClientExInternal;
webPartTitle: string;
webClientUrl: string;
loggedIn: boolean;
}): JSX.Element {
Expand Down Expand Up @@ -166,7 +165,7 @@ export default function RepositoryViewComponent(props: {
<img
src={require('./../../../Assets/Images/laserfiche-logo.png')}
/>{' '}
{props.webPartTitle}
Laserfiche Repository Explorer
</a>
</nav>
{props.loggedIn && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ declare interface ILaserficheRepositoryAccessWebPartWebPartStrings {
BasicGroupName: string;
LaserficheApiUrlFieldLabel: string;
RepositoryApiUrlFieldLabel: string;
WebPartTitle:string;
LaserficheRedirectUrl:string;
}

declare module 'LaserficheRepositoryAccessWebPartWebPartStrings' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,25 @@
// Components that allow authors to embed arbitrary script code should set this to true.
// https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f
"requiresCustomScript": false,
"supportedHosts": ["SharePointWebPart", "TeamsPersonalApp", "TeamsTab", "SharePointFullPage"],
"supportedHosts": [
"SharePointWebPart",
"TeamsPersonalApp",
"TeamsTab",
"SharePointFullPage"
],
"supportsThemeVariants": true,

"preconfiguredEntries": [{
"groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Other
"group": { "default": "Other" },
"title": { "default": "Admin Configuration" },
"description": { "default": "This web part helps to configure Laserfiche metadata mappings" },
"iconImageUrl":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAMAAAAKE/YAAAAAUVBMVEXSXyj////HYzL/+/T/+Or/9d+yaUa9ZT2yaUj/9OG7Zj3SXybRYCj/+/b///3LYS/OYCvEZDS2aEL/89jAZTnMYS3/8dO7Zzusa02+ZTn/78wyF0DsAAABnUlEQVR4nO3ci26CMABGYQcoLRS5OTf2/g86R+KSLYUm2vxcPB8RTYzxkADRajkcAAAAAAAAAADYgbJcusCvqdtLnhfeJR/a96X7vOriarNJ/cUtHeiTnI7p26TsY+XRZ190sXSfVyA6X7rP6xZdzeweREeTGDt3IBIdTeCUR3Q0wQOxLNf3CWSr0ZvcPYiWIFqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVV4zeok/379m9BL2HO1Ckymlky0jRQc3Kqoou4f6YHzdaLX56PRzak757/JjfDS0dbOK6HM6Paf8P3st6lVE/9mAwPOpNcnqokOIJppoookmmmiiiSaaaKKJ3k30OfTFdU3RXZ+lT6qq6rbO+k4VXQ9fvT2OrH30Zo+3u/5rUI17NO3QmdPImIduxoyrUze0khEm5w6uqZNIRKNi91Hl5661dH+tdow6wts5J//BaJPRwH6IT1NxbDJ6vVc+nrXJaAAAAADALn0DBosqnCStFi4AAAAASUVORK5CYII=",
"officeFabricIconFontName": "Page",
"properties": {
"WebPartTitle":"Profile Editor",
"LaserficheRedirectPage":"/SitePages/LaserficheSpAdministration.aspx"
"preconfiguredEntries": [
{
"groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Other
"group": { "default": "Other" },
"title": { "default": "Laserfiche Administrator Configuration" },
"description": {
"default": "Configure metadata mappings from SharePoint to Laserfiche"
},
"iconImageUrl": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAMAAAAKE/YAAAAAUVBMVEXSXyj////HYzL/+/T/+Or/9d+yaUa9ZT2yaUj/9OG7Zj3SXybRYCj/+/b///3LYS/OYCvEZDS2aEL/89jAZTnMYS3/8dO7Zzusa02+ZTn/78wyF0DsAAABnUlEQVR4nO3ci26CMABGYQcoLRS5OTf2/g86R+KSLYUm2vxcPB8RTYzxkADRajkcAAAAAAAAAADYgbJcusCvqdtLnhfeJR/a96X7vOriarNJ/cUtHeiTnI7p26TsY+XRZ190sXSfVyA6X7rP6xZdzeweREeTGDt3IBIdTeCUR3Q0wQOxLNf3CWSr0ZvcPYiWIFqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVYhWIVqFaBWiVV4zeok/379m9BL2HO1Ckymlky0jRQc3Kqoou4f6YHzdaLX56PRzak757/JjfDS0dbOK6HM6Paf8P3st6lVE/9mAwPOpNcnqokOIJppoookmmmiiiSaaaKKJ3k30OfTFdU3RXZ+lT6qq6rbO+k4VXQ9fvT2OrH30Zo+3u/5rUI17NO3QmdPImIduxoyrUze0khEm5w6uqZNIRKNi91Hl5661dH+tdow6wts5J//BaJPRwH6IT1NxbDJ6vVc+nrXJaAAAAADALn0DBosqnCStFi4AAAAASUVORK5CYII=",
"officeFabricIconFontName": "Page",
"properties": {}
}
}]
]
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { Version } from '@microsoft/sp-core-library';
import {
IPropertyPaneConfiguration,
PropertyPaneTextField,
IPropertyPaneGroup,
} from '@microsoft/sp-property-pane';
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';

import * as strings from 'LaserficheAdminConfigurationWebPartStrings';
import LaserficheAdminConfiguration from './components/LaserficheAdminConfiguration';
import { ILaserficheAdminConfigurationProps } from './components/ILaserficheAdminConfigurationProps';

export interface ILaserficheAdminConfigurationWebPartProps {
WebPartTitle: string;
LaserficheRedirectPage: string;
}

export default class LaserficheAdminConfigurationWebPart extends BaseClientSideWebPart<ILaserficheAdminConfigurationWebPartProps> {
export default class LaserficheAdminConfigurationWebPart extends BaseClientSideWebPart<{}> {
public render(): void {
const element: React.ReactElement<ILaserficheAdminConfigurationProps> =
React.createElement(LaserficheAdminConfiguration, {
webPartTitle: this.properties.WebPartTitle,
laserficheRedirectPage: this.properties.LaserficheRedirectPage,
context: this.context,
});

Expand All @@ -36,32 +23,4 @@ export default class LaserficheAdminConfigurationWebPart extends BaseClientSideW
protected get dataVersion(): Version {
return Version.parse('1.0');
}

protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
let conditionalGroupFields: IPropertyPaneGroup['groupFields'] = [];

conditionalGroupFields = [
PropertyPaneTextField('WebPartTitle', {
label: strings.WebPartTitle,
}),
PropertyPaneTextField('LaserficheRedirectPage', {
label: strings.LaserficheRedirectPage,
}),
];
return {
pages: [
{
header: {
description: strings.PropertyPaneDescription,
},
groups: [
{
groupName: strings.BasicGroupName,
groupFields: conditionalGroupFields,
},
],
},
],
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { IRepositoryApiClientExInternal } from '../../../../repository-client/re

export interface IAdminPageProps {
context: WebPartContext;
webPartTitle: string;
loggedIn: boolean;
repoClient: IRepositoryApiClientExInternal;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export interface IEditManageConfigurationProps {
context: WebPartContext;
// eslint-disable-next-line
match: any;
laserficheRedirectPage: string;
loggedIn: boolean;
repoClient: IRepositoryApiClientExInternal;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { WebPartContext } from "@microsoft/sp-webpart-base";

export interface ILaserficheAdminConfigurationProps {
webPartTitle: string;
laserficheRedirectPage: string;
context: WebPartContext;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ export default function LaserficheAdminConfiguration(

const region = getRegion();

const redirectPage =
props.context.pageContext.web.absoluteUrl + props.laserficheRedirectPage;
const redirectPage = window.location.origin + window.location.pathname;

async function getAndInitializeRepositoryClientAndServicesAsync(): Promise<void> {
const accessToken =
Expand Down Expand Up @@ -74,9 +73,6 @@ export default function LaserficheAdminConfiguration(
};
const logoutCompleted: () => Promise<void> = async () => {
setLoggedIn(false);
window.location.href =
props.context.pageContext.web.absoluteUrl +
props.laserficheRedirectPage;
};

loginComponent.current.addEventListener('loginCompleted', loginCompleted);
Expand Down Expand Up @@ -112,7 +108,6 @@ export default function LaserficheAdminConfiguration(
</div>
<AdminMainPage
context={props.context}
webPartTitle={props.webPartTitle}
loggedIn={loggedIn}
repoClient={repoClient}
/>
Expand Down Expand Up @@ -159,7 +154,6 @@ export default function LaserficheAdminConfiguration(
<EditManageConfiguration
{...properties}
context={props.context}
laserficheRedirectPage={props.laserficheRedirectPage}
loggedIn={loggedIn}
repoClient={repoClient}
/>
Expand Down
2 changes: 0 additions & 2 deletions src/webparts/laserficheAdminConfiguration/loc/en-us.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@ define([], function() {
return {
"PropertyPaneDescription": "",
"BasicGroupName": "Laserfiche Admin WebPart Properties",
"WebPartTitle":"Enter the WebPart Title",
"LaserficheRedirectPage":"Enter the Laserfiche Redirect Page"
}
});
2 changes: 0 additions & 2 deletions src/webparts/laserficheAdminConfiguration/loc/mystrings.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
declare interface ILaserficheAdminConfigurationWebPartStrings {
PropertyPaneDescription: string;
BasicGroupName: string;
WebPartTitle:string;
LaserficheRedirectPage:string;
}

declare module 'LaserficheAdminConfigurationWebPartStrings' {
Expand Down
Loading
Loading