cleanup
This commit is contained in:
parent
31a14fa9ef
commit
5e34ee7cb7
|
@ -132,19 +132,18 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
{this.state.workingStorage.DisplayProps.map((dp, i) => {
|
{this.state.workingStorage.DisplayProps.map((dp, i) => {
|
||||||
return (<tr>
|
return (<tr key={dp.managedPropertyName}>
|
||||||
<td>{dp.managedPropertyName}</td>
|
<td>{dp.managedPropertyName}</td>
|
||||||
<td>{this.state.workingStorage[dp.managedPropertyName]}</td>
|
<td>{this.state.workingStorage[dp.managedPropertyName]}</td>
|
||||||
<td>{dp.crawledPropertyName}</td>
|
<td>{dp.crawledPropertyName}</td>
|
||||||
<td>
|
<td>
|
||||||
<TextField
|
<TextField
|
||||||
data-crawledPropertyName={dp.crawledPropertyName}
|
|
||||||
value={dp.value}
|
value={dp.value}
|
||||||
onChange={(event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string) => {
|
onChange={(event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string) => {
|
||||||
const selectedProperty = dp.crawledPropertyName;
|
debugger;
|
||||||
const temp: DisplayProp = _.find(this.state.workingStorage.DisplayProps, p => { return p.crawledPropertyName === selectedProperty; });
|
const ws = _.clone(this.state.workingStorage);
|
||||||
dp.value = newValue;
|
_.find(ws.DisplayProps, p => { return p.crawledPropertyName === dp.crawledPropertyName; }).value = newValue;
|
||||||
this.setState(this.state);
|
this.setState((current) => ({ ...current, workingStorage: ws }));
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
|
@ -328,9 +327,6 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
|
||||||
* @memberOf PropertyBagDisplay
|
* @memberOf PropertyBagDisplay
|
||||||
*/
|
*/
|
||||||
public componentDidMount(): void {
|
public componentDidMount(): void {
|
||||||
// this.state.columns = this.setupColumns();
|
|
||||||
// this.state.managedToCrawedMapping = [];
|
|
||||||
// this.state.managedPropNames = [];
|
|
||||||
let initState = {
|
let initState = {
|
||||||
|
|
||||||
columns: this.setupColumns(),
|
columns: this.setupColumns(),
|
||||||
|
@ -382,7 +378,6 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
|
||||||
initState.sites.push(obj);
|
initState.sites.push(obj);
|
||||||
}
|
}
|
||||||
debugger;
|
debugger;
|
||||||
//initState.errorMessages.push(new md.Message("Items Recieved"));
|
|
||||||
this.setState({ ...initState });
|
this.setState({ ...initState });
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
debugger;
|
debugger;
|
||||||
|
@ -400,7 +395,6 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
|
||||||
* @memberOf PropertyBagDisplay
|
* @memberOf PropertyBagDisplay
|
||||||
*/
|
*/
|
||||||
public onActiveItemChanged(item?: any, index?: number): void {
|
public onActiveItemChanged(item?: any, index?: number): void {
|
||||||
//this.state.selectedIndex = index;
|
|
||||||
this.setState((current) => ({ ...current, selectedIndex: index }));
|
this.setState((current) => ({ ...current, selectedIndex: index }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,15 +419,15 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
|
||||||
if (this.state.workingStorage.forceCrawl) {
|
if (this.state.workingStorage.forceCrawl) {
|
||||||
utils.forceCrawl(this.state.workingStorage.Url);
|
utils.forceCrawl(this.state.workingStorage.Url);
|
||||||
}
|
}
|
||||||
|
debugger;
|
||||||
this.setState((current) => ({ ...current, workingStorage: null, isediting: false }));
|
this.setState((current) => ({ ...current, workingStorage: null, isediting: false }));
|
||||||
|
|
||||||
this.setState(this.state);
|
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
debugger;
|
debugger;
|
||||||
this.state.workingStorage.errorMessages.push(new md.Message(err));
|
|
||||||
this.setState(this.state);
|
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
const temp = _.clone(this.state.workingStorage);
|
||||||
|
temp.errorMessages.push(new md.Message(err));
|
||||||
|
this.setState(current => ({ ...current, workingStorage: temp }))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -444,8 +438,6 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
|
||||||
* @memberOf PropertyBagDisplay
|
* @memberOf PropertyBagDisplay
|
||||||
*/
|
*/
|
||||||
public onCancel(e?: MouseEvent): void {
|
public onCancel(e?: MouseEvent): void {
|
||||||
// this.state.isediting = false;
|
|
||||||
// this.state.workingStorage = null;
|
|
||||||
this.setState((current) => ({ ...current, workingStorage: null, isediting: false }));
|
this.setState((current) => ({ ...current, workingStorage: null, isediting: false }));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -457,24 +449,10 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
|
||||||
* @memberOf PropertyBagDisplay
|
* @memberOf PropertyBagDisplay
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public onForceCrawlChange(newValue: boolean) {
|
public onForceCrawlChange(newValue: boolean): void {
|
||||||
this.state.workingStorage.forceCrawl = newValue;
|
this.setState(current => ({ ...current, workingStorage: ({ ...current.workingStorage, forceCrawl: newValue }) }));
|
||||||
this.setState(this.state);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Called when the value of a property i schanged in the display.
|
|
||||||
* Saves the new value in workingStarage,
|
|
||||||
*
|
|
||||||
* @param {React.FormEvent<HTMLInputElement>} event
|
|
||||||
*
|
|
||||||
* @memberOf PropertyBagDisplay
|
|
||||||
*/
|
|
||||||
public onPropertyValueChanged(event: React.FormEvent<HTMLInputElement>, newValue: string) {
|
|
||||||
const selectedProperty = newValue;//event.currentTarget.attributes["data-crawledpropertyname"].value;
|
|
||||||
const dp: DisplayProp = _.find(this.state.workingStorage.DisplayProps, p => { return p.crawledPropertyName === selectedProperty; });
|
|
||||||
dp.value = event.currentTarget.value;
|
|
||||||
this.setState(this.state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public createSearcheableOnChangedHandler = (managedPropertyName) => (value) => {
|
public createSearcheableOnChangedHandler = (managedPropertyName) => (value) => {
|
||||||
const dp: DisplayProp = _.find(this.state.workingStorage.DisplayProps, p => { return p.crawledPropertyName === managedPropertyName; });
|
const dp: DisplayProp = _.find(this.state.workingStorage.DisplayProps, p => { return p.crawledPropertyName === managedPropertyName; });
|
||||||
dp.searchable = value;
|
dp.searchable = value;
|
||||||
|
@ -495,23 +473,21 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
|
||||||
console.log("in onEditItemClicked");
|
console.log("in onEditItemClicked");
|
||||||
const selectedSite = this.state.sites[this.state.selectedIndex];
|
const selectedSite = this.state.sites[this.state.selectedIndex];
|
||||||
const web = new Web(selectedSite.Url);
|
const web = new Web(selectedSite.Url);
|
||||||
let context = this;
|
// let context = this;
|
||||||
web.select("Title", "AllProperties").expand("AllProperties").get().then((r) => {
|
web.select("Title", "AllProperties").expand("AllProperties").get().then((r) => {
|
||||||
console.log(context.context);
|
const crawledProps: Array<string> = this.props.propertiesToDisplay.map(item => {
|
||||||
const crawledProps: Array<string> = context.props.propertiesToDisplay.map(item => {
|
|
||||||
return item.split("|")[0];
|
return item.split("|")[0];
|
||||||
});
|
});
|
||||||
let temp = _.clone(selectedSite);
|
let temp = _.clone(selectedSite);
|
||||||
temp.searchableProps = utils.decodeSearchableProps(r.AllProperties["vti_x005f_indexedpropertykeys"]);
|
temp.searchableProps = utils.decodeSearchableProps(r.AllProperties["vti_x005f_indexedpropertykeys"]);
|
||||||
// temp.DisplayProps = utils.SelectProperties(r.AllProperties, crawledProps, context.state.workingStorage.searchableProps);
|
|
||||||
temp.DisplayProps = utils.SelectProperties(r.AllProperties, crawledProps, temp.searchableProps);
|
temp.DisplayProps = utils.SelectProperties(r.AllProperties, crawledProps, temp.searchableProps);
|
||||||
temp.errorMessages = new Array<md.Message>();
|
temp.errorMessages = new Array<md.Message>();
|
||||||
// now add in the managed Prop
|
// now add in the managed Prop
|
||||||
for (const dp of temp.DisplayProps) {
|
for (const dp of temp.DisplayProps) {
|
||||||
dp.managedPropertyName =
|
dp.managedPropertyName =
|
||||||
_.find(context.state.managedToCrawedMapping, mtc => { return mtc.crawledPropertyName === dp.crawledPropertyName; }).managedPropertyName;
|
_.find(this.state.managedToCrawedMapping, mtc => { return mtc.crawledPropertyName === dp.crawledPropertyName; }).managedPropertyName;
|
||||||
}
|
}
|
||||||
context.setState((current) => ({
|
this.setState((current) => ({
|
||||||
...current,
|
...current,
|
||||||
workingStorage: temp, isediting: true
|
workingStorage: temp, isediting: true
|
||||||
|
|
||||||
|
|
|
@ -80,22 +80,16 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
|
||||||
debugger;
|
debugger;
|
||||||
const sp = utils.decodeSearchableProps(r.AllProperties.vti_x005f_indexedpropertykeys);
|
const sp = utils.decodeSearchableProps(r.AllProperties.vti_x005f_indexedpropertykeys);
|
||||||
const dp = utils.SelectProperties(r.AllProperties, this.props.propertiesToEdit, sp);
|
const dp = utils.SelectProperties(r.AllProperties, this.props.propertiesToEdit, sp);
|
||||||
// this.state.searchableProps = sp;
|
|
||||||
// this.state.displayProps = dp;
|
|
||||||
|
|
||||||
this.setState((current) => ({ ...current, searchableProps: sp, displayProps: dp }))
|
this.setState((current) => ({ ...current, searchableProps: sp, displayProps: dp }))
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** event hadlers */
|
/** event hadlers */
|
||||||
public stopediting() {
|
public stopediting() {
|
||||||
//this.state.isediting = false;
|
|
||||||
this.setState((current) => ({ ...current, isediting: false }))
|
this.setState((current) => ({ ...current, isediting: false }))
|
||||||
}
|
}
|
||||||
public onActiveItemChanged(item?: any, index?: number) {
|
public onActiveItemChanged(item?: any, index?: number) {
|
||||||
//this.state.selectedIndex = index;
|
|
||||||
this.setState((current) => ({ ...current, selectedIndex: index }))
|
this.setState((current) => ({ ...current, selectedIndex: index }))
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -107,10 +101,6 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
|
||||||
* @memberOf PropertyBagEditor
|
* @memberOf PropertyBagEditor
|
||||||
*/
|
*/
|
||||||
public onSearchableValueChanged(e: Event, newValue: boolean) {
|
public onSearchableValueChanged(e: Event, newValue: boolean) {
|
||||||
|
|
||||||
//this.state.workingStorage.searchable = newValue;
|
|
||||||
//this.setState(this.state);
|
|
||||||
//this.state.workingStorage.searchable = newValue;
|
|
||||||
debugger;
|
debugger;
|
||||||
this.setState((current) => ({ ...current, workingStorage: ({ ...current.workingStorage, searchable: newValue }) }));
|
this.setState((current) => ({ ...current, workingStorage: ({ ...current.workingStorage, searchable: newValue }) }));
|
||||||
}
|
}
|
||||||
|
@ -124,7 +114,6 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
|
||||||
*/
|
*/
|
||||||
public onPropertyValueChanged(event) {
|
public onPropertyValueChanged(event) {
|
||||||
debugger;
|
debugger;
|
||||||
//this.state.workingStorage.value = event.target.value;
|
|
||||||
this.setState((current) => ({
|
this.setState((current) => ({
|
||||||
...current,
|
...current,
|
||||||
workingStorage: ({
|
workingStorage: ({
|
||||||
|
@ -143,9 +132,6 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
|
||||||
* @memberOf PropertyBagEditor
|
* @memberOf PropertyBagEditor
|
||||||
*/
|
*/
|
||||||
public onEditItemClicked(e?: MouseEvent): void {
|
public onEditItemClicked(e?: MouseEvent): void {
|
||||||
//this.state.isediting = true;
|
|
||||||
//this.state.workingStorage = _.clone(this.state.displayProps[this.state.selectedIndex]);
|
|
||||||
//this.setState(this.state);
|
|
||||||
this.setState((current) => ({ ...current, isediting: true, workingStorage: _.clone(current.displayProps[current.selectedIndex]) }))
|
this.setState((current) => ({ ...current, isediting: true, workingStorage: _.clone(current.displayProps[current.selectedIndex]) }))
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -161,10 +147,8 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
|
||||||
.then(value => {
|
.then(value => {
|
||||||
this.changeSearchable(this.state.workingStorage.crawledPropertyName, this.state.workingStorage.searchable)
|
this.changeSearchable(this.state.workingStorage.crawledPropertyName, this.state.workingStorage.searchable)
|
||||||
.then(s => {
|
.then(s => {
|
||||||
//this.state.displayProps[this.state.selectedIndex] = this.state.workingStorage;
|
|
||||||
const temp = _.clone(this.state.displayProps);// this.state.workingStorage = null;
|
const temp = _.clone(this.state.displayProps);// this.state.workingStorage = null;
|
||||||
temp[this.state.selectedIndex] = this.state.workingStorage;// this.state.isediting = false;
|
temp[this.state.selectedIndex] = this.state.workingStorage;// this.state.isediting = false;
|
||||||
// this.setState(this.state);
|
|
||||||
this.setState((current) => ({ ...current, isediting: false, workingStorage: null, displayProps: temp }))
|
this.setState((current) => ({ ...current, isediting: false, workingStorage: null, displayProps: temp }))
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -177,9 +161,6 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
|
||||||
* @memberOf PropertyBagEditor
|
* @memberOf PropertyBagEditor
|
||||||
*/
|
*/
|
||||||
public onCancel(e?: MouseEvent): void {
|
public onCancel(e?: MouseEvent): void {
|
||||||
// this.state.isediting = false;
|
|
||||||
// this.state.workingStorage = null;
|
|
||||||
// this.setState(this.state);
|
|
||||||
this.setState((current) => ({ ...current, isediting: false, workingStorage: null }))
|
this.setState((current) => ({ ...current, isediting: false, workingStorage: null }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +177,6 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
|
||||||
public changeSearchable(propname: string, newValue: boolean): Promise<any> {
|
public changeSearchable(propname: string, newValue: boolean): Promise<any> {
|
||||||
if (newValue) {//make prop searchable
|
if (newValue) {//make prop searchable
|
||||||
if (_.indexOf(this.state.searchableProps, propname) === -1) {// wasa not searchable, mpw it is
|
if (_.indexOf(this.state.searchableProps, propname) === -1) {// wasa not searchable, mpw it is
|
||||||
//this.state.searchableProps.push(propname);
|
|
||||||
const temp = _.clone(this.state.searchableProps);
|
const temp = _.clone(this.state.searchableProps);
|
||||||
temp.push(propname);
|
temp.push(propname);
|
||||||
this.setState(current => ({ ...current, searchableProps: temp }));
|
this.setState(current => ({ ...current, searchableProps: temp }));
|
||||||
|
|
|
@ -8,9 +8,8 @@ import { Label } from "office-ui-fabric-react/lib/Label";
|
||||||
import MessageDisplay, * as md from "../../shared/MessageDisplay";
|
import MessageDisplay, * as md from "../../shared/MessageDisplay";
|
||||||
import utils from "../../shared/utils";
|
import utils from "../../shared/utils";
|
||||||
import { IPropertyBagFilteredSiteListProps } from "./IPropertyBagFilteredSiteListProps";
|
import { IPropertyBagFilteredSiteListProps } from "./IPropertyBagFilteredSiteListProps";
|
||||||
|
|
||||||
import { IContextualMenuItem, } from "office-ui-fabric-react/lib/ContextualMenu";
|
import { IContextualMenuItem, } from "office-ui-fabric-react/lib/ContextualMenu";
|
||||||
import { DetailsList } from "office-ui-fabric-react";
|
|
||||||
export interface IPropertyBagFilteredSiteListState {
|
export interface IPropertyBagFilteredSiteListState {
|
||||||
errorMessages: Array<md.Message>;
|
errorMessages: Array<md.Message>;
|
||||||
sites: Array<Site>;
|
sites: Array<Site>;
|
||||||
|
@ -83,10 +82,6 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
|
||||||
* @memberOf PropertyBagFilteredSiteList
|
* @memberOf PropertyBagFilteredSiteList
|
||||||
*/
|
*/
|
||||||
public removeMessage(messageId: string) {
|
public removeMessage(messageId: string) {
|
||||||
// _.remove(this.state.errorMessages, {
|
|
||||||
// Id: messageId
|
|
||||||
// });
|
|
||||||
// this.setState(this.state);
|
|
||||||
const messages = this.state.errorMessages;
|
const messages = this.state.errorMessages;
|
||||||
_.remove(messages, {
|
_.remove(messages, {
|
||||||
Id: messageId
|
Id: messageId
|
||||||
|
@ -94,27 +89,7 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
|
||||||
this.setState((current) => ({ ...current, errorMessages: messages }));
|
this.setState((current) => ({ ...current, errorMessages: messages }));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the list of user filters.
|
|
||||||
* A user filter is created for each UserFilter name specified in the props.
|
|
||||||
*
|
|
||||||
* @param {Array<string>} userFilterNames
|
|
||||||
*
|
|
||||||
* @memberOf PropertyBagFilteredSiteList
|
|
||||||
*/
|
|
||||||
// public setupUserFilters(userFilterNames: Array<string>): void {
|
|
||||||
|
|
||||||
// // this.state.userFilters = [];
|
|
||||||
// // for (const userFilterName of userFilterNames) {
|
|
||||||
// // this.state.userFilters.push(new UserFilter(userFilterName));
|
|
||||||
// // }
|
|
||||||
// let userFilters = [];
|
|
||||||
// for (const userFilterName of userFilterNames) {
|
|
||||||
// userFilters.push(new UserFilter(userFilterName));
|
|
||||||
// }
|
|
||||||
// this.setState((current) => ({ ...current, userFilters: userFilters }));
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds values to All the UserFilters for a given SearchResults.
|
* Adds values to All the UserFilters for a given SearchResults.
|
||||||
|
@ -193,19 +168,6 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
|
||||||
|
|
||||||
};
|
};
|
||||||
pnp.sp.search(q).then((results: SearchResults) => {
|
pnp.sp.search(q).then((results: SearchResults) => {
|
||||||
// this.state.sites = [];
|
|
||||||
// debugger;
|
|
||||||
// this.setupUserFilters(userFilterNameArray);
|
|
||||||
// for (const r of results.PrimarySearchResults) {
|
|
||||||
// const index = this.state.sites.push(new Site(r.Title, r.Description, r.SPSiteUrl));
|
|
||||||
|
|
||||||
// for (const mp of this.props.userFilters) {
|
|
||||||
// this.state.sites[index-1][mp] = r[mp];
|
|
||||||
// }
|
|
||||||
// this.extractUserFilterValues(r);
|
|
||||||
// }
|
|
||||||
// this.filterSites();
|
|
||||||
// this.setState(this.state);
|
|
||||||
let sites = [];
|
let sites = [];
|
||||||
debugger;
|
debugger;
|
||||||
let userFilters: UserFilter[] = [];
|
let userFilters: UserFilter[] = [];
|
||||||
|
@ -243,20 +205,7 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
|
||||||
|
|
||||||
this.getSites(this.props.siteTemplatesToInclude, this.props.filters, this.props.showQueryText, this.props.userFilters, this.props.showSiteDescriptions);
|
this.getSites(this.props.siteTemplatesToInclude, this.props.filters, this.props.showQueryText, this.props.userFilters, this.props.showSiteDescriptions);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Called whe Properties are changed in the PropertyPane
|
|
||||||
* Gets the sites and builds the userFilters using the new Properties
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param {IPropertyBagFilteredSiteListProps} nextProps
|
|
||||||
* @param {*} nextContext
|
|
||||||
*
|
|
||||||
* @memberOf PropertyBagFilteredSiteList
|
|
||||||
*/
|
|
||||||
// public component(nextProps: IPropertyBagFilteredSiteListProps, nextContext: any): void {
|
|
||||||
// debugger;
|
|
||||||
// this.getSites(nextProps.siteTemplatesToInclude, nextProps.filters, nextProps.showQueryText, nextProps.userFilters, nextProps.showSiteDescriptions);
|
|
||||||
// }
|
|
||||||
/**
|
/**
|
||||||
* Called by the Render method.
|
* Called by the Render method.
|
||||||
* Displayes the Site Description if requested in the PropertyPane.
|
* Displayes the Site Description if requested in the PropertyPane.
|
||||||
|
@ -395,8 +344,6 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
|
||||||
*/
|
*/
|
||||||
public filterOnMetadata(ev?: React.MouseEvent<HTMLElement>, item?: IContextualMenuItem) {
|
public filterOnMetadata(ev?: React.MouseEvent<HTMLElement>, item?: IContextualMenuItem) {
|
||||||
const newFilters = this.ToggleAppliedUserFilter(this.state.appliedUserFilters, item);
|
const newFilters = this.ToggleAppliedUserFilter(this.state.appliedUserFilters, item);
|
||||||
// this.filterSites();
|
|
||||||
// this.setState(this.state);
|
|
||||||
this.setState((current) => ({ ...current, appliedUserFilters: newFilters, filteredSites: this.filterSites(newFilters, current.sites) }));
|
this.setState((current) => ({ ...current, appliedUserFilters: newFilters, filteredSites: this.filterSites(newFilters, current.sites) }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,11 +90,6 @@ export default class PropertyBagGlobalNav extends React.Component<IPropertyBagGl
|
||||||
|
|
||||||
};
|
};
|
||||||
pnp.sp.search(q).then((results: SearchResults) => {
|
pnp.sp.search(q).then((results: SearchResults) => {
|
||||||
// this.state.menuitems = [];
|
|
||||||
// for (const r of results.PrimarySearchResults) {
|
|
||||||
// this.addMenuItem(r);
|
|
||||||
// }
|
|
||||||
// this.setState(this.state);
|
|
||||||
let menuitems = [];
|
let menuitems = [];
|
||||||
for (const r of results.PrimarySearchResults) {
|
for (const r of results.PrimarySearchResults) {
|
||||||
this.addMenuItem(menuitems, r);
|
this.addMenuItem(menuitems, r);
|
||||||
|
@ -106,11 +101,13 @@ export default class PropertyBagGlobalNav extends React.Component<IPropertyBagGl
|
||||||
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
debugger;
|
debugger;
|
||||||
this.state.errorMessages.push(new md.Message(err));
|
|
||||||
this.setState(this.state);
|
const em = this.state.errorMessages;
|
||||||
|
em.push(new md.Message(err));
|
||||||
|
this.setState(current => ({ ...current, errorMessages: em }));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/** react lifecycle */
|
|
||||||
public componentDidMount(): void {
|
public componentDidMount(): void {
|
||||||
|
|
||||||
this.getSites(this.props.siteTemplatesToInclude, this.props.filters, this.props.managedProperties);
|
this.getSites(this.props.siteTemplatesToInclude, this.props.filters, this.props.managedProperties);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"inlineSources": false,
|
"inlineSources": false,
|
||||||
"strictNullChecks": false,
|
"strictNullChecks": false,
|
||||||
"noUnusedLocals": false,
|
"noUnusedLocals": true,
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
|
|
Loading…
Reference in New Issue