каркас вроде есть
This commit is contained in:
@@ -3,46 +3,62 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var React = tslib_1.__importStar(require("react"));
|
||||
var ApprovalAdmin_module_scss_1 = tslib_1.__importDefault(require("./ApprovalAdmin.module.scss"));
|
||||
var sp_lodash_subset_1 = require("@microsoft/sp-lodash-subset");
|
||||
var ApprovalAdmin = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(ApprovalAdmin, _super);
|
||||
function ApprovalAdmin() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
ApprovalAdmin.prototype.render = function () {
|
||||
var _a = this.props, description = _a.description, isDarkTheme = _a.isDarkTheme, environmentMessage = _a.environmentMessage, hasTeamsContext = _a.hasTeamsContext, userDisplayName = _a.userDisplayName;
|
||||
return (React.createElement("section", { className: "".concat(ApprovalAdmin_module_scss_1.default.approvalAdmin, " ").concat(hasTeamsContext ? ApprovalAdmin_module_scss_1.default.teams : '') },
|
||||
React.createElement("div", { className: ApprovalAdmin_module_scss_1.default.welcome },
|
||||
React.createElement("img", { alt: "", src: isDarkTheme ? require('../assets/welcome-dark.png') : require('../assets/welcome-light.png'), className: ApprovalAdmin_module_scss_1.default.welcomeImage }),
|
||||
React.createElement("h2", null,
|
||||
"Well done, ",
|
||||
(0, sp_lodash_subset_1.escape)(userDisplayName),
|
||||
"!"),
|
||||
React.createElement("div", null, environmentMessage),
|
||||
React.createElement("div", null,
|
||||
"Web part property value: ",
|
||||
React.createElement("strong", null, (0, sp_lodash_subset_1.escape)(description)))),
|
||||
React.createElement("div", null,
|
||||
React.createElement("h3", null, "Welcome to SharePoint Framerk!"),
|
||||
React.createElement("p", null, "The SharePoint Framework (SPFx) is a extensibility model for Microsoft Viva, Microsoft Teams and SharePoint. It's the easiest way to extend Microsoft 365 with automatic Single Sign On, automatic hosting and industry standard tooling."),
|
||||
React.createElement("h4", null, "Learn more about SPFx development:"),
|
||||
React.createElement("ul", { className: ApprovalAdmin_module_scss_1.default.links },
|
||||
React.createElement("li", null,
|
||||
React.createElement("a", { href: "https://aka.ms/spfx", target: "_blank", rel: "noreferrer" }, "SharePoint Framework Overview")),
|
||||
React.createElement("li", null,
|
||||
React.createElement("a", { href: "https://aka.ms/spfx-yeoman-graph", target: "_blank", rel: "noreferrer" }, "Use Microsoft Graph in your solution")),
|
||||
React.createElement("li", null,
|
||||
React.createElement("a", { href: "https://aka.ms/spfx-yeoman-teams", target: "_blank", rel: "noreferrer" }, "Build for Microsoft Teams using SharePoint Framework")),
|
||||
React.createElement("li", null,
|
||||
React.createElement("a", { href: "https://aka.ms/spfx-yeoman-viva", target: "_blank", rel: "noreferrer" }, "Build for Microsoft Viva Connections using SharePoint Framework")),
|
||||
React.createElement("li", null,
|
||||
React.createElement("a", { href: "https://aka.ms/spfx-yeoman-store", target: "_blank", rel: "noreferrer" }, "Publish SharePoint Framework applications to the marketplace")),
|
||||
React.createElement("li", null,
|
||||
React.createElement("a", { href: "https://aka.ms/spfx-yeoman-api", target: "_blank", rel: "noreferrer" }, "SharePoint Framework API reference")),
|
||||
React.createElement("li", null,
|
||||
React.createElement("a", { href: "https://aka.ms/m365pnp", target: "_blank", rel: "noreferrer" }, "Microsoft 365 Developer Community"))))));
|
||||
};
|
||||
return ApprovalAdmin;
|
||||
}(React.Component));
|
||||
var AdminApp_1 = require("./app/AdminApp");
|
||||
var api_1 = require("../services/api");
|
||||
var httpClient_1 = require("../services/httpClient");
|
||||
var FONTS_LINK_ID = 'tnsu-approval-admin-fonts';
|
||||
function ensureFontsLoaded() {
|
||||
if (typeof document === 'undefined' || document.getElementById(FONTS_LINK_ID))
|
||||
return;
|
||||
var link = document.createElement('link');
|
||||
link.id = FONTS_LINK_ID;
|
||||
link.rel = 'stylesheet';
|
||||
link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Lora:wght@500;600;700&display=swap';
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
function createHttpClient(props) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var aadClient;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
if (props.useDevAuth) {
|
||||
return [2 /*return*/, new httpClient_1.DevApiHttpClient(props.apiBaseUrl, props.devUserEmail || 'dev@tnsu.kz')];
|
||||
}
|
||||
return [4 /*yield*/, props.context.aadHttpClientFactory.getClient(props.aadResourceId)];
|
||||
case 1:
|
||||
aadClient = _a.sent();
|
||||
return [2 /*return*/, new httpClient_1.AadApiHttpClient(aadClient, props.apiBaseUrl)];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
var ApprovalAdmin = function (props) {
|
||||
var _a = React.useState(), api = _a[0], setApi = _a[1];
|
||||
var _b = React.useState(), error = _b[0], setError = _b[1];
|
||||
React.useEffect(function () {
|
||||
ensureFontsLoaded();
|
||||
}, []);
|
||||
React.useEffect(function () {
|
||||
var cancelled = false;
|
||||
setApi(undefined);
|
||||
setError(undefined);
|
||||
createHttpClient(props)
|
||||
.then(function (client) { if (!cancelled)
|
||||
setApi(new api_1.ApprovalRouteApi(client)); })
|
||||
.catch(function (e) { if (!cancelled)
|
||||
setError(e.message); });
|
||||
return function () { cancelled = true; };
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [props.useDevAuth, props.apiBaseUrl, props.devUserEmail, props.aadResourceId]);
|
||||
return (React.createElement("section", { className: ApprovalAdmin_module_scss_1.default.approvalAdmin },
|
||||
error && (React.createElement("div", { className: ApprovalAdmin_module_scss_1.default.stateBox },
|
||||
"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0438\u0442\u044C\u0441\u044F \u043A API: ",
|
||||
error,
|
||||
React.createElement("br", null),
|
||||
"\u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0441\u0432\u043E\u0439\u0441\u0442\u0432\u0430 \u0432\u0435\u0431-\u0447\u0430\u0441\u0442\u0438 (Api Base Url, \u0440\u0435\u0436\u0438\u043C \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u0430\u0446\u0438\u0438) \u0432 \u043F\u0430\u043D\u0435\u043B\u0438 \u043D\u0430\u0441\u0442\u0440\u043E\u0435\u043A.")),
|
||||
!error && !api && React.createElement("div", { className: ApprovalAdmin_module_scss_1.default.stateBox }, "\u041F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435 \u043A API..."),
|
||||
api && React.createElement(AdminApp_1.AdminApp, { api: api, currentUserEmail: props.context.pageContext.user.email })));
|
||||
};
|
||||
exports.default = ApprovalAdmin;
|
||||
//# sourceMappingURL=ApprovalAdmin.js.map
|
||||
Reference in New Issue
Block a user