import { override } from '@microsoft/decorators' ; import { Log } from '@microsoft/sp-core-library' ; import { BaseListViewCommandSet , Command , IListViewCommandSetListViewUpdatedParameters , IListViewCommandSetExecuteEventParameters } from '@microsoft/sp-listview-extensibility' ; import * as strings from 'DiscussNowCommandSetStrings' ; import { Dialog } from '@microsoft/sp-dialog' ; import ScheduleMeetingDialog from './components/ScheduleMeetingDialog' ; /**
 * If your command set uses the ClientSideComponentProperties JSON input,
 * it will be deserialized into the BaseExtension.properties object.
 * You can define an interface to describe it.
 */ export interface IDiscussNowCommandSetProperties { disabledCommandIds : string [ ] | undefined ; } const LOG_SOURCE = 'DiscussNowCommandSet' ; export default class DiscussNowCommandSet extends BaseListViewCommandSet < IDiscussNowCommandSetProperties > { @ override public onInit ( ) { console . log ( "DiscussNowCommandSet.onInit" ) ; Log . info ( LOG_SOURCE , 'Initialized DiscussNowCommandSet' ) ; return Promise . resolve < void > ( ) ; } @ override public onListViewUpdated ( event ) { const scheduleMeetingCommand = this . tryGetCommand ( 'DISCUSS_NOW' ) ; scheduleMeetingCommand . visible = event . selectedRows . length === 1 ; } @ override public onExecute ( event ) { switch ( event . itemId ) { case 'DISCUSS_NOW' : const id = event . selectedRows [ 0 ] . getValueByName ( "ID" ) ; const fileName = event . selectedRows [ 0 ] . getValueByName ( "FileLeafRef" ) ; const filePath = event . selectedRows [ 0 ] . getValueByName ( "ServerRedirectedEmbedUrl" ) ; const dialog = new ScheduleMeetingDialog ( ) ; dialog . fileName = fileName ; dialog . filePath = filePath ; dialog . context = this . context ; dialog . show ( ) ; break ; default : throw new Error ( 'Unknown command' ) ; } } }