Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions spfx/src/webparts/siteAdmin/SiteAdminWebPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ export interface ISiteAdminWebPartProps {
AppTitle: string;
AuditOnly: boolean;
DisableSensitivityLabelOverride: boolean;
HideAppPermissionsTab: boolean;
HideAuditToolsTab: boolean;
HideFeaturesTab: boolean;
HideListsTab: boolean;
HideManagementTab: boolean;
HideSearchTab: boolean;
HideWebsTab: boolean;
MaxStorage: number;
MaxStorageDescription: string;
ReportsDocRententionYears: string;
Expand Down Expand Up @@ -135,6 +142,15 @@ declare const SiteAdmin: {
el: HTMLElement;
title?: string;
disableSensitivityLabelOverride?: boolean;
hideTabs: {
appPermissions: boolean;
auditTools: boolean;
features: boolean;
lists: boolean;
management: boolean;
search: boolean;
webs: boolean;
}
imageReferences: string[];
maxStorageDesc?: string;
maxStorageSize?: number;
Expand Down Expand Up @@ -223,6 +239,15 @@ export default class SiteAdminWebPart extends BaseClientSideWebPart<ISiteAdminWe
context: this.context,
el: this.domElement,
disableSensitivityLabelOverride: this.properties.DisableSensitivityLabelOverride,
hideTabs: {
appPermissions: this.properties.HideAppPermissionsTab,
auditTools: this.properties.HideAuditToolsTab,
features: this.properties.HideFeaturesTab,
lists: this.properties.HideListsTab,
management: this.properties.HideManagementTab,
search: this.properties.HideSearchTab,
webs: this.properties.HideWebsTab
},
imageReferences,
maxStorageDesc: this.properties.MaxStorageDescription,
maxStorageSize: this.properties.MaxStorage,
Expand Down Expand Up @@ -404,6 +429,53 @@ export default class SiteAdminWebPart extends BaseClientSideWebPart<ISiteAdminWe
})
]
},
{
groupName: "Show/Hide Tabs",
groupFields: [
PropertyPaneToggle("HideAppPermissionsTab", {
label: "Hide App Permissions Tab",
checked: this.properties.HideAppPermissionsTab,
onText: "The 'App Permissions' tab will be hidden.",
offText: "The 'App Permissions' tab will be visible"
}),
PropertyPaneToggle("HideAuditToolsTab", {
label: "Hide Audit Tools Tab",
checked: this.properties.HideAuditToolsTab,
onText: "The 'Audit Tools' tab will be hidden.",
offText: "The 'Audit Tools' tab will be visible"
}),
PropertyPaneToggle("HideFeaturesTab", {
label: "Hide Features Tab",
checked: this.properties.HideFeaturesTab,
onText: "The 'Features' tab will be hidden.",
offText: "The 'Features' tab will be visible"
}),
PropertyPaneToggle("HideListsTab", {
label: "Hide Lists/Libraries Tab",
checked: this.properties.HideListsTab,
onText: "The 'Lists/Libraries' tab will be hidden.",
offText: "The 'Lists/Libraries' tab will be visible"
}),
PropertyPaneToggle("HideManagementTab", {
label: "Hide Management Tab",
checked: this.properties.HideManagementTab,
onText: "The 'Management' tab will be hidden.",
offText: "The 'Management' tab will be visible"
}),
PropertyPaneToggle("HideSearchTab", {
label: "Hide Search Tab",
checked: this.properties.HideSearchTab,
onText: "The 'Search' tab will be hidden.",
offText: "The 'Search' tab will be visible"
}),
PropertyPaneToggle("HideWebsTab", {
label: "Hide Webs Tab",
checked: this.properties.HideWebsTab,
onText: "The 'Webs' tab will be hidden.",
offText: "The 'Webs' tab will be visible"
}),
]
},
{
groupName: "Sensitivity Labels",
groupFields: [
Expand Down
11 changes: 10 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,17 @@ export interface IAppProps {
auditOnly?: boolean;
context?: any;
disableSensitivityLabelOverride?: boolean;
imageReferences: string[];
el: HTMLElement;
hideTabs: {
appPermissions?: boolean;
auditTools?: boolean;
features?: boolean;
lists?: boolean;
management?: boolean;
search?: boolean;
webs?: boolean;
}
imageReferences: string[];
maxStorageDesc?: string;
maxStorageSize?: number;
reportProps?: IReportProps;
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,5 @@ window[Strings.GlobalVariable] = GlobalVariable;
let elApp = document.querySelector("#" + Strings.AppElementId) as HTMLElement;
if (elApp) {
// Render the application
GlobalVariable.render({ el: elApp, imageReferences: [], siteProps: {}, webProps: {} });
GlobalVariable.render({ el: elApp, hideTabs: {}, imageReferences: [], siteProps: {}, webProps: {} });
}
97 changes: 41 additions & 56 deletions src/tabs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,90 +52,74 @@ export class Tabs {

// Renders the tabs
private render(appProps: IAppProps) {
// Set the items
let items: Components.IListGroupItem[] = !DataSource.IsAdmin || appProps.auditOnly ? [
{
tabName: "Information",
isActive: true,
onRender: (el) => {
// Render the tab
new InfoTab(el, appProps.siteAttestation, appProps.siteProps);
}
},
{
tabName: "Lists/Libraries",
onRender: (el) => {
// Render the tab
this._tabLists = new ListsTab(el, appProps);
}
},
{
tabName: "Audit Tools",
onRender: (el) => {
// Render the tab
this._tabReports = new ReportsTab(el, appProps);
}
let auditOnly = !DataSource.IsAdmin || appProps.auditOnly;

// Show the info tab by default always
let items: Components.IListGroupItem[] = [{
tabName: "Information",
isActive: true,
onRender: (el) => {
// Render the tab
new InfoTab(el, appProps.siteAttestation, appProps.siteProps);
}
] : [
{
tabName: "Information",
isActive: true,
}];

// Add the tabs
if (!auditOnly && !appProps.hideTabs.search && !isEmpty(appProps.searchProps) && appProps.searchProps.key) {
items.push({
tabName: appProps.searchProps.tabName || "Search Property",
onRender: (el) => {
// Render the tab
new InfoTab(el, appProps.siteAttestation, appProps.siteProps);
this._tabSearch = new SearchPropTab(el, appProps.searchProps);
}
},
{
});
}
if (!auditOnly && !appProps.hideTabs.management) {
items.push({
tabName: "Management",
onRender: (el) => {
// Render the tab
this._tabManagement = new ManagementTab(el, appProps.siteProps, appProps.maxStorageSize, appProps.maxStorageDesc);
}
},
{
});
}
if (!auditOnly && !appProps.hideTabs.features) {
items.push({
tabName: "Features",
onRender: (el) => {
// Render the tab
this._tabFeatures = new FeaturesTab(el, appProps.siteProps);
}
},
{
});
}
if (!auditOnly && !appProps.hideTabs.appPermissions) {
items.push({
tabName: "App Permissions",
onRender: (el) => {
// Render the tab
this._tabAppPermissions = new AppPermissionsTab(el);
}
},
{
});
}
if (!appProps.hideTabs.lists) {
items.push({
tabName: "Lists/Libraries",
onRender: (el) => {
// Render the tab
this._tabLists = new ListsTab(el, appProps);
}
},
{
});
}
if (!appProps.hideTabs.auditTools) {
items.push({
tabName: "Audit Tools",
onRender: (el) => {
// Render the tab
this._tabReports = new ReportsTab(el, appProps);
}
}
];

// See if we are rendering all tabs
if (DataSource.IsAdmin && appProps.auditOnly != true) {
// See if we are customizing a search property
if (!isEmpty(appProps.searchProps) && appProps.searchProps.key) {
items.splice(1, 0, {
tabName: appProps.searchProps.tabName || "Search Property",
onRender: (el) => {
// Render the tab
this._tabSearch = new SearchPropTab(el, appProps.searchProps);
}
});
}

// Add the webs
});
}
if (!auditOnly && !appProps.hideTabs.webs) {
items.push({
tabName: DataSource.Site.RootWeb.Id == DataSource.Web.Id ? "Top Site" : "Sub Site",
onRenderTab: el => {
Expand All @@ -147,7 +131,8 @@ export class Tabs {
this._tabWeb = new WebTab(el, appProps.webProps);
}
});

}
if (!auditOnly) {
// Add the changes
items.push({
tabName: "Changes",
Expand Down