Skip to content

Instantly share code, notes, and snippets.

@ypcode
Last active July 13, 2017 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ypcode/311be02229f9fa4732a0d84946d9b97c to your computer and use it in GitHub Desktop.
Save ypcode/311be02229f9fa4732a0d84946d9b97c to your computer and use it in GitHub Desktop.
// ...
import {
BaseClientSideWebPart,
IPropertyPaneConfiguration,
PropertyPaneTextField,
PropertyPaneDropdown
} from '@microsoft/sp-webpart-base';
import { escape } from '@microsoft/sp-lodash-subset';
// ...
import { ITask } from "./models/ITask";
import { IListInfo } from "./models/IListInfo";
import { IFieldInfo } from "./models/IFieldInfo";
// ...
export default class KanbanBoardWebPart extends BaseClientSideWebPart<IKanbanBoardWebPartProps> {
private statuses: string[] = [];
private tasks: ITask[] = [];
private availableLists: IListInfo[] = [];
// ...
private _getAvailableFieldsFromCurrentList(): IFieldInfo[] {
if (!this.properties.tasksListId)
return [];
let filteredListInfo = this.availableLists.filter(l => l.Id == this.properties.tasksListId);
if (filteredListInfo.length != 1)
return [];
return filteredListInfo[0].Fields.filter(f => f.TypeAsString == "Choice");
}
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
return {
pages: [
{
header: {
description: "Settings"
},
groups: [
{
groupName: "Tasks source configuration",
groupFields: [
PropertyPaneDropdown('tasksListId', {
label: "Source Task list",
options: this.availableLists.map(l => ({
key: l.Id,
text: l.Title
}))
}),
PropertyPaneDropdown('statusFieldName', {
label: "Status field Internal name",
options: this._getAvailableFieldsFromCurrentList().map(f => ({
key: f.InternalName,
text: f.Title
}))
})
]
}
]
}
]
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment