MM-51846 : Upgrade Esint from 7 to 8+ (#22753)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
84b0e3dff1
Коммит
9bffaeae42
@@ -1,3 +1,3 @@
|
|||||||
save-exact=true
|
save-exact=true
|
||||||
legacy-peer-deps=true
|
legacy-peer-deps=true
|
||||||
global-style=true
|
global-style=true
|
||||||
|
|||||||
@@ -102,12 +102,11 @@
|
|||||||
"@types/react-router-dom": "^5.3.3",
|
"@types/react-router-dom": "^5.3.3",
|
||||||
"@types/react-transition-group": "4.4.4",
|
"@types/react-transition-group": "4.4.4",
|
||||||
"@types/redux-mock-store": "1.0.3",
|
"@types/redux-mock-store": "1.0.3",
|
||||||
"@typescript-eslint/eslint-plugin": "5.16.0",
|
"@typescript-eslint/eslint-plugin": "5.57.1",
|
||||||
"@typescript-eslint/parser": "5.16.0",
|
"@typescript-eslint/parser": "5.57.1",
|
||||||
"babel-eslint": "10.1.0",
|
"babel-eslint": "10.1.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"css-loader": "6.7.1",
|
"css-loader": "6.7.1",
|
||||||
"eslint": "^8.11.0",
|
|
||||||
"eslint-import-resolver-webpack": "0.13.2",
|
"eslint-import-resolver-webpack": "0.13.2",
|
||||||
"eslint-plugin-babel": "^5.3.1",
|
"eslint-plugin-babel": "^5.3.1",
|
||||||
"eslint-plugin-formatjs": "4.9.0",
|
"eslint-plugin-formatjs": "4.9.0",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"plugin:react-hooks/recommended"
|
"plugin:react-hooks/recommended"
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@babel/eslint-plugin",
|
"@babel",
|
||||||
"mattermost",
|
"mattermost",
|
||||||
"import",
|
"import",
|
||||||
"no-only-tests",
|
"no-only-tests",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"npm": ">=7.0.0",
|
"npm": ">=7.0.0",
|
||||||
"node": ">=16.4.0"
|
"node": ">=16.10.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@floating-ui/react-dom": "1.0.0",
|
"@floating-ui/react-dom": "1.0.0",
|
||||||
@@ -153,8 +153,8 @@
|
|||||||
"@types/styled-components": "5.1.24",
|
"@types/styled-components": "5.1.24",
|
||||||
"@types/tinycolor2": "1.4.3",
|
"@types/tinycolor2": "1.4.3",
|
||||||
"@types/webpack-env": "1.18.0",
|
"@types/webpack-env": "1.18.0",
|
||||||
"@typescript-eslint/eslint-plugin": "5.41.0",
|
"@typescript-eslint/eslint-plugin": "5.57.1",
|
||||||
"@typescript-eslint/parser": "5.41.0",
|
"@typescript-eslint/parser": "5.57.1",
|
||||||
"babel-loader": "8.2.3",
|
"babel-loader": "8.2.3",
|
||||||
"babel-plugin-lodash": "3.3.4",
|
"babel-plugin-lodash": "3.3.4",
|
||||||
"babel-plugin-styled-components": "1.12.0",
|
"babel-plugin-styled-components": "1.12.0",
|
||||||
@@ -167,14 +167,13 @@
|
|||||||
"enzyme": "3.11.0",
|
"enzyme": "3.11.0",
|
||||||
"enzyme-adapter-react-17-updated": "1.0.2",
|
"enzyme-adapter-react-17-updated": "1.0.2",
|
||||||
"enzyme-to-json": "3.6.2",
|
"enzyme-to-json": "3.6.2",
|
||||||
"eslint": "7.32.0",
|
|
||||||
"eslint-import-resolver-webpack": "0.13.2",
|
"eslint-import-resolver-webpack": "0.13.2",
|
||||||
"eslint-plugin-formatjs": "4.3.4",
|
"eslint-plugin-formatjs": "4.9.1",
|
||||||
"eslint-plugin-header": "3.1.1",
|
"eslint-plugin-header": "3.1.1",
|
||||||
"eslint-plugin-import": "2.23.4",
|
"eslint-plugin-import": "2.27.5",
|
||||||
"eslint-plugin-mattermost": "github:mattermost/eslint-plugin-mattermost#5b0c972eacf19286e4c66221b39113bf8728a99e",
|
"eslint-plugin-mattermost": "github:mattermost/eslint-plugin-mattermost#5b0c972eacf19286e4c66221b39113bf8728a99e",
|
||||||
"eslint-plugin-no-only-tests": "2.6.0",
|
"eslint-plugin-no-only-tests": "3.1.0",
|
||||||
"eslint-plugin-react": "7.31.10",
|
"eslint-plugin-react": "7.32.2",
|
||||||
"eslint-plugin-react-hooks": "4.6.0",
|
"eslint-plugin-react-hooks": "4.6.0",
|
||||||
"external-remotes-plugin": "1.0.0",
|
"external-remotes-plugin": "1.0.0",
|
||||||
"file-loader": "6.2.0",
|
"file-loader": "6.2.0",
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export default class AboutBuildModal extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
doHide = () => {
|
doHide = () => {
|
||||||
this.setState({show: false});
|
this.setState({show: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const config = this.props.config;
|
const config = this.props.config;
|
||||||
|
|||||||
@@ -32,11 +32,11 @@ export default class AccessHistoryModal extends React.PureComponent<Props, State
|
|||||||
|
|
||||||
public onShow = () => { // public for testing
|
public onShow = () => { // public for testing
|
||||||
this.props.actions.getUserAudits(this.props.currentUserId, 0, 200);
|
this.props.actions.getUserAudits(this.props.currentUserId, 0, 200);
|
||||||
}
|
};
|
||||||
|
|
||||||
public onHide = () => { // public for testing
|
public onHide = () => { // public for testing
|
||||||
this.setState({show: false});
|
this.setState({show: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
public componentDidMount() {
|
public componentDidMount() {
|
||||||
this.onShow();
|
this.onShow();
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default class Accordion extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
setExpanded = (expandedKey: string) => {
|
setExpanded = (expandedKey: string) => {
|
||||||
this.setState({expandedKey});
|
this.setState({expandedKey});
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ export class ActionMenuClass extends React.PureComponent<Props, State> {
|
|||||||
appBindings: [],
|
appBindings: [],
|
||||||
location: Locations.CENTER,
|
location: Locations.CENTER,
|
||||||
pluginMenuItems: [],
|
pluginMenuItems: [],
|
||||||
}
|
};
|
||||||
private buttonRef: React.RefObject<HTMLButtonElement>;
|
private buttonRef: React.RefObject<HTMLButtonElement>;
|
||||||
|
|
||||||
constructor(props: Props) {
|
constructor(props: Props) {
|
||||||
@@ -115,7 +115,7 @@ export class ActionMenuClass extends React.PureComponent<Props, State> {
|
|||||||
defaultMessage='Message actions'
|
defaultMessage='Message actions'
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)
|
);
|
||||||
|
|
||||||
componentDidUpdate(prevProps: Props) {
|
componentDidUpdate(prevProps: Props) {
|
||||||
if (this.props.isMenuOpen && !prevProps.isMenuOpen) {
|
if (this.props.isMenuOpen && !prevProps.isMenuOpen) {
|
||||||
@@ -137,7 +137,7 @@ export class ActionMenuClass extends React.PureComponent<Props, State> {
|
|||||||
this.setState({appBindings: data});
|
this.setState({appBindings: data});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
handleOpenMarketplace = (): void => {
|
handleOpenMarketplace = (): void => {
|
||||||
const openedFrom: OpenedFromType = 'actions_menu';
|
const openedFrom: OpenedFromType = 'actions_menu';
|
||||||
@@ -197,7 +197,7 @@ export class ActionMenuClass extends React.PureComponent<Props, State> {
|
|||||||
this.props.actions.postEphemeralCallResponseForPost(callResp, errorMessage, post);
|
this.props.actions.postEphemeralCallResponseForPost(callResp, errorMessage, post);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
visitMarketplaceTip(): React.ReactElement {
|
visitMarketplaceTip(): React.ReactElement {
|
||||||
return (
|
return (
|
||||||
@@ -263,7 +263,7 @@ export class ActionMenuClass extends React.PureComponent<Props, State> {
|
|||||||
this.setState({
|
this.setState({
|
||||||
openUp: (spaceOnTop > spaceOnBottom),
|
openUp: (spaceOnTop > spaceOnBottom),
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
render(): React.ReactNode {
|
render(): React.ReactNode {
|
||||||
const isSystemMessage = PostUtils.isSystemMessage(this.props.post);
|
const isSystemMessage = PostUtils.isSystemMessage(this.props.post);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ type State = {
|
|||||||
export default class ActivityLogModal extends React.PureComponent<Props, State> {
|
export default class ActivityLogModal extends React.PureComponent<Props, State> {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
constructor(props: Props) {
|
constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
@@ -73,15 +73,15 @@ export default class ActivityLogModal extends React.PureComponent<Props, State>
|
|||||||
this.props.actions.revokeSession(this.props.currentUserId, altId).then(() => {
|
this.props.actions.revokeSession(this.props.currentUserId, altId).then(() => {
|
||||||
this.props.actions.getSessions(this.props.currentUserId);
|
this.props.actions.getSessions(this.props.currentUserId);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
onShow = () => {
|
onShow = () => {
|
||||||
this.props.actions.getSessions(this.props.currentUserId);
|
this.props.actions.getSessions(this.props.currentUserId);
|
||||||
}
|
};
|
||||||
|
|
||||||
onHide = () => {
|
onHide = () => {
|
||||||
this.setState({show: false});
|
this.setState({show: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.onShow();
|
this.onShow();
|
||||||
|
|||||||
@@ -56,11 +56,11 @@ export default class ActivityLog extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
handleMoreInfo = (): void => {
|
handleMoreInfo = (): void => {
|
||||||
this.setState({moreInfo: true});
|
this.setState({moreInfo: true});
|
||||||
}
|
};
|
||||||
|
|
||||||
submitRevoke = (e: React.MouseEvent): void => {
|
submitRevoke = (e: React.MouseEvent): void => {
|
||||||
this.props.submitRevoke(this.props.currentSession.id, e);
|
this.props.submitRevoke(this.props.currentSession.id, e);
|
||||||
}
|
};
|
||||||
|
|
||||||
isMobileSession = (session: Session): boolean => {
|
isMobileSession = (session: Session): boolean => {
|
||||||
return Boolean(session.device_id && (session.device_id.includes('apple') || session.device_id.includes('android')));
|
return Boolean(session.device_id && (session.device_id.includes('apple') || session.device_id.includes('android')));
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ export default class AddGroupsToChannelModal extends React.PureComponent<Props,
|
|||||||
handleHide = () => {
|
handleHide = () => {
|
||||||
this.props.actions.setModalSearchTerm('');
|
this.props.actions.setModalSearchTerm('');
|
||||||
this.setState({show: false});
|
this.setState({show: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleResponse = (err?: ServerError) => {
|
handleResponse = (err?: ServerError) => {
|
||||||
let addError = null;
|
let addError = null;
|
||||||
@@ -122,7 +122,7 @@ export default class AddGroupsToChannelModal extends React.PureComponent<Props,
|
|||||||
saving: false,
|
saving: false,
|
||||||
addError,
|
addError,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleSubmit = async () => {
|
handleSubmit = async () => {
|
||||||
const groupIDs = this.state.values.map((v) => v.id);
|
const groupIDs = this.state.values.map((v) => v.id);
|
||||||
@@ -147,7 +147,7 @@ export default class AddGroupsToChannelModal extends React.PureComponent<Props,
|
|||||||
this.handleHide();
|
this.handleHide();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
};
|
||||||
|
|
||||||
addValue = (value: GroupValue) => {
|
addValue = (value: GroupValue) => {
|
||||||
const values = Object.assign([], this.state.values);
|
const values = Object.assign([], this.state.values);
|
||||||
@@ -157,13 +157,13 @@ export default class AddGroupsToChannelModal extends React.PureComponent<Props,
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setState({values});
|
this.setState({values});
|
||||||
}
|
};
|
||||||
|
|
||||||
setGroupsLoadingState = (loadingState: boolean) => {
|
setGroupsLoadingState = (loadingState: boolean) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loadingGroups: loadingState,
|
loadingGroups: loadingState,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
handlePageChange = (page: number, prevPage: number) => {
|
handlePageChange = (page: number, prevPage: number) => {
|
||||||
if (page > prevPage) {
|
if (page > prevPage) {
|
||||||
@@ -172,15 +172,15 @@ export default class AddGroupsToChannelModal extends React.PureComponent<Props,
|
|||||||
this.setGroupsLoadingState(false);
|
this.setGroupsLoadingState(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
handleDelete = (values: GroupValue[]) => {
|
handleDelete = (values: GroupValue[]) => {
|
||||||
this.setState({values});
|
this.setState({values});
|
||||||
}
|
};
|
||||||
|
|
||||||
search = (term: string) => {
|
search = (term: string) => {
|
||||||
this.props.actions.setModalSearchTerm(term);
|
this.props.actions.setModalSearchTerm(term);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderOption = (option: GroupValue, isSelected: boolean, onAdd: (value: GroupValue) => void, onMouseMove?: (value: GroupValue) => void) => {
|
renderOption = (option: GroupValue, isSelected: boolean, onAdd: (value: GroupValue) => void, onMouseMove?: (value: GroupValue) => void) => {
|
||||||
const rowSelected = isSelected ? 'more-modal__row--selected' : '';
|
const rowSelected = isSelected ? 'more-modal__row--selected' : '';
|
||||||
@@ -222,7 +222,7 @@ export default class AddGroupsToChannelModal extends React.PureComponent<Props,
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderValue(props: { data: Partial<Value> }) {
|
renderValue(props: { data: Partial<Value> }) {
|
||||||
return props.data.display_name;
|
return props.data.display_name;
|
||||||
|
|||||||
@@ -105,12 +105,12 @@ export default class AddGroupsToTeamModal extends React.PureComponent<Props, Sta
|
|||||||
public handleHide = () => {
|
public handleHide = () => {
|
||||||
this.props.actions.setModalSearchTerm('');
|
this.props.actions.setModalSearchTerm('');
|
||||||
this.setState({show: false});
|
this.setState({show: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
// public for tests
|
// public for tests
|
||||||
public handleExit = (): void => {
|
public handleExit = (): void => {
|
||||||
this.props.onExited();
|
this.props.onExited();
|
||||||
}
|
};
|
||||||
|
|
||||||
// public for tests
|
// public for tests
|
||||||
public handleResponse = (err?: Error): void => {
|
public handleResponse = (err?: Error): void => {
|
||||||
@@ -123,7 +123,7 @@ export default class AddGroupsToTeamModal extends React.PureComponent<Props, Sta
|
|||||||
saving: false,
|
saving: false,
|
||||||
addError,
|
addError,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// public for tests
|
// public for tests
|
||||||
public handleSubmit = async () => {
|
public handleSubmit = async () => {
|
||||||
@@ -148,7 +148,7 @@ export default class AddGroupsToTeamModal extends React.PureComponent<Props, Sta
|
|||||||
this.handleHide();
|
this.handleHide();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
};
|
||||||
|
|
||||||
// public for tests
|
// public for tests
|
||||||
public addValue = (value: GroupValue): void => {
|
public addValue = (value: GroupValue): void => {
|
||||||
@@ -159,13 +159,13 @@ export default class AddGroupsToTeamModal extends React.PureComponent<Props, Sta
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setState({values});
|
this.setState({values});
|
||||||
}
|
};
|
||||||
|
|
||||||
private setGroupsLoadingState = (loadingState: boolean) => {
|
private setGroupsLoadingState = (loadingState: boolean) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loadingGroups: loadingState,
|
loadingGroups: loadingState,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// public for tests
|
// public for tests
|
||||||
public handlePageChange = (page: number, prevPage: number): void => {
|
public handlePageChange = (page: number, prevPage: number): void => {
|
||||||
@@ -175,7 +175,7 @@ export default class AddGroupsToTeamModal extends React.PureComponent<Props, Sta
|
|||||||
this.setGroupsLoadingState(false);
|
this.setGroupsLoadingState(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
// public for tests
|
// public for tests
|
||||||
public handleDelete = (values: GroupValue[]): void => this.setState({values});
|
public handleDelete = (values: GroupValue[]): void => this.setState({values});
|
||||||
@@ -224,7 +224,7 @@ export default class AddGroupsToTeamModal extends React.PureComponent<Props, Sta
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
// public for tests
|
// public for tests
|
||||||
public renderValue = (props: { data: Value }): string | undefined => props.data.display_name;
|
public renderValue = (props: { data: Value }): string | undefined => props.data.display_name;
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ export default class AddUserToChannelModal extends React.PureComponent<Props, St
|
|||||||
|
|
||||||
enableChannelProvider = () => {
|
enableChannelProvider = () => {
|
||||||
this.suggestionProviders[0].disableDispatches = false;
|
this.suggestionProviders[0].disableDispatches = false;
|
||||||
}
|
};
|
||||||
|
|
||||||
focusTextbox = () => {
|
focusTextbox = () => {
|
||||||
if (this.channelSearchBox == null) {
|
if (this.channelSearchBox == null) {
|
||||||
@@ -126,30 +126,30 @@ export default class AddUserToChannelModal extends React.PureComponent<Props, St
|
|||||||
textbox.focus();
|
textbox.focus();
|
||||||
placeCaretAtEnd(textbox);
|
placeCaretAtEnd(textbox);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
onInputChange = (e: ChangeEvent<HTMLInputElement>) => {
|
onInputChange = (e: ChangeEvent<HTMLInputElement>) => {
|
||||||
this.setState({text: e.target.value, selectedChannelId: null});
|
this.setState({text: e.target.value, selectedChannelId: null});
|
||||||
}
|
};
|
||||||
|
|
||||||
onHide = () => {
|
onHide = () => {
|
||||||
this.setState({show: false});
|
this.setState({show: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
onExited = () => {
|
onExited = () => {
|
||||||
this.props.onExited();
|
this.props.onExited();
|
||||||
}
|
};
|
||||||
|
|
||||||
setSearchBoxRef = (input: SuggestionBoxComponent) => {
|
setSearchBoxRef = (input: SuggestionBoxComponent) => {
|
||||||
this.channelSearchBox = input;
|
this.channelSearchBox = input;
|
||||||
this.focusTextbox();
|
this.focusTextbox();
|
||||||
}
|
};
|
||||||
|
|
||||||
handleSubmitError = (error: {message: string}) => {
|
handleSubmitError = (error: {message: string}) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
this.setState({submitError: error.message, saving: false});
|
this.setState({submitError: error.message, saving: false});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
didSelectChannel = (selection: {channel: Channel}) => {
|
didSelectChannel = (selection: {channel: Channel}) => {
|
||||||
const channel = selection.channel;
|
const channel = selection.channel;
|
||||||
@@ -165,7 +165,7 @@ export default class AddUserToChannelModal extends React.PureComponent<Props, St
|
|||||||
this.props.actions.getChannelMember(channel.id, userId).then(() => {
|
this.props.actions.getChannelMember(channel.id, userId).then(() => {
|
||||||
this.setState({checkingForMembership: false});
|
this.setState({checkingForMembership: false});
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleSubmit = (e: FormEvent) => {
|
handleSubmit = (e: FormEvent) => {
|
||||||
if (e && e.preventDefault) {
|
if (e && e.preventDefault) {
|
||||||
@@ -192,7 +192,7 @@ export default class AddUserToChannelModal extends React.PureComponent<Props, St
|
|||||||
this.onHide();
|
this.onHide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
isUserMemberOfChannel = (channelId: string | null) => {
|
isUserMemberOfChannel = (channelId: string | null) => {
|
||||||
const user = this.props.user;
|
const user = this.props.user;
|
||||||
@@ -207,7 +207,7 @@ export default class AddUserToChannelModal extends React.PureComponent<Props, St
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Boolean(memberships[channelId][user.id]);
|
return Boolean(memberships[channelId][user.id]);
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const user = this.props.user;
|
const user = this.props.user;
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ export default class AddUserToGroupMultiSelect extends React.PureComponent<Props
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
return option.username;
|
return option.username;
|
||||||
}
|
};
|
||||||
|
|
||||||
renderOption = (option: UserProfileValue, isSelected: boolean, onAdd: (user: UserProfileValue) => void, onMouseMove: (user: UserProfileValue) => void) => {
|
renderOption = (option: UserProfileValue, isSelected: boolean, onAdd: (user: UserProfileValue) => void, onMouseMove: (user: UserProfileValue) => void) => {
|
||||||
return (
|
return (
|
||||||
@@ -241,5 +241,5 @@ export default class AddUserToGroupMultiSelect extends React.PureComponent<Props
|
|||||||
numRemainingText={numRemainingText}
|
numRemainingText={numRemainingText}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,11 +78,11 @@ export default class AddUsersToTeamModal extends React.PureComponent<Props, Stat
|
|||||||
public componentDidMount = async () => {
|
public componentDidMount = async () => {
|
||||||
await this.props.actions.getProfilesNotInTeam(this.props.team.id, false, 0, USERS_PER_PAGE * 2);
|
await this.props.actions.getProfilesNotInTeam(this.props.team.id, false, 0, USERS_PER_PAGE * 2);
|
||||||
this.setUsersLoadingState(false);
|
this.setUsersLoadingState(false);
|
||||||
}
|
};
|
||||||
|
|
||||||
private setUsersLoadingState = (loading: boolean) => {
|
private setUsersLoadingState = (loading: boolean) => {
|
||||||
this.setState({loading});
|
this.setState({loading});
|
||||||
}
|
};
|
||||||
|
|
||||||
public search = async (term: string) => {
|
public search = async (term: string) => {
|
||||||
this.setUsersLoadingState(true);
|
this.setUsersLoadingState(true);
|
||||||
@@ -95,17 +95,17 @@ export default class AddUsersToTeamModal extends React.PureComponent<Props, Stat
|
|||||||
await this.props.actions.getProfilesNotInTeam(this.props.team.id, false, 0, USERS_PER_PAGE * 2);
|
await this.props.actions.getProfilesNotInTeam(this.props.team.id, false, 0, USERS_PER_PAGE * 2);
|
||||||
}
|
}
|
||||||
this.setState({loading: false, searchResults, search});
|
this.setState({loading: false, searchResults, search});
|
||||||
}
|
};
|
||||||
|
|
||||||
public handleHide = () => {
|
public handleHide = () => {
|
||||||
this.setState({show: false});
|
this.setState({show: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
private handleExit = () => {
|
private handleExit = () => {
|
||||||
if (this.props.onExited) {
|
if (this.props.onExited) {
|
||||||
this.props.onExited();
|
this.props.onExited();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
private renderOption = (option: UserProfileValue, isSelected: boolean, onAdd: (user: UserProfileValue) => void, onMouseMove: (user: UserProfileValue) => void) => {
|
private renderOption = (option: UserProfileValue, isSelected: boolean, onAdd: (user: UserProfileValue) => void, onMouseMove: (user: UserProfileValue) => void) => {
|
||||||
let rowSelected = '';
|
let rowSelected = '';
|
||||||
@@ -139,15 +139,15 @@ export default class AddUsersToTeamModal extends React.PureComponent<Props, Stat
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
private renderValue = (value: { data: UserProfileValue }): string => {
|
private renderValue = (value: { data: UserProfileValue }): string => {
|
||||||
return value.data?.username || '';
|
return value.data?.username || '';
|
||||||
}
|
};
|
||||||
|
|
||||||
private renderAriaLabel = (option: UserProfileValue): string => {
|
private renderAriaLabel = (option: UserProfileValue): string => {
|
||||||
return option?.username || '';
|
return option?.username || '';
|
||||||
}
|
};
|
||||||
|
|
||||||
private handleAdd = (value: UserProfileValue) => {
|
private handleAdd = (value: UserProfileValue) => {
|
||||||
const values: UserProfileValue[] = [...this.state.values];
|
const values: UserProfileValue[] = [...this.state.values];
|
||||||
@@ -155,11 +155,11 @@ export default class AddUsersToTeamModal extends React.PureComponent<Props, Stat
|
|||||||
values.push(value);
|
values.push(value);
|
||||||
}
|
}
|
||||||
this.setState({values});
|
this.setState({values});
|
||||||
}
|
};
|
||||||
|
|
||||||
private handleDelete = (values: UserProfileValue[]) => {
|
private handleDelete = (values: UserProfileValue[]) => {
|
||||||
this.setState({values});
|
this.setState({values});
|
||||||
}
|
};
|
||||||
|
|
||||||
private handlePageChange = (page: number, prevPage: number) => {
|
private handlePageChange = (page: number, prevPage: number) => {
|
||||||
if (page > prevPage) {
|
if (page > prevPage) {
|
||||||
@@ -173,7 +173,7 @@ export default class AddUsersToTeamModal extends React.PureComponent<Props, Stat
|
|||||||
private handleSubmit = () => {
|
private handleSubmit = () => {
|
||||||
this.props.onAddCallback(this.state.values);
|
this.props.onAddCallback(this.state.values);
|
||||||
this.handleHide();
|
this.handleHide();
|
||||||
}
|
};
|
||||||
|
|
||||||
public render = (): JSX.Element => {
|
public render = (): JSX.Element => {
|
||||||
const numRemainingText = (
|
const numRemainingText = (
|
||||||
@@ -259,5 +259,5 @@ export default class AddUsersToTeamModal extends React.PureComponent<Props, Stat
|
|||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ export default class AdminConsole extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
private onFilterChange = (filter: string) => {
|
private onFilterChange = (filter: string) => {
|
||||||
this.setState({filter});
|
this.setState({filter});
|
||||||
}
|
};
|
||||||
|
|
||||||
private mainRolesLoaded(roles: Record<string, Role>) {
|
private mainRolesLoaded(roles: Record<string, Role>) {
|
||||||
return (
|
return (
|
||||||
@@ -186,7 +186,7 @@ export default class AdminConsole extends React.PureComponent<Props, State> {
|
|||||||
{<Redirect to={`${this.props.match.url}/${defaultUrl}`}/>}
|
{<Redirect to={`${this.props.match.url}/${defaultUrl}`}/>}
|
||||||
</Switch>
|
</Switch>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
public render(): JSX.Element | null {
|
public render(): JSX.Element | null {
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export default abstract class AdminSettings <Props extends BaseProps, State exte
|
|||||||
|
|
||||||
private closeTooltip = () => {
|
private closeTooltip = () => {
|
||||||
this.setState({errorTooltip: false});
|
this.setState({errorTooltip: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
private openTooltip = (e: React.MouseEvent) => {
|
private openTooltip = (e: React.MouseEvent) => {
|
||||||
const elm: HTMLElement|null = e.currentTarget.querySelector('.control-label');
|
const elm: HTMLElement|null = e.currentTarget.querySelector('.control-label');
|
||||||
@@ -77,7 +77,7 @@ export default abstract class AdminSettings <Props extends BaseProps, State exte
|
|||||||
const isElipsis = elm.offsetWidth < elm.scrollWidth;
|
const isElipsis = elm.offsetWidth < elm.scrollWidth;
|
||||||
this.setState({errorTooltip: isElipsis});
|
this.setState({errorTooltip: isElipsis});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
protected handleChange = (id: string, value: boolean) => {
|
protected handleChange = (id: string, value: boolean) => {
|
||||||
this.setState((prevState) => ({
|
this.setState((prevState) => ({
|
||||||
@@ -95,7 +95,7 @@ export default abstract class AdminSettings <Props extends BaseProps, State exte
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
this.doSubmit();
|
this.doSubmit();
|
||||||
}
|
};
|
||||||
|
|
||||||
protected doSubmit = async (callback?: () => void) => {
|
protected doSubmit = async (callback?: () => void) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|||||||
@@ -57,11 +57,11 @@ const renderScrollThumbVertical = (props: Props) => (
|
|||||||
|
|
||||||
class AdminSidebar extends React.PureComponent<Props, State> {
|
class AdminSidebar extends React.PureComponent<Props, State> {
|
||||||
searchRef: React.RefObject<HTMLInputElement>;
|
searchRef: React.RefObject<HTMLInputElement>;
|
||||||
idx: Index | null
|
idx: Index | null;
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
plugins: {},
|
plugins: {},
|
||||||
}
|
};
|
||||||
|
|
||||||
constructor(props: Props) {
|
constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
@@ -130,7 +130,7 @@ class AdminSidebar extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
updateTitle = () => {
|
updateTitle = () => {
|
||||||
let currentSiteName = '';
|
let currentSiteName = '';
|
||||||
@@ -139,7 +139,7 @@ class AdminSidebar extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
document.title = localizeMessage('sidebar_right_menu.console', 'System Console') + currentSiteName;
|
document.title = localizeMessage('sidebar_right_menu.console', 'System Console') + currentSiteName;
|
||||||
}
|
};
|
||||||
|
|
||||||
visibleSections = () => {
|
visibleSections = () => {
|
||||||
const {config, license, buildEnterpriseReady, consoleAccess, adminDefinition, cloud} = this.props;
|
const {config, license, buildEnterpriseReady, consoleAccess, adminDefinition, cloud} = this.props;
|
||||||
@@ -166,7 +166,7 @@ class AdminSidebar extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
};
|
||||||
|
|
||||||
renderRootMenu = (definition: typeof AdminDefinition) => {
|
renderRootMenu = (definition: typeof AdminDefinition) => {
|
||||||
const {config, license, buildEnterpriseReady, consoleAccess, cloud, subscriptionProduct} = this.props;
|
const {config, license, buildEnterpriseReady, consoleAccess, cloud, subscriptionProduct} = this.props;
|
||||||
@@ -249,11 +249,11 @@ class AdminSidebar extends React.PureComponent<Props, State> {
|
|||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
return sidebarSections;
|
return sidebarSections;
|
||||||
}
|
};
|
||||||
|
|
||||||
isPluginPresentInSections = (plugin: PluginRedux) => {
|
isPluginPresentInSections = (plugin: PluginRedux) => {
|
||||||
return this.state.sections && this.state.sections.indexOf(`plugin_${plugin.id}`) >= 0;
|
return this.state.sections && this.state.sections.indexOf(`plugin_${plugin.id}`) >= 0;
|
||||||
}
|
};
|
||||||
|
|
||||||
renderPluginsMenu = () => {
|
renderPluginsMenu = () => {
|
||||||
const {config, plugins} = this.props;
|
const {config, plugins} = this.props;
|
||||||
@@ -279,12 +279,12 @@ class AdminSidebar extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
}
|
};
|
||||||
|
|
||||||
handleClearFilter = () => {
|
handleClearFilter = () => {
|
||||||
this.setState({sections: null, filter: ''});
|
this.setState({sections: null, filter: ''});
|
||||||
this.props.onFilterChange('');
|
this.props.onFilterChange('');
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {showTaskList} = this.props;
|
const {showTaskList} = this.props;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export default class BleveSettings extends AdminSettings {
|
|||||||
config.BleveSettings.EnableAutocomplete = this.state.enableAutocomplete;
|
config.BleveSettings.EnableAutocomplete = this.state.enableAutocomplete;
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
};
|
||||||
|
|
||||||
getStateFromConfig(config) {
|
getStateFromConfig(config) {
|
||||||
return {
|
return {
|
||||||
@@ -55,17 +55,17 @@ export default class BleveSettings extends AdminSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.handleChange(id, value);
|
this.handleChange(id, value);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleSaved = () => {
|
handleSaved = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
canPurgeAndIndex: this.state.enableIndexing && this.state.indexDir !== '',
|
canPurgeAndIndex: this.state.enableIndexing && this.state.indexDir !== '',
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
canSave = () => {
|
canSave = () => {
|
||||||
return this.state.canSave;
|
return this.state.canSave;
|
||||||
}
|
};
|
||||||
|
|
||||||
getExtraInfo(job) {
|
getExtraInfo(job) {
|
||||||
if (job.status === JobStatuses.IN_PROGRESS) {
|
if (job.status === JobStatuses.IN_PROGRESS) {
|
||||||
@@ -246,5 +246,5 @@ export default class BleveSettings extends AdminSettings {
|
|||||||
/>
|
/>
|
||||||
</SettingsGroup>
|
</SettingsGroup>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export default class BooleanSetting extends React.PureComponent<Props> {
|
|||||||
|
|
||||||
private handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
private handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
this.props.onChange(this.props.id, e.target.value === 'true');
|
this.props.onChange(this.props.id, e.target.value === 'true');
|
||||||
}
|
};
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
let helpText;
|
let helpText;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export default class ClusterSettings extends AdminSettings {
|
|||||||
config.ClusterSettings.GossipPort = this.parseIntNonZero(this.state.GossipPort, 8074);
|
config.ClusterSettings.GossipPort = this.parseIntNonZero(this.state.GossipPort, 8074);
|
||||||
config.ClusterSettings.StreamingPort = this.parseIntNonZero(this.state.StreamingPort, 8075);
|
config.ClusterSettings.StreamingPort = this.parseIntNonZero(this.state.StreamingPort, 8075);
|
||||||
return config;
|
return config;
|
||||||
}
|
};
|
||||||
|
|
||||||
getStateFromConfig(config) {
|
getStateFromConfig(config) {
|
||||||
const settings = config.ClusterSettings;
|
const settings = config.ClusterSettings;
|
||||||
@@ -62,7 +62,7 @@ export default class ClusterSettings extends AdminSettings {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.handleChange(id, value);
|
this.handleChange(id, value);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderSettings = () => {
|
renderSettings = () => {
|
||||||
const licenseEnabled = this.props.license.IsLicensed === 'true' && this.props.license.Cluster === 'true';
|
const licenseEnabled = this.props.license.IsLicensed === 'true' && this.props.license.Cluster === 'true';
|
||||||
@@ -309,7 +309,7 @@ export default class ClusterSettings extends AdminSettings {
|
|||||||
/>
|
/>
|
||||||
</SettingsGroup>
|
</SettingsGroup>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const style = {
|
const style = {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export default class ClusterTable extends React.PureComponent {
|
|||||||
static propTypes = {
|
static propTypes = {
|
||||||
clusterInfos: PropTypes.array.isRequired,
|
clusterInfos: PropTypes.array.isRequired,
|
||||||
reload: PropTypes.func.isRequired,
|
reload: PropTypes.func.isRequired,
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
var versionMismatch = (
|
var versionMismatch = (
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export default class ClusterTableContainer extends React.PureComponent {
|
|||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.load();
|
this.load();
|
||||||
@@ -53,7 +53,7 @@ export default class ClusterTableContainer extends React.PureComponent {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.load();
|
this.load();
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (this.state.clusterInfos == null) {
|
if (this.state.clusterInfos == null) {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export default class ColorSetting extends React.PureComponent<Props> {
|
|||||||
if (this.props.onChange) {
|
if (this.props.onChange) {
|
||||||
this.props.onChange(this.props.id, color);
|
this.props.onChange(this.props.id, color);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ export default class ComplianceReports extends React.PureComponent<Props, State>
|
|||||||
this.props.actions.getComplianceReports().then(
|
this.props.actions.getComplianceReports().then(
|
||||||
() => this.setState({loadingReports: false}),
|
() => this.setState({loadingReports: false}),
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
runReport = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
runReport = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -131,7 +131,7 @@ export default class ComplianceReports extends React.PureComponent<Props, State>
|
|||||||
this.props.actions.getComplianceReports();
|
this.props.actions.getComplianceReports();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
getDateTime(millis: number) {
|
getDateTime(millis: number) {
|
||||||
const date = new Date(millis);
|
const date = new Date(millis);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export default class CustomTermsOfServiceSettings extends AdminSettings<Props, S
|
|||||||
config.SupportSettings.CustomTermsOfServiceReAcceptancePeriod = this.parseIntNonZero(String(this.state.reAcceptancePeriod), Constants.DEFAULT_TERMS_OF_SERVICE_RE_ACCEPTANCE_PERIOD);
|
config.SupportSettings.CustomTermsOfServiceReAcceptancePeriod = this.parseIntNonZero(String(this.state.reAcceptancePeriod), Constants.DEFAULT_TERMS_OF_SERVICE_RE_ACCEPTANCE_PERIOD);
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.getTermsOfService();
|
this.getTermsOfService();
|
||||||
@@ -244,5 +244,5 @@ export default class CustomTermsOfServiceSettings extends AdminSettings<Props, S
|
|||||||
/>
|
/>
|
||||||
</SettingsGroup>
|
</SettingsGroup>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class DataGrid extends React.PureComponent<Props, State> {
|
|||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
term: '',
|
term: '',
|
||||||
searchPlaceholder: '',
|
searchPlaceholder: '',
|
||||||
}
|
};
|
||||||
|
|
||||||
public constructor(props: Props) {
|
public constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
@@ -134,7 +134,7 @@ class DataGrid extends React.PureComponent<Props, State> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.setState({visibleColumns});
|
this.setState({visibleColumns});
|
||||||
}
|
};
|
||||||
|
|
||||||
private renderRows(): JSX.Element {
|
private renderRows(): JSX.Element {
|
||||||
const {rows, rowsContainerStyles} = this.props;
|
const {rows, rowsContainerStyles} = this.props;
|
||||||
@@ -219,19 +219,19 @@ class DataGrid extends React.PureComponent<Props, State> {
|
|||||||
if (!this.props.loading) {
|
if (!this.props.loading) {
|
||||||
this.props.nextPage();
|
this.props.nextPage();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
private previousPage = () => {
|
private previousPage = () => {
|
||||||
if (!this.props.loading) {
|
if (!this.props.loading) {
|
||||||
this.props.previousPage();
|
this.props.previousPage();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
private search = (term: string) => {
|
private search = (term: string) => {
|
||||||
if (this.props.onSearch) {
|
if (this.props.onSearch) {
|
||||||
this.props.onSearch(term);
|
this.props.onSearch(term);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
private renderFooter = (): JSX.Element | null => {
|
private renderFooter = (): JSX.Element | null => {
|
||||||
const {startCount, endCount, total} = this.props;
|
const {startCount, endCount, total} = this.props;
|
||||||
@@ -286,7 +286,7 @@ class DataGrid extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return footer;
|
return footer;
|
||||||
}
|
};
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class DataGridSearch extends React.PureComponent<Props, State> {
|
|||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
placeholder: '',
|
placeholder: '',
|
||||||
term: '',
|
term: '',
|
||||||
}
|
};
|
||||||
|
|
||||||
public constructor(props: Props) {
|
public constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
@@ -46,7 +46,7 @@ class DataGridSearch extends React.PureComponent<Props, State> {
|
|||||||
const term = e.target.value;
|
const term = e.target.value;
|
||||||
this.setState({term});
|
this.setState({term});
|
||||||
this.props.onSearch(term);
|
this.props.onSearch(term);
|
||||||
}
|
};
|
||||||
|
|
||||||
resetSearch = () => {
|
resetSearch = () => {
|
||||||
this.props.onSearch('');
|
this.props.onSearch('');
|
||||||
|
|||||||
@@ -58,14 +58,14 @@ export default class ChannelList extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
componentDidMount = () => {
|
componentDidMount = () => {
|
||||||
this.loadPage(0, PAGE_SIZE * 2);
|
this.loadPage(0, PAGE_SIZE * 2);
|
||||||
}
|
};
|
||||||
|
|
||||||
private setStateLoading = (loading: boolean) => {
|
private setStateLoading = (loading: boolean) => {
|
||||||
this.setState({loading});
|
this.setState({loading});
|
||||||
}
|
};
|
||||||
private setStatePage = (page: number) => {
|
private setStatePage = (page: number) => {
|
||||||
this.setState({page});
|
this.setState({page});
|
||||||
}
|
};
|
||||||
|
|
||||||
private loadPage = async (page: number, pageSize = PAGE_SIZE) => {
|
private loadPage = async (page: number, pageSize = PAGE_SIZE) => {
|
||||||
if (this.props.policyId) {
|
if (this.props.policyId) {
|
||||||
@@ -73,26 +73,26 @@ export default class ChannelList extends React.PureComponent<Props, State> {
|
|||||||
await this.props.actions.getDataRetentionCustomPolicyChannels(this.props.policyId, page, pageSize);
|
await this.props.actions.getDataRetentionCustomPolicyChannels(this.props.policyId, page, pageSize);
|
||||||
this.setStateLoading(false);
|
this.setStateLoading(false);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
private nextPage = () => {
|
private nextPage = () => {
|
||||||
const page = this.state.page + 1;
|
const page = this.state.page + 1;
|
||||||
this.loadPage(page + 1);
|
this.loadPage(page + 1);
|
||||||
this.setStatePage(page);
|
this.setStatePage(page);
|
||||||
}
|
};
|
||||||
|
|
||||||
private previousPage = () => {
|
private previousPage = () => {
|
||||||
const page = this.state.page - 1;
|
const page = this.state.page - 1;
|
||||||
this.loadPage(page + 1);
|
this.loadPage(page + 1);
|
||||||
this.setStatePage(page);
|
this.setStatePage(page);
|
||||||
}
|
};
|
||||||
|
|
||||||
private getVisibleTotalCount = (): number => {
|
private getVisibleTotalCount = (): number => {
|
||||||
const {channelsToAdd, channelsToRemove, totalCount} = this.props;
|
const {channelsToAdd, channelsToRemove, totalCount} = this.props;
|
||||||
const channelsToAddCount = Object.keys(channelsToAdd).length;
|
const channelsToAddCount = Object.keys(channelsToAdd).length;
|
||||||
const channelsToRemoveCount = Object.keys(channelsToRemove).length;
|
const channelsToRemoveCount = Object.keys(channelsToRemove).length;
|
||||||
return totalCount + (channelsToAddCount - channelsToRemoveCount);
|
return totalCount + (channelsToAddCount - channelsToRemoveCount);
|
||||||
}
|
};
|
||||||
|
|
||||||
public getPaginationProps = (): {startCount: number; endCount: number; total: number} => {
|
public getPaginationProps = (): {startCount: number; endCount: number; total: number} => {
|
||||||
const {page} = this.state;
|
const {page} = this.state;
|
||||||
@@ -105,7 +105,7 @@ export default class ChannelList extends React.PureComponent<Props, State> {
|
|||||||
endCount = endCount > total ? total : endCount;
|
endCount = endCount > total ? total : endCount;
|
||||||
|
|
||||||
return {startCount, endCount, total};
|
return {startCount, endCount, total};
|
||||||
}
|
};
|
||||||
|
|
||||||
private removeChannel = (channel: ChannelWithTeamData) => {
|
private removeChannel = (channel: ChannelWithTeamData) => {
|
||||||
const {channelsToRemove} = this.props;
|
const {channelsToRemove} = this.props;
|
||||||
@@ -122,7 +122,7 @@ export default class ChannelList extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setStatePage(page);
|
this.setStatePage(page);
|
||||||
}
|
};
|
||||||
|
|
||||||
getColumns = (): Column[] => {
|
getColumns = (): Column[] => {
|
||||||
const name = (
|
const name = (
|
||||||
@@ -157,7 +157,7 @@ export default class ChannelList extends React.PureComponent<Props, State> {
|
|||||||
fixed: true,
|
fixed: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
};
|
||||||
|
|
||||||
getRows = () => {
|
getRows = () => {
|
||||||
const {page} = this.state;
|
const {page} = this.state;
|
||||||
@@ -235,11 +235,11 @@ export default class ChannelList extends React.PureComponent<Props, State> {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
onSearch = async (searchTerm: string) => {
|
onSearch = async (searchTerm: string) => {
|
||||||
this.props.actions.setChannelListSearch(searchTerm);
|
this.props.actions.setChannelListSearch(searchTerm);
|
||||||
}
|
};
|
||||||
public async componentDidUpdate(prevProps: Props) {
|
public async componentDidUpdate(prevProps: Props) {
|
||||||
const {policyId, searchTerm, filters} = this.props;
|
const {policyId, searchTerm, filters} = this.props;
|
||||||
const filtersModified = !isEqual(prevProps.filters, this.props.filters);
|
const filtersModified = !isEqual(prevProps.filters, this.props.filters);
|
||||||
@@ -284,7 +284,7 @@ export default class ChannelList extends React.PureComponent<Props, State> {
|
|||||||
filters.team_ids = teamIds.value as string[];
|
filters.team_ids = teamIds.value as string[];
|
||||||
}
|
}
|
||||||
this.props.actions.setChannelListFilters(filters);
|
this.props.actions.setChannelListFilters(filters);
|
||||||
}
|
};
|
||||||
render() {
|
render() {
|
||||||
const rows: Row[] = this.getRows();
|
const rows: Row[] = this.getRows();
|
||||||
const columns: Column[] = this.getColumns();
|
const columns: Column[] = this.getColumns();
|
||||||
|
|||||||
@@ -93,19 +93,19 @@ export default class CustomPolicyForm extends React.PureComponent<Props, State>
|
|||||||
|
|
||||||
openAddChannel = () => {
|
openAddChannel = () => {
|
||||||
this.setState({addChannelOpen: true});
|
this.setState({addChannelOpen: true});
|
||||||
}
|
};
|
||||||
|
|
||||||
closeAddChannel = () => {
|
closeAddChannel = () => {
|
||||||
this.setState({addChannelOpen: false});
|
this.setState({addChannelOpen: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
openAddTeam = () => {
|
openAddTeam = () => {
|
||||||
this.setState({addTeamOpen: true});
|
this.setState({addTeamOpen: true});
|
||||||
}
|
};
|
||||||
|
|
||||||
closeAddTeam = () => {
|
closeAddTeam = () => {
|
||||||
this.setState({addTeamOpen: false});
|
this.setState({addTeamOpen: false});
|
||||||
}
|
};
|
||||||
getMessageRetentionDefaultInputValue = (): string => {
|
getMessageRetentionDefaultInputValue = (): string => {
|
||||||
if (!this.props.policy || Object.keys(this.props.policy).length === 0 || (this.props.policy && this.props.policy.post_duration === -1)) {
|
if (!this.props.policy || Object.keys(this.props.policy).length === 0 || (this.props.policy && this.props.policy.post_duration === -1)) {
|
||||||
return '';
|
return '';
|
||||||
@@ -114,7 +114,7 @@ export default class CustomPolicyForm extends React.PureComponent<Props, State>
|
|||||||
return (this.props.policy.post_duration / 365).toString();
|
return (this.props.policy.post_duration / 365).toString();
|
||||||
}
|
}
|
||||||
return this.props.policy.post_duration.toString();
|
return this.props.policy.post_duration.toString();
|
||||||
}
|
};
|
||||||
getMessageRetentionDefaultDropdownValue = () => {
|
getMessageRetentionDefaultDropdownValue = () => {
|
||||||
if (!this.props.policyId || (this.props.policy && this.props.policy.post_duration === -1)) {
|
if (!this.props.policyId || (this.props.policy && this.props.policy.post_duration === -1)) {
|
||||||
return keepForeverOption();
|
return keepForeverOption();
|
||||||
@@ -123,11 +123,11 @@ export default class CustomPolicyForm extends React.PureComponent<Props, State>
|
|||||||
return yearsOption();
|
return yearsOption();
|
||||||
}
|
}
|
||||||
return daysOption();
|
return daysOption();
|
||||||
}
|
};
|
||||||
|
|
||||||
componentDidMount = async () => {
|
componentDidMount = async () => {
|
||||||
this.loadPage();
|
this.loadPage();
|
||||||
}
|
};
|
||||||
private loadPage = async () => {
|
private loadPage = async () => {
|
||||||
if (this.props.policyId) {
|
if (this.props.policyId) {
|
||||||
await this.props.actions.fetchPolicy(this.props.policyId);
|
await this.props.actions.fetchPolicy(this.props.policyId);
|
||||||
@@ -137,7 +137,7 @@ export default class CustomPolicyForm extends React.PureComponent<Props, State>
|
|||||||
messageRetentionDropdownValue: this.getMessageRetentionDefaultDropdownValue(),
|
messageRetentionDropdownValue: this.getMessageRetentionDefaultDropdownValue(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
addToNewTeams = (teams: Team[]) => {
|
addToNewTeams = (teams: Team[]) => {
|
||||||
let {removedTeamsCount} = this.state;
|
let {removedTeamsCount} = this.state;
|
||||||
@@ -152,7 +152,7 @@ export default class CustomPolicyForm extends React.PureComponent<Props, State>
|
|||||||
});
|
});
|
||||||
this.setState({newTeams: {...newTeams}, removedTeams: {...removedTeams}, removedTeamsCount, saveNeeded: true});
|
this.setState({newTeams: {...newTeams}, removedTeams: {...removedTeams}, removedTeamsCount, saveNeeded: true});
|
||||||
this.props.actions.setNavigationBlocked(true);
|
this.props.actions.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
addToRemovedTeams = (team: Team) => {
|
addToRemovedTeams = (team: Team) => {
|
||||||
let {removedTeamsCount} = this.state;
|
let {removedTeamsCount} = this.state;
|
||||||
@@ -165,7 +165,7 @@ export default class CustomPolicyForm extends React.PureComponent<Props, State>
|
|||||||
}
|
}
|
||||||
this.setState({removedTeams: {...removedTeams}, newTeams: {...newTeams}, removedTeamsCount, saveNeeded: true});
|
this.setState({removedTeams: {...removedTeams}, newTeams: {...newTeams}, removedTeamsCount, saveNeeded: true});
|
||||||
this.props.actions.setNavigationBlocked(true);
|
this.props.actions.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
addToNewChannels = (channels: ChannelWithTeamData[]) => {
|
addToNewChannels = (channels: ChannelWithTeamData[]) => {
|
||||||
let {removedChannelsCount} = this.state;
|
let {removedChannelsCount} = this.state;
|
||||||
@@ -180,7 +180,7 @@ export default class CustomPolicyForm extends React.PureComponent<Props, State>
|
|||||||
});
|
});
|
||||||
this.setState({newChannels: {...newChannels}, removedChannels: {...removedChannels}, removedChannelsCount, saveNeeded: true});
|
this.setState({newChannels: {...newChannels}, removedChannels: {...removedChannels}, removedChannelsCount, saveNeeded: true});
|
||||||
this.props.actions.setNavigationBlocked(true);
|
this.props.actions.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
addToRemovedChannels = (channel: ChannelWithTeamData) => {
|
addToRemovedChannels = (channel: ChannelWithTeamData) => {
|
||||||
let {removedChannelsCount} = this.state;
|
let {removedChannelsCount} = this.state;
|
||||||
@@ -193,7 +193,7 @@ export default class CustomPolicyForm extends React.PureComponent<Props, State>
|
|||||||
}
|
}
|
||||||
this.setState({removedChannels: {...removedChannels}, newChannels: {...newChannels}, removedChannelsCount, saveNeeded: true});
|
this.setState({removedChannels: {...removedChannels}, newChannels: {...newChannels}, removedChannelsCount, saveNeeded: true});
|
||||||
this.props.actions.setNavigationBlocked(true);
|
this.props.actions.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
getTeamsToExclude = () => {
|
getTeamsToExclude = () => {
|
||||||
const {teams} = this.props;
|
const {teams} = this.props;
|
||||||
@@ -210,7 +210,7 @@ export default class CustomPolicyForm extends React.PureComponent<Props, State>
|
|||||||
teamsToDisplay = [...includeTeamsList, ...teamsToDisplay];
|
teamsToDisplay = [...includeTeamsList, ...teamsToDisplay];
|
||||||
}
|
}
|
||||||
return teamsToDisplay;
|
return teamsToDisplay;
|
||||||
}
|
};
|
||||||
handleSubmit = async () => {
|
handleSubmit = async () => {
|
||||||
const {policyName, messageRetentionInputValue, messageRetentionDropdownValue, newTeams, removedTeams, newChannels, removedChannels} = this.state;
|
const {policyName, messageRetentionInputValue, messageRetentionDropdownValue, newTeams, removedTeams, newChannels, removedChannels} = this.state;
|
||||||
const {policyId, policy} = this.props;
|
const {policyId, policy} = this.props;
|
||||||
@@ -302,7 +302,7 @@ export default class CustomPolicyForm extends React.PureComponent<Props, State>
|
|||||||
this.props.actions.setNavigationBlocked(false);
|
this.props.actions.setNavigationBlocked(false);
|
||||||
getHistory().push('/admin_console/compliance/data_retention_settings');
|
getHistory().push('/admin_console/compliance/data_retention_settings');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
render = () => {
|
render = () => {
|
||||||
const {serverError, formErrorText} = this.state;
|
const {serverError, formErrorText} = this.state;
|
||||||
@@ -531,5 +531,5 @@ export default class CustomPolicyForm extends React.PureComponent<Props, State>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,9 +65,9 @@ export default class DataRetentionSettings extends React.PureComponent<Props, St
|
|||||||
deleteCustomPolicy = async (id: string) => {
|
deleteCustomPolicy = async (id: string) => {
|
||||||
await this.props.actions.deleteDataRetentionCustomPolicy(id);
|
await this.props.actions.deleteDataRetentionCustomPolicy(id);
|
||||||
this.loadPage(0);
|
this.loadPage(0);
|
||||||
}
|
};
|
||||||
|
|
||||||
includeBoards = this.props.config.PluginSettings?.PluginStates?.focalboard?.Enable && this.props.config.FeatureFlags?.BoardsDataRetention
|
includeBoards = this.props.config.PluginSettings?.PluginStates?.focalboard?.Enable && this.props.config.FeatureFlags?.BoardsDataRetention;
|
||||||
getGlobalPolicyColumns = (): Column[] => {
|
getGlobalPolicyColumns = (): Column[] => {
|
||||||
const columns: Column[] = [
|
const columns: Column[] = [
|
||||||
{
|
{
|
||||||
@@ -119,7 +119,7 @@ export default class DataRetentionSettings extends React.PureComponent<Props, St
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
return columns;
|
return columns;
|
||||||
}
|
};
|
||||||
getCustomPolicyColumns = (): Column[] => {
|
getCustomPolicyColumns = (): Column[] => {
|
||||||
const columns: Column[] = [
|
const columns: Column[] = [
|
||||||
{
|
{
|
||||||
@@ -156,7 +156,7 @@ export default class DataRetentionSettings extends React.PureComponent<Props, St
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
return columns;
|
return columns;
|
||||||
}
|
};
|
||||||
getMessageRetentionSetting = (enabled: boolean | undefined, days: number | undefined): JSX.Element => {
|
getMessageRetentionSetting = (enabled: boolean | undefined, days: number | undefined): JSX.Element => {
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
return (
|
return (
|
||||||
@@ -187,7 +187,7 @@ export default class DataRetentionSettings extends React.PureComponent<Props, St
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
getGlobalPolicyRows = (): Row[] => {
|
getGlobalPolicyRows = (): Row[] => {
|
||||||
const {DataRetentionSettings} = this.props.config;
|
const {DataRetentionSettings} = this.props.config;
|
||||||
return [{
|
return [{
|
||||||
@@ -240,7 +240,7 @@ export default class DataRetentionSettings extends React.PureComponent<Props, St
|
|||||||
getHistory().push('/admin_console/compliance/data_retention_settings/global_policy');
|
getHistory().push('/admin_console/compliance/data_retention_settings/global_policy');
|
||||||
},
|
},
|
||||||
}];
|
}];
|
||||||
}
|
};
|
||||||
getChannelAndTeamCounts = (policy: DataRetentionCustomPolicy): JSX.Element => {
|
getChannelAndTeamCounts = (policy: DataRetentionCustomPolicy): JSX.Element => {
|
||||||
if (policy.channel_count === 0 && policy.team_count === 0) {
|
if (policy.channel_count === 0 && policy.team_count === 0) {
|
||||||
return (
|
return (
|
||||||
@@ -260,7 +260,7 @@ export default class DataRetentionSettings extends React.PureComponent<Props, St
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
getCustomPolicyRows = (startCount: number, endCount: number): Row[] => {
|
getCustomPolicyRows = (startCount: number, endCount: number): Row[] => {
|
||||||
let policies = Object.values(this.props.customPolicies);
|
let policies = Object.values(this.props.customPolicies);
|
||||||
policies = policies.slice(startCount - 1, endCount);
|
policies = policies.slice(startCount - 1, endCount);
|
||||||
@@ -333,18 +333,18 @@ export default class DataRetentionSettings extends React.PureComponent<Props, St
|
|||||||
this.setState({customPoliciesLoading: true});
|
this.setState({customPoliciesLoading: true});
|
||||||
await this.props.actions.getDataRetentionCustomPolicies(page);
|
await this.props.actions.getDataRetentionCustomPolicies(page);
|
||||||
this.setState({page, customPoliciesLoading: false});
|
this.setState({page, customPoliciesLoading: false});
|
||||||
}
|
};
|
||||||
componentDidMount = async () => {
|
componentDidMount = async () => {
|
||||||
await this.loadPage(this.state.page);
|
await this.loadPage(this.state.page);
|
||||||
}
|
};
|
||||||
|
|
||||||
private nextPage = () => {
|
private nextPage = () => {
|
||||||
this.loadPage(this.state.page + 1);
|
this.loadPage(this.state.page + 1);
|
||||||
}
|
};
|
||||||
|
|
||||||
private previousPage = () => {
|
private previousPage = () => {
|
||||||
this.loadPage(this.state.page - 1);
|
this.loadPage(this.state.page - 1);
|
||||||
}
|
};
|
||||||
|
|
||||||
public getPaginationProps = (): {startCount: number; endCount: number; total: number} => {
|
public getPaginationProps = (): {startCount: number; endCount: number; total: number} => {
|
||||||
const {page} = this.state;
|
const {page} = this.state;
|
||||||
@@ -354,17 +354,17 @@ export default class DataRetentionSettings extends React.PureComponent<Props, St
|
|||||||
endCount = endCount > total ? total : endCount;
|
endCount = endCount > total ? total : endCount;
|
||||||
|
|
||||||
return {startCount, endCount, total};
|
return {startCount, endCount, total};
|
||||||
}
|
};
|
||||||
|
|
||||||
showEditJobTime = (value: boolean) => {
|
showEditJobTime = (value: boolean) => {
|
||||||
this.setState({showEditJobTime: value});
|
this.setState({showEditJobTime: value});
|
||||||
}
|
};
|
||||||
|
|
||||||
componentDidUpdate = (prevProps: Props, prevState: State) => {
|
componentDidUpdate = (prevProps: Props, prevState: State) => {
|
||||||
if (prevState.showEditJobTime !== this.state.showEditJobTime && this.state.showEditJobTime) {
|
if (prevState.showEditJobTime !== this.state.showEditJobTime && this.state.showEditJobTime) {
|
||||||
this.inputRef.current?.focus();
|
this.inputRef.current?.focus();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
handleCreateJob = async (e?: React.SyntheticEvent) => {
|
handleCreateJob = async (e?: React.SyntheticEvent) => {
|
||||||
e?.preventDefault();
|
e?.preventDefault();
|
||||||
@@ -382,7 +382,7 @@ export default class DataRetentionSettings extends React.PureComponent<Props, St
|
|||||||
|
|
||||||
await this.props.actions.updateConfig(newConfig);
|
await this.props.actions.updateConfig(newConfig);
|
||||||
this.inputRef.current?.blur();
|
this.inputRef.current?.blur();
|
||||||
}
|
};
|
||||||
|
|
||||||
getJobStartTime = (): JSX.Element | null => {
|
getJobStartTime = (): JSX.Element | null => {
|
||||||
const {DataRetentionSettings} = this.props.config;
|
const {DataRetentionSettings} = this.props.config;
|
||||||
@@ -417,7 +417,7 @@ export default class DataRetentionSettings extends React.PureComponent<Props, St
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
getJobTimeOptions = () => {
|
getJobTimeOptions = () => {
|
||||||
const options: OptionType[] = [];
|
const options: OptionType[] = [];
|
||||||
return () => {
|
return () => {
|
||||||
@@ -445,7 +445,7 @@ export default class DataRetentionSettings extends React.PureComponent<Props, St
|
|||||||
|
|
||||||
return options;
|
return options;
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
getJobTimes = this.getJobTimeOptions();
|
getJobTimes = this.getJobTimeOptions();
|
||||||
|
|
||||||
render = () => {
|
render = () => {
|
||||||
@@ -653,5 +653,5 @@ export default class DataRetentionSettings extends React.PureComponent<Props, St
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export default class GlobalPolicyForm extends React.PureComponent<Props, State>
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
includeBoards = this.props.config.PluginSettings?.PluginStates?.focalboard?.Enable && this.props.config.FeatureFlags?.BoardsDataRetention
|
includeBoards = this.props.config.PluginSettings?.PluginStates?.focalboard?.Enable && this.props.config.FeatureFlags?.BoardsDataRetention;
|
||||||
|
|
||||||
getDefaultInputValue = (isEnabled: boolean | undefined, days: number | undefined): string => {
|
getDefaultInputValue = (isEnabled: boolean | undefined, days: number | undefined): string => {
|
||||||
if (!isEnabled || days === undefined) {
|
if (!isEnabled || days === undefined) {
|
||||||
@@ -70,7 +70,7 @@ export default class GlobalPolicyForm extends React.PureComponent<Props, State>
|
|||||||
return (days / 365).toString();
|
return (days / 365).toString();
|
||||||
}
|
}
|
||||||
return days.toString();
|
return days.toString();
|
||||||
}
|
};
|
||||||
getDefaultDropdownValue = (isEnabled: boolean | undefined, days: number | undefined) => {
|
getDefaultDropdownValue = (isEnabled: boolean | undefined, days: number | undefined) => {
|
||||||
if (!isEnabled || days === undefined) {
|
if (!isEnabled || days === undefined) {
|
||||||
return keepForeverOption();
|
return keepForeverOption();
|
||||||
@@ -79,7 +79,7 @@ export default class GlobalPolicyForm extends React.PureComponent<Props, State>
|
|||||||
return yearsOption();
|
return yearsOption();
|
||||||
}
|
}
|
||||||
return daysOption();
|
return daysOption();
|
||||||
}
|
};
|
||||||
|
|
||||||
handleSubmit = async () => {
|
handleSubmit = async () => {
|
||||||
const {messageRetentionDropdownValue, messageRetentionInputValue, fileRetentionDropdownValue, fileRetentionInputValue, boardsRetentionDropdownValue, boardsRetentionInputValue} = this.state;
|
const {messageRetentionDropdownValue, messageRetentionInputValue, fileRetentionDropdownValue, fileRetentionInputValue, boardsRetentionDropdownValue, boardsRetentionInputValue} = this.state;
|
||||||
@@ -128,7 +128,7 @@ export default class GlobalPolicyForm extends React.PureComponent<Props, State>
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
|
|
||||||
setRetentionDays = (dropdownValue: string, value: string): number => {
|
setRetentionDays = (dropdownValue: string, value: string): number => {
|
||||||
if (dropdownValue === YEARS) {
|
if (dropdownValue === YEARS) {
|
||||||
@@ -140,7 +140,7 @@ export default class GlobalPolicyForm extends React.PureComponent<Props, State>
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
};
|
||||||
|
|
||||||
render = () => {
|
render = () => {
|
||||||
return (
|
return (
|
||||||
@@ -290,5 +290,5 @@ export default class GlobalPolicyForm extends React.PureComponent<Props, State>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,14 +52,14 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
componentDidMount = () => {
|
componentDidMount = () => {
|
||||||
this.loadPage(0, PAGE_SIZE * 2);
|
this.loadPage(0, PAGE_SIZE * 2);
|
||||||
}
|
};
|
||||||
|
|
||||||
private setStateLoading = (loading: boolean) => {
|
private setStateLoading = (loading: boolean) => {
|
||||||
this.setState({loading});
|
this.setState({loading});
|
||||||
}
|
};
|
||||||
private setStatePage = (page: number) => {
|
private setStatePage = (page: number) => {
|
||||||
this.setState({page});
|
this.setState({page});
|
||||||
}
|
};
|
||||||
|
|
||||||
private loadPage = async (page: number, pageSize = PAGE_SIZE) => {
|
private loadPage = async (page: number, pageSize = PAGE_SIZE) => {
|
||||||
if (this.props.policyId) {
|
if (this.props.policyId) {
|
||||||
@@ -67,26 +67,26 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
await this.props.actions.getDataRetentionCustomPolicyTeams(this.props.policyId, page, pageSize);
|
await this.props.actions.getDataRetentionCustomPolicyTeams(this.props.policyId, page, pageSize);
|
||||||
this.setStateLoading(false);
|
this.setStateLoading(false);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
private nextPage = () => {
|
private nextPage = () => {
|
||||||
const page = this.state.page + 1;
|
const page = this.state.page + 1;
|
||||||
this.loadPage(page + 1);
|
this.loadPage(page + 1);
|
||||||
this.setStatePage(page);
|
this.setStatePage(page);
|
||||||
}
|
};
|
||||||
|
|
||||||
private previousPage = () => {
|
private previousPage = () => {
|
||||||
const page = this.state.page - 1;
|
const page = this.state.page - 1;
|
||||||
this.loadPage(page + 1);
|
this.loadPage(page + 1);
|
||||||
this.setStatePage(page);
|
this.setStatePage(page);
|
||||||
}
|
};
|
||||||
|
|
||||||
private getVisibleTotalCount = (): number => {
|
private getVisibleTotalCount = (): number => {
|
||||||
const {teamsToAdd, teamsToRemove, totalCount} = this.props;
|
const {teamsToAdd, teamsToRemove, totalCount} = this.props;
|
||||||
const teamsToAddCount = Object.keys(teamsToAdd).length;
|
const teamsToAddCount = Object.keys(teamsToAdd).length;
|
||||||
const teamsToRemoveCount = Object.keys(teamsToRemove).length;
|
const teamsToRemoveCount = Object.keys(teamsToRemove).length;
|
||||||
return totalCount + (teamsToAddCount - teamsToRemoveCount);
|
return totalCount + (teamsToAddCount - teamsToRemoveCount);
|
||||||
}
|
};
|
||||||
|
|
||||||
public getPaginationProps = (): {startCount: number; endCount: number; total: number} => {
|
public getPaginationProps = (): {startCount: number; endCount: number; total: number} => {
|
||||||
const {page} = this.state;
|
const {page} = this.state;
|
||||||
@@ -98,7 +98,7 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
endCount = endCount > total ? total : endCount;
|
endCount = endCount > total ? total : endCount;
|
||||||
|
|
||||||
return {startCount, endCount, total};
|
return {startCount, endCount, total};
|
||||||
}
|
};
|
||||||
|
|
||||||
private removeTeam = (team: Team) => {
|
private removeTeam = (team: Team) => {
|
||||||
const {teamsToRemove} = this.props;
|
const {teamsToRemove} = this.props;
|
||||||
@@ -115,7 +115,7 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setStatePage(page);
|
this.setStatePage(page);
|
||||||
}
|
};
|
||||||
|
|
||||||
getColumns = (): Column[] => {
|
getColumns = (): Column[] => {
|
||||||
const name = (
|
const name = (
|
||||||
@@ -139,7 +139,7 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
className: 'TeamList__actionColumn',
|
className: 'TeamList__actionColumn',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
};
|
||||||
|
|
||||||
getRows = () => {
|
getRows = () => {
|
||||||
const {page} = this.state;
|
const {page} = this.state;
|
||||||
@@ -203,11 +203,11 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
onSearch = async (searchTerm: string) => {
|
onSearch = async (searchTerm: string) => {
|
||||||
this.props.actions.setTeamListSearch(searchTerm);
|
this.props.actions.setTeamListSearch(searchTerm);
|
||||||
}
|
};
|
||||||
public async componentDidUpdate(prevProps: Props) {
|
public async componentDidUpdate(prevProps: Props) {
|
||||||
const {searchTerm} = this.props;
|
const {searchTerm} = this.props;
|
||||||
const searchTermModified = prevProps.searchTerm !== this.props.searchTerm;
|
const searchTermModified = prevProps.searchTerm !== this.props.searchTerm;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export default class DatabaseSettings extends AdminSettings {
|
|||||||
config.ServiceSettings.MinimumHashtagLength = this.parseIntNonZero(this.state.minimumHashtagLength, 3, 2);
|
config.ServiceSettings.MinimumHashtagLength = this.parseIntNonZero(this.state.minimumHashtagLength, 3, 2);
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
};
|
||||||
|
|
||||||
getStateFromConfig(config) {
|
getStateFromConfig(config) {
|
||||||
return {
|
return {
|
||||||
@@ -370,5 +370,5 @@ export default class DatabaseSettings extends AdminSettings {
|
|||||||
</div>
|
</div>
|
||||||
</SettingsGroup>
|
</SettingsGroup>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,15 +16,15 @@ export default class DropdownSetting extends React.PureComponent {
|
|||||||
disabled: PropTypes.bool,
|
disabled: PropTypes.bool,
|
||||||
setByEnv: PropTypes.bool.isRequired,
|
setByEnv: PropTypes.bool.isRequired,
|
||||||
helpText: PropTypes.node,
|
helpText: PropTypes.node,
|
||||||
}
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
isDisabled: false,
|
isDisabled: false,
|
||||||
}
|
};
|
||||||
|
|
||||||
handleChange = (e) => {
|
handleChange = (e) => {
|
||||||
this.props.onChange(this.props.id, e.target.value);
|
this.props.onChange(this.props.id, e.target.value);
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const options = [];
|
const options = [];
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export default class ElasticsearchSettings extends AdminSettings {
|
|||||||
config.ElasticsearchSettings.EnableAutocomplete = this.state.enableAutocomplete;
|
config.ElasticsearchSettings.EnableAutocomplete = this.state.enableAutocomplete;
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
};
|
||||||
|
|
||||||
getStateFromConfig(config) {
|
getStateFromConfig(config) {
|
||||||
return {
|
return {
|
||||||
@@ -83,17 +83,17 @@ export default class ElasticsearchSettings extends AdminSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.handleChange(id, value);
|
this.handleChange(id, value);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleSaved = () => {
|
handleSaved = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
canPurgeAndIndex: this.state.enableIndexing,
|
canPurgeAndIndex: this.state.enableIndexing,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
canSave = () => {
|
canSave = () => {
|
||||||
return this.state.canSave;
|
return this.state.canSave;
|
||||||
}
|
};
|
||||||
|
|
||||||
doTestConfig = (success, error) => {
|
doTestConfig = (success, error) => {
|
||||||
const config = JSON.parse(JSON.stringify(this.props.config));
|
const config = JSON.parse(JSON.stringify(this.props.config));
|
||||||
@@ -116,7 +116,7 @@ export default class ElasticsearchSettings extends AdminSettings {
|
|||||||
error(err);
|
error(err);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
getExtraInfo(job) {
|
getExtraInfo(job) {
|
||||||
if (job.status === JobStatuses.IN_PROGRESS) {
|
if (job.status === JobStatuses.IN_PROGRESS) {
|
||||||
@@ -470,5 +470,5 @@ export default class ElasticsearchSettings extends AdminSettings {
|
|||||||
/>
|
/>
|
||||||
</SettingsGroup>
|
</SettingsGroup>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ export default class FeatureDiscovery extends React.PureComponent<Props, State>
|
|||||||
callerCTA: 'feature_discovery_subscribe_button',
|
callerCTA: 'feature_discovery_subscribe_button',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
contactSalesFunc = () => {
|
contactSalesFunc = () => {
|
||||||
const {customer, isCloud} = this.props;
|
const {customer, isCloud} = this.props;
|
||||||
@@ -107,7 +107,7 @@ export default class FeatureDiscovery extends React.PureComponent<Props, State>
|
|||||||
const companyName = customer?.name || '';
|
const companyName = customer?.name || '';
|
||||||
const utmMedium = isCloud ? 'in-product-cloud' : 'in-product';
|
const utmMedium = isCloud ? 'in-product-cloud' : 'in-product';
|
||||||
goToMattermostContactSalesForm(firstName, lastName, companyName, customerEmail, 'mattermost', utmMedium);
|
goToMattermostContactSalesForm(firstName, lastName, companyName, customerEmail, 'mattermost', utmMedium);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderPostTrialCta = () => {
|
renderPostTrialCta = () => {
|
||||||
const {
|
const {
|
||||||
@@ -164,7 +164,7 @@ export default class FeatureDiscovery extends React.PureComponent<Props, State>
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderStartTrial = (learnMoreURL: string, gettingTrialError: React.ReactNode) => {
|
renderStartTrial = (learnMoreURL: string, gettingTrialError: React.ReactNode) => {
|
||||||
const {
|
const {
|
||||||
@@ -317,7 +317,7 @@ export default class FeatureDiscovery extends React.PureComponent<Props, State>
|
|||||||
</p>}
|
</p>}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export default class FileUploadSetting extends Setting {
|
|||||||
if (files && files.length > 0) {
|
if (files && files.length > 0) {
|
||||||
this.setState({fileSelected: true, fileName: files[0].name});
|
this.setState({fileSelected: true, fileName: files[0].name});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
handleSubmit = (e) => {
|
handleSubmit = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -51,7 +51,7 @@ export default class FileUploadSetting extends Setting {
|
|||||||
Utils.clearFileInput(this.fileInputRef.current);
|
Utils.clearFileInput(this.fileInputRef.current);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let serverError;
|
let serverError;
|
||||||
|
|||||||
@@ -96,23 +96,23 @@ class Filter extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
componentDidMount = () => {
|
componentDidMount = () => {
|
||||||
document.addEventListener('mousedown', this.handleClickOutside);
|
document.addEventListener('mousedown', this.handleClickOutside);
|
||||||
}
|
};
|
||||||
|
|
||||||
componentWillUnmount = () => {
|
componentWillUnmount = () => {
|
||||||
document.removeEventListener('mousedown', this.handleClickOutside);
|
document.removeEventListener('mousedown', this.handleClickOutside);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleClickOutside = (event: MouseEvent) => {
|
handleClickOutside = (event: MouseEvent) => {
|
||||||
if (this.filterRef?.current?.contains(event.target as Node)) {
|
if (this.filterRef?.current?.contains(event.target as Node)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.hidePopover();
|
this.hidePopover();
|
||||||
}
|
};
|
||||||
|
|
||||||
hidePopover = () => {
|
hidePopover = () => {
|
||||||
this.setState({show: false});
|
this.setState({show: false});
|
||||||
this.buttonRef?.current?.blur();
|
this.buttonRef?.current?.blur();
|
||||||
}
|
};
|
||||||
|
|
||||||
togglePopover = () => {
|
togglePopover = () => {
|
||||||
if (this.state.show) {
|
if (this.state.show) {
|
||||||
@@ -121,7 +121,7 @@ class Filter extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setState({show: true});
|
this.setState({show: true});
|
||||||
}
|
};
|
||||||
|
|
||||||
updateValues = async (values: FilterValues, optionKey: string) => {
|
updateValues = async (values: FilterValues, optionKey: string) => {
|
||||||
const options = {
|
const options = {
|
||||||
@@ -134,12 +134,12 @@ class Filter extends React.PureComponent<Props, State> {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
this.setState({options, optionsModified: true});
|
this.setState({options, optionsModified: true});
|
||||||
}
|
};
|
||||||
|
|
||||||
onFilter = () => {
|
onFilter = () => {
|
||||||
this.props.onFilter(this.state.options);
|
this.props.onFilter(this.state.options);
|
||||||
this.setState({optionsModified: false, show: false, filterCount: this.calculateFilterCount()});
|
this.setState({optionsModified: false, show: false, filterCount: this.calculateFilterCount()});
|
||||||
}
|
};
|
||||||
|
|
||||||
calculateFilterCount = () => {
|
calculateFilterCount = () => {
|
||||||
const options = this.state.options;
|
const options = this.state.options;
|
||||||
@@ -155,11 +155,11 @@ class Filter extends React.PureComponent<Props, State> {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
return filterCount;
|
return filterCount;
|
||||||
}
|
};
|
||||||
|
|
||||||
resetFilters = () => {
|
resetFilters = () => {
|
||||||
this.setState({options: {...this.props.options}}, this.onFilter);
|
this.setState({options: {...this.props.options}}, this.onFilter);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderFilterOptions = () => {
|
renderFilterOptions = () => {
|
||||||
const {keys, options} = this.state;
|
const {keys, options} = this.state;
|
||||||
@@ -176,7 +176,7 @@ class Filter extends React.PureComponent<Props, State> {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const filters = this.renderFilterOptions();
|
const filters = this.renderFilterOptions();
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class FilterCheckbox extends React.PureComponent<Props> {
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
const {checked, name, updateOption} = this.props;
|
const {checked, name, updateOption} = this.props;
|
||||||
updateOption(!checked, name);
|
updateOption(!checked, name);
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {name, checked, label} = this.props;
|
const {name, checked, label} = this.props;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class FilterList extends React.PureComponent<Props> {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
await this.props.updateValues(values, this.props.optionKey);
|
await this.props.updateValues(values, this.props.optionKey);
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {option} = this.props;
|
const {option} = this.props;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class TeamFilterCheckbox extends React.PureComponent<Props> {
|
|||||||
toggleOption = () => {
|
toggleOption = () => {
|
||||||
const {checked, id, updateOption} = this.props;
|
const {checked, id, updateOption} = this.props;
|
||||||
updateOption(!checked, id);
|
updateOption(!checked, id);
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -100,11 +100,11 @@ class TeamFilterDropdown extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
componentWillUnmount = () => {
|
componentWillUnmount = () => {
|
||||||
document.removeEventListener('mousedown', this.handleClickOutside);
|
document.removeEventListener('mousedown', this.handleClickOutside);
|
||||||
}
|
};
|
||||||
|
|
||||||
hidePopover = () => {
|
hidePopover = () => {
|
||||||
this.setState({show: false});
|
this.setState({show: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
togglePopover = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
togglePopover = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
||||||
if (this.state.show) {
|
if (this.state.show) {
|
||||||
@@ -125,18 +125,18 @@ class TeamFilterDropdown extends React.PureComponent<Props, State> {
|
|||||||
this.listRef.current.scrollTop = 0;
|
this.listRef.current.scrollTop = 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleClickOutside = (event: MouseEvent) => {
|
handleClickOutside = (event: MouseEvent) => {
|
||||||
if (this.ref?.current?.contains(event.target as Node)) {
|
if (this.ref?.current?.contains(event.target as Node)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.hidePopover();
|
this.hidePopover();
|
||||||
}
|
};
|
||||||
|
|
||||||
setScrollPosition = (event: React.UIEvent<HTMLDivElement, UIEvent>) => {
|
setScrollPosition = (event: React.UIEvent<HTMLDivElement, UIEvent>) => {
|
||||||
this.scrollPosition = (event.target as HTMLDivElement).scrollTop;
|
this.scrollPosition = (event.target as HTMLDivElement).scrollTop;
|
||||||
}
|
};
|
||||||
|
|
||||||
hasMore = (): boolean => {
|
hasMore = (): boolean => {
|
||||||
if (this.state.loading) {
|
if (this.state.loading) {
|
||||||
@@ -145,7 +145,7 @@ class TeamFilterDropdown extends React.PureComponent<Props, State> {
|
|||||||
return this.state.searchTotal > this.state.searchResults.length;
|
return this.state.searchTotal > this.state.searchResults.length;
|
||||||
}
|
}
|
||||||
return this.props.total > (this.state.page + 1) * TEAMS_PER_PAGE;
|
return this.props.total > (this.state.page + 1) * TEAMS_PER_PAGE;
|
||||||
}
|
};
|
||||||
|
|
||||||
loadMore = async () => {
|
loadMore = async () => {
|
||||||
const {searchTerm, loading} = this.state;
|
const {searchTerm, loading} = this.state;
|
||||||
@@ -165,7 +165,7 @@ class TeamFilterDropdown extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setState({page, loading: false});
|
this.setState({page, loading: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
searchTeams = async (term: string, page: number) => {
|
searchTeams = async (term: string, page: number) => {
|
||||||
let searchResults = [];
|
let searchResults = [];
|
||||||
@@ -180,7 +180,7 @@ class TeamFilterDropdown extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
this.searchRetryInterval *= 2;
|
this.searchRetryInterval *= 2;
|
||||||
this.searchRetryId = window.setTimeout(this.searchTeams.bind(null, term, page), this.searchRetryInterval);
|
this.searchRetryId = window.setTimeout(this.searchTeams.bind(null, term, page), this.searchRetryInterval);
|
||||||
}
|
};
|
||||||
|
|
||||||
searchTeamsDebounced = debounce((page, term) => this.searchTeams(term, page), INITIAL_SEARCH_RETRY_TIMEOUT, false, () => {});
|
searchTeamsDebounced = debounce((page, term) => this.searchTeams(term, page), INITIAL_SEARCH_RETRY_TIMEOUT, false, () => {});
|
||||||
|
|
||||||
@@ -203,12 +203,12 @@ class TeamFilterDropdown extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.searchTeamsDebounced(0, searchTerm);
|
this.searchTeamsDebounced(0, searchTerm);
|
||||||
}
|
};
|
||||||
|
|
||||||
resetTeams = () => {
|
resetTeams = () => {
|
||||||
this.setState({savedSelectedTeams: [], show: false, searchResults: [], searchTotal: 0, page: 0, searchTerm: ''});
|
this.setState({savedSelectedTeams: [], show: false, searchResults: [], searchTotal: 0, page: 0, searchTerm: ''});
|
||||||
this.props.updateValues({team_ids: {name: 'Teams', value: []}}, 'teams');
|
this.props.updateValues({team_ids: {name: 'Teams', value: []}}, 'teams');
|
||||||
}
|
};
|
||||||
|
|
||||||
toggleTeam = (checked: boolean, teamId: string) => {
|
toggleTeam = (checked: boolean, teamId: string) => {
|
||||||
const prevSelectedTeamIds = this.props.option.values.team_ids.value as string[];
|
const prevSelectedTeamIds = this.props.option.values.team_ids.value as string[];
|
||||||
@@ -220,7 +220,7 @@ class TeamFilterDropdown extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.props.updateValues({team_ids: {name: 'Teams', value: selectedTeamIds}}, 'teams');
|
this.props.updateValues({team_ids: {name: 'Teams', value: selectedTeamIds}}, 'teams');
|
||||||
}
|
};
|
||||||
|
|
||||||
generateButtonText = () => {
|
generateButtonText = () => {
|
||||||
const selectedTeamIds = this.props.option.values.team_ids.value as string[];
|
const selectedTeamIds = this.props.option.values.team_ids.value as string[];
|
||||||
@@ -252,7 +252,7 @@ class TeamFilterDropdown extends React.PureComponent<Props, State> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return {buttonText, buttonMore};
|
return {buttonText, buttonMore};
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const selectedTeamIds = this.props.option.values.team_ids.value as string[];
|
const selectedTeamIds = this.props.option.values.team_ids.value as string[];
|
||||||
|
|||||||
@@ -42,12 +42,12 @@ export default class FullLogEventModal extends React.PureComponent<Props, State>
|
|||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
copyLog = () => {
|
copyLog = () => {
|
||||||
navigator.clipboard.writeText(JSON.stringify(this.props.log, undefined, 2));
|
navigator.clipboard.writeText(JSON.stringify(this.props.log, undefined, 2));
|
||||||
this.showCopySuccess();
|
this.showCopySuccess();
|
||||||
}
|
};
|
||||||
|
|
||||||
exportToCsv = () => {
|
exportToCsv = () => {
|
||||||
const file = navigator.clipboard.writeText(JSON.stringify(this.props.log, undefined, 2));
|
const file = navigator.clipboard.writeText(JSON.stringify(this.props.log, undefined, 2));
|
||||||
@@ -55,7 +55,7 @@ export default class FullLogEventModal extends React.PureComponent<Props, State>
|
|||||||
const encodedUri = encodeURI(csvContent);
|
const encodedUri = encodeURI(csvContent);
|
||||||
window.open(encodedUri);
|
window.open(encodedUri);
|
||||||
this.showExportSuccess();
|
this.showExportSuccess();
|
||||||
}
|
};
|
||||||
|
|
||||||
showCopySuccess = () => {
|
showCopySuccess = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -67,7 +67,7 @@ export default class FullLogEventModal extends React.PureComponent<Props, State>
|
|||||||
copySuccess: false,
|
copySuccess: false,
|
||||||
});
|
});
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
};
|
||||||
|
|
||||||
showExportSuccess = () => {
|
showExportSuccess = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -79,7 +79,7 @@ export default class FullLogEventModal extends React.PureComponent<Props, State>
|
|||||||
exportSuccess: false,
|
exportSuccess: false,
|
||||||
});
|
});
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export default class GeneratedSetting extends React.PureComponent<Props> {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
this.props.onChange(this.props.id, crypto.randomBytes(256).toString('base64').substring(0, 32));
|
this.props.onChange(this.props.id, crypto.randomBytes(256).toString('base64').substring(0, 32));
|
||||||
}
|
};
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
let disabledText = null;
|
let disabledText = null;
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ export default class GroupsList extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
public closeFilters = () => {
|
public closeFilters = () => {
|
||||||
this.setState({showFilters: false});
|
this.setState({showFilters: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
public componentDidMount() {
|
public componentDidMount() {
|
||||||
this.props.actions.getLdapGroups(this.state.page, LDAP_GROUPS_PAGE_SIZE).then(() => {
|
this.props.actions.getLdapGroups(this.state.page, LDAP_GROUPS_PAGE_SIZE).then(() => {
|
||||||
@@ -222,7 +222,7 @@ export default class GroupsList extends React.PureComponent<Props, State> {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
public renderRows(): JSX.Element | JSX.Element[] {
|
public renderRows(): JSX.Element | JSX.Element[] {
|
||||||
if (this.state.loading) {
|
if (this.state.loading) {
|
||||||
@@ -437,7 +437,7 @@ export default class GroupsList extends React.PureComponent<Props, State> {
|
|||||||
this.props.actions.getLdapGroups(this.state.page, LDAP_GROUPS_PAGE_SIZE, {q: ''}).then(() => {
|
this.props.actions.getLdapGroups(this.state.page, LDAP_GROUPS_PAGE_SIZE, {q: ''}).then(() => {
|
||||||
this.setState({loading: false});
|
this.setState({loading: false});
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
const startCount = (this.state.page * LDAP_GROUPS_PAGE_SIZE) + 1;
|
const startCount = (this.state.page * LDAP_GROUPS_PAGE_SIZE) + 1;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class JobTable extends React.PureComponent<Props> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return <span/>;
|
return <span/>;
|
||||||
}
|
};
|
||||||
|
|
||||||
reload = () => {
|
reload = () => {
|
||||||
this.props.actions.getJobsByType(this.props.jobType);
|
this.props.actions.getJobsByType(this.props.jobType);
|
||||||
|
|||||||
@@ -145,14 +145,14 @@ export default class LicenseSettings extends React.PureComponent<Props, State> {
|
|||||||
this.interval = setInterval(this.reloadPercentage, 2000);
|
this.interval = setInterval(this.reloadPercentage, 2000);
|
||||||
}
|
}
|
||||||
this.setState({upgradingPercentage: percentage || 0, upgradeError: error as string});
|
this.setState({upgradingPercentage: percentage || 0, upgradeError: error as string});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleChange = () => {
|
handleChange = () => {
|
||||||
const element = this.fileInputRef.current;
|
const element = this.fileInputRef.current;
|
||||||
if (element?.files?.length) {
|
if (element?.files?.length) {
|
||||||
this.setState({fileSelected: true, file: element.files[0]});
|
this.setState({fileSelected: true, file: element.files[0]});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
openEELicenseModal = async () => {
|
openEELicenseModal = async () => {
|
||||||
this.props.actions.openModal({
|
this.props.actions.openModal({
|
||||||
@@ -183,7 +183,7 @@ export default class LicenseSettings extends React.PureComponent<Props, State> {
|
|||||||
this.props.actions.getPrevTrialLicense();
|
this.props.actions.getPrevTrialLicense();
|
||||||
await this.props.actions.getLicenseConfig();
|
await this.props.actions.getLicenseConfig();
|
||||||
this.setState({serverError: null, removing: false});
|
this.setState({serverError: null, removing: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleUpgrade = async (e?: React.MouseEvent<HTMLButtonElement>) => {
|
handleUpgrade = async (e?: React.MouseEvent<HTMLButtonElement>) => {
|
||||||
if (e) {
|
if (e) {
|
||||||
@@ -200,7 +200,7 @@ export default class LicenseSettings extends React.PureComponent<Props, State> {
|
|||||||
trackEvent('api', 'upgrade_to_e0_failed', {error: error.message as string});
|
trackEvent('api', 'upgrade_to_e0_failed', {error: error.message as string});
|
||||||
this.setState({upgradeError: error.message, upgradingPercentage: 0});
|
this.setState({upgradeError: error.message, upgradingPercentage: 0});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
checkRestarted = () => {
|
checkRestarted = () => {
|
||||||
this.props.actions.ping().then(() => {
|
this.props.actions.ping().then(() => {
|
||||||
@@ -208,7 +208,7 @@ export default class LicenseSettings extends React.PureComponent<Props, State> {
|
|||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
setTimeout(this.checkRestarted, 1000);
|
setTimeout(this.checkRestarted, 1000);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleRestart = async (e?: React.MouseEvent<HTMLButtonElement>) => {
|
handleRestart = async (e?: React.MouseEvent<HTMLButtonElement>) => {
|
||||||
if (e) {
|
if (e) {
|
||||||
@@ -221,11 +221,11 @@ export default class LicenseSettings extends React.PureComponent<Props, State> {
|
|||||||
this.setState({restarting: false, restartError: err as string});
|
this.setState({restarting: false, restartError: err as string});
|
||||||
}
|
}
|
||||||
setTimeout(this.checkRestarted, 1000);
|
setTimeout(this.checkRestarted, 1000);
|
||||||
}
|
};
|
||||||
|
|
||||||
setClickNormalUpgradeBtn = () => {
|
setClickNormalUpgradeBtn = () => {
|
||||||
this.setState({clickNormalUpgradeBtn: true});
|
this.setState({clickNormalUpgradeBtn: true});
|
||||||
}
|
};
|
||||||
|
|
||||||
currentPlan = (
|
currentPlan = (
|
||||||
<div className='current-plan-legend'>
|
<div className='current-plan-legend'>
|
||||||
@@ -244,7 +244,7 @@ export default class LicenseSettings extends React.PureComponent<Props, State> {
|
|||||||
{text}
|
{text}
|
||||||
</ExternalLink>
|
</ExternalLink>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
termsAndPolicy = (
|
termsAndPolicy = (
|
||||||
<div className='terms-and-policy'>
|
<div className='terms-and-policy'>
|
||||||
@@ -400,5 +400,5 @@ export default class LicenseSettings extends React.PureComponent<Props, State> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export default class ManageRolesModal extends React.PureComponent<Props, State>
|
|||||||
this.setState({
|
this.setState({
|
||||||
error,
|
error,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleSystemAdminChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
handleSystemAdminChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
if (e.target.name === 'systemadmin') {
|
if (e.target.name === 'systemadmin') {
|
||||||
@@ -115,7 +115,7 @@ export default class ManageRolesModal extends React.PureComponent<Props, State>
|
|||||||
} else if (!UserUtils.hasPostAllPublicRole(roles) && UserUtils.hasPostAllPublicRole(oldRoles)) {
|
} else if (!UserUtils.hasPostAllPublicRole(roles) && UserUtils.hasPostAllPublicRole(oldRoles)) {
|
||||||
trackEvent('actions', 'remove_roles', {role: General.SYSTEM_POST_ALL_PUBLIC_ROLE});
|
trackEvent('actions', 'remove_roles', {role: General.SYSTEM_POST_ALL_PUBLIC_ROLE});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
handleSave = async () => {
|
handleSave = async () => {
|
||||||
this.setState({error: null});
|
this.setState({error: null});
|
||||||
@@ -146,7 +146,7 @@ export default class ManageRolesModal extends React.PureComponent<Props, State>
|
|||||||
/>,
|
/>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
renderContents = () => {
|
renderContents = () => {
|
||||||
const {user} = this.props;
|
const {user} = this.props;
|
||||||
@@ -335,7 +335,7 @@ export default class ManageRolesModal extends React.PureComponent<Props, State>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export default class ManageTokensModal extends React.PureComponent<Props, State>
|
|||||||
this.setState({
|
this.setState({
|
||||||
error,
|
error,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
private renderContents = (): JSX.Element => {
|
private renderContents = (): JSX.Element => {
|
||||||
const {user, userAccessTokens} = this.props;
|
const {user, userAccessTokens} = this.props;
|
||||||
@@ -181,7 +181,7 @@ export default class ManageTokensModal extends React.PureComponent<Props, State>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
public render = (): JSX.Element => {
|
public render = (): JSX.Element => {
|
||||||
return (
|
return (
|
||||||
@@ -209,5 +209,5 @@ export default class ManageTokensModal extends React.PureComponent<Props, State>
|
|||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ export default class MemberListGroup extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
loadComplete = () => {
|
loadComplete = () => {
|
||||||
this.setState({loading: false});
|
this.setState({loading: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
private nextPage = async () => {
|
private nextPage = async () => {
|
||||||
const {actions, groupID} = this.props;
|
const {actions, groupID} = this.props;
|
||||||
@@ -104,11 +104,11 @@ export default class MemberListGroup extends React.PureComponent<Props, State> {
|
|||||||
this.setState({loading: true, page});
|
this.setState({loading: true, page});
|
||||||
await actions.getProfilesInGroup(groupID, page, USERS_PER_PAGE * 2);
|
await actions.getProfilesInGroup(groupID, page, USERS_PER_PAGE * 2);
|
||||||
this.setState({loading: false});
|
this.setState({loading: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
private previousPage = () => {
|
private previousPage = () => {
|
||||||
this.setState({page: this.state.page - 1});
|
this.setState({page: this.state.page - 1});
|
||||||
}
|
};
|
||||||
|
|
||||||
private getRows = (): Row[] => {
|
private getRows = (): Row[] => {
|
||||||
const {users} = this.props;
|
const {users} = this.props;
|
||||||
@@ -129,7 +129,7 @@ export default class MemberListGroup extends React.PureComponent<Props, State> {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
private getColumns = (): Column[] => {
|
private getColumns = (): Column[] => {
|
||||||
return [
|
return [
|
||||||
@@ -143,7 +143,7 @@ export default class MemberListGroup extends React.PureComponent<Props, State> {
|
|||||||
field: 'name',
|
field: 'name',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
};
|
||||||
|
|
||||||
private getPaginationProps = () => {
|
private getPaginationProps = () => {
|
||||||
let {total} = this.props;
|
let {total} = this.props;
|
||||||
@@ -158,7 +158,7 @@ export default class MemberListGroup extends React.PureComponent<Props, State> {
|
|||||||
endCount = total;
|
endCount = total;
|
||||||
}
|
}
|
||||||
return {startCount, endCount, total};
|
return {startCount, endCount, total};
|
||||||
}
|
};
|
||||||
|
|
||||||
public render = (): JSX.Element => {
|
public render = (): JSX.Element => {
|
||||||
const rows: Row[] = this.getRows();
|
const rows: Row[] = this.getRows();
|
||||||
@@ -190,5 +190,5 @@ export default class MemberListGroup extends React.PureComponent<Props, State> {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export default class MessageExportSettings extends AdminSettings {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
};
|
||||||
|
|
||||||
getStateFromConfig(config) {
|
getStateFromConfig(config) {
|
||||||
const state = {
|
const state = {
|
||||||
@@ -321,5 +321,5 @@ export default class MessageExportSettings extends AdminSettings {
|
|||||||
/>
|
/>
|
||||||
</SettingsGroup>
|
</SettingsGroup>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export default class MultiSelectSetting extends React.PureComponent {
|
|||||||
|
|
||||||
this.props.onChange(this.props.id, values);
|
this.props.onChange(this.props.id, values);
|
||||||
this.setState({error: false});
|
this.setState({error: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
calculateValue = () => {
|
calculateValue = () => {
|
||||||
return this.props.selected.reduce((values, item) => {
|
return this.props.selected.reduce((values, item) => {
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export default class OpenIdConvert extends React.PureComponent<Props, State> {
|
|||||||
} else {
|
} else {
|
||||||
getHistory().push('/admin_console/authentication/openid');
|
getHistory().push('/admin_console/authentication/openid');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ export default class PasswordSettings extends AdminSettings {
|
|||||||
config.ServiceSettings.MaximumLoginAttempts = this.parseIntNonZero(this.state.maximumLoginAttempts, Constants.MAXIMUM_LOGIN_ATTEMPTS_DEFAULT);
|
config.ServiceSettings.MaximumLoginAttempts = this.parseIntNonZero(this.state.maximumLoginAttempts, Constants.MAXIMUM_LOGIN_ATTEMPTS_DEFAULT);
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
};
|
||||||
|
|
||||||
getStateFromConfig(config) {
|
getStateFromConfig(config) {
|
||||||
return {
|
return {
|
||||||
@@ -123,17 +123,17 @@ export default class PasswordSettings extends AdminSettings {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
handlePasswordLengthChange = (id, value) => {
|
handlePasswordLengthChange = (id, value) => {
|
||||||
this.handleChange(id, value);
|
this.handleChange(id, value);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleCheckboxChange = (id) => {
|
handleCheckboxChange = (id) => {
|
||||||
return ({target: {checked}}) => {
|
return ({target: {checked}}) => {
|
||||||
this.handleChange(id, checked);
|
this.handleChange(id, checked);
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
renderTitle() {
|
renderTitle() {
|
||||||
return (
|
return (
|
||||||
@@ -283,5 +283,5 @@ export default class PasswordSettings extends AdminSettings {
|
|||||||
}
|
}
|
||||||
</SettingsGroup>
|
</SettingsGroup>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,21 +70,21 @@ export default class PermissionGroup extends React.PureComponent<Props, State> {
|
|||||||
toggleExpanded = (e: MouseEvent) => {
|
toggleExpanded = (e: MouseEvent) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
this.setState({expanded: !this.state.expanded});
|
this.setState({expanded: !this.state.expanded});
|
||||||
}
|
};
|
||||||
|
|
||||||
toggleSelectRow = (id: string) => {
|
toggleSelectRow = (id: string) => {
|
||||||
if (this.props.readOnly) {
|
if (this.props.readOnly) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.props.onChange([id]);
|
this.props.onChange([id]);
|
||||||
}
|
};
|
||||||
|
|
||||||
toggleSelectSubGroup = (ids: string[]) => {
|
toggleSelectSubGroup = (ids: string[]) => {
|
||||||
if (this.props.readOnly) {
|
if (this.props.readOnly) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.props.onChange(ids);
|
this.props.onChange(ids);
|
||||||
}
|
};
|
||||||
|
|
||||||
toggleSelectGroup = () => {
|
toggleSelectGroup = () => {
|
||||||
const {readOnly, permissions, role, onChange} = this.props;
|
const {readOnly, permissions, role, onChange} = this.props;
|
||||||
@@ -129,7 +129,7 @@ export default class PermissionGroup extends React.PureComponent<Props, State> {
|
|||||||
this.setState({prevPermissions: role.permissions || [], expanded: false});
|
this.setState({prevPermissions: role.permissions || [], expanded: false});
|
||||||
onChange(permissionsToToggle);
|
onChange(permissionsToToggle);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
isInScope = (permission: string) => {
|
isInScope = (permission: string) => {
|
||||||
if (this.props.scope === 'channel_scope' && PermissionsScope[permission] !== 'channel_scope') {
|
if (this.props.scope === 'channel_scope' && PermissionsScope[permission] !== 'channel_scope') {
|
||||||
@@ -139,7 +139,7 @@ export default class PermissionGroup extends React.PureComponent<Props, State> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
|
|
||||||
renderPermission = (permission: string, additionalValues: AdditionalValues) => {
|
renderPermission = (permission: string, additionalValues: AdditionalValues) => {
|
||||||
if (!this.isInScope(permission)) {
|
if (!this.isInScope(permission)) {
|
||||||
@@ -162,7 +162,7 @@ export default class PermissionGroup extends React.PureComponent<Props, State> {
|
|||||||
additionalValues={additionalValues}
|
additionalValues={additionalValues}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderGroup = (g: Permission) => {
|
renderGroup = (g: Permission) => {
|
||||||
return (
|
return (
|
||||||
@@ -183,11 +183,11 @@ export default class PermissionGroup extends React.PureComponent<Props, State> {
|
|||||||
root={false}
|
root={false}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
fromParent = (id: string) => {
|
fromParent = (id: string) => {
|
||||||
return this.props.parentRole && this.props.parentRole.permissions?.indexOf(id) !== -1;
|
return this.props.parentRole && this.props.parentRole.permissions?.indexOf(id) !== -1;
|
||||||
}
|
};
|
||||||
|
|
||||||
getStatus = (permissions: Permissions) => {
|
getStatus = (permissions: Permissions) => {
|
||||||
let anyChecked = false;
|
let anyChecked = false;
|
||||||
@@ -219,11 +219,11 @@ export default class PermissionGroup extends React.PureComponent<Props, State> {
|
|||||||
return 'checked';
|
return 'checked';
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
};
|
||||||
|
|
||||||
hasPermissionsOnScope = () => {
|
hasPermissionsOnScope = () => {
|
||||||
return getRecursivePermissions(this.props.permissions).some((permission) => this.isInScope(permission));
|
return getRecursivePermissions(this.props.permissions).some((permission) => this.isInScope(permission));
|
||||||
}
|
};
|
||||||
|
|
||||||
allPermissionsFromParent = (permissions: Permissions) => {
|
allPermissionsFromParent = (permissions: Permissions) => {
|
||||||
for (const permission of permissions) {
|
for (const permission of permissions) {
|
||||||
@@ -238,7 +238,7 @@ export default class PermissionGroup extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
|
|
||||||
render = () => {
|
render = () => {
|
||||||
const {id, uniqId, permissions, readOnly, combined, root, selected, additionalValues} = this.props;
|
const {id, uniqId, permissions, readOnly, combined, root, selected, additionalValues} = this.props;
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ export default class PermissionSchemesSettings extends React.PureComponent<Props
|
|||||||
}
|
}
|
||||||
Promise.all(promises).then(() => this.setState({loadingMore: false, page: this.state.page + 1}));
|
Promise.all(promises).then(() => this.setState({loadingMore: false, page: this.state.page + 1}));
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// |RunJobs && !EnableCluster|(*App).IsPhase2MigrationCompleted|View |
|
// |RunJobs && !EnableCluster|(*App).IsPhase2MigrationCompleted|View |
|
||||||
// |-------------------------|---------------------------------|-------------------------------------------------------|
|
// |-------------------------|---------------------------------|-------------------------------------------------------|
|
||||||
@@ -127,7 +127,7 @@ export default class PermissionSchemesSettings extends React.PureComponent<Props
|
|||||||
'Migration job on hold: Team Override Schemes are not available until the job server can execute the permissions migration. The job will be automatically started when the job server is enabled. Learn more in the {documentationLink}.',
|
'Migration job on hold: Team Override Schemes are not available until the job server can execute the permissions migration. The job will be automatically started when the job server is enabled. Learn more in the {documentationLink}.',
|
||||||
docLink,
|
docLink,
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
teamOverrideUnavalableView = (id: string, defaultMsg: string, documentationLink: React.ReactNode) => {
|
teamOverrideUnavalableView = (id: string, defaultMsg: string, documentationLink: React.ReactNode) => {
|
||||||
return (
|
return (
|
||||||
@@ -211,7 +211,7 @@ export default class PermissionSchemesSettings extends React.PureComponent<Props
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
||||||
render = () => {
|
render = () => {
|
||||||
if (this.state.loading) {
|
if (this.state.loading) {
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ export default class PermissionSystemSchemeSettings extends React.PureComponent<
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
||||||
selectRow = (permission: string) => {
|
selectRow = (permission: string) => {
|
||||||
this.setState({selectedPermission: permission});
|
this.setState({selectedPermission: permission});
|
||||||
@@ -139,7 +139,7 @@ export default class PermissionSystemSchemeSettings extends React.PureComponent<
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({selectedPermission: undefined});
|
this.setState({selectedPermission: undefined});
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
};
|
||||||
|
|
||||||
loadRolesIntoState(props: Props) {
|
loadRolesIntoState(props: Props) {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -195,7 +195,7 @@ export default class PermissionSystemSchemeSettings extends React.PureComponent<
|
|||||||
permissions: role.permissions?.filter((p) => PermissionsScope[p] === 'run_scope'),
|
permissions: role.permissions?.filter((p) => PermissionsScope[p] === 'run_scope'),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
deriveRolesFromGuests = (role: Partial<Role>): Record<string, Partial<Role>> => {
|
deriveRolesFromGuests = (role: Partial<Role>): Record<string, Partial<Role>> => {
|
||||||
return {
|
return {
|
||||||
@@ -212,7 +212,7 @@ export default class PermissionSystemSchemeSettings extends React.PureComponent<
|
|||||||
permissions: role.permissions?.filter((p) => PermissionsScope[p] === 'channel_scope'),
|
permissions: role.permissions?.filter((p) => PermissionsScope[p] === 'channel_scope'),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
restoreExcludedPermissions = (roles: Record<string, Partial<Role>>) => {
|
restoreExcludedPermissions = (roles: Record<string, Partial<Role>>) => {
|
||||||
for (const permission of this.props.roles.system_user.permissions) {
|
for (const permission of this.props.roles.system_user.permissions) {
|
||||||
@@ -236,7 +236,7 @@ export default class PermissionSystemSchemeSettings extends React.PureComponent<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return roles;
|
return roles;
|
||||||
}
|
};
|
||||||
|
|
||||||
restoreGuestPermissions = (roles: Record<string, Partial<Role>>) => {
|
restoreGuestPermissions = (roles: Record<string, Partial<Role>>) => {
|
||||||
for (const permission of this.props.roles.system_guest.permissions) {
|
for (const permission of this.props.roles.system_guest.permissions) {
|
||||||
@@ -255,7 +255,7 @@ export default class PermissionSystemSchemeSettings extends React.PureComponent<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return roles;
|
return roles;
|
||||||
}
|
};
|
||||||
|
|
||||||
handleSubmit = async () => {
|
handleSubmit = async () => {
|
||||||
const teamAdminPromise = this.props.actions.editRole(this.state.roles.team_admin);
|
const teamAdminPromise = this.props.actions.editRole(this.state.roles.team_admin);
|
||||||
@@ -303,13 +303,13 @@ export default class PermissionSystemSchemeSettings extends React.PureComponent<
|
|||||||
|
|
||||||
this.setState({serverError, saving: false, saveNeeded});
|
this.setState({serverError, saving: false, saveNeeded});
|
||||||
this.props.actions.setNavigationBlocked(saveNeeded);
|
this.props.actions.setNavigationBlocked(saveNeeded);
|
||||||
}
|
};
|
||||||
|
|
||||||
toggleRole = (roleId: string) => {
|
toggleRole = (roleId: string) => {
|
||||||
const newOpenRoles = {...this.state.openRoles};
|
const newOpenRoles = {...this.state.openRoles};
|
||||||
newOpenRoles[roleId] = !newOpenRoles[roleId];
|
newOpenRoles[roleId] = !newOpenRoles[roleId];
|
||||||
this.setState({openRoles: newOpenRoles});
|
this.setState({openRoles: newOpenRoles});
|
||||||
}
|
};
|
||||||
|
|
||||||
togglePermission = (roleId: string, permissions: Iterable<string>) => {
|
togglePermission = (roleId: string, permissions: Iterable<string>) => {
|
||||||
const roles = {...this.state.roles};
|
const roles = {...this.state.roles};
|
||||||
@@ -327,7 +327,7 @@ export default class PermissionSystemSchemeSettings extends React.PureComponent<
|
|||||||
|
|
||||||
this.setState({roles, saveNeeded: true});
|
this.setState({roles, saveNeeded: true});
|
||||||
this.props.actions.setNavigationBlocked(true);
|
this.props.actions.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
resetDefaults = () => {
|
resetDefaults = () => {
|
||||||
const newRolesState = JSON.parse(JSON.stringify({...this.state.roles}));
|
const newRolesState = JSON.parse(JSON.stringify({...this.state.roles}));
|
||||||
@@ -338,11 +338,11 @@ export default class PermissionSystemSchemeSettings extends React.PureComponent<
|
|||||||
|
|
||||||
this.setState({roles: newRolesState, saveNeeded: true});
|
this.setState({roles: newRolesState, saveNeeded: true});
|
||||||
this.props.actions.setNavigationBlocked(true);
|
this.props.actions.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
haveGuestAccountsPermissions = () => {
|
haveGuestAccountsPermissions = () => {
|
||||||
return this.props.license.GuestAccountsPermissions === 'true';
|
return this.props.license.GuestAccountsPermissions === 'true';
|
||||||
}
|
};
|
||||||
|
|
||||||
render = () => {
|
render = () => {
|
||||||
if (!this.state.loaded) {
|
if (!this.state.loaded) {
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ export default class PermissionTeamSchemeSettings extends React.PureComponent<Pr
|
|||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
scheme: null,
|
scheme: null,
|
||||||
}
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const rolesNeeded = [
|
const rolesNeeded = [
|
||||||
@@ -178,7 +178,7 @@ export default class PermissionTeamSchemeSettings extends React.PureComponent<Pr
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
||||||
goToSelectedRow = () => {
|
goToSelectedRow = () => {
|
||||||
const selected = document.querySelector('.permission-row.selected,.permission-group-row.selected');
|
const selected = document.querySelector('.permission-row.selected,.permission-group-row.selected');
|
||||||
@@ -196,7 +196,7 @@ export default class PermissionTeamSchemeSettings extends React.PureComponent<Pr
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
||||||
selectRow = (permission: string) => {
|
selectRow = (permission: string) => {
|
||||||
this.setState({selectedPermission: permission});
|
this.setState({selectedPermission: permission});
|
||||||
@@ -208,7 +208,7 @@ export default class PermissionTeamSchemeSettings extends React.PureComponent<Pr
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({selectedPermission: undefined});
|
this.setState({selectedPermission: undefined});
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
};
|
||||||
|
|
||||||
getStateRoles = () => {
|
getStateRoles = () => {
|
||||||
if (this.state.roles !== null) {
|
if (this.state.roles !== null) {
|
||||||
@@ -276,7 +276,7 @@ export default class PermissionTeamSchemeSettings extends React.PureComponent<Pr
|
|||||||
permissions: teamGuest?.permissions.concat(channelGuest?.permissions || []),
|
permissions: teamGuest?.permissions.concat(channelGuest?.permissions || []),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
deriveRolesFromGuests = (teamGuest: Role, channelGuest: Role, role: Role): RolesMap => {
|
deriveRolesFromGuests = (teamGuest: Role, channelGuest: Role, role: Role): RolesMap => {
|
||||||
return {
|
return {
|
||||||
@@ -289,7 +289,7 @@ export default class PermissionTeamSchemeSettings extends React.PureComponent<Pr
|
|||||||
permissions: role.permissions.filter((p) => PermissionsScope[p] === 'channel_scope'),
|
permissions: role.permissions.filter((p) => PermissionsScope[p] === 'channel_scope'),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
restoreGuestPermissions = (teamGuest: Role, channelGuest: Role, roles: RolesMap) => {
|
restoreGuestPermissions = (teamGuest: Role, channelGuest: Role, roles: RolesMap) => {
|
||||||
for (const permission of teamGuest.permissions) {
|
for (const permission of teamGuest.permissions) {
|
||||||
@@ -303,7 +303,7 @@ export default class PermissionTeamSchemeSettings extends React.PureComponent<Pr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return roles;
|
return roles;
|
||||||
}
|
};
|
||||||
|
|
||||||
deriveRolesFromAllUsers = (baseTeam: Role, baseChannel: Role, basePlaybookMember: Role, baseRunMember: Role, role: Role): RolesMap => {
|
deriveRolesFromAllUsers = (baseTeam: Role, baseChannel: Role, basePlaybookMember: Role, baseRunMember: Role, role: Role): RolesMap => {
|
||||||
return {
|
return {
|
||||||
@@ -324,7 +324,7 @@ export default class PermissionTeamSchemeSettings extends React.PureComponent<Pr
|
|||||||
permissions: role.permissions?.filter((p) => PermissionsScope[p] === 'run_scope'),
|
permissions: role.permissions?.filter((p) => PermissionsScope[p] === 'run_scope'),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
restoreExcludedPermissions = (baseTeam: Role, baseChannel: Role, roles: RolesMap) => {
|
restoreExcludedPermissions = (baseTeam: Role, baseChannel: Role, roles: RolesMap) => {
|
||||||
for (const permission of baseTeam.permissions) {
|
for (const permission of baseTeam.permissions) {
|
||||||
@@ -338,17 +338,17 @@ export default class PermissionTeamSchemeSettings extends React.PureComponent<Pr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return roles;
|
return roles;
|
||||||
}
|
};
|
||||||
|
|
||||||
handleNameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
handleNameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
this.setState({schemeName: e.target.value, saveNeeded: true});
|
this.setState({schemeName: e.target.value, saveNeeded: true});
|
||||||
this.props.actions.setNavigationBlocked(true);
|
this.props.actions.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleDescriptionChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
handleDescriptionChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
||||||
this.setState({schemeDescription: e.target.value, saveNeeded: true});
|
this.setState({schemeDescription: e.target.value, saveNeeded: true});
|
||||||
this.props.actions.setNavigationBlocked(true);
|
this.props.actions.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleSubmit = async () => {
|
handleSubmit = async () => {
|
||||||
const roles = this.getStateRoles();
|
const roles = this.getStateRoles();
|
||||||
@@ -495,13 +495,13 @@ export default class PermissionTeamSchemeSettings extends React.PureComponent<Pr
|
|||||||
this.setState({serverError, saving: false, saveNeeded});
|
this.setState({serverError, saving: false, saveNeeded});
|
||||||
this.props.actions.setNavigationBlocked(saveNeeded);
|
this.props.actions.setNavigationBlocked(saveNeeded);
|
||||||
this.props.history.push('/admin_console/user_management/permissions');
|
this.props.history.push('/admin_console/user_management/permissions');
|
||||||
}
|
};
|
||||||
|
|
||||||
toggleRole = (roleId: 'all_users' | 'team_admin' | 'channel_admin' | 'guests' | 'playbook_admin') => {
|
toggleRole = (roleId: 'all_users' | 'team_admin' | 'channel_admin' | 'guests' | 'playbook_admin') => {
|
||||||
const newOpenRoles = {...this.state.openRoles};
|
const newOpenRoles = {...this.state.openRoles};
|
||||||
newOpenRoles[roleId] = !newOpenRoles[roleId];
|
newOpenRoles[roleId] = !newOpenRoles[roleId];
|
||||||
this.setState({openRoles: newOpenRoles});
|
this.setState({openRoles: newOpenRoles});
|
||||||
}
|
};
|
||||||
|
|
||||||
togglePermission = (roleId: string, permissions: string[]) => {
|
togglePermission = (roleId: string, permissions: string[]) => {
|
||||||
const roles = {...this.getStateRoles()} as RolesMap;
|
const roles = {...this.getStateRoles()} as RolesMap;
|
||||||
@@ -543,17 +543,17 @@ export default class PermissionTeamSchemeSettings extends React.PureComponent<Pr
|
|||||||
|
|
||||||
this.setState({roles, saveNeeded: true});
|
this.setState({roles, saveNeeded: true});
|
||||||
this.props.actions.setNavigationBlocked(true);
|
this.props.actions.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
openAddTeam = () => {
|
openAddTeam = () => {
|
||||||
this.setState({addTeamOpen: true});
|
this.setState({addTeamOpen: true});
|
||||||
}
|
};
|
||||||
|
|
||||||
removeTeam = (teamId: string) => {
|
removeTeam = (teamId: string) => {
|
||||||
const teams = (this.state.teams || this.props.teams).filter((team) => team.id !== teamId);
|
const teams = (this.state.teams || this.props.teams).filter((team) => team.id !== teamId);
|
||||||
this.setState({teams, saveNeeded: true});
|
this.setState({teams, saveNeeded: true});
|
||||||
this.props.actions.setNavigationBlocked(true);
|
this.props.actions.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
addTeams = (teams: Team[]) => {
|
addTeams = (teams: Team[]) => {
|
||||||
const currentTeams = this.state.teams || this.props.teams || [];
|
const currentTeams = this.state.teams || this.props.teams || [];
|
||||||
@@ -562,15 +562,15 @@ export default class PermissionTeamSchemeSettings extends React.PureComponent<Pr
|
|||||||
saveNeeded: true,
|
saveNeeded: true,
|
||||||
});
|
});
|
||||||
this.props.actions.setNavigationBlocked(true);
|
this.props.actions.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
closeAddTeam = () => {
|
closeAddTeam = () => {
|
||||||
this.setState({addTeamOpen: false});
|
this.setState({addTeamOpen: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
haveGuestAccountsPermissions = () => {
|
haveGuestAccountsPermissions = () => {
|
||||||
return this.props.license.GuestAccountsPermissions === 'true';
|
return this.props.license.GuestAccountsPermissions === 'true';
|
||||||
}
|
};
|
||||||
|
|
||||||
render = () => {
|
render = () => {
|
||||||
if (!this.isLoaded(this.props)) {
|
if (!this.isLoaded(this.props)) {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export default class TeamInList extends React.PureComponent<Props> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
onRemoveTeam(team.id);
|
onRemoveTeam(team.id);
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {team, isDisabled} = this.props;
|
const {team, isDisabled} = this.props;
|
||||||
|
|||||||
@@ -96,17 +96,17 @@ export default class PermissionsSchemeSummary extends React.PureComponent<Props
|
|||||||
onCancel={this.handleDeleteCanceled}
|
onCancel={this.handleDeleteCanceled}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
stopPropagation = (e: React.MouseEvent<HTMLElement, MouseEvent>): void => {
|
stopPropagation = (e: React.MouseEvent<HTMLElement, MouseEvent>): void => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}
|
};
|
||||||
|
|
||||||
handleDeleteCanceled = (): void => {
|
handleDeleteCanceled = (): void => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showConfirmModal: false,
|
showConfirmModal: false,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleDeleteConfirmed = async (): Promise<void> => {
|
handleDeleteConfirmed = async (): Promise<void> => {
|
||||||
this.setState({deleting: true, serverError: undefined});
|
this.setState({deleting: true, serverError: undefined});
|
||||||
@@ -116,7 +116,7 @@ export default class PermissionsSchemeSummary extends React.PureComponent<Props
|
|||||||
} else {
|
} else {
|
||||||
this.setState({deleting: false, showConfirmModal: false});
|
this.setState({deleting: false, showConfirmModal: false});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
delete = (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>): void => {
|
delete = (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>): void => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@@ -124,11 +124,11 @@ export default class PermissionsSchemeSummary extends React.PureComponent<Props
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setState({showConfirmModal: true, serverError: undefined});
|
this.setState({showConfirmModal: true, serverError: undefined});
|
||||||
}
|
};
|
||||||
|
|
||||||
goToEdit = (): void => {
|
goToEdit = (): void => {
|
||||||
this.props.history.push('/admin_console/user_management/permissions/team_override_scheme/' + this.props.scheme.id);
|
this.props.history.push('/admin_console/user_management/permissions/team_override_scheme/' + this.props.scheme.id);
|
||||||
}
|
};
|
||||||
|
|
||||||
render = () => {
|
render = () => {
|
||||||
const {scheme, isDisabled} = this.props;
|
const {scheme, isDisabled} = this.props;
|
||||||
|
|||||||
@@ -260,15 +260,15 @@ export default class PermissionsTree extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
openPostTimeLimitModal = () => {
|
openPostTimeLimitModal = () => {
|
||||||
this.setState({editTimeLimitModalIsVisible: true});
|
this.setState({editTimeLimitModalIsVisible: true});
|
||||||
}
|
};
|
||||||
|
|
||||||
closePostTimeLimitModal = () => {
|
closePostTimeLimitModal = () => {
|
||||||
this.setState({editTimeLimitModalIsVisible: false});
|
this.setState({editTimeLimitModalIsVisible: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
componentDidUpdate(prevProps: Props) {
|
componentDidUpdate(prevProps: Props) {
|
||||||
if (this.props.config !== prevProps.config || this.props.license !== prevProps.license) {
|
if (this.props.config !== prevProps.config || this.props.license !== prevProps.license) {
|
||||||
@@ -281,7 +281,7 @@ export default class PermissionsTree extends React.PureComponent<Props, State> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.props.onToggle(this.props.role.name!, ids);
|
this.props.onToggle(this.props.role.name!, ids);
|
||||||
}
|
};
|
||||||
|
|
||||||
render = () => {
|
render = () => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -486,7 +486,7 @@ export default class PluginManagement extends AdminSettings<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
};
|
||||||
|
|
||||||
getStateFromConfig(config: Props['config']) {
|
getStateFromConfig(config: Props['config']) {
|
||||||
const state = {
|
const state = {
|
||||||
@@ -517,7 +517,7 @@ export default class PluginManagement extends AdminSettings<Props, State> {
|
|||||||
if (element.files && element.files.length > 0) {
|
if (element.files && element.files.length > 0) {
|
||||||
this.setState({fileSelected: true, file: element.files[0]});
|
this.setState({fileSelected: true, file: element.files[0]});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
helpSubmitUpload = async (file: File, force: boolean) => {
|
helpSubmitUpload = async (file: File, force: boolean) => {
|
||||||
this.setState({uploading: true});
|
this.setState({uploading: true});
|
||||||
@@ -561,7 +561,7 @@ export default class PluginManagement extends AdminSettings<Props, State> {
|
|||||||
uploading: false,
|
uploading: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleSubmitUpload = (e: React.SyntheticEvent) => {
|
handleSubmitUpload = (e: React.SyntheticEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -575,7 +575,7 @@ export default class PluginManagement extends AdminSettings<Props, State> {
|
|||||||
this.helpSubmitUpload(file, false);
|
this.helpSubmitUpload(file, false);
|
||||||
}
|
}
|
||||||
Utils.clearFileInput(element);
|
Utils.clearFileInput(element);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleOverwriteUploadPluginCancel = () => {
|
handleOverwriteUploadPluginCancel = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -586,20 +586,20 @@ export default class PluginManagement extends AdminSettings<Props, State> {
|
|||||||
lastMessage: null,
|
lastMessage: null,
|
||||||
uploading: false,
|
uploading: false,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleOverwriteUploadPlugin = () => {
|
handleOverwriteUploadPlugin = () => {
|
||||||
this.setState({confirmOverwriteUploadModal: false});
|
this.setState({confirmOverwriteUploadModal: false});
|
||||||
if (this.state.file) {
|
if (this.state.file) {
|
||||||
this.helpSubmitUpload(this.state.file, true);
|
this.helpSubmitUpload(this.state.file, true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
onPluginDownloadUrlChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
onPluginDownloadUrlChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
pluginDownloadUrl: e.target.value,
|
pluginDownloadUrl: e.target.value,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
installFromUrl = async (force: boolean) => {
|
installFromUrl = async (force: boolean) => {
|
||||||
const {pluginDownloadUrl} = this.state;
|
const {pluginDownloadUrl} = this.state;
|
||||||
@@ -644,7 +644,7 @@ export default class PluginManagement extends AdminSettings<Props, State> {
|
|||||||
installing: false,
|
installing: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
getMarketplaceURLHelpText = (url: string, enableUploads: boolean) => {
|
getMarketplaceURLHelpText = (url: string, enableUploads: boolean) => {
|
||||||
return (
|
return (
|
||||||
@@ -685,16 +685,16 @@ export default class PluginManagement extends AdminSettings<Props, State> {
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
canSave = () => {
|
canSave = () => {
|
||||||
return this.state.marketplaceUrl !== '';
|
return this.state.marketplaceUrl !== '';
|
||||||
}
|
};
|
||||||
|
|
||||||
handleSubmitInstall = (e: React.SyntheticEvent) => {
|
handleSubmitInstall = (e: React.SyntheticEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return this.installFromUrl(false);
|
return this.installFromUrl(false);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleOverwriteInstallPluginCancel = () => {
|
handleOverwriteInstallPluginCancel = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -703,12 +703,12 @@ export default class PluginManagement extends AdminSettings<Props, State> {
|
|||||||
serverError: null,
|
serverError: null,
|
||||||
lastMessage: null,
|
lastMessage: null,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleOverwriteInstallPlugin = () => {
|
handleOverwriteInstallPlugin = () => {
|
||||||
this.setState({confirmOverwriteInstallModal: false});
|
this.setState({confirmOverwriteInstallModal: false});
|
||||||
return this.installFromUrl(true);
|
return this.installFromUrl(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
showRemovePluginModal = (e: React.SyntheticEvent) => {
|
showRemovePluginModal = (e: React.SyntheticEvent) => {
|
||||||
if (this.props.isDisabled) {
|
if (this.props.isDisabled) {
|
||||||
@@ -717,16 +717,16 @@ export default class PluginManagement extends AdminSettings<Props, State> {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const pluginId = e.currentTarget.getAttribute('data-plugin-id');
|
const pluginId = e.currentTarget.getAttribute('data-plugin-id');
|
||||||
this.setState({showRemoveModal: true, removing: pluginId});
|
this.setState({showRemoveModal: true, removing: pluginId});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleRemovePluginCancel = () => {
|
handleRemovePluginCancel = () => {
|
||||||
this.setState({showRemoveModal: false, removing: null});
|
this.setState({showRemoveModal: false, removing: null});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleRemovePlugin = () => {
|
handleRemovePlugin = () => {
|
||||||
this.setState({showRemoveModal: false});
|
this.setState({showRemoveModal: false});
|
||||||
this.handleRemove();
|
this.handleRemove();
|
||||||
}
|
};
|
||||||
|
|
||||||
handleRemove = async () => {
|
handleRemove = async () => {
|
||||||
this.setState({lastMessage: null, serverError: null});
|
this.setState({lastMessage: null, serverError: null});
|
||||||
@@ -738,7 +738,7 @@ export default class PluginManagement extends AdminSettings<Props, State> {
|
|||||||
this.setState({serverError: error.message});
|
this.setState({serverError: error.message});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
handleEnable = async (e: React.KeyboardEvent) => {
|
handleEnable = async (e: React.KeyboardEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -755,7 +755,7 @@ export default class PluginManagement extends AdminSettings<Props, State> {
|
|||||||
this.setState({serverError: error.message});
|
this.setState({serverError: error.message});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
handleDisable = async (e: React.KeyboardEvent) => {
|
handleDisable = async (e: React.KeyboardEvent) => {
|
||||||
this.setState({lastMessage: null, serverError: null});
|
this.setState({lastMessage: null, serverError: null});
|
||||||
@@ -772,7 +772,7 @@ export default class PluginManagement extends AdminSettings<Props, State> {
|
|||||||
this.setState({serverError: error.message});
|
this.setState({serverError: error.message});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
renderTitle() {
|
renderTitle() {
|
||||||
return (
|
return (
|
||||||
@@ -818,7 +818,7 @@ export default class PluginManagement extends AdminSettings<Props, State> {
|
|||||||
onCancel={onCancel}
|
onCancel={onCancel}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderRemovePluginModal = (
|
renderRemovePluginModal = (
|
||||||
show: boolean, onConfirm: (checked: boolean) => void, onCancel: (checked: boolean) => void) => {
|
show: boolean, onConfirm: (checked: boolean) => void, onCancel: (checked: boolean) => void) => {
|
||||||
@@ -854,7 +854,7 @@ export default class PluginManagement extends AdminSettings<Props, State> {
|
|||||||
onCancel={onCancel}
|
onCancel={onCancel}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderEnablePluginsSetting = () => {
|
renderEnablePluginsSetting = () => {
|
||||||
const hideEnablePlugins = this.props.config.ExperimentalSettings && this.props.config.ExperimentalSettings.RestrictSystemAdmin;
|
const hideEnablePlugins = this.props.config.ExperimentalSettings && this.props.config.ExperimentalSettings.RestrictSystemAdmin;
|
||||||
@@ -892,7 +892,7 @@ export default class PluginManagement extends AdminSettings<Props, State> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
};
|
||||||
|
|
||||||
renderSettings = () => {
|
renderSettings = () => {
|
||||||
const {enableUploads} = this.state;
|
const {enableUploads} = this.state;
|
||||||
@@ -1256,5 +1256,5 @@ export default class PluginManagement extends AdminSettings<Props, State> {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ const PUSH_NOTIFICATIONS_CUSTOM = 'custom';
|
|||||||
export default class PushSettings extends AdminSettings {
|
export default class PushSettings extends AdminSettings {
|
||||||
canSave = () => {
|
canSave = () => {
|
||||||
return this.state.pushNotificationServerType !== PUSH_NOTIFICATIONS_MHPNS || this.state.agree;
|
return this.state.pushNotificationServerType !== PUSH_NOTIFICATIONS_MHPNS || this.state.agree;
|
||||||
}
|
};
|
||||||
|
|
||||||
handleAgreeChange = (e) => {
|
handleAgreeChange = (e) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
agree: e.target.checked,
|
agree: e.target.checked,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleDropdownChange = (id, value) => {
|
handleDropdownChange = (id, value) => {
|
||||||
if (id === 'pushNotificationServerType') {
|
if (id === 'pushNotificationServerType') {
|
||||||
@@ -54,7 +54,7 @@ export default class PushSettings extends AdminSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.handleChange(id, value);
|
this.handleChange(id, value);
|
||||||
}
|
};
|
||||||
|
|
||||||
getConfigFromState = (config) => {
|
getConfigFromState = (config) => {
|
||||||
config.EmailSettings.SendPushNotifications = this.state.pushNotificationServerType !== PUSH_NOTIFICATIONS_OFF;
|
config.EmailSettings.SendPushNotifications = this.state.pushNotificationServerType !== PUSH_NOTIFICATIONS_OFF;
|
||||||
@@ -62,7 +62,7 @@ export default class PushSettings extends AdminSettings {
|
|||||||
config.TeamSettings.MaxNotificationsPerChannel = this.state.maxNotificationsPerChannel;
|
config.TeamSettings.MaxNotificationsPerChannel = this.state.maxNotificationsPerChannel;
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
};
|
||||||
|
|
||||||
getStateFromConfig(config) {
|
getStateFromConfig(config) {
|
||||||
let pushNotificationServerType = PUSH_NOTIFICATIONS_CUSTOM;
|
let pushNotificationServerType = PUSH_NOTIFICATIONS_CUSTOM;
|
||||||
@@ -318,5 +318,5 @@ export default class PushSettings extends AdminSettings {
|
|||||||
/>
|
/>
|
||||||
</SettingsGroup>
|
</SettingsGroup>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export default class RemoveFileSetting extends Setting {
|
|||||||
this.props.onSubmit(this.props.id, () => {
|
this.props.onSubmit(this.props.id, () => {
|
||||||
this.setState({removing: false});
|
this.setState({removing: false});
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export default class ResetEmailModal extends React.PureComponent<Props, State> {
|
|||||||
isEmailError: false,
|
isEmailError: false,
|
||||||
isCurrentPasswordError: false,
|
isCurrentPasswordError: false,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
private isEmailValid = (): boolean => {
|
private isEmailValid = (): boolean => {
|
||||||
if (!this.emailRef.current || !this.emailRef.current.value || !isEmail(this.emailRef.current.value)) {
|
if (!this.emailRef.current || !this.emailRef.current.value || !isEmail(this.emailRef.current.value)) {
|
||||||
@@ -75,7 +75,7 @@ export default class ResetEmailModal extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
this.setState({error: null, isEmailError: false});
|
this.setState({error: null, isEmailError: false});
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
|
|
||||||
private isCurrentPasswordValid = (): boolean => {
|
private isCurrentPasswordValid = (): boolean => {
|
||||||
if (!this.currentPasswordRef.current || !this.currentPasswordRef.current.value) {
|
if (!this.currentPasswordRef.current || !this.currentPasswordRef.current.value) {
|
||||||
@@ -91,7 +91,7 @@ export default class ResetEmailModal extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
this.setState({error: null, isCurrentPasswordError: false});
|
this.setState({error: null, isCurrentPasswordError: false});
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
|
|
||||||
private doSubmit = async (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
private doSubmit = async (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -126,14 +126,14 @@ export default class ResetEmailModal extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.props.onModalSubmit(this.props.user);
|
this.props.onModalSubmit(this.props.user);
|
||||||
}
|
};
|
||||||
|
|
||||||
private doCancel = (): void => {
|
private doCancel = (): void => {
|
||||||
this.setState({
|
this.setState({
|
||||||
error: null,
|
error: null,
|
||||||
});
|
});
|
||||||
this.props.onModalDismissed();
|
this.props.onModalDismissed();
|
||||||
}
|
};
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
const user = this.props.user;
|
const user = this.props.user;
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ export default class ResetPasswordModal extends React.PureComponent<Props, State
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.props.onModalSubmit(this.props.user);
|
this.props.onModalSubmit(this.props.user);
|
||||||
}
|
};
|
||||||
|
|
||||||
private doCancel = (): void => {
|
private doCancel = (): void => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -106,7 +106,7 @@ export default class ResetPasswordModal extends React.PureComponent<Props, State
|
|||||||
serverErrorCurrentPass: null,
|
serverErrorCurrentPass: null,
|
||||||
});
|
});
|
||||||
this.props.onModalDismissed();
|
this.props.onModalDismissed();
|
||||||
}
|
};
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
const user = this.props.user;
|
const user = this.props.user;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export default class RevokeTokenButton extends React.PureComponent<RevokeTokenBu
|
|||||||
if ('error' in response) {
|
if ('error' in response) {
|
||||||
this.props.onError(response.error.message);
|
this.props.onError(response.error.message);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
consoleAccess: PropTypes.object,
|
consoleAccess: PropTypes.object,
|
||||||
cloud: PropTypes.object,
|
cloud: PropTypes.object,
|
||||||
isCurrentUserSystemAdmin: PropTypes.bool,
|
isCurrentUserSystemAdmin: PropTypes.bool,
|
||||||
}
|
};
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
@@ -161,7 +161,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
});
|
});
|
||||||
this.props.setNavigationBlocked(false);
|
this.props.setNavigationBlocked(false);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
getConfigFromState(config) {
|
getConfigFromState(config) {
|
||||||
const schema = this.props.schema;
|
const schema = this.props.schema;
|
||||||
@@ -317,7 +317,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
return setting.label;
|
return setting.label;
|
||||||
}
|
};
|
||||||
|
|
||||||
renderHelpText = (setting) => {
|
renderHelpText = (setting) => {
|
||||||
if (!this.props.schema) {
|
if (!this.props.schema) {
|
||||||
@@ -353,7 +353,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
textValues={helpTextValues}
|
textValues={helpTextValues}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderLabel = (setting) => {
|
renderLabel = (setting) => {
|
||||||
if (!this.props.schema) {
|
if (!this.props.schema) {
|
||||||
@@ -364,7 +364,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
return setting.label;
|
return setting.label;
|
||||||
}
|
}
|
||||||
return Utils.localizeMessage(setting.label, setting.label_default);
|
return Utils.localizeMessage(setting.label, setting.label_default);
|
||||||
}
|
};
|
||||||
|
|
||||||
isDisabled = (setting) => {
|
isDisabled = (setting) => {
|
||||||
const enterpriseReady = this.props.config.BuildEnterpriseReady === 'true';
|
const enterpriseReady = this.props.config.BuildEnterpriseReady === 'true';
|
||||||
@@ -372,14 +372,14 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
return setting.isDisabled(this.props.config, this.state, this.props.license, enterpriseReady, this.props.consoleAccess, this.props.cloud, this.props.isCurrentUserSystemAdmin);
|
return setting.isDisabled(this.props.config, this.state, this.props.license, enterpriseReady, this.props.consoleAccess, this.props.cloud, this.props.isCurrentUserSystemAdmin);
|
||||||
}
|
}
|
||||||
return Boolean(setting.isDisabled);
|
return Boolean(setting.isDisabled);
|
||||||
}
|
};
|
||||||
|
|
||||||
isHidden = (setting) => {
|
isHidden = (setting) => {
|
||||||
if (typeof setting.isHidden === 'function') {
|
if (typeof setting.isHidden === 'function') {
|
||||||
return setting.isHidden(this.props.config, this.state, this.props.license);
|
return setting.isHidden(this.props.config, this.state, this.props.license);
|
||||||
}
|
}
|
||||||
return Boolean(setting.isHidden);
|
return Boolean(setting.isHidden);
|
||||||
}
|
};
|
||||||
|
|
||||||
buildButtonSetting = (setting) => {
|
buildButtonSetting = (setting) => {
|
||||||
const handleRequestAction = (success, error) => {
|
const handleRequestAction = (success, error) => {
|
||||||
@@ -437,7 +437,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
buildTextSetting = (setting) => {
|
buildTextSetting = (setting) => {
|
||||||
let inputType = 'input';
|
let inputType = 'input';
|
||||||
@@ -479,7 +479,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
footer={footer}
|
footer={footer}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
buildColorSetting = (setting) => {
|
buildColorSetting = (setting) => {
|
||||||
return (
|
return (
|
||||||
@@ -494,7 +494,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
buildBoolSetting = (setting) => {
|
buildBoolSetting = (setting) => {
|
||||||
return (
|
return (
|
||||||
@@ -509,7 +509,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
buildPermissionSetting = (setting) => {
|
buildPermissionSetting = (setting) => {
|
||||||
return (
|
return (
|
||||||
@@ -524,7 +524,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
onChange={this.handlePermissionChange}
|
onChange={this.handlePermissionChange}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
buildDropdownSetting = (setting) => {
|
buildDropdownSetting = (setting) => {
|
||||||
const enterpriseReady = this.props.config.BuildEnterpriseReady === 'true';
|
const enterpriseReady = this.props.config.BuildEnterpriseReady === 'true';
|
||||||
@@ -569,7 +569,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
buildLanguageSetting = (setting) => {
|
buildLanguageSetting = (setting) => {
|
||||||
const locales = I18n.getAllLanguages();
|
const locales = I18n.getAllLanguages();
|
||||||
@@ -613,7 +613,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
buildRadioSetting = (setting) => {
|
buildRadioSetting = (setting) => {
|
||||||
const options = setting.options || [];
|
const options = setting.options || [];
|
||||||
@@ -632,7 +632,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
buildBannerSetting = (setting) => {
|
buildBannerSetting = (setting) => {
|
||||||
if (this.isDisabled(setting)) {
|
if (this.isDisabled(setting)) {
|
||||||
@@ -651,7 +651,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
buildGeneratedSetting = (setting) => {
|
buildGeneratedSetting = (setting) => {
|
||||||
return (
|
return (
|
||||||
@@ -668,11 +668,11 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
onChange={this.handleGeneratedChange}
|
onChange={this.handleGeneratedChange}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleGeneratedChange = (id, s) => {
|
handleGeneratedChange = (id, s) => {
|
||||||
this.handleChange(id, s.replace('+', '-').replace('/', '_'));
|
this.handleChange(id, s.replace('+', '-').replace('/', '_'));
|
||||||
}
|
};
|
||||||
|
|
||||||
handleChange = (id, value, confirm = false, doSubmit = false, warning = false) => {
|
handleChange = (id, value, confirm = false, doSubmit = false, warning = false) => {
|
||||||
let saveNeeded = this.state.saveNeeded === 'permissions' ? 'both' : 'config';
|
let saveNeeded = this.state.saveNeeded === 'permissions' ? 'both' : 'config';
|
||||||
@@ -702,7 +702,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.props.setNavigationBlocked(true);
|
this.props.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
handlePermissionChange = (id, value) => {
|
handlePermissionChange = (id, value) => {
|
||||||
let saveNeeded = 'permissions';
|
let saveNeeded = 'permissions';
|
||||||
@@ -715,7 +715,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.props.setNavigationBlocked(true);
|
this.props.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
buildUsernameSetting = (setting) => {
|
buildUsernameSetting = (setting) => {
|
||||||
return (
|
return (
|
||||||
@@ -730,7 +730,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
buildJobsTableSetting = (setting) => {
|
buildJobsTableSetting = (setting) => {
|
||||||
return (
|
return (
|
||||||
@@ -753,7 +753,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
buildFileUploadSetting = (setting) => {
|
buildFileUploadSetting = (setting) => {
|
||||||
const setData = (id, data) => {
|
const setData = (id, data) => {
|
||||||
@@ -831,7 +831,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
setByEnv={this.isSetByEnv(setting.key)}
|
setByEnv={this.isSetByEnv(setting.key)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
buildCustomSetting = (setting) => {
|
buildCustomSetting = (setting) => {
|
||||||
const CustomComponent = setting.component;
|
const CustomComponent = setting.component;
|
||||||
@@ -869,21 +869,21 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
return componentInstance;
|
return componentInstance;
|
||||||
}
|
};
|
||||||
|
|
||||||
unRegisterSaveAction = (saveAction) => {
|
unRegisterSaveAction = (saveAction) => {
|
||||||
const indexOfSaveAction = this.saveActions.indexOf(saveAction);
|
const indexOfSaveAction = this.saveActions.indexOf(saveAction);
|
||||||
this.saveActions.splice(indexOfSaveAction, 1);
|
this.saveActions.splice(indexOfSaveAction, 1);
|
||||||
}
|
};
|
||||||
|
|
||||||
registerSaveAction = (saveAction) => {
|
registerSaveAction = (saveAction) => {
|
||||||
this.saveActions.push(saveAction);
|
this.saveActions.push(saveAction);
|
||||||
}
|
};
|
||||||
|
|
||||||
setSaveNeeded = () => {
|
setSaveNeeded = () => {
|
||||||
this.setState({saveNeeded: 'config'});
|
this.setState({saveNeeded: 'config'});
|
||||||
this.props.setNavigationBlocked(true);
|
this.props.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderSettings = () => {
|
renderSettings = () => {
|
||||||
const schema = this.props.schema;
|
const schema = this.props.schema;
|
||||||
@@ -995,17 +995,17 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
};
|
||||||
|
|
||||||
closeTooltip = () => {
|
closeTooltip = () => {
|
||||||
this.setState({errorTooltip: false});
|
this.setState({errorTooltip: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
openTooltip = (e) => {
|
openTooltip = (e) => {
|
||||||
const elm = e.currentTarget.querySelector('.control-label');
|
const elm = e.currentTarget.querySelector('.control-label');
|
||||||
const isElipsis = elm.offsetWidth < elm.scrollWidth;
|
const isElipsis = elm.offsetWidth < elm.scrollWidth;
|
||||||
this.setState({errorTooltip: isElipsis});
|
this.setState({errorTooltip: isElipsis});
|
||||||
}
|
};
|
||||||
|
|
||||||
doSubmit = async (getStateFromConfig) => {
|
doSubmit = async (getStateFromConfig) => {
|
||||||
// clone config so that we aren't modifying data in the stores
|
// clone config so that we aren't modifying data in the stores
|
||||||
@@ -1106,7 +1106,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
};
|
||||||
|
|
||||||
canSave = () => {
|
canSave = () => {
|
||||||
if (!this.props.schema || !this.props.schema.settings) {
|
if (!this.props.schema || !this.props.schema.settings) {
|
||||||
@@ -1143,7 +1143,7 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
|
|
||||||
render = () => {
|
render = () => {
|
||||||
const schema = this.props.schema;
|
const schema = this.props.schema;
|
||||||
@@ -1238,5 +1238,5 @@ export default class SchemaAdminSettings extends React.PureComponent {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,21 +46,21 @@ export default class LogList extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
isSearching = (term: string, filters: ChannelSearchOpts) => {
|
isSearching = (term: string, filters: ChannelSearchOpts) => {
|
||||||
return term.length > 0 || Object.keys(filters).length > 0;
|
return term.length > 0 || Object.keys(filters).length > 0;
|
||||||
}
|
};
|
||||||
|
|
||||||
onSearch = (term: string) => {
|
onSearch = (term: string) => {
|
||||||
this.props.onSearchChange(term);
|
this.props.onSearchChange(term);
|
||||||
}
|
};
|
||||||
|
|
||||||
nextPage = () => {
|
nextPage = () => {
|
||||||
const page = this.state.page + 1;
|
const page = this.state.page + 1;
|
||||||
this.setState({page});
|
this.setState({page});
|
||||||
}
|
};
|
||||||
|
|
||||||
previousPage = () => {
|
previousPage = () => {
|
||||||
const page = this.state.page - 1;
|
const page = this.state.page - 1;
|
||||||
this.setState({page});
|
this.setState({page});
|
||||||
}
|
};
|
||||||
|
|
||||||
getPaginationProps = (): {startCount: number; endCount: number; total: number} => {
|
getPaginationProps = (): {startCount: number; endCount: number; total: number} => {
|
||||||
const {page} = this.state;
|
const {page} = this.state;
|
||||||
@@ -73,12 +73,12 @@ export default class LogList extends React.PureComponent<Props, State> {
|
|||||||
endCount = endCount > total ? total : endCount;
|
endCount = endCount > total ? total : endCount;
|
||||||
|
|
||||||
return {startCount, endCount, total};
|
return {startCount, endCount, total};
|
||||||
}
|
};
|
||||||
|
|
||||||
handleDateSort = () => {
|
handleDateSort = () => {
|
||||||
this.setState({dateAsc: !this.state.dateAsc});
|
this.setState({dateAsc: !this.state.dateAsc});
|
||||||
this.getColumns(this.state.dateAsc);
|
this.getColumns(this.state.dateAsc);
|
||||||
}
|
};
|
||||||
|
|
||||||
getColumns = (dateAsc: boolean): Column[] => {
|
getColumns = (dateAsc: boolean): Column[] => {
|
||||||
const timestamp: JSX.Element = (
|
const timestamp: JSX.Element = (
|
||||||
@@ -155,7 +155,7 @@ export default class LogList extends React.PureComponent<Props, State> {
|
|||||||
width: 1,
|
width: 1,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
};
|
||||||
|
|
||||||
getRows = (): Row[] => {
|
getRows = (): Row[] => {
|
||||||
const {startCount, endCount} = this.getPaginationProps();
|
const {startCount, endCount} = this.getPaginationProps();
|
||||||
@@ -219,21 +219,21 @@ export default class LogList extends React.PureComponent<Props, State> {
|
|||||||
onClick: () => this.showFullLogEvent(log),
|
onClick: () => this.showFullLogEvent(log),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
showFullLogEvent = (log: LogObject) => {
|
showFullLogEvent = (log: LogObject) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
modalLog: log,
|
modalLog: log,
|
||||||
modalOpen: true,
|
modalOpen: true,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
hideModal = () => {
|
hideModal = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
modalLog: null,
|
modalLog: null,
|
||||||
modalOpen: false,
|
modalOpen: false,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
onFilter = (filterOptions: FilterOptions) => {
|
onFilter = (filterOptions: FilterOptions) => {
|
||||||
const filters = {} as unknown as LogFilter;
|
const filters = {} as unknown as LogFilter;
|
||||||
@@ -249,17 +249,17 @@ export default class LogList extends React.PureComponent<Props, State> {
|
|||||||
}, []);
|
}, []);
|
||||||
}
|
}
|
||||||
this.props.onFiltersChange(filters);
|
this.props.onFiltersChange(filters);
|
||||||
}
|
};
|
||||||
|
|
||||||
showErrors = () => {
|
showErrors = () => {
|
||||||
this.props.onFiltersChange({logLevels: ['error']} as unknown as LogFilter);
|
this.props.onFiltersChange({logLevels: ['error']} as unknown as LogFilter);
|
||||||
}
|
};
|
||||||
|
|
||||||
getErrorCount = (): number => {
|
getErrorCount = (): number => {
|
||||||
let n = 0;
|
let n = 0;
|
||||||
this.props.logs.map((log) => log.level === 'error' && ++n);
|
this.props.logs.map((log) => log.level === 'error' && ++n);
|
||||||
return n;
|
return n;
|
||||||
}
|
};
|
||||||
|
|
||||||
render = (): JSX.Element => {
|
render = (): JSX.Element => {
|
||||||
const {search} = this.props;
|
const {search} = this.props;
|
||||||
@@ -377,5 +377,5 @@ export default class LogList extends React.PureComponent<Props, State> {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,11 +57,11 @@ export default class Logs extends React.PureComponent<Props, State> {
|
|||||||
dateTo: this.state.dateTo,
|
dateTo: this.state.dateTo,
|
||||||
});
|
});
|
||||||
this.setState({loadingLogs: false});
|
this.setState({loadingLogs: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
onSearchChange = (search: string) => {
|
onSearchChange = (search: string) => {
|
||||||
this.setState({search}, () => this.performSearch());
|
this.setState({search}, () => this.performSearch());
|
||||||
}
|
};
|
||||||
|
|
||||||
performSearch = debounce(() => {
|
performSearch = debounce(() => {
|
||||||
const {search} = this.state;
|
const {search} = this.state;
|
||||||
@@ -74,7 +74,7 @@ export default class Logs extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
onFiltersChange = ({dateFrom, dateTo, logLevels, serverNames}: LogFilter) => {
|
onFiltersChange = ({dateFrom, dateTo, logLevels, serverNames}: LogFilter) => {
|
||||||
this.setState({dateFrom, dateTo, logLevels, serverNames}, () => this.reload());
|
this.setState({dateFrom, dateTo, logLevels, serverNames}, () => this.reload());
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export default class SessionLengthSettings extends AdminSettings {
|
|||||||
config.ServiceSettings.SessionIdleTimeoutInMinutes = this.parseIntZeroOrMin(this.state.sessionIdleTimeoutInMinutes, MINIMUM_IDLE_TIMEOUT);
|
config.ServiceSettings.SessionIdleTimeoutInMinutes = this.parseIntZeroOrMin(this.state.sessionIdleTimeoutInMinutes, MINIMUM_IDLE_TIMEOUT);
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
};
|
||||||
|
|
||||||
getStateFromConfig(config) {
|
getStateFromConfig(config) {
|
||||||
return {
|
return {
|
||||||
@@ -204,5 +204,5 @@ export default class SessionLengthSettings extends AdminSettings {
|
|||||||
{sessionTimeoutSetting}
|
{sessionTimeoutSetting}
|
||||||
</SettingsGroup>
|
</SettingsGroup>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,11 +76,11 @@ export default class AddUsersToRoleModal extends React.PureComponent<Props, Stat
|
|||||||
componentDidMount = async () => {
|
componentDidMount = async () => {
|
||||||
await this.props.actions.getProfiles(0, USERS_PER_PAGE * 2);
|
await this.props.actions.getProfiles(0, USERS_PER_PAGE * 2);
|
||||||
this.setUsersLoadingState(false);
|
this.setUsersLoadingState(false);
|
||||||
}
|
};
|
||||||
|
|
||||||
setUsersLoadingState = (loading: boolean) => {
|
setUsersLoadingState = (loading: boolean) => {
|
||||||
this.setState({loading});
|
this.setState({loading});
|
||||||
}
|
};
|
||||||
|
|
||||||
search = async (term: string) => {
|
search = async (term: string) => {
|
||||||
this.setUsersLoadingState(true);
|
this.setUsersLoadingState(true);
|
||||||
@@ -93,17 +93,17 @@ export default class AddUsersToRoleModal extends React.PureComponent<Props, Stat
|
|||||||
await this.props.actions.getProfiles(0, USERS_PER_PAGE * 2);
|
await this.props.actions.getProfiles(0, USERS_PER_PAGE * 2);
|
||||||
}
|
}
|
||||||
this.setState({loading: false, searchResults, term});
|
this.setState({loading: false, searchResults, term});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleHide = () => {
|
handleHide = () => {
|
||||||
this.setState({show: false});
|
this.setState({show: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleExit = () => {
|
handleExit = () => {
|
||||||
if (this.props.onExited) {
|
if (this.props.onExited) {
|
||||||
this.props.onExited();
|
this.props.onExited();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
renderOption = (option: UserProfileValue, isSelected: boolean, onAdd: (user: UserProfileValue) => void, onMouseMove: (user: UserProfileValue) => void) => {
|
renderOption = (option: UserProfileValue, isSelected: boolean, onAdd: (user: UserProfileValue) => void, onMouseMove: (user: UserProfileValue) => void) => {
|
||||||
let rowSelected = '';
|
let rowSelected = '';
|
||||||
@@ -137,15 +137,15 @@ export default class AddUsersToRoleModal extends React.PureComponent<Props, Stat
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderValue = (value: { data: UserProfileValue }): string => {
|
renderValue = (value: { data: UserProfileValue }): string => {
|
||||||
return value.data?.username || '';
|
return value.data?.username || '';
|
||||||
}
|
};
|
||||||
|
|
||||||
renderAriaLabel = (option: UserProfileValue): string => {
|
renderAriaLabel = (option: UserProfileValue): string => {
|
||||||
return option?.username || '';
|
return option?.username || '';
|
||||||
}
|
};
|
||||||
|
|
||||||
handleAdd = (value: UserProfileValue) => {
|
handleAdd = (value: UserProfileValue) => {
|
||||||
const values: UserProfileValue[] = [...this.state.values];
|
const values: UserProfileValue[] = [...this.state.values];
|
||||||
@@ -153,11 +153,11 @@ export default class AddUsersToRoleModal extends React.PureComponent<Props, Stat
|
|||||||
values.push(value);
|
values.push(value);
|
||||||
}
|
}
|
||||||
this.setState({values});
|
this.setState({values});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleDelete = (values: UserProfileValue[]) => {
|
handleDelete = (values: UserProfileValue[]) => {
|
||||||
this.setState({values});
|
this.setState({values});
|
||||||
}
|
};
|
||||||
|
|
||||||
handlePageChange = (page: number, prevPage: number) => {
|
handlePageChange = (page: number, prevPage: number) => {
|
||||||
if (page > prevPage) {
|
if (page > prevPage) {
|
||||||
@@ -171,7 +171,7 @@ export default class AddUsersToRoleModal extends React.PureComponent<Props, Stat
|
|||||||
handleSubmit = () => {
|
handleSubmit = () => {
|
||||||
this.props.onAddCallback(this.state.values);
|
this.props.onAddCallback(this.state.values);
|
||||||
this.handleHide();
|
this.handleHide();
|
||||||
}
|
};
|
||||||
|
|
||||||
render = (): JSX.Element => {
|
render = (): JSX.Element => {
|
||||||
const numRemainingText = (
|
const numRemainingText = (
|
||||||
@@ -265,5 +265,5 @@ export default class AddUsersToRoleModal extends React.PureComponent<Props, Stat
|
|||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export default class SystemRole extends React.PureComponent<Props, State> {
|
|||||||
saveNeeded = saveNeeded || difference(updatedRolePermissions, role.permissions).length > 0 || difference(role.permissions, updatedRolePermissions).length > 0;
|
saveNeeded = saveNeeded || difference(updatedRolePermissions, role.permissions).length > 0 || difference(role.permissions, updatedRolePermissions).length > 0;
|
||||||
}
|
}
|
||||||
return saveNeeded;
|
return saveNeeded;
|
||||||
}
|
};
|
||||||
|
|
||||||
addUsersToRole = (users: UserProfile[]) => {
|
addUsersToRole = (users: UserProfile[]) => {
|
||||||
const {actions: {setNavigationBlocked}} = this.props;
|
const {actions: {setNavigationBlocked}} = this.props;
|
||||||
@@ -95,7 +95,7 @@ export default class SystemRole extends React.PureComponent<Props, State> {
|
|||||||
const saveNeeded = this.getSaveStateNeeded({usersToAdd, usersToRemove});
|
const saveNeeded = this.getSaveStateNeeded({usersToAdd, usersToRemove});
|
||||||
setNavigationBlocked(saveNeeded);
|
setNavigationBlocked(saveNeeded);
|
||||||
this.setState({usersToAdd, usersToRemove, saveNeeded});
|
this.setState({usersToAdd, usersToRemove, saveNeeded});
|
||||||
}
|
};
|
||||||
|
|
||||||
removeUserFromRole = (user: UserProfile) => {
|
removeUserFromRole = (user: UserProfile) => {
|
||||||
const {actions: {setNavigationBlocked}} = this.props;
|
const {actions: {setNavigationBlocked}} = this.props;
|
||||||
@@ -114,7 +114,7 @@ export default class SystemRole extends React.PureComponent<Props, State> {
|
|||||||
const saveNeeded = this.getSaveStateNeeded({usersToAdd, usersToRemove});
|
const saveNeeded = this.getSaveStateNeeded({usersToAdd, usersToRemove});
|
||||||
setNavigationBlocked(saveNeeded);
|
setNavigationBlocked(saveNeeded);
|
||||||
this.setState({usersToRemove, usersToAdd, saveNeeded});
|
this.setState({usersToRemove, usersToAdd, saveNeeded});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleSubmit = async () => {
|
handleSubmit = async () => {
|
||||||
this.setState({saving: true, saveNeeded: false});
|
this.setState({saving: true, saveNeeded: false});
|
||||||
@@ -189,7 +189,7 @@ export default class SystemRole extends React.PureComponent<Props, State> {
|
|||||||
usersToRemove: {},
|
usersToRemove: {},
|
||||||
saveKey,
|
saveKey,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
updatePermissions = (permissions: PermissionToUpdate[]) => {
|
updatePermissions = (permissions: PermissionToUpdate[]) => {
|
||||||
const {role, actions: {setNavigationBlocked}} = this.props;
|
const {role, actions: {setNavigationBlocked}} = this.props;
|
||||||
@@ -235,7 +235,7 @@ export default class SystemRole extends React.PureComponent<Props, State> {
|
|||||||
...nextState,
|
...nextState,
|
||||||
saveNeeded: this.getSaveStateNeeded(nextState),
|
saveNeeded: this.getSaveStateNeeded(nextState),
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {usersToAdd, usersToRemove, saving, saveNeeded, serverError, permissionsToUpdate, saveKey} = this.state;
|
const {usersToAdd, usersToRemove, saving, saveNeeded, serverError, permissionsToUpdate, saveKey} = this.state;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export default class SystemRolePermission extends React.PureComponent<Props> {
|
|||||||
return visibleSections[section.name];
|
return visibleSections[section.name];
|
||||||
}
|
}
|
||||||
return this.getAccessForSection(section, permissionsMap, permissionsToUpdate) === mixedAccess;
|
return this.getAccessForSection(section, permissionsMap, permissionsToUpdate) === mixedAccess;
|
||||||
}
|
};
|
||||||
|
|
||||||
renderSubsectionToggle = (section: SystemSection, isSectionVisible: boolean) => {
|
renderSubsectionToggle = (section: SystemSection, isSectionVisible: boolean) => {
|
||||||
if (!section.subsections || section.subsections.length === 0) {
|
if (!section.subsections || section.subsections.length === 0) {
|
||||||
@@ -59,7 +59,7 @@ export default class SystemRolePermission extends React.PureComponent<Props> {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderSubsections = (section: SystemSection, permissionsMap: Record<string, boolean>, permissionsToUpdate: PermissionsToUpdate, isSectionVisible: boolean) => {
|
renderSubsections = (section: SystemSection, permissionsMap: Record<string, boolean>, permissionsToUpdate: PermissionsToUpdate, isSectionVisible: boolean) => {
|
||||||
if (!section.subsections || section.subsections.length === 0) {
|
if (!section.subsections || section.subsections.length === 0) {
|
||||||
@@ -74,7 +74,7 @@ export default class SystemRolePermission extends React.PureComponent<Props> {
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderSectionRow = (section: SystemSection, permissionsMap: Record<string, boolean>, permissionsToUpdate: PermissionsToUpdate, isSectionVisible: boolean) => {
|
renderSectionRow = (section: SystemSection, permissionsMap: Record<string, boolean>, permissionsToUpdate: PermissionsToUpdate, isSectionVisible: boolean) => {
|
||||||
return (
|
return (
|
||||||
@@ -111,7 +111,7 @@ export default class SystemRolePermission extends React.PureComponent<Props> {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
getAccessForSection = (section: SystemSection, permissions: Record<string, boolean>, permissionsToUpdate: Record<string, PermissionAccess>) => {
|
getAccessForSection = (section: SystemSection, permissions: Record<string, boolean>, permissionsToUpdate: Record<string, PermissionAccess>) => {
|
||||||
// If we have subsections then use them to determine access to show.
|
// If we have subsections then use them to determine access to show.
|
||||||
@@ -145,7 +145,7 @@ export default class SystemRolePermission extends React.PureComponent<Props> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.getAccessForSectionByName(section.name, permissions, permissionsToUpdate);
|
return this.getAccessForSectionByName(section.name, permissions, permissionsToUpdate);
|
||||||
}
|
};
|
||||||
|
|
||||||
getAccessForSectionByName = (sectionName: string, permissions: Record<string, boolean>, permissionsToUpdate: Record<string, PermissionAccess>) => {
|
getAccessForSectionByName = (sectionName: string, permissions: Record<string, boolean>, permissionsToUpdate: Record<string, PermissionAccess>) => {
|
||||||
// Assume sysadmin has write access for everything, this is a bit of a hack but it should be left in until `user_management_read|write_system_roles` is actually a permission
|
// Assume sysadmin has write access for everything, this is a bit of a hack but it should be left in until `user_management_read|write_system_roles` is actually a permission
|
||||||
@@ -167,7 +167,7 @@ export default class SystemRolePermission extends React.PureComponent<Props> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return access;
|
return access;
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {section, permissionsMap, permissionsToUpdate, visibleSections} = this.props;
|
const {section, permissionsMap, permissionsToUpdate, visibleSections} = this.props;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export default class SystemRolePermissionDropdown extends React.PureComponent<Pr
|
|||||||
permissions.push({name: section.name, value});
|
permissions.push({name: section.name, value});
|
||||||
}
|
}
|
||||||
this.props.updatePermissions(permissions);
|
this.props.updatePermissions(permissions);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderOption = (label: JSX.Element, description: JSX.Element) => {
|
renderOption = (label: JSX.Element, description: JSX.Element) => {
|
||||||
return (
|
return (
|
||||||
@@ -50,7 +50,7 @@ export default class SystemRolePermissionDropdown extends React.PureComponent<Pr
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {isDisabled, section} = this.props;
|
const {isDisabled, section} = this.props;
|
||||||
|
|||||||
@@ -181,11 +181,11 @@ export default class SystemRolePermissions extends React.PureComponent<Props, St
|
|||||||
if (sectionIndex > -1) {
|
if (sectionIndex > -1) {
|
||||||
sectionsList.splice(sectionIndex, 1);
|
sectionsList.splice(sectionIndex, 1);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
updatePermissions = (permissions: PermissionToUpdate[]) => {
|
updatePermissions = (permissions: PermissionToUpdate[]) => {
|
||||||
this.props.updatePermissions(permissions);
|
this.props.updatePermissions(permissions);
|
||||||
}
|
};
|
||||||
|
|
||||||
setSectionVisible = (name: string, visible: boolean) => {
|
setSectionVisible = (name: string, visible: boolean) => {
|
||||||
const {visibleSections} = this.state;
|
const {visibleSections} = this.state;
|
||||||
@@ -195,7 +195,7 @@ export default class SystemRolePermissions extends React.PureComponent<Props, St
|
|||||||
[name]: visible,
|
[name]: visible,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
getRows = (permissionsMap: Record<string, boolean>, permissionsToUpdate: PermissionsToUpdate, visibleSections: Record<string, boolean>) => {
|
getRows = (permissionsMap: Record<string, boolean>, permissionsToUpdate: PermissionsToUpdate, visibleSections: Record<string, boolean>) => {
|
||||||
const {isLicensedForCloud} = this.props;
|
const {isLicensedForCloud} = this.props;
|
||||||
@@ -257,7 +257,7 @@ export default class SystemRolePermissions extends React.PureComponent<Props, St
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {role, permissionsToUpdate} = this.props;
|
const {role, permissionsToUpdate} = this.props;
|
||||||
|
|||||||
@@ -106,14 +106,14 @@ export default class SystemRoleUsers extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
setStateLoading = (loading: boolean) => {
|
setStateLoading = (loading: boolean) => {
|
||||||
this.setState({loading});
|
this.setState({loading});
|
||||||
}
|
};
|
||||||
|
|
||||||
getVisibleTotalCount = (): number => {
|
getVisibleTotalCount = (): number => {
|
||||||
const {usersToRemove, usersToAdd, totalCount} = this.props;
|
const {usersToRemove, usersToAdd, totalCount} = this.props;
|
||||||
const usersToAddCount = Object.keys(usersToAdd).length;
|
const usersToAddCount = Object.keys(usersToAdd).length;
|
||||||
const usersToRemoveCount = Object.keys(usersToRemove).length;
|
const usersToRemoveCount = Object.keys(usersToRemove).length;
|
||||||
return totalCount + (usersToAddCount - usersToRemoveCount);
|
return totalCount + (usersToAddCount - usersToRemoveCount);
|
||||||
}
|
};
|
||||||
|
|
||||||
getPaginationProps = (): {startCount: number; endCount: number; total: number} => {
|
getPaginationProps = (): {startCount: number; endCount: number; total: number} => {
|
||||||
const {term, usersToRemove, usersToAdd} = this.props;
|
const {term, usersToRemove, usersToAdd} = this.props;
|
||||||
@@ -138,11 +138,11 @@ export default class SystemRoleUsers extends React.PureComponent<Props, State> {
|
|||||||
endCount = endCount > total ? total : endCount;
|
endCount = endCount > total ? total : endCount;
|
||||||
|
|
||||||
return {startCount, endCount, total};
|
return {startCount, endCount, total};
|
||||||
}
|
};
|
||||||
|
|
||||||
onSearch = async (term: string) => {
|
onSearch = async (term: string) => {
|
||||||
this.props.actions.setUserGridSearch(term);
|
this.props.actions.setUserGridSearch(term);
|
||||||
}
|
};
|
||||||
|
|
||||||
nextPage = async () => {
|
nextPage = async () => {
|
||||||
if (this.state.loading) {
|
if (this.state.loading) {
|
||||||
@@ -152,14 +152,14 @@ export default class SystemRoleUsers extends React.PureComponent<Props, State> {
|
|||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
await this.props.actions.getProfiles(page, USERS_PER_PAGE, {role: this.props.role.name});
|
await this.props.actions.getProfiles(page, USERS_PER_PAGE, {role: this.props.role.name});
|
||||||
this.setState({loading: false, page});
|
this.setState({loading: false, page});
|
||||||
}
|
};
|
||||||
|
|
||||||
previousPage = async () => {
|
previousPage = async () => {
|
||||||
if (this.state.loading || this.state.page === 0) {
|
if (this.state.loading || this.state.page === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setState({page: this.state.page - 1});
|
this.setState({page: this.state.page - 1});
|
||||||
}
|
};
|
||||||
|
|
||||||
getRows = () => {
|
getRows = () => {
|
||||||
const {users, readOnly, usersToAdd, usersToRemove} = this.props;
|
const {users, readOnly, usersToAdd, usersToRemove} = this.props;
|
||||||
@@ -198,7 +198,7 @@ export default class SystemRoleUsers extends React.PureComponent<Props, State> {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
getColumns = () => {
|
getColumns = () => {
|
||||||
const name: JSX.Element = (
|
const name: JSX.Element = (
|
||||||
@@ -228,15 +228,15 @@ export default class SystemRoleUsers extends React.PureComponent<Props, State> {
|
|||||||
fixed: true,
|
fixed: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
};
|
||||||
|
|
||||||
onAddCallback = (users: UserProfile[]) => {
|
onAddCallback = (users: UserProfile[]) => {
|
||||||
this.props.onAddCallback(users);
|
this.props.onAddCallback(users);
|
||||||
}
|
};
|
||||||
|
|
||||||
onRemoveCallback = (user: UserProfile) => {
|
onRemoveCallback = (user: UserProfile) => {
|
||||||
this.props.onRemoveCallback(user);
|
this.props.onRemoveCallback(user);
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {page, loading} = this.state;
|
const {page, loading} = this.state;
|
||||||
|
|||||||
@@ -108,11 +108,11 @@ export default class SystemUserDetail extends React.PureComponent<Props & RouteC
|
|||||||
this.setState({teams});
|
this.setState({teams});
|
||||||
this.setState({teamIds});
|
this.setState({teamIds});
|
||||||
this.setState({refreshTeams: false});
|
this.setState({refreshTeams: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
openAddTeam = (): void => {
|
openAddTeam = (): void => {
|
||||||
this.setState({addTeamOpen: true});
|
this.setState({addTeamOpen: true});
|
||||||
}
|
};
|
||||||
|
|
||||||
addTeams = (teams: Team[]): void => {
|
addTeams = (teams: Team[]): void => {
|
||||||
const promises = [];
|
const promises = [];
|
||||||
@@ -120,63 +120,63 @@ export default class SystemUserDetail extends React.PureComponent<Props & RouteC
|
|||||||
promises.push(this.props.actions.addUserToTeam(team.id, this.props.user.id));
|
promises.push(this.props.actions.addUserToTeam(team.id, this.props.user.id));
|
||||||
}
|
}
|
||||||
Promise.all(promises).finally(() => this.setState({refreshTeams: true}));
|
Promise.all(promises).finally(() => this.setState({refreshTeams: true}));
|
||||||
}
|
};
|
||||||
|
|
||||||
closeAddTeam = (): void => {
|
closeAddTeam = (): void => {
|
||||||
this.setState({addTeamOpen: false});
|
this.setState({addTeamOpen: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
doPasswordReset = (user: UserProfile): void => {
|
doPasswordReset = (user: UserProfile): void => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showPasswordModal: true,
|
showPasswordModal: true,
|
||||||
user,
|
user,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
doPasswordResetDismiss = (): void => {
|
doPasswordResetDismiss = (): void => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showPasswordModal: false,
|
showPasswordModal: false,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
doPasswordResetSubmit = (): void => {
|
doPasswordResetSubmit = (): void => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showPasswordModal: false,
|
showPasswordModal: false,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleMakeActive = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>): void => {
|
handleMakeActive = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>): void => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.props.actions.updateUserActive(this.props.user.id, true).
|
this.props.actions.updateUserActive(this.props.user.id, true).
|
||||||
then((data) => this.onUpdateActiveResult(data.error));
|
then((data) => this.onUpdateActiveResult(data.error));
|
||||||
}
|
};
|
||||||
|
|
||||||
handleShowDeactivateMemberModal = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>): void => {
|
handleShowDeactivateMemberModal = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>): void => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.setState({showDeactivateMemberModal: true});
|
this.setState({showDeactivateMemberModal: true});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleDeactivateMember = (): void => {
|
handleDeactivateMember = (): void => {
|
||||||
this.props.actions.updateUserActive(this.props.user.id, false).
|
this.props.actions.updateUserActive(this.props.user.id, false).
|
||||||
then((data) => this.onUpdateActiveResult(data.error));
|
then((data) => this.onUpdateActiveResult(data.error));
|
||||||
this.setState({showDeactivateMemberModal: false});
|
this.setState({showDeactivateMemberModal: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
onUpdateActiveResult = (error: ServerError): void => {
|
onUpdateActiveResult = (error: ServerError): void => {
|
||||||
if (error) {
|
if (error) {
|
||||||
this.setState({error});
|
this.setState({error});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
handleDeactivateCancel = (): void => {
|
handleDeactivateCancel = (): void => {
|
||||||
this.setState({showDeactivateMemberModal: false});
|
this.setState({showDeactivateMemberModal: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
// TODO: add error handler function
|
// TODO: add error handler function
|
||||||
handleResetMfa = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>): void => {
|
handleResetMfa = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>): void => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
adminResetMfa(this.props.user.id, null, null);
|
adminResetMfa(this.props.user.id, null, null);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleEmailChange = (e: React.ChangeEvent<HTMLInputElement>): void => {
|
handleEmailChange = (e: React.ChangeEvent<HTMLInputElement>): void => {
|
||||||
const emailChanged = e.target.value !== this.props.user.email;
|
const emailChanged = e.target.value !== this.props.user.email;
|
||||||
@@ -187,7 +187,7 @@ export default class SystemUserDetail extends React.PureComponent<Props & RouteC
|
|||||||
saveNeeded: emailChanged,
|
saveNeeded: emailChanged,
|
||||||
});
|
});
|
||||||
this.props.actions.setNavigationBlocked(emailChanged);
|
this.props.actions.setNavigationBlocked(emailChanged);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleSubmit = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>): void => {
|
handleSubmit = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>): void => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -220,7 +220,7 @@ export default class SystemUserDetail extends React.PureComponent<Props & RouteC
|
|||||||
});
|
});
|
||||||
this.props.actions.setNavigationBlocked(false);
|
this.props.actions.setNavigationBlocked(false);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
renderDeactivateMemberModal = (user: UserProfile): React.ReactNode => {
|
renderDeactivateMemberModal = (user: UserProfile): React.ReactNode => {
|
||||||
const title = (
|
const title = (
|
||||||
@@ -279,7 +279,7 @@ export default class SystemUserDetail extends React.PureComponent<Props & RouteC
|
|||||||
onCancel={this.handleDeactivateCancel}
|
onCancel={this.handleDeactivateCancel}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderActivateDeactivate = (): React.ReactNode => {
|
renderActivateDeactivate = (): React.ReactNode => {
|
||||||
if (this.props.user.delete_at > 0) {
|
if (this.props.user.delete_at > 0) {
|
||||||
@@ -302,7 +302,7 @@ export default class SystemUserDetail extends React.PureComponent<Props & RouteC
|
|||||||
{Utils.localizeMessage('admin.user_item.makeInactive', 'Deactivate')}
|
{Utils.localizeMessage('admin.user_item.makeInactive', 'Deactivate')}
|
||||||
</AdminButtonOutline>
|
</AdminButtonOutline>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderRemoveMFA = (): React.ReactNode => {
|
renderRemoveMFA = (): React.ReactNode => {
|
||||||
if (this.props.user.mfa_active) {
|
if (this.props.user.mfa_active) {
|
||||||
@@ -317,7 +317,7 @@ export default class SystemUserDetail extends React.PureComponent<Props & RouteC
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
};
|
||||||
|
|
||||||
getAuthenticationText(): string {
|
getAuthenticationText(): string {
|
||||||
const {user, mfaEnabled} = this.props;
|
const {user, mfaEnabled} = this.props;
|
||||||
|
|||||||
@@ -63,14 +63,14 @@ export default class AbstractList extends React.PureComponent<Props, State> {
|
|||||||
const page = this.state.page < 1 ? 0 : this.state.page - 1;
|
const page = this.state.page < 1 ? 0 : this.state.page - 1;
|
||||||
this.setState({page, loading: true});
|
this.setState({page, loading: true});
|
||||||
this.performSearch();
|
this.performSearch();
|
||||||
}
|
};
|
||||||
|
|
||||||
private nextPage = async (e: React.MouseEvent<HTMLButtonElement>): Promise<void> => {
|
private nextPage = async (e: React.MouseEvent<HTMLButtonElement>): Promise<void> => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const page = this.state.page + 1;
|
const page = this.state.page + 1;
|
||||||
this.setState({page, loading: true});
|
this.setState({page, loading: true});
|
||||||
this.performSearch();
|
this.performSearch();
|
||||||
}
|
};
|
||||||
|
|
||||||
private performSearch = (): void => {
|
private performSearch = (): void => {
|
||||||
const userId = this.props.userId;
|
const userId = this.props.userId;
|
||||||
@@ -83,7 +83,7 @@ export default class AbstractList extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
this.setState({loading: false});
|
this.setState({loading: false});
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
private getPaging(): Paging {
|
private getPaging(): Paging {
|
||||||
const startCount = (this.state.page * PAGE_SIZE) + 1;
|
const startCount = (this.state.page * PAGE_SIZE) + 1;
|
||||||
@@ -110,7 +110,7 @@ export default class AbstractList extends React.PureComponent<Props, State> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
};
|
||||||
|
|
||||||
private renderRows = (): JSX.Element | JSX.Element[] => {
|
private renderRows = (): JSX.Element | JSX.Element[] => {
|
||||||
if (this.state.loading) {
|
if (this.state.loading) {
|
||||||
@@ -134,7 +134,7 @@ export default class AbstractList extends React.PureComponent<Props, State> {
|
|||||||
const pageEnd = this.state.page < 1 ? PAGE_SIZE : (this.state.page + 1) * PAGE_SIZE; // ie 10, 20, 30, etc.
|
const pageEnd = this.state.page < 1 ? PAGE_SIZE : (this.state.page + 1) * PAGE_SIZE; // ie 10, 20, 30, etc.
|
||||||
const pageData = this.props.data.slice(pageStart, pageEnd).map(this.props.renderRow); // ie 0-10, 10-20, etc.
|
const pageData = this.props.data.slice(pageStart, pageEnd).map(this.props.renderRow); // ie 0-10, 10-20, etc.
|
||||||
return pageData;
|
return pageData;
|
||||||
}
|
};
|
||||||
|
|
||||||
public render = (): JSX.Element => {
|
public render = (): JSX.Element => {
|
||||||
const {startCount, endCount, total} = this.getPaging();
|
const {startCount, endCount, total} = this.getPaging();
|
||||||
@@ -179,6 +179,6 @@ export default class AbstractList extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
emptyListTextId: t('admin.team_settings.team_list.no_teams_found'),
|
emptyListTextId: t('admin.team_settings.team_list.no_teams_found'),
|
||||||
emptyListTextDefaultMessage: 'No teams found',
|
emptyListTextDefaultMessage: 'No teams found',
|
||||||
refreshTeams: false,
|
refreshTeams: false,
|
||||||
}
|
};
|
||||||
|
|
||||||
public constructor(props: Props) {
|
public constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
@@ -100,7 +100,7 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
this.setState({teamsWithMemberships});
|
this.setState({teamsWithMemberships});
|
||||||
this.props.userDetailCallback(teamsWithMemberships);
|
this.props.userDetailCallback(teamsWithMemberships);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// check this out
|
// check this out
|
||||||
private mergeTeamsWithMemberships = (data: [{data: Team[]}, {data: TeamMembership[]}]): TeamWithMembership[] => {
|
private mergeTeamsWithMemberships = (data: [{data: Team[]}, {data: TeamMembership[]}]): TeamWithMembership[] => {
|
||||||
@@ -113,7 +113,7 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
});
|
});
|
||||||
teamsWithMemberships = filterAndSortTeamsByDisplayName(teamsWithMemberships, this.props.locale);
|
teamsWithMemberships = filterAndSortTeamsByDisplayName(teamsWithMemberships, this.props.locale);
|
||||||
return teamsWithMemberships;
|
return teamsWithMemberships;
|
||||||
}
|
};
|
||||||
|
|
||||||
private doRemoveUserFromTeam = async (teamId: string): Promise<void> => {
|
private doRemoveUserFromTeam = async (teamId: string): Promise<void> => {
|
||||||
const {error} = await this.props.actions.removeUserFromTeam(teamId, this.props.userId);
|
const {error} = await this.props.actions.removeUserFromTeam(teamId, this.props.userId);
|
||||||
@@ -122,7 +122,7 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
} else {
|
} else {
|
||||||
this.getTeamsAndMemberships();
|
this.getTeamsAndMemberships();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
private doMakeUserTeamAdmin = async (teamId: string) => {
|
private doMakeUserTeamAdmin = async (teamId: string) => {
|
||||||
const {error} = await this.props.actions.updateTeamMemberSchemeRoles(teamId, this.props.userId, true, true);
|
const {error} = await this.props.actions.updateTeamMemberSchemeRoles(teamId, this.props.userId, true, true);
|
||||||
@@ -131,7 +131,7 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
} else {
|
} else {
|
||||||
this.getTeamsAndMemberships();
|
this.getTeamsAndMemberships();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
private doMakeUserTeamMember = async (teamId: string) => {
|
private doMakeUserTeamMember = async (teamId: string) => {
|
||||||
const {error} = await this.props.actions.updateTeamMemberSchemeRoles(teamId, this.props.userId, true, false);
|
const {error} = await this.props.actions.updateTeamMemberSchemeRoles(teamId, this.props.userId, true, false);
|
||||||
@@ -140,7 +140,7 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
} else {
|
} else {
|
||||||
this.getTeamsAndMemberships();
|
this.getTeamsAndMemberships();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
let serverError = null;
|
let serverError = null;
|
||||||
@@ -179,5 +179,5 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
readOnly={this.props.readOnly}
|
readOnly={this.props.readOnly}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export default class TeamRow extends React.PureComponent<Props> {
|
|||||||
defaultMessage={'Invite only'}
|
defaultMessage={'Invite only'}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
private renderTeamRole = (team: TeamWithMembership) => {
|
private renderTeamRole = (team: TeamWithMembership) => {
|
||||||
if (team.scheme_guest) {
|
if (team.scheme_guest) {
|
||||||
return (
|
return (
|
||||||
@@ -73,7 +73,7 @@ export default class TeamRow extends React.PureComponent<Props> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
};
|
||||||
public render = (): JSX.Element => {
|
public render = (): JSX.Element => {
|
||||||
const {team} = this.props;
|
const {team} = this.props;
|
||||||
const teamIconUrl = Utils.imageURLForTeam(team);
|
const teamIconUrl = Utils.imageURLForTeam(team);
|
||||||
|
|||||||
@@ -103,11 +103,11 @@ export default class SystemUsersList extends React.PureComponent<Props, State> {
|
|||||||
this.setState({page: this.state.page + 1});
|
this.setState({page: this.state.page + 1});
|
||||||
|
|
||||||
this.props.nextPage(this.state.page + 1);
|
this.props.nextPage(this.state.page + 1);
|
||||||
}
|
};
|
||||||
|
|
||||||
previousPage = () => {
|
previousPage = () => {
|
||||||
this.setState({page: this.state.page - 1});
|
this.setState({page: this.state.page - 1});
|
||||||
}
|
};
|
||||||
|
|
||||||
search = (term: string) => {
|
search = (term: string) => {
|
||||||
this.props.search(term);
|
this.props.search(term);
|
||||||
@@ -115,63 +115,63 @@ export default class SystemUsersList extends React.PureComponent<Props, State> {
|
|||||||
if (term !== '') {
|
if (term !== '') {
|
||||||
this.setState({page: 0});
|
this.setState({page: 0});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
doManageTeams = (user: UserProfile) => {
|
doManageTeams = (user: UserProfile) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showManageTeamsModal: true,
|
showManageTeamsModal: true,
|
||||||
user,
|
user,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
doManageRoles = (user: UserProfile) => {
|
doManageRoles = (user: UserProfile) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showManageRolesModal: true,
|
showManageRolesModal: true,
|
||||||
user,
|
user,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
doManageTokens = (user: UserProfile) => {
|
doManageTokens = (user: UserProfile) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showManageTokensModal: true,
|
showManageTokensModal: true,
|
||||||
user,
|
user,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
doManageTeamsDismiss = () => {
|
doManageTeamsDismiss = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showManageTeamsModal: false,
|
showManageTeamsModal: false,
|
||||||
user: undefined,
|
user: undefined,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
doManageRolesDismiss = () => {
|
doManageRolesDismiss = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showManageRolesModal: false,
|
showManageRolesModal: false,
|
||||||
user: undefined,
|
user: undefined,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
doManageTokensDismiss = () => {
|
doManageTokensDismiss = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showManageTokensModal: false,
|
showManageTokensModal: false,
|
||||||
user: undefined,
|
user: undefined,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
doPasswordReset = (user: UserProfile) => {
|
doPasswordReset = (user: UserProfile) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showPasswordModal: true,
|
showPasswordModal: true,
|
||||||
user,
|
user,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
doPasswordResetDismiss = () => {
|
doPasswordResetDismiss = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showPasswordModal: false,
|
showPasswordModal: false,
|
||||||
user: undefined,
|
user: undefined,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
doPasswordResetSubmit = (user?: UserProfile) => {
|
doPasswordResetSubmit = (user?: UserProfile) => {
|
||||||
if (user) {
|
if (user) {
|
||||||
@@ -182,21 +182,21 @@ export default class SystemUsersList extends React.PureComponent<Props, State> {
|
|||||||
showPasswordModal: false,
|
showPasswordModal: false,
|
||||||
user: undefined,
|
user: undefined,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
doEmailReset = (user: UserProfile) => {
|
doEmailReset = (user: UserProfile) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showEmailModal: true,
|
showEmailModal: true,
|
||||||
user,
|
user,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
doEmailResetDismiss = () => {
|
doEmailResetDismiss = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showEmailModal: false,
|
showEmailModal: false,
|
||||||
user: undefined,
|
user: undefined,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
doEmailResetSubmit = (user?: UserProfile) => {
|
doEmailResetSubmit = (user?: UserProfile) => {
|
||||||
if (user) {
|
if (user) {
|
||||||
@@ -207,7 +207,7 @@ export default class SystemUsersList extends React.PureComponent<Props, State> {
|
|||||||
showEmailModal: false,
|
showEmailModal: false,
|
||||||
user: undefined,
|
user: undefined,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
getInfoForUser(user: UserProfile) {
|
getInfoForUser(user: UserProfile) {
|
||||||
const info = [];
|
const info = [];
|
||||||
|
|||||||
@@ -164,23 +164,23 @@ export default class SystemUsers extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setState({loading: false});
|
this.setState({loading: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleTeamChange = (e: ChangeEvent<HTMLSelectElement>) => {
|
handleTeamChange = (e: ChangeEvent<HTMLSelectElement>) => {
|
||||||
const teamId = e.target.value;
|
const teamId = e.target.value;
|
||||||
this.loadDataForTeam(teamId, this.props.filter);
|
this.loadDataForTeam(teamId, this.props.filter);
|
||||||
this.props.actions.setSystemUsersSearch(this.props.searchTerm, teamId, this.props.filter);
|
this.props.actions.setSystemUsersSearch(this.props.searchTerm, teamId, this.props.filter);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleFilterChange = (e: ChangeEvent<HTMLSelectElement>) => {
|
handleFilterChange = (e: ChangeEvent<HTMLSelectElement>) => {
|
||||||
const filter = e.target.value;
|
const filter = e.target.value;
|
||||||
this.loadDataForTeam(this.props.teamId, filter);
|
this.loadDataForTeam(this.props.teamId, filter);
|
||||||
this.props.actions.setSystemUsersSearch(this.props.searchTerm, this.props.teamId, filter);
|
this.props.actions.setSystemUsersSearch(this.props.searchTerm, this.props.teamId, filter);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleTermChange = (term: string) => {
|
handleTermChange = (term: string) => {
|
||||||
this.props.actions.setSystemUsersSearch(term, this.props.teamId, this.props.filter);
|
this.props.actions.setSystemUsersSearch(term, this.props.teamId, this.props.filter);
|
||||||
}
|
};
|
||||||
handleRevokeAllSessions = async () => {
|
handleRevokeAllSessions = async () => {
|
||||||
const {data} = await this.props.actions.revokeSessionsForAllUsers();
|
const {data} = await this.props.actions.revokeSessionsForAllUsers();
|
||||||
if (data) {
|
if (data) {
|
||||||
@@ -188,13 +188,13 @@ export default class SystemUsers extends React.PureComponent<Props, State> {
|
|||||||
} else {
|
} else {
|
||||||
this.props.actions.logError({type: 'critical', message: 'Can\'t revoke all sessions'});
|
this.props.actions.logError({type: 'critical', message: 'Can\'t revoke all sessions'});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
handleRevokeAllSessionsCancel = () => {
|
handleRevokeAllSessionsCancel = () => {
|
||||||
this.setState({showRevokeAllSessionsModal: false});
|
this.setState({showRevokeAllSessionsModal: false});
|
||||||
}
|
};
|
||||||
handleShowRevokeAllSessionsModal = () => {
|
handleShowRevokeAllSessionsModal = () => {
|
||||||
this.setState({showRevokeAllSessionsModal: true});
|
this.setState({showRevokeAllSessionsModal: true});
|
||||||
}
|
};
|
||||||
|
|
||||||
nextPage = async (page: number) => {
|
nextPage = async (page: number) => {
|
||||||
const {teamId, filter} = this.props;
|
const {teamId, filter} = this.props;
|
||||||
@@ -216,7 +216,7 @@ export default class SystemUsers extends React.PureComponent<Props, State> {
|
|||||||
await loadProfilesAndTeamMembers(page + 1, USERS_PER_PAGE, teamId, options);
|
await loadProfilesAndTeamMembers(page + 1, USERS_PER_PAGE, teamId, options);
|
||||||
}
|
}
|
||||||
this.setState({loading: false});
|
this.setState({loading: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
doSearch = debounce(async (term, teamId = this.props.teamId, filter = this.props.filter) => {
|
doSearch = debounce(async (term, teamId = this.props.teamId, filter = this.props.filter) => {
|
||||||
if (!term) {
|
if (!term) {
|
||||||
@@ -250,7 +250,7 @@ export default class SystemUsers extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
await this.props.actions.getUser(id);
|
await this.props.actions.getUser(id);
|
||||||
this.setState({loading: false});
|
this.setState({loading: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
getUserByTokenOrId = async (id: string) => {
|
getUserByTokenOrId = async (id: string) => {
|
||||||
if (this.props.enableUserAccessTokens) {
|
if (this.props.enableUserAccessTokens) {
|
||||||
@@ -264,7 +264,7 @@ export default class SystemUsers extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.getUserById(id);
|
this.getUserById(id);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderRevokeAllUsersModal = () => {
|
renderRevokeAllUsersModal = () => {
|
||||||
const title = (
|
const title = (
|
||||||
@@ -302,7 +302,7 @@ export default class SystemUsers extends React.PureComponent<Props, State> {
|
|||||||
onCancel={this.handleRevokeAllSessionsCancel}
|
onCancel={this.handleRevokeAllSessionsCancel}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderFilterRow = (doSearch: ((event: React.FormEvent<HTMLInputElement>) => void) | undefined) => {
|
renderFilterRow = (doSearch: ((event: React.FormEvent<HTMLInputElement>) => void) | undefined) => {
|
||||||
const teams = this.props.teams.map((team) => (
|
const teams = this.props.teams.map((team) => (
|
||||||
@@ -363,7 +363,7 @@ export default class SystemUsers extends React.PureComponent<Props, State> {
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const revokeAllUsersModal = this.renderRevokeAllUsersModal();
|
const revokeAllUsersModal = this.renderRevokeAllUsersModal();
|
||||||
|
|||||||
@@ -86,40 +86,40 @@ export default class SystemUsersDropdown extends React.PureComponent<Props, Stat
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.props.actions.updateUserActive(this.props.user.id, true).
|
this.props.actions.updateUserActive(this.props.user.id, true).
|
||||||
then(this.onUpdateActiveResult);
|
then(this.onUpdateActiveResult);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleManageTeams = (e: {preventDefault: () => void}) => {
|
handleManageTeams = (e: {preventDefault: () => void}) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
this.props.doManageTeams(this.props.user);
|
this.props.doManageTeams(this.props.user);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleManageRoles = (e: {preventDefault: () => void}) => {
|
handleManageRoles = (e: {preventDefault: () => void}) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
this.props.doManageRoles(this.props.user);
|
this.props.doManageRoles(this.props.user);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleManageTokens = (e: {preventDefault: () => void}) => {
|
handleManageTokens = (e: {preventDefault: () => void}) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
this.props.doManageTokens(this.props.user);
|
this.props.doManageTokens(this.props.user);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleResetPassword = (e: {preventDefault: () => void}) => {
|
handleResetPassword = (e: {preventDefault: () => void}) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.props.doPasswordReset(this.props.user);
|
this.props.doPasswordReset(this.props.user);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleResetEmail = (e: {preventDefault: () => void}) => {
|
handleResetEmail = (e: {preventDefault: () => void}) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.props.doEmailReset(this.props.user);
|
this.props.doEmailReset(this.props.user);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleResetMfa = (e: {preventDefault: () => void}) => {
|
handleResetMfa = (e: {preventDefault: () => void}) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
adminResetMfa(this.props.user.id, null, this.props.onError);
|
adminResetMfa(this.props.user.id, null, this.props.onError);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleShowDeactivateMemberModal = async (e: {preventDefault: () => void}) => {
|
handleShowDeactivateMemberModal = async (e: {preventDefault: () => void}) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -130,23 +130,23 @@ export default class SystemUsersDropdown extends React.PureComponent<Props, Stat
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.setState({showDeactivateMemberModal: true});
|
this.setState({showDeactivateMemberModal: true});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleDeactivateMember = () => {
|
handleDeactivateMember = () => {
|
||||||
this.props.actions.updateUserActive(this.props.user.id, false).
|
this.props.actions.updateUserActive(this.props.user.id, false).
|
||||||
then(this.onUpdateActiveResult);
|
then(this.onUpdateActiveResult);
|
||||||
this.setState({showDeactivateMemberModal: false});
|
this.setState({showDeactivateMemberModal: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
onUpdateActiveResult = ({error}: {error: ServerError}) => {
|
onUpdateActiveResult = ({error}: {error: ServerError}) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
this.props.onError({id: error.server_error_id, ...error});
|
this.props.onError({id: error.server_error_id, ...error});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
handleDeactivateCancel = () => {
|
handleDeactivateCancel = () => {
|
||||||
this.setState({showDeactivateMemberModal: false});
|
this.setState({showDeactivateMemberModal: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
renderDeactivateMemberModal = () => {
|
renderDeactivateMemberModal = () => {
|
||||||
const user = this.props.user;
|
const user = this.props.user;
|
||||||
@@ -273,7 +273,7 @@ export default class SystemUsersDropdown extends React.PureComponent<Props, Stat
|
|||||||
onCancel={this.handleDeactivateCancel}
|
onCancel={this.handleDeactivateCancel}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
shouldDisableBotsWhenOwnerIsDeactivated() {
|
shouldDisableBotsWhenOwnerIsDeactivated() {
|
||||||
return this.props.config &&
|
return this.props.config &&
|
||||||
@@ -284,12 +284,12 @@ export default class SystemUsersDropdown extends React.PureComponent<Props, Stat
|
|||||||
handleShowRevokeSessionsModal = (e: {preventDefault: () => void}) => {
|
handleShowRevokeSessionsModal = (e: {preventDefault: () => void}) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.setState({showRevokeSessionsModal: true});
|
this.setState({showRevokeSessionsModal: true});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleShowCreateGroupSyncableMembershipsModal = (e: {preventDefault: () => void}) => {
|
handleShowCreateGroupSyncableMembershipsModal = (e: {preventDefault: () => void}) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.setState({showCreateGroupMembershipsModal: true});
|
this.setState({showCreateGroupMembershipsModal: true});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleCreateGroupSyncableMemberships = async () => {
|
handleCreateGroupSyncableMemberships = async () => {
|
||||||
const {error} = await this.props.actions.createGroupTeamsAndChannels(this.props.user.id);
|
const {error} = await this.props.actions.createGroupTeamsAndChannels(this.props.user.id);
|
||||||
@@ -298,11 +298,11 @@ export default class SystemUsersDropdown extends React.PureComponent<Props, Stat
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setState({showCreateGroupMembershipsModal: false});
|
this.setState({showCreateGroupMembershipsModal: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleCreateGroupSyncableMembershipsCancel = () => {
|
handleCreateGroupSyncableMembershipsCancel = () => {
|
||||||
this.setState({showCreateGroupMembershipsModal: false});
|
this.setState({showCreateGroupMembershipsModal: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleRevokeSessions = async () => {
|
handleRevokeSessions = async () => {
|
||||||
const me = this.props.currentUser;
|
const me = this.props.currentUser;
|
||||||
@@ -315,15 +315,15 @@ export default class SystemUsersDropdown extends React.PureComponent<Props, Stat
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setState({showRevokeSessionsModal: false});
|
this.setState({showRevokeSessionsModal: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleRevokeSessionsCancel = () => {
|
handleRevokeSessionsCancel = () => {
|
||||||
this.setState({showRevokeSessionsModal: false});
|
this.setState({showRevokeSessionsModal: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
handlePromoteToUser = () => {
|
handlePromoteToUser = () => {
|
||||||
this.setState({showPromoteToUserModal: true});
|
this.setState({showPromoteToUserModal: true});
|
||||||
}
|
};
|
||||||
|
|
||||||
handlePromoteToUserConfirm = async () => {
|
handlePromoteToUserConfirm = async () => {
|
||||||
const {error} = await this.props.actions.promoteGuestToUser(this.props.user.id);
|
const {error} = await this.props.actions.promoteGuestToUser(this.props.user.id);
|
||||||
@@ -332,15 +332,15 @@ export default class SystemUsersDropdown extends React.PureComponent<Props, Stat
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setState({showPromoteToUserModal: false});
|
this.setState({showPromoteToUserModal: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
handlePromoteToUserCancel = () => {
|
handlePromoteToUserCancel = () => {
|
||||||
this.setState({showPromoteToUserModal: false});
|
this.setState({showPromoteToUserModal: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleDemoteToGuest = () => {
|
handleDemoteToGuest = () => {
|
||||||
this.setState({showDemoteToGuestModal: true});
|
this.setState({showDemoteToGuestModal: true});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleDemoteToGuestConfirm = async () => {
|
handleDemoteToGuestConfirm = async () => {
|
||||||
const {error} = await this.props.actions.demoteUserToGuest(this.props.user.id);
|
const {error} = await this.props.actions.demoteUserToGuest(this.props.user.id);
|
||||||
@@ -348,11 +348,11 @@ export default class SystemUsersDropdown extends React.PureComponent<Props, Stat
|
|||||||
this.props.onError(error);
|
this.props.onError(error);
|
||||||
}
|
}
|
||||||
this.setState({showDemoteToGuestModal: false});
|
this.setState({showDemoteToGuestModal: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleDemoteToGuestCancel = () => {
|
handleDemoteToGuestCancel = () => {
|
||||||
this.setState({showDemoteToGuestModal: false});
|
this.setState({showDemoteToGuestModal: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
renderPromoteToUserModal = () => {
|
renderPromoteToUserModal = () => {
|
||||||
const title = (
|
const title = (
|
||||||
@@ -393,7 +393,7 @@ export default class SystemUsersDropdown extends React.PureComponent<Props, Stat
|
|||||||
onCancel={this.handlePromoteToUserCancel}
|
onCancel={this.handlePromoteToUserCancel}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderDemoteToGuestModal = () => {
|
renderDemoteToGuestModal = () => {
|
||||||
const title = (
|
const title = (
|
||||||
@@ -434,7 +434,7 @@ export default class SystemUsersDropdown extends React.PureComponent<Props, Stat
|
|||||||
onCancel={this.handleDemoteToGuestCancel}
|
onCancel={this.handleDemoteToGuestCancel}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderRevokeSessionsModal = () => {
|
renderRevokeSessionsModal = () => {
|
||||||
const title = (
|
const title = (
|
||||||
@@ -475,7 +475,7 @@ export default class SystemUsersDropdown extends React.PureComponent<Props, Stat
|
|||||||
onCancel={this.handleRevokeSessionsCancel}
|
onCancel={this.handleRevokeSessionsCancel}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderCreateGroupSyncablesMembershipsModal = () => {
|
renderCreateGroupSyncablesMembershipsModal = () => {
|
||||||
const title = (
|
const title = (
|
||||||
@@ -524,7 +524,7 @@ export default class SystemUsersDropdown extends React.PureComponent<Props, Stat
|
|||||||
onCancel={this.handleCreateGroupSyncableMembershipsCancel}
|
onCancel={this.handleCreateGroupSyncableMembershipsCancel}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderAccessToken = () => {
|
renderAccessToken = () => {
|
||||||
const userAccessTokensEnabled = this.props.enableUserAccessTokens;
|
const userAccessTokensEnabled = this.props.enableUserAccessTokens;
|
||||||
@@ -561,7 +561,7 @@ export default class SystemUsersDropdown extends React.PureComponent<Props, Stat
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {currentUser, user, isLicensed, config} = this.props;
|
const {currentUser, user, isLicensed, config} = this.props;
|
||||||
|
|||||||
@@ -62,21 +62,21 @@ export default class AbstractList extends React.PureComponent<Props, State> {
|
|||||||
const page = this.state.page < 1 ? 0 : this.state.page - 1;
|
const page = this.state.page < 1 ? 0 : this.state.page - 1;
|
||||||
this.setState({page, loading: true});
|
this.setState({page, loading: true});
|
||||||
this.performSearch(page);
|
this.performSearch(page);
|
||||||
}
|
};
|
||||||
|
|
||||||
nextPage = async (e: MouseEvent<HTMLButtonElement>): Promise<void> => {
|
nextPage = async (e: MouseEvent<HTMLButtonElement>): Promise<void> => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const page = this.state.page + 1;
|
const page = this.state.page + 1;
|
||||||
this.setState({page, loading: true});
|
this.setState({page, loading: true});
|
||||||
this.performSearch(page);
|
this.performSearch(page);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderHeader = (): JSX.Element | null => {
|
renderHeader = (): JSX.Element | null => {
|
||||||
if (this.props.data.length > 0) {
|
if (this.props.data.length > 0) {
|
||||||
return this.props.header;
|
return this.props.header;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
};
|
||||||
|
|
||||||
renderRows = (): JSX.Element | JSX.Element[] => {
|
renderRows = (): JSX.Element | JSX.Element[] => {
|
||||||
if (this.state.loading) {
|
if (this.state.loading) {
|
||||||
@@ -98,7 +98,7 @@ export default class AbstractList extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
const offset = this.state.page * PAGE_SIZE;
|
const offset = this.state.page * PAGE_SIZE;
|
||||||
return this.props.data.slice(offset, offset + PAGE_SIZE).map(this.props.renderRow);
|
return this.props.data.slice(offset, offset + PAGE_SIZE).map(this.props.renderRow);
|
||||||
}
|
};
|
||||||
|
|
||||||
performSearch = (page: number): void => {
|
performSearch = (page: number): void => {
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
@@ -109,7 +109,7 @@ export default class AbstractList extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
this.setState({loading: false});
|
this.setState({loading: false});
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
getPaging(): Paging {
|
getPaging(): Paging {
|
||||||
const startCount = (this.state.page * PAGE_SIZE) + 1;
|
const startCount = (this.state.page * PAGE_SIZE) + 1;
|
||||||
@@ -175,5 +175,5 @@ export default class AbstractList extends React.PureComponent<Props, State> {
|
|||||||
</div>}
|
</div>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ export default class ChannelDetails extends React.PureComponent<ChannelDetailsPr
|
|||||||
return g;
|
return g;
|
||||||
});
|
});
|
||||||
this.processGroupsChange(groups);
|
this.processGroupsChange(groups);
|
||||||
}
|
};
|
||||||
|
|
||||||
private channelPermissionsChanged = (name: string, channelRole: ChannelModerationRoles) => {
|
private channelPermissionsChanged = (name: string, channelRole: ChannelModerationRoles) => {
|
||||||
const currentValueIndex = this.state.channelPermissions.findIndex((element) => element.name === name);
|
const currentValueIndex = this.state.channelPermissions.findIndex((element) => element.name === name);
|
||||||
@@ -321,7 +321,7 @@ export default class ChannelDetails extends React.PureComponent<ChannelDetailsPr
|
|||||||
};
|
};
|
||||||
this.setState({channelPermissions, saveNeeded: true});
|
this.setState({channelPermissions, saveNeeded: true});
|
||||||
this.props.actions.setNavigationBlocked(true);
|
this.props.actions.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
private handleGroupChange = (groupIDs: string[]) => {
|
private handleGroupChange = (groupIDs: string[]) => {
|
||||||
const groups = [...this.state.groups, ...groupIDs.map((gid: string) => this.props.allGroups[gid])];
|
const groups = [...this.state.groups, ...groupIDs.map((gid: string) => this.props.allGroups[gid])];
|
||||||
@@ -607,20 +607,20 @@ export default class ChannelDetails extends React.PureComponent<ChannelDetailsPr
|
|||||||
const {isLocalArchived} = this.state;
|
const {isLocalArchived} = this.state;
|
||||||
const isServerArchived = this.props.channel.delete_at !== 0;
|
const isServerArchived = this.props.channel.delete_at !== 0;
|
||||||
return isLocalArchived && !isServerArchived;
|
return isLocalArchived && !isServerArchived;
|
||||||
}
|
};
|
||||||
|
|
||||||
private channelToBeRestored = (): boolean => {
|
private channelToBeRestored = (): boolean => {
|
||||||
const {isLocalArchived} = this.state;
|
const {isLocalArchived} = this.state;
|
||||||
const isServerArchived = this.props.channel.delete_at !== 0;
|
const isServerArchived = this.props.channel.delete_at !== 0;
|
||||||
return !isLocalArchived && isServerArchived;
|
return !isLocalArchived && isServerArchived;
|
||||||
}
|
};
|
||||||
|
|
||||||
private addRolesToUpdate = (userId: string, schemeUser: boolean, schemeAdmin: boolean) => {
|
private addRolesToUpdate = (userId: string, schemeUser: boolean, schemeAdmin: boolean) => {
|
||||||
const {rolesToUpdate} = this.state;
|
const {rolesToUpdate} = this.state;
|
||||||
rolesToUpdate[userId] = {schemeUser, schemeAdmin};
|
rolesToUpdate[userId] = {schemeUser, schemeAdmin};
|
||||||
this.setState({rolesToUpdate: {...rolesToUpdate}, saveNeeded: true});
|
this.setState({rolesToUpdate: {...rolesToUpdate}, saveNeeded: true});
|
||||||
this.props.actions.setNavigationBlocked(true);
|
this.props.actions.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
private addUserToRemove = (user: UserProfile) => {
|
private addUserToRemove = (user: UserProfile) => {
|
||||||
let {usersToRemoveCount} = this.state;
|
let {usersToRemoveCount} = this.state;
|
||||||
@@ -634,7 +634,7 @@ export default class ChannelDetails extends React.PureComponent<ChannelDetailsPr
|
|||||||
delete rolesToUpdate[user.id];
|
delete rolesToUpdate[user.id];
|
||||||
this.setState({usersToRemove: {...usersToRemove}, usersToAdd: {...usersToAdd}, rolesToUpdate: {...rolesToUpdate}, usersToRemoveCount, saveNeeded: true});
|
this.setState({usersToRemove: {...usersToRemove}, usersToAdd: {...usersToAdd}, rolesToUpdate: {...rolesToUpdate}, usersToRemoveCount, saveNeeded: true});
|
||||||
this.props.actions.setNavigationBlocked(true);
|
this.props.actions.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
private addUsersToAdd = (users: UserProfile[]) => {
|
private addUsersToAdd = (users: UserProfile[]) => {
|
||||||
let {usersToRemoveCount} = this.state;
|
let {usersToRemoveCount} = this.state;
|
||||||
@@ -649,7 +649,7 @@ export default class ChannelDetails extends React.PureComponent<ChannelDetailsPr
|
|||||||
});
|
});
|
||||||
this.setState({usersToAdd: {...usersToAdd}, usersToRemove: {...usersToRemove}, usersToRemoveCount, saveNeeded: true});
|
this.setState({usersToAdd: {...usersToAdd}, usersToRemove: {...usersToRemove}, usersToRemoveCount, saveNeeded: true});
|
||||||
this.props.actions.setNavigationBlocked(true);
|
this.props.actions.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
private onToggleArchive = () => {
|
private onToggleArchive = () => {
|
||||||
const {isLocalArchived, serverError, previousServerError} = this.state;
|
const {isLocalArchived, serverError, previousServerError} = this.state;
|
||||||
|
|||||||
@@ -126,29 +126,29 @@ export default class ChannelMembers extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
private setStateLoading = (loading: boolean) => {
|
private setStateLoading = (loading: boolean) => {
|
||||||
this.setState({loading});
|
this.setState({loading});
|
||||||
}
|
};
|
||||||
|
|
||||||
private loadPage = async (page: number) => {
|
private loadPage = async (page: number) => {
|
||||||
const {loadProfilesAndReloadChannelMembers} = this.props.actions;
|
const {loadProfilesAndReloadChannelMembers} = this.props.actions;
|
||||||
const {channelId, filters} = this.props;
|
const {channelId, filters} = this.props;
|
||||||
await loadProfilesAndReloadChannelMembers(page + 1, PROFILE_CHUNK_SIZE, channelId, '', {active: true, ...filters});
|
await loadProfilesAndReloadChannelMembers(page + 1, PROFILE_CHUNK_SIZE, channelId, '', {active: true, ...filters});
|
||||||
}
|
};
|
||||||
|
|
||||||
private removeUser = (user: UserProfile) => {
|
private removeUser = (user: UserProfile) => {
|
||||||
this.props.onRemoveCallback(user);
|
this.props.onRemoveCallback(user);
|
||||||
}
|
};
|
||||||
|
|
||||||
private onAddCallback = (users: UserProfile[]) => {
|
private onAddCallback = (users: UserProfile[]) => {
|
||||||
this.props.onAddCallback(users);
|
this.props.onAddCallback(users);
|
||||||
}
|
};
|
||||||
|
|
||||||
private onSearch = async (term: string) => {
|
private onSearch = async (term: string) => {
|
||||||
this.props.actions.setUserGridSearch(term);
|
this.props.actions.setUserGridSearch(term);
|
||||||
}
|
};
|
||||||
|
|
||||||
private updateMembership = (membership: BaseMembership) => {
|
private updateMembership = (membership: BaseMembership) => {
|
||||||
this.props.updateRole(membership.user_id, membership.scheme_user, membership.scheme_admin);
|
this.props.updateRole(membership.user_id, membership.scheme_user, membership.scheme_admin);
|
||||||
}
|
};
|
||||||
|
|
||||||
private onFilter = async (filterOptions: FilterOptions) => {
|
private onFilter = async (filterOptions: FilterOptions) => {
|
||||||
const roles = filterOptions.role.values;
|
const roles = filterOptions.role.values;
|
||||||
@@ -181,7 +181,7 @@ export default class ChannelMembers extends React.PureComponent<Props, State> {
|
|||||||
} else {
|
} else {
|
||||||
this.props.actions.setUserGridFilters(filters);
|
this.props.actions.setUserGridFilters(filters);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
render = () => {
|
render = () => {
|
||||||
const {users, channel, channelId, usersToAdd, usersToRemove, channelMembers, totalCount, searchTerm, isDisabled} = this.props;
|
const {users, channel, channelId, usersToAdd, usersToRemove, channelMembers, totalCount, searchTerm, isDisabled} = this.props;
|
||||||
@@ -294,5 +294,5 @@ export default class ChannelMembers extends React.PureComponent<Props, State> {
|
|||||||
/>
|
/>
|
||||||
</AdminPanel>
|
</AdminPanel>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ export default class ChannelModeration extends React.PureComponent<Props> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
return errorMessages;
|
return errorMessages;
|
||||||
}
|
};
|
||||||
|
|
||||||
render = (): JSX.Element => {
|
render = (): JSX.Element => {
|
||||||
const {channelPermissions, guestAccountsEnabled, onChannelPermissionsChanged, readOnly} = this.props;
|
const {channelPermissions, guestAccountsEnabled, onChannelPermissionsChanged, readOnly} = this.props;
|
||||||
@@ -421,5 +421,5 @@ export default class ChannelModeration extends React.PureComponent<Props> {
|
|||||||
</div>
|
</div>
|
||||||
</AdminPanel>
|
</AdminPanel>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export default class ChannelList extends React.PureComponent<ChannelListProps, C
|
|||||||
|
|
||||||
isSearching = (term: string, filters: ChannelSearchOpts) => {
|
isSearching = (term: string, filters: ChannelSearchOpts) => {
|
||||||
return term.length > 0 || Object.keys(filters).length > 0;
|
return term.length > 0 || Object.keys(filters).length > 0;
|
||||||
}
|
};
|
||||||
|
|
||||||
getPaginationProps = () => {
|
getPaginationProps = () => {
|
||||||
const {page, term, filters} = this.state;
|
const {page, term, filters} = this.state;
|
||||||
@@ -78,7 +78,7 @@ export default class ChannelList extends React.PureComponent<ChannelListProps, C
|
|||||||
let endCount = (page + 1) * PAGE_SIZE;
|
let endCount = (page + 1) * PAGE_SIZE;
|
||||||
endCount = endCount > total ? total : endCount;
|
endCount = endCount > total ? total : endCount;
|
||||||
return {startCount, endCount, total};
|
return {startCount, endCount, total};
|
||||||
}
|
};
|
||||||
|
|
||||||
loadPage = async (page = 0, term = '', filters = {}) => {
|
loadPage = async (page = 0, term = '', filters = {}) => {
|
||||||
this.setState({loading: true, term, filters});
|
this.setState({loading: true, term, filters});
|
||||||
@@ -93,7 +93,7 @@ export default class ChannelList extends React.PureComponent<ChannelListProps, C
|
|||||||
|
|
||||||
await this.props.actions.getData(page, PAGE_SIZE, '', false, true);
|
await this.props.actions.getData(page, PAGE_SIZE, '', false, true);
|
||||||
this.setState({page, loading: false});
|
this.setState({page, loading: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
searchChannels = async (page = 0, term = '', filters = {}) => {
|
searchChannels = async (page = 0, term = '', filters = {}) => {
|
||||||
let channels = [];
|
let channels = [];
|
||||||
@@ -106,21 +106,21 @@ export default class ChannelList extends React.PureComponent<ChannelListProps, C
|
|||||||
searchErrored = false;
|
searchErrored = false;
|
||||||
}
|
}
|
||||||
this.setState({page, loading: false, channels, total, searchErrored});
|
this.setState({page, loading: false, channels, total, searchErrored});
|
||||||
}
|
};
|
||||||
|
|
||||||
searchChannelsDebounced = debounce((page, term, filters = {}) => this.searchChannels(page, term, filters), 300, false, () => {});
|
searchChannelsDebounced = debounce((page, term, filters = {}) => this.searchChannels(page, term, filters), 300, false, () => {});
|
||||||
|
|
||||||
nextPage = () => {
|
nextPage = () => {
|
||||||
this.loadPage(this.state.page + 1, this.state.term, this.state.filters);
|
this.loadPage(this.state.page + 1, this.state.term, this.state.filters);
|
||||||
}
|
};
|
||||||
|
|
||||||
previousPage = () => {
|
previousPage = () => {
|
||||||
this.setState({page: this.state.page - 1});
|
this.setState({page: this.state.page - 1});
|
||||||
}
|
};
|
||||||
|
|
||||||
onSearch = async (term = '') => {
|
onSearch = async (term = '') => {
|
||||||
this.loadPage(0, term, this.state.filters);
|
this.loadPage(0, term, this.state.filters);
|
||||||
}
|
};
|
||||||
|
|
||||||
getColumns = (): Column[] => {
|
getColumns = (): Column[] => {
|
||||||
const name: JSX.Element = (
|
const name: JSX.Element = (
|
||||||
@@ -167,7 +167,7 @@ export default class ChannelList extends React.PureComponent<ChannelListProps, C
|
|||||||
fixed: true,
|
fixed: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
};
|
||||||
|
|
||||||
getRows = (): Row[] => {
|
getRows = (): Row[] => {
|
||||||
const {data} = this.props;
|
const {data} = this.props;
|
||||||
@@ -245,7 +245,7 @@ export default class ChannelList extends React.PureComponent<ChannelListProps, C
|
|||||||
onClick: () => getHistory().push(`/admin_console/user_management/channels/${channel.id}`),
|
onClick: () => getHistory().push(`/admin_console/user_management/channels/${channel.id}`),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
onFilter = (filterOptions: FilterOptions) => {
|
onFilter = (filterOptions: FilterOptions) => {
|
||||||
const filters: ChannelSearchOpts = {};
|
const filters: ChannelSearchOpts = {};
|
||||||
@@ -285,7 +285,7 @@ export default class ChannelList extends React.PureComponent<ChannelListProps, C
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.loadPage(0, this.state.term, filters);
|
this.loadPage(0, this.state.term, filters);
|
||||||
}
|
};
|
||||||
|
|
||||||
render = (): JSX.Element => {
|
render = (): JSX.Element => {
|
||||||
const {term, searchErrored} = this.state;
|
const {term, searchErrored} = this.state;
|
||||||
@@ -414,5 +414,5 @@ export default class ChannelList extends React.PureComponent<ChannelListProps, C
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export default class GroupList extends React.PureComponent<Props> {
|
|||||||
isDisabled={this.props.isDisabled}
|
isDisabled={this.props.isDisabled}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
render(): JSX.Element {
|
render(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ export default class GroupMembersModal extends React.PureComponent<Props, State>
|
|||||||
|
|
||||||
handleHide = () => {
|
handleHide = () => {
|
||||||
this.setState({show: false});
|
this.setState({show: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
handleExit = () => {
|
handleExit = () => {
|
||||||
this.props.onExited();
|
this.props.onExited();
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {group} = this.props;
|
const {group} = this.props;
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export default class GroupRow extends React.PureComponent<GroupRowProps> {
|
|||||||
return teamAdmin;
|
return teamAdmin;
|
||||||
}
|
}
|
||||||
return member;
|
return member;
|
||||||
}
|
};
|
||||||
|
|
||||||
displayRoleToBe = () => {
|
displayRoleToBe = () => {
|
||||||
const {group, type} = this.props;
|
const {group, type} = this.props;
|
||||||
@@ -73,7 +73,7 @@ export default class GroupRow extends React.PureComponent<GroupRowProps> {
|
|||||||
return localizeMessage('admin.team_channel_settings.group_row.teamAdmin', 'Team Admin');
|
return localizeMessage('admin.team_channel_settings.group_row.teamAdmin', 'Team Admin');
|
||||||
}
|
}
|
||||||
return localizeMessage('admin.team_channel_settings.group_row.member', 'Member');
|
return localizeMessage('admin.team_channel_settings.group_row.member', 'Member');
|
||||||
}
|
};
|
||||||
|
|
||||||
render = () => {
|
render = () => {
|
||||||
const {group} = this.props;
|
const {group} = this.props;
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ export default class UsersToRemove extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
setStateLoading = (loading: boolean) => {
|
setStateLoading = (loading: boolean) => {
|
||||||
this.setState({loading});
|
this.setState({loading});
|
||||||
}
|
};
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this.props.actions.setModalSearchTerm('');
|
this.props.actions.setModalSearchTerm('');
|
||||||
@@ -98,23 +98,23 @@ export default class UsersToRemove extends React.PureComponent<Props, State> {
|
|||||||
} else if (scope === 'team') {
|
} else if (scope === 'team') {
|
||||||
await loadTeamMembersForProfilesList(profiles, scopeId);
|
await loadTeamMembersForProfilesList(profiles, scopeId);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
previousPage = async () => {
|
previousPage = async () => {
|
||||||
const page = this.state.page < 1 ? 0 : this.state.page - 1;
|
const page = this.state.page < 1 ? 0 : this.state.page - 1;
|
||||||
this.setState({page});
|
this.setState({page});
|
||||||
}
|
};
|
||||||
|
|
||||||
nextPage = async () => {
|
nextPage = async () => {
|
||||||
const {total} = this.props;
|
const {total} = this.props;
|
||||||
const page = (this.state.page + 1) * GROUP_MEMBERS_PAGE_SIZE >= total ? this.state.page : this.state.page + 1;
|
const page = (this.state.page + 1) * GROUP_MEMBERS_PAGE_SIZE >= total ? this.state.page : this.state.page + 1;
|
||||||
this.setState({page});
|
this.setState({page});
|
||||||
}
|
};
|
||||||
|
|
||||||
onSearch = (term: string) => {
|
onSearch = (term: string) => {
|
||||||
this.props.actions.setModalSearchTerm(term);
|
this.props.actions.setModalSearchTerm(term);
|
||||||
this.setState({page: 0});
|
this.setState({page: 0});
|
||||||
}
|
};
|
||||||
|
|
||||||
private onFilter = async (filterOptions: FilterOptions) => {
|
private onFilter = async (filterOptions: FilterOptions) => {
|
||||||
const roles = filterOptions.role.values;
|
const roles = filterOptions.role.values;
|
||||||
@@ -147,7 +147,7 @@ export default class UsersToRemove extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
this.props.actions.setModalFilters(filters);
|
this.props.actions.setModalFilters(filters);
|
||||||
this.setState({page: 0});
|
this.setState({page: 0});
|
||||||
}
|
};
|
||||||
|
|
||||||
private getPaginationProps = () => {
|
private getPaginationProps = () => {
|
||||||
const {page} = this.state;
|
const {page} = this.state;
|
||||||
@@ -161,7 +161,7 @@ export default class UsersToRemove extends React.PureComponent<Props, State> {
|
|||||||
const firstPage = page === 0;
|
const firstPage = page === 0;
|
||||||
|
|
||||||
return {startCount, endCount, page, lastPage, firstPage, total};
|
return {startCount, endCount, page, lastPage, firstPage, total};
|
||||||
}
|
};
|
||||||
|
|
||||||
private getRows = (): Row[] => {
|
private getRows = (): Row[] => {
|
||||||
const {members, memberships, scope} = this.props;
|
const {members, memberships, scope} = this.props;
|
||||||
@@ -201,7 +201,7 @@ export default class UsersToRemove extends React.PureComponent<Props, State> {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
private getColumns = (): Column[] => {
|
private getColumns = (): Column[] => {
|
||||||
return [
|
return [
|
||||||
@@ -236,7 +236,7 @@ export default class UsersToRemove extends React.PureComponent<Props, State> {
|
|||||||
width: 3,
|
width: 3,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
};
|
||||||
|
|
||||||
private getFilterOptions = (): FilterOptions => {
|
private getFilterOptions = (): FilterOptions => {
|
||||||
const filterOptions: FilterOptions = {
|
const filterOptions: FilterOptions = {
|
||||||
@@ -325,7 +325,7 @@ export default class UsersToRemove extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return filterOptions;
|
return filterOptions;
|
||||||
}
|
};
|
||||||
|
|
||||||
public render = (): JSX.Element => {
|
public render = (): JSX.Element => {
|
||||||
const rows: Row[] = this.getRows();
|
const rows: Row[] = this.getRows();
|
||||||
@@ -360,5 +360,5 @@ export default class UsersToRemove extends React.PureComponent<Props, State> {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ export default class TeamDetails extends React.PureComponent<Props, State> {
|
|||||||
return g;
|
return g;
|
||||||
});
|
});
|
||||||
this.processGroupsChange(groups);
|
this.processGroupsChange(groups);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleSubmit = async () => {
|
handleSubmit = async () => {
|
||||||
this.setState({showRemoveConfirmation: false, saving: true});
|
this.setState({showRemoveConfirmation: false, saving: true});
|
||||||
@@ -290,7 +290,7 @@ export default class TeamDetails extends React.PureComponent<Props, State> {
|
|||||||
getHistory().push('/admin_console/user_management/teams');
|
getHistory().push('/admin_console/user_management/teams');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
setToggles = (syncChecked: boolean, allAllowedChecked: boolean, allowedDomainsChecked: boolean, allowedDomains: string) => {
|
setToggles = (syncChecked: boolean, allAllowedChecked: boolean, allowedDomainsChecked: boolean, allowedDomains: string) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -301,7 +301,7 @@ export default class TeamDetails extends React.PureComponent<Props, State> {
|
|||||||
allowedDomains,
|
allowedDomains,
|
||||||
}, () => this.processGroupsChange(this.state.groups));
|
}, () => this.processGroupsChange(this.state.groups));
|
||||||
this.props.actions.setNavigationBlocked(true);
|
this.props.actions.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
async processGroupsChange(groups: Group[]) {
|
async processGroupsChange(groups: Group[]) {
|
||||||
const {teamID, actions} = this.props;
|
const {teamID, actions} = this.props;
|
||||||
@@ -348,7 +348,7 @@ export default class TeamDetails extends React.PureComponent<Props, State> {
|
|||||||
});
|
});
|
||||||
this.setState({usersToAdd: {...usersToAddCopy}, usersToRemove: {...usersToRemove}, usersToRemoveCount, saveNeeded: true});
|
this.setState({usersToAdd: {...usersToAddCopy}, usersToRemove: {...usersToRemove}, usersToRemoveCount, saveNeeded: true});
|
||||||
this.props.actions.setNavigationBlocked(true);
|
this.props.actions.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
addUserToRemove = (user: UserProfile) => {
|
addUserToRemove = (user: UserProfile) => {
|
||||||
let {usersToRemoveCount} = this.state;
|
let {usersToRemoveCount} = this.state;
|
||||||
@@ -362,26 +362,26 @@ export default class TeamDetails extends React.PureComponent<Props, State> {
|
|||||||
delete rolesToUpdate[user.id];
|
delete rolesToUpdate[user.id];
|
||||||
this.setState({usersToRemove: {...usersToRemove}, usersToAdd: {...usersToAdd}, rolesToUpdate: {...rolesToUpdate}, usersToRemoveCount, saveNeeded: true});
|
this.setState({usersToRemove: {...usersToRemove}, usersToAdd: {...usersToAdd}, rolesToUpdate: {...rolesToUpdate}, usersToRemoveCount, saveNeeded: true});
|
||||||
this.props.actions.setNavigationBlocked(true);
|
this.props.actions.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
addRolesToUpdate = (userId: string, schemeUser: boolean, schemeAdmin: boolean) => {
|
addRolesToUpdate = (userId: string, schemeUser: boolean, schemeAdmin: boolean) => {
|
||||||
const {rolesToUpdate} = this.state;
|
const {rolesToUpdate} = this.state;
|
||||||
rolesToUpdate[userId] = {schemeUser, schemeAdmin};
|
rolesToUpdate[userId] = {schemeUser, schemeAdmin};
|
||||||
this.setState({rolesToUpdate: {...rolesToUpdate}, saveNeeded: true});
|
this.setState({rolesToUpdate: {...rolesToUpdate}, saveNeeded: true});
|
||||||
this.props.actions.setNavigationBlocked(true);
|
this.props.actions.setNavigationBlocked(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleGroupRemoved = (gid: string) => {
|
handleGroupRemoved = (gid: string) => {
|
||||||
const groups = this.state.groups.filter((g) => g.id !== gid);
|
const groups = this.state.groups.filter((g) => g.id !== gid);
|
||||||
this.setState({totalGroups: this.state.totalGroups - 1});
|
this.setState({totalGroups: this.state.totalGroups - 1});
|
||||||
this.processGroupsChange(groups);
|
this.processGroupsChange(groups);
|
||||||
}
|
};
|
||||||
|
|
||||||
handleGroupChange = (groupIDs: string[]) => {
|
handleGroupChange = (groupIDs: string[]) => {
|
||||||
const groups = [...this.state.groups, ...groupIDs.map((gid) => this.props.allGroups[gid])];
|
const groups = [...this.state.groups, ...groupIDs.map((gid) => this.props.allGroups[gid])];
|
||||||
this.setState({totalGroups: this.state.totalGroups + groupIDs.length});
|
this.setState({totalGroups: this.state.totalGroups + groupIDs.length});
|
||||||
this.processGroupsChange(groups);
|
this.processGroupsChange(groups);
|
||||||
}
|
};
|
||||||
|
|
||||||
hideRemoveUsersModal = () => this.setState({showRemoveConfirmation: false});
|
hideRemoveUsersModal = () => this.setState({showRemoveConfirmation: false});
|
||||||
|
|
||||||
@@ -395,19 +395,19 @@ export default class TeamDetails extends React.PureComponent<Props, State> {
|
|||||||
} else {
|
} else {
|
||||||
this.handleSubmit();
|
this.handleSubmit();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
teamToBeArchived = () => {
|
teamToBeArchived = () => {
|
||||||
const {isLocalArchived} = this.state;
|
const {isLocalArchived} = this.state;
|
||||||
const isServerArchived = this.props.team.delete_at !== 0;
|
const isServerArchived = this.props.team.delete_at !== 0;
|
||||||
return isLocalArchived && !isServerArchived;
|
return isLocalArchived && !isServerArchived;
|
||||||
}
|
};
|
||||||
|
|
||||||
teamToBeRestored = () => {
|
teamToBeRestored = () => {
|
||||||
const {isLocalArchived} = this.state;
|
const {isLocalArchived} = this.state;
|
||||||
const isServerArchived = this.props.team.delete_at !== 0;
|
const isServerArchived = this.props.team.delete_at !== 0;
|
||||||
return !isLocalArchived && isServerArchived;
|
return !isLocalArchived && isServerArchived;
|
||||||
}
|
};
|
||||||
|
|
||||||
onToggleArchive = () => {
|
onToggleArchive = () => {
|
||||||
const {isLocalArchived, serverError, previousServerError} = this.state;
|
const {isLocalArchived, serverError, previousServerError} = this.state;
|
||||||
|
|||||||
@@ -126,25 +126,25 @@ export default class TeamMembers extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
private setStateLoading = (loading: boolean) => {
|
private setStateLoading = (loading: boolean) => {
|
||||||
this.setState({loading});
|
this.setState({loading});
|
||||||
}
|
};
|
||||||
|
|
||||||
private loadPage = async (page: number) => {
|
private loadPage = async (page: number) => {
|
||||||
const {loadProfilesAndReloadTeamMembers} = this.props.actions;
|
const {loadProfilesAndReloadTeamMembers} = this.props.actions;
|
||||||
const {teamId, filters} = this.props;
|
const {teamId, filters} = this.props;
|
||||||
await loadProfilesAndReloadTeamMembers(page + 1, PROFILE_CHUNK_SIZE, teamId, {active: true, ...filters});
|
await loadProfilesAndReloadTeamMembers(page + 1, PROFILE_CHUNK_SIZE, teamId, {active: true, ...filters});
|
||||||
}
|
};
|
||||||
|
|
||||||
private removeUser = (user: UserProfile) => {
|
private removeUser = (user: UserProfile) => {
|
||||||
this.props.onRemoveCallback(user);
|
this.props.onRemoveCallback(user);
|
||||||
}
|
};
|
||||||
|
|
||||||
private onAddCallback = (users: UserProfile[]) => {
|
private onAddCallback = (users: UserProfile[]) => {
|
||||||
this.props.onAddCallback(users);
|
this.props.onAddCallback(users);
|
||||||
}
|
};
|
||||||
|
|
||||||
private onSearch = async (term: string) => {
|
private onSearch = async (term: string) => {
|
||||||
this.props.actions.setUserGridSearch(term);
|
this.props.actions.setUserGridSearch(term);
|
||||||
}
|
};
|
||||||
|
|
||||||
private onFilter = async (filterOptions: FilterOptions) => {
|
private onFilter = async (filterOptions: FilterOptions) => {
|
||||||
const roles = filterOptions.role.values;
|
const roles = filterOptions.role.values;
|
||||||
@@ -177,11 +177,11 @@ export default class TeamMembers extends React.PureComponent<Props, State> {
|
|||||||
} else {
|
} else {
|
||||||
this.props.actions.setUserGridFilters(filters);
|
this.props.actions.setUserGridFilters(filters);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
private updateMembership = (membership: BaseMembership) => {
|
private updateMembership = (membership: BaseMembership) => {
|
||||||
this.props.updateRole(membership.user_id, membership.scheme_user, membership.scheme_admin);
|
this.props.updateRole(membership.user_id, membership.scheme_user, membership.scheme_admin);
|
||||||
}
|
};
|
||||||
|
|
||||||
public render = () => {
|
public render = () => {
|
||||||
const {users, team, usersToAdd, usersToRemove, teamMembers, totalCount, searchTerm, isDisabled} = this.props;
|
const {users, team, usersToAdd, usersToRemove, teamMembers, totalCount, searchTerm, isDisabled} = this.props;
|
||||||
@@ -294,5 +294,5 @@ export default class TeamMembers extends React.PureComponent<Props, State> {
|
|||||||
/>
|
/>
|
||||||
</AdminPanel>
|
</AdminPanel>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
isSearching = (term: string, filters: TeamSearchOpts) => {
|
isSearching = (term: string, filters: TeamSearchOpts) => {
|
||||||
return (term.length + Object.keys(filters).length) > 0;
|
return (term.length + Object.keys(filters).length) > 0;
|
||||||
}
|
};
|
||||||
|
|
||||||
getPaginationProps = () => {
|
getPaginationProps = () => {
|
||||||
const {page, term, filters} = this.state;
|
const {page, term, filters} = this.state;
|
||||||
@@ -70,7 +70,7 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
let endCount = (page + 1) * PAGE_SIZE;
|
let endCount = (page + 1) * PAGE_SIZE;
|
||||||
endCount = endCount > total ? total : endCount;
|
endCount = endCount > total ? total : endCount;
|
||||||
return {startCount, endCount, total};
|
return {startCount, endCount, total};
|
||||||
}
|
};
|
||||||
|
|
||||||
loadPage = async (page = 0, term = '', filters = {}) => {
|
loadPage = async (page = 0, term = '', filters = {}) => {
|
||||||
this.setState({loading: true, term, filters});
|
this.setState({loading: true, term, filters});
|
||||||
@@ -86,7 +86,7 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
await this.props.actions.getData(page, PAGE_SIZE);
|
await this.props.actions.getData(page, PAGE_SIZE);
|
||||||
this.setState({page, loading: false});
|
this.setState({page, loading: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
searchTeams = async (page = 0, term = '', filters = {}) => {
|
searchTeams = async (page = 0, term = '', filters = {}) => {
|
||||||
let teams: Team[] = [];
|
let teams: Team[] = [];
|
||||||
@@ -99,17 +99,17 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
searchErrored = false;
|
searchErrored = false;
|
||||||
}
|
}
|
||||||
this.setState({page, loading: false, teams, total, searchErrored});
|
this.setState({page, loading: false, teams, total, searchErrored});
|
||||||
}
|
};
|
||||||
|
|
||||||
searchTeamsDebounced = debounce((page, term, filters = {}) => this.searchTeams(page, term, filters), 300, false, () => {});
|
searchTeamsDebounced = debounce((page, term, filters = {}) => this.searchTeams(page, term, filters), 300, false, () => {});
|
||||||
|
|
||||||
nextPage = () => {
|
nextPage = () => {
|
||||||
this.loadPage(this.state.page + 1, this.state.term, this.state.filters);
|
this.loadPage(this.state.page + 1, this.state.term, this.state.filters);
|
||||||
}
|
};
|
||||||
|
|
||||||
previousPage = () => {
|
previousPage = () => {
|
||||||
this.setState({page: this.state.page - 1});
|
this.setState({page: this.state.page - 1});
|
||||||
}
|
};
|
||||||
|
|
||||||
onSearch = (term = '') => {
|
onSearch = (term = '') => {
|
||||||
this.loadPage(0, term, this.state.filters);
|
this.loadPage(0, term, this.state.filters);
|
||||||
@@ -151,7 +151,7 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.loadPage(0, this.state.term, filters);
|
this.loadPage(0, this.state.term, filters);
|
||||||
}
|
};
|
||||||
|
|
||||||
getColumns = (): Column[] => {
|
getColumns = (): Column[] => {
|
||||||
const name = (
|
const name = (
|
||||||
@@ -186,7 +186,7 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
fixed: true,
|
fixed: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
};
|
||||||
|
|
||||||
renderManagementMethodText = (team: Team) => {
|
renderManagementMethodText = (team: Team) => {
|
||||||
if (team.group_constrained) {
|
if (team.group_constrained) {
|
||||||
@@ -210,7 +210,7 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
defaultMessage='Invite Only'
|
defaultMessage='Invite Only'
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
getRows = () => {
|
getRows = () => {
|
||||||
const {data} = this.props;
|
const {data} = this.props;
|
||||||
@@ -278,7 +278,7 @@ export default class TeamList extends React.PureComponent<Props, State> {
|
|||||||
onClick: () => getHistory().push(`/admin_console/user_management/teams/${team.id}`),
|
onClick: () => getHistory().push(`/admin_console/user_management/teams/${team.id}`),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {term, searchErrored} = this.state;
|
const {term, searchErrored} = this.state;
|
||||||
|
|||||||
@@ -70,32 +70,32 @@ export default class UserGrid extends React.PureComponent<Props, State> {
|
|||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
this.props.loadPage(page);
|
this.props.loadPage(page);
|
||||||
this.setState({page, loading: false});
|
this.setState({page, loading: false});
|
||||||
}
|
};
|
||||||
|
|
||||||
private nextPage = () => {
|
private nextPage = () => {
|
||||||
this.loadPage(this.state.page + 1);
|
this.loadPage(this.state.page + 1);
|
||||||
}
|
};
|
||||||
|
|
||||||
private previousPage = () => {
|
private previousPage = () => {
|
||||||
this.loadPage(this.state.page - 1);
|
this.loadPage(this.state.page - 1);
|
||||||
}
|
};
|
||||||
|
|
||||||
private onSearch = async (term: string) => {
|
private onSearch = async (term: string) => {
|
||||||
this.props.onSearch(term);
|
this.props.onSearch(term);
|
||||||
this.setState({page: 0});
|
this.setState({page: 0});
|
||||||
}
|
};
|
||||||
|
|
||||||
private onFilter = async (filters: FilterOptions) => {
|
private onFilter = async (filters: FilterOptions) => {
|
||||||
this.props.filterProps?.onFilter(filters);
|
this.props.filterProps?.onFilter(filters);
|
||||||
this.setState({page: 0});
|
this.setState({page: 0});
|
||||||
}
|
};
|
||||||
|
|
||||||
private getVisibleTotalCount = (): number => {
|
private getVisibleTotalCount = (): number => {
|
||||||
const {includeUsers, excludeUsers, totalCount} = this.props;
|
const {includeUsers, excludeUsers, totalCount} = this.props;
|
||||||
const includeUsersCount = Object.keys(includeUsers).length;
|
const includeUsersCount = Object.keys(includeUsers).length;
|
||||||
const excludeUsersCount = Object.keys(excludeUsers).length;
|
const excludeUsersCount = Object.keys(excludeUsers).length;
|
||||||
return totalCount + (includeUsersCount - excludeUsersCount);
|
return totalCount + (includeUsersCount - excludeUsersCount);
|
||||||
}
|
};
|
||||||
|
|
||||||
public getPaginationProps = (): {startCount: number; endCount: number; total: number} => {
|
public getPaginationProps = (): {startCount: number; endCount: number; total: number} => {
|
||||||
const {includeUsers, excludeUsers, term} = this.props;
|
const {includeUsers, excludeUsers, term} = this.props;
|
||||||
@@ -120,7 +120,7 @@ export default class UserGrid extends React.PureComponent<Props, State> {
|
|||||||
endCount = endCount > total ? total : endCount;
|
endCount = endCount > total ? total : endCount;
|
||||||
|
|
||||||
return {startCount, endCount, total};
|
return {startCount, endCount, total};
|
||||||
}
|
};
|
||||||
|
|
||||||
private removeUser = (user: UserProfile) => {
|
private removeUser = (user: UserProfile) => {
|
||||||
const {excludeUsers} = this.props;
|
const {excludeUsers} = this.props;
|
||||||
@@ -137,7 +137,7 @@ export default class UserGrid extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setState({page});
|
this.setState({page});
|
||||||
}
|
};
|
||||||
|
|
||||||
private updateMembership = (membership: BaseMembership) => {
|
private updateMembership = (membership: BaseMembership) => {
|
||||||
const {membershipsToUpdate} = this.state;
|
const {membershipsToUpdate} = this.state;
|
||||||
@@ -150,7 +150,7 @@ export default class UserGrid extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
this.props.updateMembership(membership);
|
this.props.updateMembership(membership);
|
||||||
this.setState({membershipsToUpdate}, this.forceUpdate);
|
this.setState({membershipsToUpdate}, this.forceUpdate);
|
||||||
}
|
};
|
||||||
|
|
||||||
private newMembership = (user: UserProfile): BaseMembership => {
|
private newMembership = (user: UserProfile): BaseMembership => {
|
||||||
return {
|
return {
|
||||||
@@ -158,7 +158,7 @@ export default class UserGrid extends React.PureComponent<Props, State> {
|
|||||||
scheme_admin: false,
|
scheme_admin: false,
|
||||||
scheme_user: !user.roles.includes('guest'),
|
scheme_user: !user.roles.includes('guest'),
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
private getRows = (): Row[] => {
|
private getRows = (): Row[] => {
|
||||||
const {page, membershipsToUpdate} = this.state;
|
const {page, membershipsToUpdate} = this.state;
|
||||||
@@ -226,7 +226,7 @@ export default class UserGrid extends React.PureComponent<Props, State> {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
private getColumns = (): Column[] => {
|
private getColumns = (): Column[] => {
|
||||||
const name: JSX.Element = (
|
const name: JSX.Element = (
|
||||||
@@ -268,7 +268,7 @@ export default class UserGrid extends React.PureComponent<Props, State> {
|
|||||||
fixed: true,
|
fixed: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
};
|
||||||
|
|
||||||
public render = (): JSX.Element => {
|
public render = (): JSX.Element => {
|
||||||
const rows: Row[] = this.getRows();
|
const rows: Row[] = this.getRows();
|
||||||
@@ -304,5 +304,5 @@ export default class UserGrid extends React.PureComponent<Props, State> {
|
|||||||
filterProps={{...this.props.filterProps, onFilter: this.onFilter}}
|
filterProps={{...this.props.filterProps, onFilter: this.onFilter}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,5 +34,5 @@ export default class UserGridName extends React.Component<Props> {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export default class UserGridRemove extends React.PureComponent<Props> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.props.removeUser(this.props.user);
|
this.props.removeUser(this.props.user);
|
||||||
}
|
};
|
||||||
|
|
||||||
public render = (): JSX.Element => {
|
public render = (): JSX.Element => {
|
||||||
const {isDisabled} = this.props;
|
const {isDisabled} = this.props;
|
||||||
@@ -39,5 +39,5 @@ export default class UserGridRemove extends React.PureComponent<Props> {
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Ссылка в новой задаче
Block a user