format code
This commit is contained in:
parent
bebe3b9c5e
commit
41172a784f
|
@ -24,10 +24,10 @@ export interface IGraphAppSecretExpirationWebPartProps {
|
||||||
export default class GraphAppSecretExpirationWebPart extends BaseClientSideWebPart<IGraphAppSecretExpirationWebPartProps> {
|
export default class GraphAppSecretExpirationWebPart extends BaseClientSideWebPart<IGraphAppSecretExpirationWebPartProps> {
|
||||||
private graphClient: MSGraphClient;
|
private graphClient: MSGraphClient;
|
||||||
private dropdownOptions: IPropertyPaneDropdownOption[] = [
|
private dropdownOptions: IPropertyPaneDropdownOption[] = [
|
||||||
{key:"none",text:"None"},
|
{ key: "none", text: "None" },
|
||||||
{key:"applicationId",text:"Application ID"},
|
{ key: "applicationId", text: "Application ID" },
|
||||||
{key:"type",text:"Type"}];
|
{ key: "type", text: "Type" }];
|
||||||
|
|
||||||
public onInit(): Promise<void> {
|
public onInit(): Promise<void> {
|
||||||
return new Promise<void>((resolve: () => void, reject: (error: any) => void): void => {
|
return new Promise<void>((resolve: () => void, reject: (error: any) => void): void => {
|
||||||
this.context.msGraphClientFactory
|
this.context.msGraphClientFactory
|
||||||
|
@ -72,28 +72,28 @@ export default class GraphAppSecretExpirationWebPart extends BaseClientSideWebPa
|
||||||
{
|
{
|
||||||
groupName: strings.BasicGroupName,
|
groupName: strings.BasicGroupName,
|
||||||
groupFields: [
|
groupFields: [
|
||||||
PropertyPaneDropdown('groupByColumn', {
|
PropertyPaneDropdown('groupByColumn', {
|
||||||
label: strings.DefaultGroupColumnFieldLabel,
|
label: strings.DefaultGroupColumnFieldLabel,
|
||||||
options: this.dropdownOptions,
|
options: this.dropdownOptions,
|
||||||
selectedKey: "none"
|
selectedKey: "none"
|
||||||
}),
|
}),
|
||||||
PropertyPaneToggle('expiringSoon', {
|
PropertyPaneToggle('expiringSoon', {
|
||||||
label: strings.DisplayOnlySecretsFieldLabel,
|
label: strings.DisplayOnlySecretsFieldLabel,
|
||||||
onText:"Yes",
|
onText: "Yes",
|
||||||
offText:"No"
|
offText: "No"
|
||||||
|
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
groupName: strings.OtherGroupName,
|
groupName: strings.OtherGroupName,
|
||||||
groupFields: [
|
groupFields: [
|
||||||
PropertyPaneToggle('displaySampleData', {
|
PropertyPaneToggle('displaySampleData', {
|
||||||
label: strings.DisplaySampleDataFieldLabel,
|
label: strings.DisplaySampleDataFieldLabel,
|
||||||
onText:"Yes",
|
onText: "Yes",
|
||||||
offText:"No"
|
offText: "No"
|
||||||
|
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -73,9 +73,9 @@ export default class GraphAppSecretExpiration extends React.Component<IGraphAppS
|
||||||
|
|
||||||
|
|
||||||
public componentDidMount(): void {
|
public componentDidMount(): void {
|
||||||
if(!this.props.displaySampleData){
|
if (!this.props.displaySampleData) {
|
||||||
this._getApplications();
|
this._getApplications();
|
||||||
}else{
|
} else {
|
||||||
this._propertiesMapping(sampleApplications.applications);
|
this._propertiesMapping(sampleApplications.applications);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,15 +134,15 @@ export default class GraphAppSecretExpiration extends React.Component<IGraphAppS
|
||||||
type: "Secret",
|
type: "Secret",
|
||||||
expirationDate: (moment(pswd.endDateTime)).format('DD-MMM-YYYY'),
|
expirationDate: (moment(pswd.endDateTime)).format('DD-MMM-YYYY'),
|
||||||
daysLeft: daysBeforeExpiration > 0 ? daysBeforeExpiration : 0,
|
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 (this.props.expiringSoon) {
|
||||||
if(daysBeforeExpiration < 30){
|
if (daysBeforeExpiration < 30) {
|
||||||
displayedApplication.push(formatedApp);
|
displayedApplication.push(formatedApp);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
displayedApplication.push(formatedApp);
|
displayedApplication.push(formatedApp);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
app.keyCredentials.forEach(keyCred => {
|
app.keyCredentials.forEach(keyCred => {
|
||||||
let daysBeforeExpiration = moment.duration((moment(keyCred.endDateTime)).diff(today, 'days'), 'days').asDays();
|
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",
|
type: "Certificate",
|
||||||
expirationDate: (moment(keyCred.endDateTime)).format('DD-MMM-YYYY'),
|
expirationDate: (moment(keyCred.endDateTime)).format('DD-MMM-YYYY'),
|
||||||
daysLeft: daysBeforeExpiration > 0 ? daysBeforeExpiration : 0,
|
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 (this.props.expiringSoon) {
|
||||||
if(daysBeforeExpiration < 30){
|
if (daysBeforeExpiration < 30) {
|
||||||
displayedApplication.push(formatedApp);
|
displayedApplication.push(formatedApp);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
displayedApplication.push(formatedApp);
|
displayedApplication.push(formatedApp);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import { IGrouping } from '@pnp/spfx-controls-react/lib/ListView';
|
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 {
|
export interface IGraphAppSecretExpirationState {
|
||||||
applications: IFormattedApplication[];
|
applications: IFormattedApplication[];
|
||||||
filteredApplications: IFormattedApplication[];
|
filteredApplications: IFormattedApplication[];
|
||||||
filterValue: string;
|
filterValue: string;
|
||||||
searchFilter: string;
|
searchFilter: string;
|
||||||
groupByFields: IGrouping[];
|
groupByFields: IGrouping[];
|
||||||
page: number;
|
page: number;
|
||||||
error: string;
|
error: string;
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
}
|
}
|
Loading…
Reference in New Issue