format code

This commit is contained in:
Aimery Thomas 2021-11-04 21:15:52 +01:00
parent bebe3b9c5e
commit 41172a784f
3 changed files with 38 additions and 38 deletions

View File

@ -24,10 +24,10 @@ export interface IGraphAppSecretExpirationWebPartProps {
export default class GraphAppSecretExpirationWebPart extends BaseClientSideWebPart<IGraphAppSecretExpirationWebPartProps> {
private graphClient: MSGraphClient;
private dropdownOptions: IPropertyPaneDropdownOption[] = [
{key:"none",text:"None"},
{key:"applicationId",text:"Application ID"},
{key:"type",text:"Type"}];
{ key: "none", text: "None" },
{ key: "applicationId", text: "Application ID" },
{ key: "type", text: "Type" }];
public onInit(): Promise<void> {
return new Promise<void>((resolve: () => void, reject: (error: any) => void): void => {
this.context.msGraphClientFactory
@ -72,28 +72,28 @@ export default class GraphAppSecretExpirationWebPart extends BaseClientSideWebPa
{
groupName: strings.BasicGroupName,
groupFields: [
PropertyPaneDropdown('groupByColumn', {
label: strings.DefaultGroupColumnFieldLabel,
PropertyPaneDropdown('groupByColumn', {
label: strings.DefaultGroupColumnFieldLabel,
options: this.dropdownOptions,
selectedKey: "none"
}),
PropertyPaneToggle('expiringSoon', {
label: strings.DisplayOnlySecretsFieldLabel,
onText:"Yes",
offText:"No"
})
}),
PropertyPaneToggle('expiringSoon', {
label: strings.DisplayOnlySecretsFieldLabel,
onText: "Yes",
offText: "No"
})
]
},
{
groupName: strings.OtherGroupName,
groupFields: [
PropertyPaneToggle('displaySampleData', {
PropertyPaneToggle('displaySampleData', {
label: strings.DisplaySampleDataFieldLabel,
onText:"Yes",
offText:"No"
})
onText: "Yes",
offText: "No"
})
]
}
]

View File

@ -73,9 +73,9 @@ export default class GraphAppSecretExpiration extends React.Component<IGraphAppS
public componentDidMount(): void {
if(!this.props.displaySampleData){
if (!this.props.displaySampleData) {
this._getApplications();
}else{
} else {
this._propertiesMapping(sampleApplications.applications);
}
@ -134,15 +134,15 @@ export default class GraphAppSecretExpiration extends React.Component<IGraphAppS
type: "Secret",
expirationDate: (moment(pswd.endDateTime)).format('DD-MMM-YYYY'),
daysLeft: daysBeforeExpiration > 0 ? daysBeforeExpiration : 0,
linkTitle: "https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/Credentials/appId/"+app.appId
linkTitle: "https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/Credentials/appId/" + app.appId
};
if (this.props.expiringSoon){
if(daysBeforeExpiration < 30){
if (this.props.expiringSoon) {
if (daysBeforeExpiration < 30) {
displayedApplication.push(formatedApp);
}
} else {
displayedApplication.push(formatedApp);
}
}
});
app.keyCredentials.forEach(keyCred => {
let daysBeforeExpiration = moment.duration((moment(keyCred.endDateTime)).diff(today, 'days'), 'days').asDays();
@ -152,15 +152,15 @@ export default class GraphAppSecretExpiration extends React.Component<IGraphAppS
type: "Certificate",
expirationDate: (moment(keyCred.endDateTime)).format('DD-MMM-YYYY'),
daysLeft: daysBeforeExpiration > 0 ? daysBeforeExpiration : 0,
linkTitle: "https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/Credentials/appId/"+app.appId
linkTitle: "https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/Credentials/appId/" + app.appId
};
if (this.props.expiringSoon){
if(daysBeforeExpiration < 30){
if (this.props.expiringSoon) {
if (daysBeforeExpiration < 30) {
displayedApplication.push(formatedApp);
}
} else {
displayedApplication.push(formatedApp);
}
}
});
});
this.setState({

View File

@ -1,13 +1,13 @@
import { IGrouping } from '@pnp/spfx-controls-react/lib/ListView';
import { IApplications, IApplication,IPasswordCredential,IKeyCredential,IFormattedApplication } from '../../../models/IApplication';
import { IFormattedApplication } from '../../../models/IApplication';
export interface IGraphAppSecretExpirationState {
applications: IFormattedApplication[];
filteredApplications: IFormattedApplication[];
filterValue: string;
searchFilter: string;
groupByFields: IGrouping[];
page: number;
error: string;
loading: boolean;
}
applications: IFormattedApplication[];
filteredApplications: IFormattedApplication[];
filterValue: string;
searchFilter: string;
groupByFields: IGrouping[];
page: number;
error: string;
loading: boolean;
}