31 linhas
1,4 KiB
JavaScript
31 linhas
1,4 KiB
JavaScript
/* Service status block (no build step). */
|
|
(function (wp) {
|
|
'use strict';
|
|
if (!wp || !wp.blocks) { return; }
|
|
var el = wp.element.createElement;
|
|
var t = window.interwebAoStatusBlock || {};
|
|
var be = wp.blockEditor;
|
|
var c = wp.components;
|
|
var SSR = wp.serverSideRender;
|
|
|
|
wp.blocks.registerBlockType('interweb-ao-status/service-status', {
|
|
title: t.title,
|
|
edit: function (props) {
|
|
var a = props.attributes;
|
|
var set = function (k) { return function (v) { var o = {}; o[k] = v; props.setAttributes(o); }; };
|
|
return el('div', be.useBlockProps ? be.useBlockProps() : {},
|
|
el(be.InspectorControls, null,
|
|
el(c.PanelBody, { title: t.settings || 'Settings', initialOpen: true },
|
|
el(c.TextControl, { label: t.heading, value: a.title, onChange: set('title') }),
|
|
el(c.SelectControl, { label: t.types, value: a.show, onChange: set('show'), options: [
|
|
{ label: t.all, value: '' }, { label: t.api, value: 'api' }, { label: t.hosting, value: 'hosting' },
|
|
{ label: t.vps, value: 'vps' }, { label: t.domain, value: 'domain' }] }),
|
|
el(c.RangeControl, { label: t.refresh, value: a.refresh, min: 30, max: 600, step: 10, onChange: set('refresh') })
|
|
)
|
|
),
|
|
el(SSR, { block: 'interweb-ao-status/service-status', attributes: a })
|
|
);
|
|
},
|
|
save: function () { return null; }
|
|
});
|
|
})(window.wp);
|