make methods private

This commit is contained in:
Russell Gove 2024-02-16 15:53:10 -05:00
parent 5e34ee7cb7
commit 52ef8554a8
5 changed files with 40 additions and 44 deletions

View File

@ -103,7 +103,7 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
* *
* @memberOf PropertyBagDisplay * @memberOf PropertyBagDisplay
*/ */
public renderPopup(): JSX.Element { private renderPopup(): JSX.Element {
if (!this.state.workingStorage) { if (!this.state.workingStorage) {
return (<div />); return (<div />);
@ -176,7 +176,7 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
* *
* @memberOf PropertyBagDisplay * @memberOf PropertyBagDisplay
*/ */
public removeMessage(messageList: Array<md.Message>, messageId: string): void { private removeMessage(messageList: Array<md.Message>, messageId: string): void {
_.remove(messageList, { _.remove(messageList, {
Id: messageId Id: messageId
}); });
@ -189,7 +189,7 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
* *
* @memberOf PropertyBagDisplay * @memberOf PropertyBagDisplay
*/ */
public removeMainMessage(messageId: string): void { private removeMainMessage(messageId: string): void {
this.removeMessage(this.state.errorMessages, messageId); this.removeMessage(this.state.errorMessages, messageId);
} }
/** /**
@ -199,7 +199,7 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
* *
* @memberOf PropertyBagDisplay * @memberOf PropertyBagDisplay
*/ */
public removePanelMessage(messageId: string): void { private removePanelMessage(messageId: string): void {
this.removeMessage(this.state.workingStorage.errorMessages, messageId); this.removeMessage(this.state.workingStorage.errorMessages, messageId);
} }
/** /**
@ -212,7 +212,7 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
* *
* @memberOf PropertyBagDisplay * @memberOf PropertyBagDisplay
*/ */
public changeSearchable(siteUrl: string, propname: string, newValue: boolean): Promise<any> { private changeSearchable(siteUrl: string, propname: string, newValue: boolean): Promise<any> {
if (newValue) {//make prop searchable if (newValue) {//make prop searchable
if (_.indexOf(this.state.workingStorage.searchableProps, propname) === -1) {// wasa not searchable, mpw it is if (_.indexOf(this.state.workingStorage.searchableProps, propname) === -1) {// wasa not searchable, mpw it is
console.log(propname + "was not searchable, now it is "); console.log(propname + "was not searchable, now it is ");
@ -242,7 +242,7 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
* *
* @memberOf PropertyBagDisplay * @memberOf PropertyBagDisplay
*/ */
public stopediting(): void { private stopediting(): void {
this.setState((current) => ({ this.setState((current) => ({
...current, ...current,
isediting: false, isediting: false,
@ -263,6 +263,8 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
private renderSiteUrl(item?: any, index?: number, column?: IColumn): JSX.Element { private renderSiteUrl(item?: any, index?: number, column?: IColumn): JSX.Element {
return (<a href={item[column.fieldName]}>{item[column.fieldName]} </a>); return (<a href={item[column.fieldName]}>{item[column.fieldName]} </a>);
} }
/** /**
* Sets the columns to be displayed in the list. * Sets the columns to be displayed in the list.
* These are SiteTemplate, Title and Url, plus any properties specified in * These are SiteTemplate, Title and Url, plus any properties specified in
@ -394,7 +396,7 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
* *
* @memberOf PropertyBagDisplay * @memberOf PropertyBagDisplay
*/ */
public onActiveItemChanged(item?: any, index?: number): void { private onActiveItemChanged(item?: any, index?: number): void {
this.setState((current) => ({ ...current, selectedIndex: index })); this.setState((current) => ({ ...current, selectedIndex: index }));
} }
@ -405,7 +407,7 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
* *
* @memberOf PropertyBagDisplay * @memberOf PropertyBagDisplay
*/ */
public onSave(e?: MouseEvent): void { private onSave(e?: MouseEvent): void {
const promises: Array<Promise<any>> = []; const promises: Array<Promise<any>> = [];
for (const prop of this.state.workingStorage.DisplayProps) { for (const prop of this.state.workingStorage.DisplayProps) {
const promise = utils.setSPProperty(prop.crawledPropertyName, prop.value, this.state.workingStorage.Url) const promise = utils.setSPProperty(prop.crawledPropertyName, prop.value, this.state.workingStorage.Url)
@ -437,7 +439,7 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
* *
* @memberOf PropertyBagDisplay * @memberOf PropertyBagDisplay
*/ */
public onCancel(e?: MouseEvent): void { private onCancel(e?: MouseEvent): void {
this.setState((current) => ({ ...current, workingStorage: null, isediting: false })); this.setState((current) => ({ ...current, workingStorage: null, isediting: false }));
} }
/** /**
@ -449,11 +451,11 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
* @memberOf PropertyBagDisplay * @memberOf PropertyBagDisplay
*/ */
public onForceCrawlChange(newValue: boolean): void { private onForceCrawlChange(newValue: boolean): void {
this.setState(current => ({ ...current, workingStorage: ({ ...current.workingStorage, forceCrawl: newValue }) })); this.setState(current => ({ ...current, workingStorage: ({ ...current.workingStorage, forceCrawl: newValue }) }));
} }
public createSearcheableOnChangedHandler = (managedPropertyName) => (value) => { private 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;
this.setState(this.state); this.setState(this.state);
@ -468,7 +470,7 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
* *
* @memberOf PropertyBagDisplay * @memberOf PropertyBagDisplay
*/ */
public onEditItemClicked(e?: MouseEvent): void { private onEditItemClicked(e?: MouseEvent): void {
debugger; debugger;
console.log("in onEditItemClicked"); console.log("in onEditItemClicked");
const selectedSite = this.state.sites[this.state.selectedIndex]; const selectedSite = this.state.sites[this.state.selectedIndex];

View File

@ -85,11 +85,11 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
} }
/** event hadlers */ /** event hadlers */
public stopediting() { private stopediting() {
this.setState((current) => ({ ...current, isediting: false })) this.setState((current) => ({ ...current, isediting: false }))
} }
public onActiveItemChanged(item?: any, index?: number) { private onActiveItemChanged(item?: any, index?: number) {
this.setState((current) => ({ ...current, selectedIndex: index })) this.setState((current) => ({ ...current, selectedIndex: index }))
} }
/** /**
@ -100,7 +100,7 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
* *
* @memberOf PropertyBagEditor * @memberOf PropertyBagEditor
*/ */
public onSearchableValueChanged(e: Event, newValue: boolean) { private onSearchableValueChanged(e: Event, newValue: boolean) {
debugger; debugger;
this.setState((current) => ({ ...current, workingStorage: ({ ...current.workingStorage, searchable: newValue }) })); this.setState((current) => ({ ...current, workingStorage: ({ ...current.workingStorage, searchable: newValue }) }));
} }
@ -112,7 +112,7 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
* *
* @memberOf PropertyBagEditor * @memberOf PropertyBagEditor
*/ */
public onPropertyValueChanged(event) { private onPropertyValueChanged(event) {
debugger; debugger;
this.setState((current) => ({ this.setState((current) => ({
...current, ...current,
@ -131,7 +131,7 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
* *
* @memberOf PropertyBagEditor * @memberOf PropertyBagEditor
*/ */
public onEditItemClicked(e?: MouseEvent): void { private onEditItemClicked(e?: MouseEvent): void {
this.setState((current) => ({ ...current, isediting: true, workingStorage: _.clone(current.displayProps[current.selectedIndex]) })) this.setState((current) => ({ ...current, isediting: true, workingStorage: _.clone(current.displayProps[current.selectedIndex]) }))
} }
/** /**
@ -141,7 +141,7 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
* *
* @memberOf PropertyBagEditor * @memberOf PropertyBagEditor
*/ */
public onSave(e?: MouseEvent): void { private onSave(e?: MouseEvent): void {
debugger; debugger;
utils.setSPProperty(this.state.workingStorage.crawledPropertyName, this.state.workingStorage.value, this.props.siteUrl) utils.setSPProperty(this.state.workingStorage.crawledPropertyName, this.state.workingStorage.value, this.props.siteUrl)
.then(value => { .then(value => {
@ -160,7 +160,7 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
* *
* @memberOf PropertyBagEditor * @memberOf PropertyBagEditor
*/ */
public onCancel(e?: MouseEvent): void { private onCancel(e?: MouseEvent): void {
this.setState((current) => ({ ...current, isediting: false, workingStorage: null })) this.setState((current) => ({ ...current, isediting: false, workingStorage: null }))
} }
@ -174,7 +174,7 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
* *
* @memberOf PropertyBagEditor * @memberOf PropertyBagEditor
*/ */
public changeSearchable(propname: string, newValue: boolean): Promise<any> { private 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
const temp = _.clone(this.state.searchableProps); const temp = _.clone(this.state.searchableProps);

View File

@ -59,7 +59,7 @@ export default class PropertyBagFilteredSiteListWebPart extends BaseClientSideWe
groupFields: [ groupFields: [
PropertyPaneTextField('description', { PropertyPaneTextField('description', {
label: strings.DescriptionFieldLabel label: strings.DescriptionFieldLabel
}), })
, ,
PropertyPaneTextField("filters", { PropertyPaneTextField("filters", {
label: strings.FiltersFieldLabel, label: strings.FiltersFieldLabel,

View File

@ -81,7 +81,7 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
* *
* @memberOf PropertyBagFilteredSiteList * @memberOf PropertyBagFilteredSiteList
*/ */
public removeMessage(messageId: string) { private removeMessage(messageId: string): void {
const messages = this.state.errorMessages; const messages = this.state.errorMessages;
_.remove(messages, { _.remove(messages, {
Id: messageId Id: messageId
@ -98,7 +98,7 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
* *
* @memberOf PropertyBagFilteredSiteList * @memberOf PropertyBagFilteredSiteList
*/ */
public extractUserFilterValues(userFilters: Array<UserFilter>, r): void { private extractUserFilterValues(userFilters: Array<UserFilter>, r): void {
for (const userFilter of userFilters) { for (const userFilter of userFilters) {
if (r[userFilter.managedPropertyName]) { if (r[userFilter.managedPropertyName]) {
@ -124,7 +124,7 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
* *
* @memberOf PropertyBagFilteredSiteList * @memberOf PropertyBagFilteredSiteList
*/ */
public getSites(siteTemplatesToInclude: Array<string>, filters: Array<string>, showQueryText: boolean, userFilters: Array<string>, showSiteDescriptions: boolean): void { private getSites(siteTemplatesToInclude: Array<string>, filters: Array<string>, showQueryText: boolean, userFilters: Array<string>, showSiteDescriptions: boolean): void {
const userFilterNameArray = []; const userFilterNameArray = [];
if (userFilters) { if (userFilters) {
@ -201,7 +201,7 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
* *
* @memberOf PropertyBagFilteredSiteList * @memberOf PropertyBagFilteredSiteList
*/ */
public componentDidMount() { public componentDidMount(): void {
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);
} }
@ -216,7 +216,7 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
* *
* @memberOf PropertyBagFilteredSiteList * @memberOf PropertyBagFilteredSiteList
*/ */
public conditionallyRenderDescription(site: Site): JSX.Element { private conditionallyRenderDescription(site: Site): JSX.Element {
if (this.props.showSiteDescriptions) { if (this.props.showSiteDescriptions) {
return (<Label>{site.description}</Label>); return (<Label>{site.description}</Label>);
} }
@ -272,7 +272,7 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
* *
* @memberOf PropertyBagFilteredSiteList * @memberOf PropertyBagFilteredSiteList
*/ */
public AppliedFilterExists(appliedUserFilters: AppliedUserFilter[], managedPropertyName: string, value: string): boolean { private AppliedFilterExists(appliedUserFilters: AppliedUserFilter[], managedPropertyName: string, value: string): boolean {
debugger; debugger;
const selectedFilter = _.find(appliedUserFilters, af => { const selectedFilter = _.find(appliedUserFilters, af => {
return (af.managedPropertyName === managedPropertyName && af.value === value); return (af.managedPropertyName === managedPropertyName && af.value === value);
@ -291,7 +291,7 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
* *
* @memberOf PropertyBagFilteredSiteList * @memberOf PropertyBagFilteredSiteList
*/ */
public ToggleAppliedUserFilter(appliedUserFilters: AppliedUserFilter[], item: IContextualMenuItem): AppliedUserFilter[] { private ToggleAppliedUserFilter(appliedUserFilters: AppliedUserFilter[], item: IContextualMenuItem): AppliedUserFilter[] {
if (this.AppliedFilterExists(appliedUserFilters, item.data.managedPropertyName, item.data.value)) { if (this.AppliedFilterExists(appliedUserFilters, item.data.managedPropertyName, item.data.value)) {
return appliedUserFilters.filter(af => { return appliedUserFilters.filter(af => {
return (af.managedPropertyName !== item.data.managedPropertyName || af.value !== item.data.value); return (af.managedPropertyName !== item.data.managedPropertyName || af.value !== item.data.value);
@ -312,7 +312,7 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
* *
* @memberOf PropertyBagFilteredSiteList * @memberOf PropertyBagFilteredSiteList
*/ */
public filterSites(appliedUserFilters: AppliedUserFilter[], sites: Site[]): Site[] { private filterSites(appliedUserFilters: AppliedUserFilter[], sites: Site[]): Site[] {
if (appliedUserFilters.length === 0) { if (appliedUserFilters.length === 0) {
return sites; return sites;
} }
@ -342,17 +342,11 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
* *
* @memberOf PropertyBagFilteredSiteList * @memberOf PropertyBagFilteredSiteList
*/ */
public filterOnMetadata(ev?: React.MouseEvent<HTMLElement>, item?: IContextualMenuItem) { private filterOnMetadata(ev?: React.MouseEvent<HTMLElement>, item?: IContextualMenuItem) {
const newFilters = this.ToggleAppliedUserFilter(this.state.appliedUserFilters, item); const newFilters = this.ToggleAppliedUserFilter(this.state.appliedUserFilters, item);
this.setState((current) => ({ ...current, appliedUserFilters: newFilters, filteredSites: this.filterSites(newFilters, current.sites) })); this.setState((current) => ({ ...current, appliedUserFilters: newFilters, filteredSites: this.filterSites(newFilters, current.sites) }));
} }
public doNothing(ev?: React.MouseEvent<HTMLElement>, item?: IContextualMenuItem) {
ev.stopPropagation();
return false;
}
/** /**
* Renders the list of sites in this.state.filteredSites. * Renders the list of sites in this.state.filteredSites.
* *

View File

@ -25,7 +25,7 @@ export default class PropertyBagGlobalNav extends React.Component<IPropertyBagGl
* *
* @memberOf PropertyBagGlobalNav * @memberOf PropertyBagGlobalNav
*/ */
public addMenuItem(items: Array<IContextualMenuItem>, r: any): Array<IContextualMenuItem> { private addMenuItem(items: Array<IContextualMenuItem>, r: any): Array<IContextualMenuItem> {
let currentItem: IContextualMenuItem; let currentItem: IContextualMenuItem;
let currentSet: Array<IContextualMenuItem> = items; let currentSet: Array<IContextualMenuItem> = items;
@ -59,7 +59,7 @@ export default class PropertyBagGlobalNav extends React.Component<IPropertyBagGl
* *
* @memberOf PropertyBagGlobalNav * @memberOf PropertyBagGlobalNav
*/ */
public getSites(siteTemplatesToInclude: Array<string>, filters: Array<string>, managedProperties: Array<string>): void { private getSites(siteTemplatesToInclude: Array<string>, filters: Array<string>, managedProperties: Array<string>): void {
let querytext = "contentclass:STS_Site "; let querytext = "contentclass:STS_Site ";
if (siteTemplatesToInclude) { if (siteTemplatesToInclude) {