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)
|
![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.
|
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
|
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)
|
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
|
> 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.
|
> 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
|
## Applies to
|
||||||
|
|
||||||
* [SharePoint Framework Developer Preview](http://dev.office.com/sharepoint/docs/spfx/sharepoint-framework-overview)
|
* [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
|
- Publishing features on site
|
||||||
|
|
||||||
> Note: The Content Types that I pull for the search come from the Publishing Content Type which only
|
> 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.
|
- 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
|
label: strings.DescriptionFieldLabel
|
||||||
}),
|
}),
|
||||||
PropertyPaneDropdown('contentTypes', {
|
PropertyPaneDropdown('contentTypes', {
|
||||||
label: 'Dropdown',
|
label: 'Available Content Types',
|
||||||
options: this._CTypesInThisSite,
|
options: this._CTypesInThisSite,
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
|
|
@ -2,9 +2,9 @@ import { ISPCType } from './AngularSearchWebPart'
|
||||||
|
|
||||||
export default class MockHttpClient {
|
export default class MockHttpClient {
|
||||||
private static _items: ISPCType[] = [
|
private static _items: ISPCType[] = [
|
||||||
{ Name: 'Mock CType 1', Description: 'Mock CType 1', Id: { StringValue: '0x01' } },
|
{ Name: 'Mock CType 1', Description: 'Mock CType 1', Id: { StringValue: 'Mock CType 1' } },
|
||||||
{ Name: 'Mock CType 2', Description: 'Mock CType 2', Id: { StringValue: '0x02' } },
|
{ Name: 'Mock CType 2', Description: 'Mock CType 2', Id: { StringValue: 'Mock CType 2' } },
|
||||||
{ Name: 'Mock CType 3', Description: 'Mock CType 3', Id: { StringValue: '0x03' } }
|
{ Name: 'Mock CType 3', Description: 'Mock CType 3', Id: { StringValue: 'Mock CType 3' } }
|
||||||
];
|
];
|
||||||
|
|
||||||
public static get(restUrl: string): Promise<ISPCType[]> {
|
public static get(restUrl: string): Promise<ISPCType[]> {
|
||||||
|
|
|
@ -46,12 +46,14 @@ export default class HomeController {
|
||||||
this.searchNotConfigured = true;
|
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) {
|
if ($scope) {
|
||||||
//$scope.$digest();
|
//$scope.$digest();
|
||||||
|
|
||||||
//get search results
|
//get search results as long as it isn't our mock dataService
|
||||||
this.getSearchResults();
|
if (ctype.toLowerCase().indexOf('mock') == -1) {
|
||||||
|
this.getSearchResults();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +78,7 @@ export default class HomeController {
|
||||||
var val: Object = {};
|
var val: Object = {};
|
||||||
|
|
||||||
result.Cells.results.forEach((cell: ICellValue) => {
|
result.Cells.results.forEach((cell: ICellValue) => {
|
||||||
if (cell.Key == 'HitHighlightedSummary'){
|
if (cell.Key == 'HitHighlightedSummary') {
|
||||||
//need to replace <ddd> markup
|
//need to replace <ddd> markup
|
||||||
val[cell.Key] = cell.Value.replace(/ <ddd\/>/g, '.');
|
val[cell.Key] = cell.Value.replace(/ <ddd\/>/g, '.');
|
||||||
}
|
}
|
||||||
|
@ -88,7 +90,7 @@ export default class HomeController {
|
||||||
val[cell.Key] = img.src;
|
val[cell.Key] = img.src;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
val[cell.Key] = cell.Value;
|
val[cell.Key] = cell.Value;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,11 @@
|
||||||
</uif-button>
|
</uif-button>
|
||||||
</div>
|
</div>
|
||||||
</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-row" ng-show="vm.searching">
|
||||||
<div class="ms-Grid-col ms-u-smPush6 ms-u-mdPush6 ms-u-lgPush6 ms-u-xlPush6">
|
<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>
|
<uif-spinner uif-size="large">Searching...</uif-spinner>
|
||||||
|
|
Loading…
Reference in New Issue