widgets.js 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950
  1. /*
  2. The MIT License (MIT)
  3. Copyright (c) 2014-2018 Nikolai Suslov and the Krestianstvo.org project contributors. (https://github.com/NikolaySuslov/livecodingspace/blob/master/LICENSE.md)
  4. */
  5. /*
  6. * Cell widgets
  7. */
  8. class Widgets {
  9. constructor() {
  10. console.log("widget constructor")
  11. }
  12. get divider(){
  13. return {
  14. $cell: true,
  15. $type: "hr",
  16. class: "mdc-list-divider"
  17. }
  18. }
  19. get emptyDiv(){
  20. return {
  21. $type: "div",
  22. style: "padding-bottom: 30px;"
  23. }
  24. }
  25. inputTextFieldOutlined(obj){
  26. function initFunc() {
  27. new mdc.textField.MDCTextField.attachTo(this);
  28. }
  29. let inputType = obj.type ? obj.type: 'text';
  30. let init = obj.init ? obj.init: initFunc;
  31. let style = obj.style ? obj.style: "";
  32. let fieldStyle = obj.fieldStyle ? obj.fieldStyle: "";
  33. return {
  34. $cell: true,
  35. $type: "div",
  36. class: "mdc-text-field mdc-text-field--outlined mdc-text-field--dense",
  37. style: style,
  38. $init: init,
  39. $components:[
  40. {
  41. $type: "input",
  42. type: inputType,
  43. id: obj.id,
  44. class: "mdc-text-field__input",
  45. value: obj.value,
  46. onchange: obj.change,
  47. style: obj.fieldStyle
  48. },
  49. {
  50. $type: "div",
  51. class: "mdc-notched-outline",
  52. $components:[
  53. {
  54. $type: "div",
  55. class: "mdc-notched-outline__leading"
  56. },
  57. {
  58. $type: "div",
  59. class: "mdc-notched-outline__notch",
  60. $components:[
  61. {
  62. $type: "label",
  63. class: "mdc-floating-label",
  64. for: obj.id,
  65. $text: obj.label
  66. }
  67. ]
  68. },
  69. {
  70. $type: "div",
  71. class: "mdc-notched-outline__trailing"
  72. }
  73. ]
  74. }
  75. ]
  76. //onclick: obj.onclick
  77. }
  78. }
  79. inputTextFieldStandart(obj){
  80. var propValue = obj.value;
  81. if (_app.helpers.testJSON(obj.value)){
  82. propValue = JSON.parse(obj.value);
  83. } else {
  84. propValue = obj.value;
  85. }
  86. return {
  87. $cell: true,
  88. $type: "div",
  89. class: "mdc-text-field text-field mdc-ripple-upgraded",
  90. _mdc: null,
  91. $init: function(){
  92. //new mdc.mdc.notchedOutline.MDCNotchedOutline(document.querySelector('.mdc-notched-outline'));
  93. this._mdc = new mdc.textField.MDCTextField.attachTo(this);
  94. },
  95. $components:[
  96. {
  97. $type: "input",
  98. type: "text",
  99. id: obj.id,
  100. class: "mdc-text-field__input",
  101. value: propValue,
  102. onchange: obj.change
  103. },
  104. {
  105. $type: "label",
  106. class: "mdc-floating-label",
  107. for: obj.id,
  108. $text: obj.label
  109. },
  110. {
  111. $type: "div",
  112. class: "mdc-line-ripple"
  113. }
  114. ]
  115. //onclick: obj.onclick
  116. }
  117. }
  118. headerH3(headertype, label, cssclass) {
  119. return {
  120. $cell: true,
  121. $type: headertype,
  122. class: cssclass,
  123. $text: label
  124. }
  125. }
  126. simpleCard(obj){
  127. let style = 'background-image: url(' + obj.imgSrc + '); background-size: cover; background-repeat: no-repeat; height:' + obj.imgHeight + ';';
  128. var addonClass = obj.addonClass;
  129. if (!addonClass){
  130. addonClass = ''
  131. }
  132. return {
  133. $cell: true,
  134. $type: "div",
  135. $components:[
  136. {
  137. $cell: true,
  138. $type: "div",
  139. class: "mdc-card" +' '+ addonClass,
  140. onclick: obj.onclickfunc,
  141. $components:[
  142. {
  143. $cell: true,
  144. $type: "section",
  145. class: "mdc-card__media",
  146. style: style
  147. },
  148. {
  149. $cell: true,
  150. $type: "section",
  151. class: "mdc-card__supporting-text",
  152. $text: obj.text
  153. }
  154. ]
  155. }
  156. ]
  157. }
  158. }
  159. listDivider() {
  160. return {
  161. $cell: true,
  162. $type: "hr",
  163. class: "mdc-list-divider mdc-list-divider--inset"
  164. }
  165. }
  166. createListItem(obj) {
  167. return {
  168. $cell: true,
  169. $type: "li",
  170. class: "mdc-list-item",
  171. $components: [
  172. {
  173. $cell: true,
  174. $type: "span",
  175. class: "mdc-list-item__graphic",
  176. $components: [
  177. {
  178. $cell: true,
  179. class: "createItems",
  180. $type: "img",
  181. src: obj.imgSrc,
  182. onclick: obj.onclickfunc
  183. }
  184. ]
  185. },
  186. {
  187. $cell: true,
  188. $type: "span",
  189. class: "mdc-list-item__text",
  190. $text: obj.title
  191. // $components: [
  192. // {
  193. // $text: obj.title
  194. // },
  195. // {
  196. // $cell: true,
  197. // $type: "span",
  198. // class: "mdc-list-item__secondary-text",
  199. // $text: obj.subTitle
  200. // }
  201. // ]
  202. }
  203. ]
  204. }
  205. }
  206. createCard(obj){
  207. return {
  208. $cell: true,
  209. $type: "div",
  210. $components:[
  211. {
  212. $cell: true,
  213. $type: "div",
  214. class: "mdc-card",
  215. $components:[
  216. {
  217. $cell: true,
  218. $type: "div",
  219. class: "mdc-card__horizontal-block",
  220. $components:[
  221. {
  222. $cell: true,
  223. $type: "section",
  224. class: "mdc-card__primary",
  225. $components:[
  226. {
  227. $cell: true,
  228. $type: "h1",
  229. class: "mdc-card__title mdc-card__title--large",
  230. $text: obj.title
  231. },
  232. {
  233. $cell: true,
  234. $type: "h2",
  235. class: "mdc-card__subtitle",
  236. $text: obj.subTitle
  237. }
  238. ]
  239. },
  240. {
  241. $cell: true,
  242. $type: "img",
  243. class: "",
  244. src: obj.imgSrc
  245. }
  246. ]
  247. },
  248. {
  249. $cell: true,
  250. $type: "section",
  251. class: "mdc-card__actions",
  252. $components:[
  253. {
  254. $cell: true,
  255. $type: "button",
  256. class: "mdc-button mdc-button--compact mdc-card__action",
  257. $text: obj.actionLabel
  258. }
  259. ]
  260. }
  261. ]
  262. }
  263. ]
  264. }
  265. }
  266. buttonStroked(obj){
  267. return {
  268. $cell: true,
  269. $type: "button",
  270. class: "mdc-button mdc-button--outlined",
  271. $text: obj.label,
  272. onclick: obj.onclick
  273. }
  274. }
  275. buttonRaised(obj){
  276. return {
  277. $cell: true,
  278. $type: "button",
  279. class: "mdc-button mdc-button--raised mdc-ripple-upgraded",
  280. $text: obj.label,
  281. onclick: obj.onclick
  282. }
  283. }
  284. buttonSimple(obj){
  285. return {
  286. $cell: true,
  287. $type: "button",
  288. class: "mdc-button",
  289. $components: [
  290. {
  291. $type: "span",
  292. class: "mdc-button__label",
  293. $text: obj.label
  294. }
  295. ],
  296. onclick: obj.onclick
  297. }
  298. }
  299. sliderDiscrete(obj) {
  300. return {
  301. $cell: true,
  302. $type: "div",
  303. class: "mdc-slider mdc-slider--discrete",
  304. role: "slider",
  305. 'aria-valuemin': obj.min,
  306. 'aria-valuemax': obj.max,
  307. 'aria-label': obj.label,
  308. $init: obj.init,
  309. $components: [
  310. {
  311. $cell: true,
  312. $type: "div",
  313. class: "mdc-slider__track-container",
  314. $components: [
  315. {
  316. $cell: true,
  317. $type: "div",
  318. class: "mdc-slider__track",
  319. }
  320. ]
  321. },
  322. {
  323. $cell: true,
  324. $type: "div",
  325. class: "mdc-slider__thumb-container",
  326. $components: [
  327. {
  328. $cell: true,
  329. $type: "div",
  330. class: "mdc-slider__pin",
  331. $components: [
  332. {
  333. $cell: true,
  334. $type: "span",
  335. class: "mdc-slider__pin-value-marker",
  336. }
  337. ]
  338. },
  339. {
  340. $cell: true,
  341. $type: "svg",
  342. class: "mdc-slider__thumb",
  343. width: 21,
  344. height: 21,
  345. $components: [
  346. {
  347. $cell: true,
  348. $type: "circle",
  349. cx: 10.5,
  350. cy: 10.5,
  351. r: 7.875
  352. }
  353. ]
  354. },
  355. {
  356. $cell: true,
  357. $type: "div",
  358. class: "mdc-slider__focus-ring"
  359. }
  360. ]
  361. }
  362. ]
  363. }
  364. }
  365. sliderContinuous(obj) {
  366. return {
  367. $cell: true,
  368. $type: "div",
  369. class: "mdc-slider",
  370. role: "slider",
  371. tabindex: 0,
  372. 'id': obj.id,
  373. 'aria-valuemin': obj.min,
  374. 'aria-valuemax': obj.max,
  375. 'aria-label': obj.label,
  376. 'aria-valuenow': obj.value,
  377. 'data-step': obj.step,
  378. $init: obj.init,
  379. $components: [
  380. {
  381. $cell: true,
  382. $type: "div",
  383. class: "mdc-slider__track-container",
  384. $components: [
  385. {
  386. $cell: true,
  387. $type: "div",
  388. class: "mdc-slider__track",
  389. }
  390. ]
  391. },
  392. {
  393. $cell: true,
  394. $type: "div",
  395. class: "mdc-slider__thumb-container",
  396. $components: [
  397. {
  398. $cell: true,
  399. $type: "svg",
  400. class: "mdc-slider__thumb",
  401. width: 21,
  402. height: 21,
  403. $components: [
  404. {
  405. $cell: true,
  406. $type: "circle",
  407. cx: 10.5,
  408. cy: 10.5,
  409. r: 7.875
  410. }
  411. ]
  412. },
  413. {
  414. $cell: true,
  415. $type: "div",
  416. class: "mdc-slider__focus-ring"
  417. }
  418. ]
  419. }
  420. ]
  421. }
  422. }
  423. textField(obj) {
  424. return {
  425. class: "mdc-text-field",
  426. style: "width: 100%",
  427. $cell: true,
  428. $type: "div",
  429. $components: [
  430. {
  431. class: "mdc-text-field__input prop-text-field-input",
  432. id: obj.id,
  433. $cell: true,
  434. $type: "input",
  435. type: "text",
  436. value: obj.value,
  437. onchange: obj.funconchange
  438. }
  439. ]
  440. }
  441. }
  442. icontoggle(obj) {
  443. var addClass = "";
  444. if (obj.styleClass){
  445. addClass = obj.styleClass;
  446. }
  447. return {
  448. $type: "button",
  449. class: addClass + " mdc-icon-button",
  450. //$text: obj.label,
  451. id: obj.id,
  452. //'data-toggle-on': obj.on,
  453. // 'data-toggle-off': obj.off,
  454. 'aria-pressed': obj.state,
  455. 'aria-hidden': true,
  456. $init: obj.init,
  457. $components:[
  458. {
  459. $type: "i",
  460. class: "material-icons mdc-icon-button__icon mdc-icon-button__icon--on",
  461. $text: JSON.parse(obj.on).content
  462. },
  463. {
  464. $type: "i",
  465. class: "material-icons mdc-icon-button__icon",
  466. $text: JSON.parse(obj.off).content
  467. },
  468. ]
  469. }
  470. }
  471. floatActionButton(obj) {
  472. var addClass = "";
  473. if (obj.styleClass){
  474. addClass = obj.styleClass;
  475. }
  476. return {
  477. $cell: true,
  478. $type: "button",
  479. class: "mdc-fab material-icons " + addClass,
  480. onclick: obj.onclickfunc,
  481. $components:[
  482. {
  483. $cell: true,
  484. $type: "span",
  485. class: "mdc-fab__icon",
  486. $text: obj.label
  487. }
  488. ]
  489. }
  490. }
  491. iconButton(obj) {
  492. var addClass = "";
  493. if (obj.styleClass){
  494. addClass = obj.styleClass;
  495. }
  496. return {
  497. $cell: true,
  498. $type: "button",
  499. class: "mdc-button " + addClass,
  500. onclick: obj.onclick,
  501. $components:[
  502. {
  503. $cell: true,
  504. $type: "i",
  505. class: "material-icons mdc-button__icon",
  506. $text: obj.label
  507. }
  508. ]
  509. }
  510. }
  511. imageButton(obj){
  512. return {
  513. $cell: true,
  514. $type: "button",
  515. class: "mdc-button mdc-button--compact",
  516. onclick: obj.onclickfunc,
  517. $components:[
  518. {
  519. $cell: true,
  520. class: obj.styleClass,
  521. $type: "img",
  522. src: obj.imgSrc
  523. }
  524. ]
  525. }
  526. }
  527. listTitle(obj){
  528. return {
  529. $type: "div",
  530. class: "mdc-layout-grid__inner",
  531. $components: [
  532. {
  533. $type: "div",
  534. class: "mdc-layout-grid__cell",
  535. $components: [
  536. {
  537. $type: "h3",
  538. class: "",
  539. $text: obj.text
  540. }
  541. ]
  542. }
  543. ]
  544. }
  545. }
  546. gridListItem(obj) {
  547. return {
  548. $type: "div",
  549. class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-2 tooltip " + obj.styleClass,
  550. $components:[
  551. {
  552. class: "tooltiptext",
  553. $type: "span",
  554. $text: obj.title
  555. },
  556. {
  557. $type: "div",
  558. style: "background-color: transparent;",
  559. $components:[
  560. {
  561. class: "",
  562. $type: "div",
  563. 'aria-label': obj.title,
  564. alt: obj.title,
  565. style: "background-image: url("+ obj.imgSrc + "); background-size: cover; background-repeat: no-repeat; height: "+ obj.imgSize + "; width: " + obj.imgSize + ";",
  566. onclick: obj.onclickfunc,
  567. }
  568. ]
  569. }
  570. ]
  571. }
  572. }
  573. switch(obj) {
  574. return {
  575. $cell: true,
  576. $type: "div",
  577. class: "mdc-switch",
  578. _switch: null,
  579. id: obj.id,
  580. $init: obj.init,
  581. //function(){
  582. // new mdc.switchControl.MDCSwitch(this);
  583. // },
  584. $components: [
  585. {
  586. $type: "div",
  587. class: "mdc-switch__track",
  588. },
  589. {
  590. $type: "div",
  591. class: "mdc-switch__thumb-underlay",
  592. $components:[
  593. {
  594. $type: "div",
  595. class: "mdc-switch__thumb",
  596. $components:[
  597. {
  598. $type: "input",
  599. type: "checkbox",
  600. class: "mdc-switch__native-control",
  601. id: 'input-' + obj.id,
  602. //$init: obj.init,
  603. //id: "basic-switch",
  604. onchange: obj.onchange,
  605. role: "switch"
  606. }
  607. ]
  608. }
  609. ]
  610. }
  611. // {
  612. // $type: "div",
  613. // class: "mdc-switch__background",
  614. // $components: [
  615. // {
  616. // $type: "div",
  617. // class: "mdc-switch__knob"
  618. // }
  619. // ]
  620. // }
  621. ]
  622. }
  623. }
  624. reflectorGUI() {
  625. let luminaryGlobalHB = {
  626. $cell: true,
  627. _luminarySwitch: null,
  628. $components: [
  629. {
  630. $type: "p",
  631. class: "mdc-typography--headline5",
  632. $text: "Use Global Heartbeat"
  633. },
  634. {
  635. $type: 'p'
  636. },
  637. _app.widgets.switch({
  638. 'id': 'forceLuminary',
  639. 'init': function () {
  640. this._switch = new mdc.switchControl.MDCSwitch(this);
  641. let config = localStorage.getItem('lcs_config');
  642. this._switch.checked = JSON.parse(config).luminaryGlobalHB;
  643. // this._replaceSwitch = this._switch;
  644. },
  645. 'onchange': function (e) {
  646. if (this._switch) {
  647. let chkAttr = this._switch.checked;//this.getAttribute('checked');
  648. if (chkAttr) {
  649. let config = JSON.parse(localStorage.getItem('lcs_config'));
  650. config.luminaryGlobalHB = true;
  651. localStorage.setItem('lcs_config', JSON.stringify(config));
  652. //this._switch.checked = false;
  653. } else {
  654. let config = JSON.parse(localStorage.getItem('lcs_config'));
  655. config.luminaryGlobalHB = false;
  656. localStorage.setItem('lcs_config', JSON.stringify(config));
  657. }
  658. }
  659. }
  660. }
  661. ),
  662. {
  663. $type: 'label',
  664. for: 'input-forceLuminary',
  665. $text: 'On / Off'
  666. }
  667. ]
  668. }
  669. let reflectorGUI =
  670. {
  671. $type: "div",
  672. id: "reflectorGUI",
  673. //style:"background-color: #efefef",
  674. class: "mdc-layout-grid mdc-layout-grid--align-left",
  675. _reflectorHost: null,
  676. _dbHost: null,
  677. _refHostField: null,
  678. _dbHostField: null,
  679. _lpath: null,
  680. _lpathField: null,
  681. _hbpath: null,
  682. _hbpathField: null,
  683. _initData: function () {
  684. this._reflectorHost = '';
  685. this._dbHost = '';
  686. let config = JSON.parse(localStorage.getItem('lcs_config'));
  687. if (config.reflector) {
  688. this._reflectorHost = config.reflector
  689. }
  690. if (config.dbhost) {
  691. this._dbHost =config.dbhost
  692. }
  693. if (config.luminaryPath) {
  694. this._lpath = config.luminaryPath
  695. }
  696. if (config.luminaryGlobalHBPath) {
  697. this._hbpath = config.luminaryGlobalHBPath
  698. }
  699. },
  700. $init: function () {
  701. this._initData();
  702. },
  703. $update: function () {
  704. this.$components = [
  705. {
  706. $type: "div",
  707. class: "mdc-layout-grid__inner",
  708. $components: [
  709. {
  710. $type: "div",
  711. class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
  712. $components: [
  713. {
  714. $type: "h4",
  715. class: "mdc-typography--headline4",
  716. $text: "Gun DB settings"
  717. }
  718. ]
  719. },
  720. {
  721. $type: "div",
  722. class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
  723. $components: [
  724. {
  725. $type: "span",
  726. class: "mdc-typography--headline5",
  727. $text: "DB Host: "
  728. },
  729. window._app.widgets.inputTextFieldOutlined({
  730. "id": 'dbhostInput',
  731. "label": "DB Host",
  732. "value": this._dbHost,
  733. "type": "text",
  734. "init": function() {
  735. this._dbHostField = new mdc.textField.MDCTextField(this);
  736. },
  737. "style": 'width: 400px;'
  738. }),
  739. ]
  740. },
  741. {
  742. $type: "div",
  743. class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
  744. $components: [
  745. {
  746. $type: "h4",
  747. class: "mdc-typography--headline4",
  748. $text: "Reflector settings"
  749. }
  750. ]
  751. },
  752. {
  753. $type: "div",
  754. class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
  755. $components: [
  756. {
  757. $type: "span",
  758. class: "mdc-typography--headline5",
  759. $text: "Reflector: "
  760. },
  761. window._app.widgets.inputTextFieldOutlined({
  762. "id": 'reflectorInput',
  763. "label": "Reflector",
  764. "value": this._reflectorHost,
  765. "type": "text",
  766. "init": function() {
  767. this._refHostField = new mdc.textField.MDCTextField(this);
  768. },
  769. "style": 'width: 400px;'
  770. }),
  771. ]
  772. },
  773. {
  774. $type: "div",
  775. class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
  776. $components: [
  777. {
  778. $type: "h4",
  779. class: "mdc-typography--headline4",
  780. $text: "Krestianstvo Luminary settings (experimental)"
  781. }
  782. ]
  783. },
  784. {
  785. $type: "div",
  786. class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
  787. $components: [
  788. {
  789. $type: "span",
  790. class: "mdc-typography--headline5",
  791. $text: "Luminary Path: "
  792. },
  793. window._app.widgets.inputTextFieldOutlined({
  794. "id": 'lpathInput',
  795. "label": "Luminary Path",
  796. "value": this._lpath,
  797. "type": "text",
  798. "init": function() {
  799. this._lpathField = new mdc.textField.MDCTextField(this);
  800. },
  801. "style": 'width: 400px;'
  802. }),
  803. ]
  804. },
  805. {
  806. $type: "div",
  807. class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
  808. $components: [
  809. {
  810. $type: "span",
  811. class: "mdc-typography--headline5",
  812. $text: "Global Heartbeat Path: "
  813. },
  814. window._app.widgets.inputTextFieldOutlined({
  815. "id": 'hbpathInput',
  816. "label": "Global Heartbeat Path",
  817. "value": this._hbpath,
  818. "type": "text",
  819. "init": function() {
  820. this._hbpathField = new mdc.textField.MDCTextField(this);
  821. },
  822. "style": 'width: 400px;'
  823. }),
  824. ]
  825. },
  826. {
  827. $type: "div",
  828. class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
  829. $components: [luminaryGlobalHB ]
  830. },
  831. {
  832. $type: "div",
  833. class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
  834. $components: [
  835. window._app.widgets.buttonRaised(
  836. {
  837. "label": 'Update',
  838. "onclick": function (e) {
  839. e.preventDefault();
  840. let config = JSON.parse(localStorage.getItem('lcs_config'));
  841. config.reflector = this._refHostField.value;
  842. config.dbhost = this._dbHostField.value;
  843. config.luminaryPath = this._lpathField.value;
  844. config.luminaryGlobalHBPath = this._hbpathField.value;
  845. localStorage.setItem('lcs_config', JSON.stringify(config));
  846. window.location.reload(true);
  847. }
  848. }),
  849. {
  850. $type: 'span',
  851. $text: " "
  852. },
  853. {
  854. $type: "button",
  855. class: "mdc-button mdc-button--raised",
  856. $text: "Close",
  857. onclick: function (e) {
  858. window.location.pathname = '/'
  859. }
  860. }
  861. ]
  862. }
  863. ]
  864. }
  865. ]
  866. }
  867. }
  868. document.querySelector("#appGUI").$cell({
  869. id: "appGUI",
  870. $cell: true,
  871. $type: "div",
  872. $components: [reflectorGUI]
  873. }
  874. );
  875. }
  876. }
  877. export { Widgets }