sp-dev-fx-webparts/samples/react-officegraph/lib/webparts/trendingInTheSitesIFollow/components/TrendingInTheSitesIFollow.j...

1 line
17 KiB
Plaintext

{"version":3,"sources":["webparts/trendingInTheSitesIFollow/components/TrendingInTheSitesIFollow.tsx"],"names":[],"mappings":";;;;;;AAAA,6BAA+B;AAC/B,iEAQgC;AAEhC,kGAA8D;AAE9D,8CAA6I;AAG7I,iDAA0F;AAC1F,qCAAoC;AAiBpC;IAAuD,6CAAiF;IACtI,mCAAY,KAAsC,EAAE,KAAsC;QAA1F,YACE,kBAAM,KAAK,CAAC,SAOb;QALC,KAAI,CAAC,KAAK,GAAG;YACX,iBAAiB,EAAE,EAAyB;YAC5C,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,IAAI;SACZ,CAAC;;IACJ,CAAC;IAEM,qDAAiB,GAAxB;QACE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvE,CAAC;IAEM,sDAAkB,GAAzB,UAA0B,SAA0C,EAAE,SAA0C,EAAE,WAAgB;QAChI,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,KAAK,SAAS,CAAC,iBAAiB;YAC9D,IAAI,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,OAAO,IAAI,CAC1C,IAAI,CAAC,KAAK,CAAC,iBAAiB,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CACnD,CAAC,CAAC,CAAC;YACJ,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IAEM,0CAAM,GAAb;QACE,IAAM,OAAO,GAAgB,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,6BAAK,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE;YAAE,oBAAC,gCAAO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GAAG,YAAY,CAAC,WAAW,EAAE,CAAC;oBAC3H,iBAAiB,CAAC,IAAI,CAAC;wBACrB,EAAE,EAAE,yBAAW,CAAC,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC;wBACnD,GAAG,EAAE,yBAAW,CAAC,mBAAmB,CAAC,qBAAqB,EAAE,KAAK,CAAC;wBAClE,MAAM,EAAE,yBAAW,CAAC,mBAAmB,CAAC,UAAU,EAAE,KAAK,CAAC;wBAC1D,QAAQ,EAAE,yBAAW,CAAC,mBAAmB,CAAC,WAAW,EAAE,KAAK,CAAC;wBAC7D,KAAK,EAAE,yBAAW,CAAC,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC;wBACtD,eAAe,EAAE,yBAAW,CAAC,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC;wBAC/D,SAAS,EAAE,yBAAW,CAAC,mBAAmB,CAAC,UAAU,EAAE,KAAK,CAAC;wBAC7D,QAAQ,EAAE;4BACR,OAAO,EAAE,CAAC,CAAC;4BACX,SAAS,EAAE,aAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;4BACpC,aAAa,EAAE,aAAK,CAAC,eAAe,CAAC,aAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;4BACxE,IAAI,EAAE,UAAU;4BAChB,IAAI,EAAE,UAAU;yBACjB;qBACF,CAAC,CAAC;gBACL,CAAC;gBAED,OAAO,CAAC,iBAAiB,CAAC,CAAC;YAC7B,CAAC,EAAE,UAAC,KAAU;gBACZ,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;IACH,gCAAC;AAAD,CAzNA,AAyNC,CAzNsD,KAAK,CAAC,SAAS,GAyNrE","file":"webparts/trendingInTheSitesIFollow/components/TrendingInTheSitesIFollow.js","sourcesContent":["import * as React from 'react';\nimport {\n css,\n DocumentCard,\n DocumentCardLocation,\n DocumentCardPreview,\n DocumentCardTitle,\n DocumentCardActivity,\n Spinner\n} from 'office-ui-fabric-react';\n\nimport styles from '../TrendingInTheSitesIFollow.module.scss';\nimport { ITrendingInTheSitesIFollowWebPartProps } from '../ITrendingInTheSitesIFollowWebPartProps';\nimport { SPHttpClient, SPHttpClientConfiguration, SPHttpClientResponse, ODataVersion, ISPHttpClientConfiguration } from '@microsoft/sp-http';\nimport { ITrendingDocument } from '../../ITrendingDocument';\nimport { IActorInformation } from '../../IActorInformation';\nimport { SearchUtils, ISearchQueryResponse, IRow, ICell, IEdge } from '../../SearchUtils';\nimport { Utils } from '../../Utils';\n\nexport interface ITrendingInTheSitesIFollowProps extends ITrendingInTheSitesIFollowWebPartProps {\n httpClient: SPHttpClient;\n siteUrl: string;\n}\n\nexport interface ITrendingInTheSitesIFollowState {\n trendingDocuments: ITrendingDocument[];\n loading: boolean;\n error: string;\n}\n\ninterface ISiteInfo {\n Uri: string;\n}\n\nexport default class TrendingInTheSitesIFollow extends React.Component<ITrendingInTheSitesIFollowProps, ITrendingInTheSitesIFollowState> {\n constructor(props: ITrendingInTheSitesIFollowProps, state: ITrendingInTheSitesIFollowState) {\n super(props);\n\n this.state = {\n trendingDocuments: [] as ITrendingDocument[],\n loading: true,\n error: null\n };\n }\n\n public componentDidMount(): void {\n this.loadDocuments(this.props.siteUrl, this.props.numberOfDocuments);\n }\n\n public componentDidUpdate(prevProps: ITrendingInTheSitesIFollowProps, prevState: ITrendingInTheSitesIFollowState, prevContext: any): void {\n if (this.props.numberOfDocuments !== prevProps.numberOfDocuments ||\n this.props.siteUrl !== prevProps.siteUrl && (\n this.props.numberOfDocuments && this.props.siteUrl\n )) {\n this.loadDocuments(this.props.siteUrl, this.props.numberOfDocuments);\n }\n }\n\n public render(): JSX.Element {\n const loading: JSX.Element = this.state.loading ? <div style={{ margin: '0 auto' }}><Spinner label={'Loading...'} /></div> : <div/>;\n const error: JSX.Element = this.state.error ? <div><strong>Error: </strong> {this.state.error}</div> : <div/>;\n const documents: JSX.Element[] = this.state.trendingDocuments.map((doc: ITrendingDocument, i: number) => {\n const iconUrl: string = `https://spoprod-a.akamaihd.net/files/odsp-next-prod_ship-2016-08-15_20160815.002/odsp-media/images/filetypes/32/${doc.extension}.png`;\n return (\n <DocumentCard onClickHref={doc.url} key={doc.id}>\n <DocumentCardPreview\n previewImages={[\n {\n previewImageSrc: doc.previewImageUrl,\n iconSrc: iconUrl,\n width: 318,\n height: 196,\n accentColor: '#ce4b1f'\n }\n ]}\n />\n <DocumentCardTitle title={doc.title}/>\n <DocumentCardLocation location={doc.webTitle} locationHref={doc.webUrl} />\n <DocumentCardActivity\n activity={`${doc.activity.name} ${doc.activity.date}`}\n people={\n [\n { name: doc.activity.actorName, profileImageSrc: doc.activity.actorPhotoUrl }\n ]\n }\n />\n </DocumentCard>\n );\n });\n return (\n <div className={styles.trendingInTheSitesIFollow}>\n <div className={css('ms-font-xl', styles.webPartTitle) }>{this.props.title}</div>\n {loading}\n {error}\n {documents}\n <div style={{ clear: 'both' }}/>\n </div>\n );\n }\n\n private loadDocuments(siteUrl: string, numberOfDocuments: number): void {\n this.setState({\n loading: true,\n error: undefined,\n trendingDocuments: []\n });\n const trendingDocuments: ITrendingDocument[] = [];\n this.getSitesIFollow(siteUrl)\n .then((sitesIFollow: string[]): Promise<ITrendingDocument[]> => {\n return this.getTrendingDocuments(sitesIFollow, siteUrl, numberOfDocuments);\n })\n .then((trendingDocuments: ITrendingDocument[]): void => {\n this.setState({\n loading: false,\n error: undefined,\n trendingDocuments: trendingDocuments\n });\n }, (error: any): void => {\n this.setState({\n loading: false,\n error: error,\n trendingDocuments: []\n });\n });\n\n return;\n }\n\n private getSitesIFollow(siteUrl: string): Promise<string[]> {\n return new Promise((resolve: (sitesIFollow: string[]) => void, reject: (error: any) => void): void => {\n this.props.httpClient.get(`${siteUrl}/_api/social.following/my/followed(types=4)`,SPHttpClient.configurations.v1 , {\n headers: {\n 'Accept': 'application/json;odata=nometadata',\n 'odata-version': ''\n }\n })\n .then((response: SPHttpClientResponse): Promise<{ value: ISiteInfo[] }> => {\n return response.json();\n })\n .then((sitesIFollowInfo: { value: ISiteInfo[] }): void => {\n const sitesIFollow: string[] = [];\n\n for (let i: number = 0; i < sitesIFollowInfo.value.length; i++) {\n sitesIFollow.push(sitesIFollowInfo.value[i].Uri);\n }\n\n resolve(sitesIFollow);\n }, (error: any): void => {\n reject(error);\n });\n });\n }\n\n private getTrendingDocuments(sitesIFollow: string[], siteUrl: string, numberOfDocuments: number): Promise<ITrendingDocument[]> {\n return new Promise((resolve: (trendingDocuments: ITrendingDocument[]) => void, reject: (error: any) => void): void => {\n if (sitesIFollow.length === 0) {\n return resolve([]);\n }\n\n let query: string = '(';\n for (let i: number = 0; i < sitesIFollow.length; i++) {\n if (query.length > 1) {\n query += ' OR ';\n }\n\n query += `Path:\"${sitesIFollow[i]}\"`;\n }\n query += ') AND (IsDocument:1)';\n\n const postData: string = JSON.stringify({\n 'request': {\n '__metadata': {\n 'type': 'Microsoft.Office.Server.Search.REST.SearchRequest'\n },\n 'Querytext': query,\n 'SelectProperties': {\n 'results': ['Author', 'AuthorOwsUser', 'DocId', 'DocumentPreviewMetadata', 'Edges', 'EditorOwsUser', 'FileExtension', 'FileType', 'HitHighlightedProperties', 'HitHighlightedSummary', 'LastModifiedTime', 'LikeCountLifetime', 'ListID', 'ListItemID', 'OriginalPath', 'Path', 'Rank', 'SPWebUrl', 'SecondaryFileExtension', 'ServerRedirectedURL', 'SiteTitle', 'Title', 'ViewCountLifetime', 'siteID', 'uniqueID', 'webID']\n },\n 'ClientType': 'TrendingInTheSitesIFollow',\n 'BypassResultTypes': 'true',\n 'RowLimit': numberOfDocuments,\n 'StartRow': '0',\n 'RankingModelId': '0c77ded8-c3ef-466d-929d-905670ea1d72',\n 'Properties': {\n 'results': [{\n 'Name': 'IncludeExternalContent',\n 'Value': {\n 'BoolVal': 'True',\n 'QueryPropertyValueTypeIndex': 3\n }\n }, {\n 'Name': 'GraphQuery',\n 'Value': {\n 'StrVal': 'actor(ME,action:1021)',\n 'QueryPropertyValueTypeIndex': 1\n }\n }]\n }\n }\n });\n this.props.httpClient.post(`${siteUrl}/_api/search/postquery`, SPHttpClient.configurations.v1 , {\n headers: {\n 'Accept': 'application/json;odata=nometadata',\n 'Content-type': 'application/json;odata=verbose',\n 'odata-version': ''\n },\n body: postData\n })\n .then((response: SPHttpClientResponse): Promise<ISearchQueryResponse> => {\n return response.json();\n })\n .then((response: ISearchQueryResponse): void => {\n if (!response ||\n !response.PrimaryQueryResult ||\n !response.PrimaryQueryResult.RelevantResults ||\n response.PrimaryQueryResult.RelevantResults.RowCount === 0) {\n resolve([]);\n return;\n }\n\n const trendingDocuments: ITrendingDocument[] = [];\n for (let i: number = 0; i < response.PrimaryQueryResult.RelevantResults.Table.Rows.length; i++) {\n const row: IRow = response.PrimaryQueryResult.RelevantResults.Table.Rows[i];\n const cells: ICell[] = row.Cells;\n const editorInfo: string[] = SearchUtils.getValueFromResults('EditorOwsUser', cells).split('|');\n const modifiedDate: Date = new Date(SearchUtils.getValueFromResults('LastModifiedTime', cells).replace('.0000000', ''));\n const dateString: string = (modifiedDate.getMonth() + 1) + '/' + modifiedDate.getDate() + '/' + modifiedDate.getFullYear();\n trendingDocuments.push({\n id: SearchUtils.getValueFromResults('DocId', cells),\n url: SearchUtils.getValueFromResults('ServerRedirectedURL', cells),\n webUrl: SearchUtils.getValueFromResults('SPWebUrl', cells),\n webTitle: SearchUtils.getValueFromResults('SiteTitle', cells),\n title: SearchUtils.getValueFromResults('Title', cells),\n previewImageUrl: SearchUtils.getPreviewImageUrl(cells, siteUrl),\n extension: SearchUtils.getValueFromResults('FileType', cells),\n activity: {\n actorId: -1,\n actorName: Utils.trim(editorInfo[1]),\n actorPhotoUrl: Utils.getUserPhotoUrl(Utils.trim(editorInfo[0]), siteUrl),\n date: dateString,\n name: 'Modified'\n }\n });\n }\n\n resolve(trendingDocuments);\n }, (error: any): void => {\n reject(error);\n });\n });\n }\n}\n"],"sourceRoot":"..\\..\\..\\..\\src"}