From 528739900e61140a06921af1830c0f4626d8c1b7 Mon Sep 17 00:00:00 2001 From: Orzu Ionut Date: Tue, 17 Aug 2021 14:16:11 +0300 Subject: [PATCH] WIP --- public/js/app.js | 125 +++++++++++++++--- resources/js/components/Regex/Create.vue | 17 ++- .../components/Searchers/DefineSearcher.vue | 45 ++++++- 3 files changed, 163 insertions(+), 24 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index 53a7bbe..28a339a 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -1955,24 +1955,34 @@ var Create = /*#__PURE__*/function (_Vue) { summary: 'Searcher created.', life: 1000 }); + + if (this.standalone) { + _context.next = 9; + break; + } + setTimeout(function () { window.location.href = "/searchers/".concat(data.searcher.id); }, 1000); - _context.next = 13; - break; + return _context.abrupt("return"); case 9: - _context.prev = 9; + this.$emit('searcher', data.searcher); + _context.next = 16; + break; + + case 12: + _context.prev = 12; _context.t0 = _context["catch"](0); console.log(_context.t0); console.log('Something went wrong.'); - case 13: + case 16: case "end": return _context.stop(); } } - }, _callee, this, [[0, 9]]); + }, _callee, this, [[0, 12]]); })); function save() { @@ -2036,6 +2046,10 @@ var Create = /*#__PURE__*/function (_Vue) { default: '' })], Create.prototype, "regex", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_7__.__decorate)([(0,vue_property_decorator__WEBPACK_IMPORTED_MODULE_1__.Prop)({ + default: false +})], Create.prototype, "standalone", void 0); + Create = (0,tslib__WEBPACK_IMPORTED_MODULE_7__.__decorate)([(0,vue_property_decorator__WEBPACK_IMPORTED_MODULE_1__.Component)({ name: 'RegexCreate', components: { @@ -2822,9 +2836,11 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); -/* harmony import */ var vue_property_decorator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue-property-decorator */ "./node_modules/vue-property-decorator/lib/vue-property-decorator.js"); -/* harmony import */ var _Create__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Create */ "./resources/js/components/Searchers/Create.vue"); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); +/* harmony import */ var primevue_radiobutton__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! primevue/radiobutton */ "./node_modules/primevue/radiobutton/index.js"); +/* harmony import */ var vue_property_decorator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-property-decorator */ "./node_modules/vue-property-decorator/lib/vue-property-decorator.js"); +/* harmony import */ var _Create__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Create */ "./resources/js/components/Searchers/Create.vue"); +/* harmony import */ var _Regex_Create__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Regex/Create */ "./resources/js/components/Regex/Create.vue"); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -2851,6 +2867,8 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g + + var DefineSearcher = /*#__PURE__*/function (_Vue) { _inherits(DefineSearcher, _Vue); @@ -2863,6 +2881,7 @@ var DefineSearcher = /*#__PURE__*/function (_Vue) { _this = _super.apply(this, arguments); _this.showDialog = false; + _this.type = ''; return _this; } @@ -2878,6 +2897,11 @@ var DefineSearcher = /*#__PURE__*/function (_Vue) { this.$emit('close'); } } + }, { + key: "created", + value: function created() { + this.type = this.text ? 'compound' : 'regex'; + } }, { key: "mounted", value: function mounted() { @@ -2886,17 +2910,19 @@ var DefineSearcher = /*#__PURE__*/function (_Vue) { }]); return DefineSearcher; -}(vue_property_decorator__WEBPACK_IMPORTED_MODULE_0__.Vue); +}(vue_property_decorator__WEBPACK_IMPORTED_MODULE_1__.Vue); -(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([(0,vue_property_decorator__WEBPACK_IMPORTED_MODULE_0__.Prop)({ +(0,tslib__WEBPACK_IMPORTED_MODULE_4__.__decorate)([(0,vue_property_decorator__WEBPACK_IMPORTED_MODULE_1__.Prop)({ default: '' })], DefineSearcher.prototype, "text", void 0); -(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([(0,vue_property_decorator__WEBPACK_IMPORTED_MODULE_0__.Watch)('showDialog')], DefineSearcher.prototype, "showDialogChanged", null); +(0,tslib__WEBPACK_IMPORTED_MODULE_4__.__decorate)([(0,vue_property_decorator__WEBPACK_IMPORTED_MODULE_1__.Watch)('showDialog')], DefineSearcher.prototype, "showDialogChanged", null); -DefineSearcher = (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([(0,vue_property_decorator__WEBPACK_IMPORTED_MODULE_0__.Component)({ +DefineSearcher = (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__decorate)([(0,vue_property_decorator__WEBPACK_IMPORTED_MODULE_1__.Component)({ components: { - CreateSearcher: _Create__WEBPACK_IMPORTED_MODULE_1__.default + RadioButton: primevue_radiobutton__WEBPACK_IMPORTED_MODULE_0__.default, + SearcherCreate: _Create__WEBPACK_IMPORTED_MODULE_2__.default, + RegexCreate: _Regex_Create__WEBPACK_IMPORTED_MODULE_3__.default } })], DefineSearcher); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DefineSearcher); @@ -31827,10 +31853,75 @@ var render = function() { } }, [ - _c("create-searcher", { - attrs: { "is-defining": true, "defined-searcher": _vm.text }, - on: { defined: _vm.onDefined } - }) + !_vm.text + ? _c("div", { staticClass: "p-d-flex p-flex-row" }, [ + _c( + "div", + { staticClass: "p-field-radiobutton p-mr-4" }, + [ + _c("RadioButton", { + attrs: { + name: "searcher-type", + id: "searcher-type-regex", + value: "regex" + }, + model: { + value: _vm.type, + callback: function($$v) { + _vm.type = $$v + }, + expression: "type" + } + }), + _vm._v(" "), + _c("label", { attrs: { for: "searcher-type-regex" } }, [ + _vm._v("Regex") + ]) + ], + 1 + ), + _vm._v(" "), + _c( + "div", + { staticClass: "p-field-radiobutton" }, + [ + _c("RadioButton", { + attrs: { + name: "searcher-type", + id: "searcher-type-compound", + value: "compound" + }, + model: { + value: _vm.type, + callback: function($$v) { + _vm.type = $$v + }, + expression: "type" + } + }), + _vm._v(" "), + _c("label", { attrs: { for: "searcher-type-compound" } }, [ + _vm._v("Searcher") + ]) + ], + 1 + ) + ]) + : _vm._e(), + _vm._v(" "), + _vm.type === "regex" + ? _c("regex-create", { + attrs: { standalone: true }, + on: { searcher: _vm.onDefined } + }) + : _vm._e(), + _vm._v(" "), + _vm.type === "compound" + ? _c("searcher-create", { + attrs: { "is-defining": true, "defined-searcher": _vm.text }, + on: { defined: _vm.onDefined } + }) + : _vm._e() ], 1 ) diff --git a/resources/js/components/Regex/Create.vue b/resources/js/components/Regex/Create.vue index ddb7b8c..40e2629 100644 --- a/resources/js/components/Regex/Create.vue +++ b/resources/js/components/Regex/Create.vue @@ -86,6 +86,11 @@ export default class Create extends Vue { }) public readonly regex!: string; + @Prop({ + default: false, + }) + public readonly standalone!: boolean; + onSave() { if ( ! this.regex) { this.save(); @@ -110,9 +115,15 @@ export default class Create extends Vue { life: 1000, }); - setTimeout(() => { - window.location.href = `/searchers/${data.searcher.id}`; - }, 1000); + if ( ! this.standalone) { + setTimeout(() => { + window.location.href = `/searchers/${data.searcher.id}`; + }, 1000); + + return; + } + + this.$emit('searcher', data.searcher); } catch (e) { console.log(e); console.log('Something went wrong.'); diff --git a/resources/js/components/Searchers/DefineSearcher.vue b/resources/js/components/Searchers/DefineSearcher.vue index d4ce6d8..1730f7a 100644 --- a/resources/js/components/Searchers/DefineSearcher.vue +++ b/resources/js/components/Searchers/DefineSearcher.vue @@ -10,24 +10,57 @@ id="define-searcher" ref="define-searcher"> - +
+ + + + +
+ +
+ + + + +
+ + + + + + -
+