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

Synchronize web title to Project list at portal root #248

Merged
merged 1 commit into from
Mar 4, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ export class ProjectInformation extends BaseWebPartComponent<IProjectInformation
}
if (!stringIsNullOrEmpty(this.state.data.propertiesListId)) {
let lastUpdated = await SPDataAdapter.project.getPropertiesLastUpdated(this.state.data);
if (lastUpdated > 60 && !force) {
return;
}
if (lastUpdated > 60 && !force) return;
}
if (this.props.skipSyncToHub) return;
this.logInfo(`Starting sync of ${strings.ProjectPropertiesListName}`, '_onSyncProperties');
Expand All @@ -162,7 +160,7 @@ export class ProjectInformation extends BaseWebPartComponent<IProjectInformation
);
if (!created) {
this.logInfo('Synchronizing properties to item in hub', '_onSyncProperties');
await SPDataAdapter.syncPropertyItemToHub(this.state.data.fieldValues, this.state.data.fieldValuesText, this.state.data.templateParameters, progressFunc);
await SPDataAdapter.syncPropertyItemToHub(this.state.data.fieldValues, { ...this.state.data.fieldValuesText, Title: this.props.webTitle }, this.state.data.templateParameters, progressFunc);
}
this.logInfo(`Finished. Reloading page.`, '_onSyncProperties');
SPDataAdapter.clearCache();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,14 @@ export default new class SPDataAdapter extends SPDataAdapterBase<ISPDataAdapterC
this.sp.web.siteUsers.select('Id', 'Email', 'LoginName').get<{ Id: number, Email: string, LoginName: string }[]>(),
]);
Logger.log({ message: `(${this._name}) (syncPropertyItemToHub) Retreived ${fields.length} from entity.`, level: LogLevel.Info });
const fieldToSync = fields.filter(fld => {
if (fld.SchemaXml.indexOf('ShowInEditForm="FALSE"') !== -1) return false;
if (fld.InternalName.indexOf('Gt') !== 0) return false;
return true;
});
const fieldToSync = [
{ InternalName: 'Title', TypeAsString: 'Text', TextField: undefined },
...fields.filter(fld => {
if (fld.SchemaXml.indexOf('ShowInEditForm="FALSE"') !== -1) return false;
if (fld.InternalName.indexOf('Gt') !== 0) return false;
return true;
}),
];
Logger.log({ message: `(${this._name}) (syncPropertyItemToHub) Syncing ${fieldToSync.length} to hub entity.`, data: { fieldToSync: fieldToSync.map(f => f.InternalName) }, level: LogLevel.Info });
let properties: TypedHash<any> = {};
for (let i = 0; i < fieldToSync.length; i++) {
Expand Down