Did some house keeping and updated README
This commit is contained in:
parent
66f44a3ef3
commit
ab38818d35
|
@ -6,7 +6,7 @@ Sample Search Web Part that illustrates how you can use Angular within the new S
|
|||
![Sample of the search web part](./assets/angularSearch.png)
|
||||
This app uses SharePoint's Search REST API endpoint to query listitems of a specific content type and displays the results to the end user.
|
||||
Ideally instead of selecting a content type for the search you would want to select a Result Source, but currently Result Sources are not
|
||||
through SharePoint's REST API.
|
||||
available through SharePoint's REST API.
|
||||
|
||||
The logic for querying the SharePoint Content Types in the properties of the webpart was in part due to Chris O'Brien and this [blog post](http://www.sharepointnutsandbolts.com/2016/09/sharepoint-framework-spfx-web-part-properties-dynamic-dropdown.html?m=0)
|
||||
|
||||
|
@ -14,6 +14,9 @@ The logic for querying the SharePoint Content Types in the properties of the web
|
|||
> Office Fabric UI in SharePoint Online, which will cause many of the icons not to load properly on the SharePoint
|
||||
> Page this webpart is added to.
|
||||
|
||||
> Note: For the display template of the search results I'm currently using the Office Fabric UI List template. Ideally
|
||||
> I was hoping to use the DocumentCard Component, however, that is not yet available through the ngOfficUIFabric.
|
||||
|
||||
## Applies to
|
||||
|
||||
* [SharePoint Framework Developer Preview](http://dev.office.com/sharepoint/docs/spfx/sharepoint-framework-overview)
|
||||
|
@ -48,7 +51,9 @@ Version|Date|Comments
|
|||
- Publishing features on site
|
||||
|
||||
> Note: The Content Types that I pull for the search come from the Publishing Content Type which only
|
||||
> available when the Publishing Features are enabled on the site.
|
||||
> available when the Publishing Features are enabled on the site. I'm also searching by content type name
|
||||
> and not by id becauase then I would get everything that inherits from that content type. I only want the
|
||||
> the results for a specific content type and not everything that inherits that content type as well
|
||||
|
||||
- In the file 'AngularSearchWebPart.ts' around line 92 you will need to put the url of the directory where the html template file resides.
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ export default class AngularSearchWebPart extends BaseClientSideWebPart<IAngular
|
|||
label: strings.DescriptionFieldLabel
|
||||
}),
|
||||
PropertyPaneDropdown('contentTypes', {
|
||||
label: 'Dropdown',
|
||||
label: 'Available Content Types',
|
||||
options: this._CTypesInThisSite,
|
||||
})
|
||||
]
|
||||
|
|
|
@ -2,9 +2,9 @@ import { ISPCType } from './AngularSearchWebPart'
|
|||
|
||||
export default class MockHttpClient {
|
||||
private static _items: ISPCType[] = [
|
||||
{ Name: 'Mock CType 1', Description: 'Mock CType 1', Id: { StringValue: '0x01' } },
|
||||
{ Name: 'Mock CType 2', Description: 'Mock CType 2', Id: { StringValue: '0x02' } },
|
||||
{ Name: 'Mock CType 3', Description: 'Mock CType 3', Id: { StringValue: '0x03' } }
|
||||
{ Name: 'Mock CType 1', Description: 'Mock CType 1', Id: { StringValue: 'Mock CType 1' } },
|
||||
{ Name: 'Mock CType 2', Description: 'Mock CType 2', Id: { StringValue: 'Mock CType 2' } },
|
||||
{ Name: 'Mock CType 3', Description: 'Mock CType 3', Id: { StringValue: 'Mock CType 3' } }
|
||||
];
|
||||
|
||||
public static get(restUrl: string): Promise<ISPCType[]> {
|
||||
|
|
|
@ -46,14 +46,16 @@ export default class HomeController {
|
|||
this.searchNotConfigured = true;
|
||||
}
|
||||
|
||||
this.status = this.searchNotConfigured ? 'Please configure the search settings in the Web Part properties' : 'Ready';
|
||||
this.status = this.searchNotConfigured ? 'Please select a contenet type in the Web Part properties' : 'Ready';
|
||||
if ($scope) {
|
||||
//$scope.$digest();
|
||||
|
||||
//get search results
|
||||
//get search results as long as it isn't our mock dataService
|
||||
if (ctype.toLowerCase().indexOf('mock') == -1) {
|
||||
this.getSearchResults();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public getSearchResults(): void {
|
||||
//display searching message
|
||||
|
@ -76,7 +78,7 @@ export default class HomeController {
|
|||
var val: Object = {};
|
||||
|
||||
result.Cells.results.forEach((cell: ICellValue) => {
|
||||
if (cell.Key == 'HitHighlightedSummary'){
|
||||
if (cell.Key == 'HitHighlightedSummary') {
|
||||
//need to replace <ddd> markup
|
||||
val[cell.Key] = cell.Value.replace(/ <ddd\/>/g, '.');
|
||||
}
|
||||
|
|
|
@ -10,6 +10,11 @@
|
|||
</uif-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ms-Grid-row" ng-show="vm.searchNotConfigured">
|
||||
<div class="ms-Grid-col ms-u-sm12">
|
||||
{{vm.status}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="ms-Grid-row" ng-show="vm.searching">
|
||||
<div class="ms-Grid-col ms-u-smPush6 ms-u-mdPush6 ms-u-lgPush6 ms-u-xlPush6">
|
||||
<uif-spinner uif-size="large">Searching...</uif-spinner>
|
||||
|
|
Loading…
Reference in New Issue