From 8a3b080608f49d11a5c9c3d93d3eb605103952fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9E=D1=81=D1=8C=D0=BC=D0=B0=D0=BA=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=81?= Date: Mon, 30 Dec 2019 11:25:44 +0300 Subject: [PATCH] message-bar --- .../SummaryContainer/SummaryContainer.tsx | 5 ++++ .../components/SummaryWebPart.tsx | 24 ++++++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/webparts/summaryWebPart/components/SummaryContainer/SummaryContainer.tsx b/src/webparts/summaryWebPart/components/SummaryContainer/SummaryContainer.tsx index ce4bc8d..c9334ac 100644 --- a/src/webparts/summaryWebPart/components/SummaryContainer/SummaryContainer.tsx +++ b/src/webparts/summaryWebPart/components/SummaryContainer/SummaryContainer.tsx @@ -70,6 +70,11 @@ export default class SummaryContainer extends React.Component{ let fieldValue = !e.fieldName.match(/\/Title/gi)?currentProject[0][e.fieldName] : currentProject[0][e.fieldName.split('/')[0]]? currentProject[0][e.fieldName.split('/')[0]]['Title'] : ''; + if (fieldValue && fieldValue.toString().match(/\;\#/gi)){ + fieldValue = fieldValue.toString().replace(/[\;\#][^\s]/gi, ''); + if (fieldValue.toString().match(/undefined/gi)) fieldValue = fieldValue.toString().replace(/undefined/gi, ''); + } + if (fieldValue || typeof fieldValue === 'boolean'){ toState.push({ key: e.key, diff --git a/src/webparts/summaryWebPart/components/SummaryWebPart.tsx b/src/webparts/summaryWebPart/components/SummaryWebPart.tsx index 82599ad..f893eda 100644 --- a/src/webparts/summaryWebPart/components/SummaryWebPart.tsx +++ b/src/webparts/summaryWebPart/components/SummaryWebPart.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { ISummaryWebPartProps } from './ISummaryWebPartProps'; import { Spinner, SpinnerSize } from 'office-ui-fabric-react/lib/Spinner'; import SummaryGlobalComponent from './SummaryGlobalComponent/SummaryGlobalComponent' -import { PrimaryButton } from 'office-ui-fabric-react'; +import { PrimaryButton, MessageBar, MessageBarType } from 'office-ui-fabric-react'; import { IPageData } from '../interfaces/IPageData'; import {sp, Web} from '@pnp/sp' @@ -11,6 +11,7 @@ export interface IComponentState{ isLoaded: boolean; isBlank: boolean; prjID: string | number; + isPerm: boolean; } export default class SummaryWebPart extends React.Component { @@ -18,15 +19,24 @@ export default class SummaryWebPart extends React.Component { + if(e.length){ + this.setState({ isPerm: true }) + } + }) + web.lists.getById('eeba7db6-4c28-41a2-a54e-82a2aaf0ca15').items.filter("Code_project eq '" + projectCode +"'").select('ID').get().then(e=>{ this.setState({prjID: e[0].ID}) }) @@ -45,8 +55,8 @@ export default class SummaryWebPart extends React.Component { - const { pageData, isLoaded, isBlank } = this.state; - return isLoaded ? ( + const { pageData, isLoaded, isBlank, isPerm } = this.state; + return isPerm ? isLoaded ? (
- ); + ) : + {'Отсутствует доступ к странице'} + } }