import Hyperlink from "../utils/Hyperlink"; import * as rsssl_api from "../utils/api"; import useFields from "./FieldsData"; import Icon from "../utils/Icon"; import {useState} from "@wordpress/element"; /** * Render a help notice in the sidebar */ const Button = (props) => { const {addHelpNotice} = useFields(); const [processing, setProcessing] = useState(false); const {fields} = useFields(); const onClickHandler = async (action) => { let data = {}; setProcessing(true); data.fields = fields; await rsssl_api.doAction(action, data).then((response) => { let label = response.success ? 'success' : 'warning'; let title = response.title; let text = response.message; setProcessing(false); addHelpNotice(props.field.id, label, text, title, false); }); } let is_disabled = !!props.field.disabled; return ( <> { props.field.url && <Hyperlink className={"button button-default"} disabled={is_disabled} text={props.field.button_text} url={props.field.url}/> } { props.field.action && <button onClick={ () => onClickHandler( props.field.action ) } className="button button-default" disabled={is_disabled}> {props.field.button_text} {processing && <Icon name = "loading" color = 'grey' />} </button> } </> ); } export default Button
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
AutoComplete | Folder | 0755 |
|
|
Captcha | Folder | 0755 |
|
|
DataTable | Folder | 0755 |
|
|
DynamicDataTable | Folder | 0755 |
|
|
EventLog | Folder | 0755 |
|
|
FileChangeDetection | Folder | 0755 |
|
|
GeoBlockList | Folder | 0755 |
|
|
Host | Folder | 0755 |
|
|
LearningMode | Folder | 0755 |
|
|
License | Folder | 0755 |
|
|
LimitLoginAttempts | Folder | 0755 |
|
|
MixedContentScan | Folder | 0755 |
|
|
RiskConfiguration | Folder | 0755 |
|
|
TwoFA | Folder | 0755 |
|
|
firewall | Folder | 0755 |
|
|
Button.js | File | 1.48 KB | 0644 |
|
CheckboxControl.js | File | 3.26 KB | 0644 |
|
Field.js | File | 20.21 KB | 0644 |
|
FieldsData.js | File | 15.3 KB | 0644 |
|
FilterData.js | File | 590 B | 0644 |
|
Help.js | File | 1.48 KB | 0644 |
|
Notices.js | File | 782 B | 0644 |
|
Password.js | File | 1009 B | 0644 |
|
PermissionsPolicy.js | File | 7.9 KB | 0644 |
|
PostDropDown.js | File | 2.86 KB | 0644 |
|
PremiumOverlay.js | File | 1.91 KB | 0644 |
|
RolesDropDown.js | File | 3.6 KB | 0644 |
|
SelectControl.js | File | 2.91 KB | 0644 |
|
Settings.js | File | 7.26 KB | 0644 |
|
SettingsGroup.js | File | 8.07 KB | 0644 |
|
Support.js | File | 1.9 KB | 0644 |
|