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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"datatables.net": "^2.3.2",
"datatables.net-bs5": "^2.3.2",
"dattatable": "^2.11.45",
"gd-sprest-bs": "^10.15.17",
"gd-sprest-bs": "^10.15.18",
"jquery": "^3.7.1",
"moment": "^2.30.1"
},
Expand Down
9 changes: 9 additions & 0 deletions spfx/src/webparts/siteAdmin/SiteAdminWebPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export interface ISiteAdminWebPartProps {
HideAuditToolsTab: boolean;
HideFeaturesTab: boolean;
HideListsTab: boolean;
HideLoadAdminOwnerBtn: boolean;
HideManagementTab: boolean;
HideSearchTab: boolean;
HideWebsTab: boolean;
Expand Down Expand Up @@ -142,6 +143,7 @@ declare const SiteAdmin: {
el: HTMLElement;
title?: string;
disableSensitivityLabelOverride?: boolean;
hideLoadAdminOwnerBtn: boolean;
hideTabs: {
appPermissions: boolean;
auditTools: boolean;
Expand Down Expand Up @@ -239,6 +241,7 @@ export default class SiteAdminWebPart extends BaseClientSideWebPart<ISiteAdminWe
context: this.context,
el: this.domElement,
disableSensitivityLabelOverride: this.properties.DisableSensitivityLabelOverride,
hideLoadAdminOwnerBtn: this.properties.HideLoadAdminOwnerBtn,
hideTabs: {
appPermissions: this.properties.HideAppPermissionsTab,
auditTools: this.properties.HideAuditToolsTab,
Expand Down Expand Up @@ -414,6 +417,12 @@ export default class SiteAdminWebPart extends BaseClientSideWebPart<ISiteAdminWe
onText: "The site admins/owners will only see the Information and Audit Tools tabs.",
offText: "The site owners will only see the Information and Audit Tools tabs."
}),
PropertyPaneToggle("HideLoadAdminOwnerBtn", {
label: "Hide Load Admin/Owner Button",
checked: this.properties.HideLoadAdminOwnerBtn,
onText: "The option to view a site's admins/owners will be hidden.",
offText: "The option to view a site's admins/owners will be visible."
}),
PropertyPaneToggle("SiteAttestation", {
label: "Site Attestation Feature",
checked: this.properties.SiteAttestation,
Expand Down
5 changes: 3 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface IAppProps {
context?: any;
disableSensitivityLabelOverride?: boolean;
el: HTMLElement;
hideLoadAdminOwnerBtn?: boolean;
hideTabs: {
appPermissions?: boolean;
auditTools?: boolean;
Expand Down Expand Up @@ -91,7 +92,7 @@ export class App {
`;

// Render the form
new LoadForm(el.children[0].children[0] as HTMLElement, el.children[0].children[1] as HTMLElement, () => {
new LoadForm(el.children[0].children[0] as HTMLElement, el.children[0].children[1] as HTMLElement, this._props.hideLoadAdminOwnerBtn, () => {
// Render the tabs
new App(this._props);
});
Expand All @@ -109,7 +110,7 @@ export class App {
text: "Load Site",
onClick: () => {
// Show the load form
LoadForm.showModal(() => {
LoadForm.showModal(this._props.hideLoadAdminOwnerBtn, () => {
// Render the tabs
this.renderTabs(elRow.children[1] as HTMLElement);
});
Expand Down
39 changes: 38 additions & 1 deletion src/ds.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { List, LoadingDialog } from "dattatable";
import { Components, ContextInfo, GroupSiteManager, Helper, Site, Types, Web, SPTypes, v2, DirectorySession } from "gd-sprest-bs";
import {
Components, ContextInfo, DirectorySession, GroupSiteManager, Helper,
Search, Site, SPTypes, Types, Web, v2
} from "gd-sprest-bs";
import { Security } from "./security";
import Strings from "./strings";

Expand Down Expand Up @@ -369,6 +372,40 @@ export class DataSource {
this.getAllWebs(web.ServerRelativeUrl).then(resolve, resolve);
});
}).then(resolve);
}, () => {
// Try to get the webs using search
Search.postQuery<{ Path: string; IdentityWebId: string; }>({
query: {
Querytext: "path: " + url + " contentclass=sts_site contentclass=sts_web",
SelectProperties: {
results: [
"Path", "IdentityWebId"
]
}
}
}).then(resp => {
// Clear the sites
this._siteItems = [];

// Parse the results
resp.results.forEach(result => {
// Add the item
this._siteItems.push({
text: result.Path.substring(location.origin.length),
value: result.IdentityWebId
});
});

// Sort the webs
this._siteItems = this._siteItems.sort((a, b) => {
if (a.text < b.text) { return -1; }
if (a.text > b.text) { return 1; }
return 0;
});

// Resolve the request
resolve();
});
});
});
}
Expand Down
58 changes: 31 additions & 27 deletions src/loadForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,48 @@ export class LoadForm {
private _onSuccess: () => void = null;

// Renders the modal
constructor(elForm: HTMLElement, elFooter: HTMLElement, onSuccess: () => void) {
constructor(elForm: HTMLElement, elFooter: HTMLElement, hideLoadAdminOwnerBtn: boolean = false, onSuccess: () => void) {
this._onSuccess = onSuccess;

// Render the form and footer
this.renderForm(elForm);
this.renderFooter(elFooter);
this.renderFooter(elFooter, hideLoadAdminOwnerBtn);
}

// Renders the footer
private renderFooter(el: HTMLElement) {
private renderFooter(el: HTMLElement, hideLoadAdminOwnerBtn: boolean) {
// Clear the element
while (el.firstChild) { el.removeChild(el.firstChild); }

// Set the tooltips
let tooltips = []
if (!hideLoadAdminOwnerBtn) {
tooltips.push({
content: "Views the owners/admins of the site.",
btnProps: {
text: "View Admins/Owners",
onClick: () => {
// Load the admins/owners of the site
this.viewAdminsOwners();
}
}
});
}
tooltips.push({
content: "Validates that you are an admin for the site entered.",
btnProps: {
text: "Load Site",
onClick: () => {
// Submit the request
this.submitForm();
}
}
});

// Render the footer
Components.TooltipGroup({
el,
tooltips: [
{
content: "Views the owners/admins of the site.",
btnProps: {
text: "View Admins/Owners",
onClick: () => {
// Load the admins/owners of the site
this.viewAdminsOwners();
}
}
},
{
content: "Validates that you are an admin for the site entered.",
btnProps: {
text: "Load Site",
onClick: () => {
// Submit the request
this.submitForm();
}
}
}
]
tooltips
});
}

Expand Down Expand Up @@ -247,15 +251,15 @@ export class LoadForm {
}

// Shows the modal
static showModal(onSuccess: () => void) {
static showModal(hideLoadAdminOwnerBtn: boolean = false, onSuccess: () => void) {
// Clear the modal
Modal.clear();

// Set the header
Modal.setHeader("Load Site");

// Create the form/footer
new LoadForm(Modal.BodyElement, Modal.FooterElement, onSuccess);
new LoadForm(Modal.BodyElement, Modal.FooterElement, hideLoadAdminOwnerBtn, onSuccess);

// Show the modal
Modal.show();
Expand Down
8 changes: 8 additions & 0 deletions src/reports/dlp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export class DLP {
Top: 5000
}).execute(items => {
let batchRequests = 0;
let completed = 0;

// Update the dialog
LoadingDialog.setBody("Creating batch job for files...");
Expand Down Expand Up @@ -110,6 +111,9 @@ export class DLP {
});
});
}

// Increment the counter and update the dialog
LoadingDialog.setBody(`Batch Requests Processed ${++completed} of ${batchRequests}...`);
});
});

Expand Down Expand Up @@ -160,6 +164,7 @@ export class DLP {
// Return a promise
return new Promise(resolve => {
let batchRequests = 0;
let completed = 0;

// Get the item ids for this library
Web(webUrl, { requestDigest: DataSource.SiteContext.FormDigestValue }).Lists(lib.Title).Items().query({
Expand Down Expand Up @@ -214,6 +219,9 @@ export class DLP {
});
});
}

// Increment the counter and update the dialog
LoadingDialog.setBody(`Batch Requests Processed ${++completed} of ${batchRequests}...`);
});
}
});
Expand Down
7 changes: 4 additions & 3 deletions src/tabs/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class FeaturesTab extends Tab<{
ClientSideAssets: IRequest;
DisableCompanyWideSharingLinks: IRequest;
NoCrawl: IRequest;
RestrictContentDiscovery: IRequest;
}, {
CommentsOnSitePagesDisabled: boolean;
SocialBarOnSitePagesDisabled: boolean;
Expand Down Expand Up @@ -151,10 +152,10 @@ export class FeaturesTab extends Tab<{
let value = item ? true : false;

// See if we are changing the value
if (this._currValues.DisableCompanyWideSharingLinks != value) {
if (this._currValues.RestrictContentDiscovery != value) {
// Set the value
this._requestItems.DisableCompanyWideSharingLinks = {
key: RequestTypes.DisableCompanyWideSharingLinks,
this._requestItems.RestrictContentDiscovery = {
key: RequestTypes.RestrictContentDiscovery,
message: `The request to ${value ? "enable" : "disable"} the restriction from global search will be processed within 5 minutes.`,
value
};
Expand Down
1 change: 1 addition & 0 deletions src/tabs/lists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ export class ListsTab {
items: this._webs,
label: "Selected Sub-Web(s):",
placeholder: "Select a sub-web",
placement: Components.DropdownPlacements.RightEnd,
onControlRendered: ctrl => { ddlWebs = ctrl; },
onValidate: (ctrl, results) => {
// See if we are not searching all the webs
Expand Down