Browse Source

Small fixes

master
Orzu Ionut 3 years ago
parent
commit
8994e8a897
  1. 2
      .gitignore
  2. 2
      app/Http/Controllers/SearcherController.php
  3. 14
      app/SearchDisplace/Searchers/SearcherCreator.php
  4. 41
      public/js/app.js
  5. 9
      resources/js/components/Searchers/Show.vue

2
.gitignore

@ -1,6 +1,8 @@
/node_modules
/public/hot
/public/storage
/public/js/app.js
/public/css/app.css
/storage/*.key
/vendor
.env

2
app/Http/Controllers/SearcherController.php

@ -114,7 +114,7 @@ class SearcherController extends Controller
try {
$factory = new SearcherFactory(request()->get('name'), request()->get('rows'));
$searcher = $factory->save($id);
$searcher = $factory->update($id);
return response()->json([
'status' => 'success',

14
app/SearchDisplace/Searchers/SearcherCreator.php

@ -31,6 +31,20 @@ abstract class SearcherCreator
return $this->save($id);
}
public function update($id)
{
$result = explode('_', $id);
$uniqueId = $result[0];
$newId = $uniqueId . '_' . $this->name;
if ($id !== $newId) {
$this->storage->move("searchers/$id.json", "searchers/$newId.json");
}
return $this->save($newId);
}
public function save($id)
{
$this->rows = $this->processRows($this->rows);

41
public/js/app.js

@ -3019,8 +3019,9 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ });
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.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 _app__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/app */ "./resources/js/app.ts");
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); }
@ -3052,6 +3053,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
var Show = /*#__PURE__*/function (_Vue) {
_inherits(Show, _Vue);
@ -3160,24 +3162,53 @@ var Show = /*#__PURE__*/function (_Vue) {
get: function get() {
return this.searcher.type !== 'custom' && !this.searcher.hasOwnProperty('expression');
}
}, {
key: "changeRoute",
value: function () {
var _changeRoute = _asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee2(url) {
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
window.location.href = url;
case 1:
case "end":
return _context2.stop();
}
}
}, _callee2);
}));
function changeRoute(_x) {
return _changeRoute.apply(this, arguments);
}
return changeRoute;
}()
}, {
key: "created",
value: function created() {
_app__WEBPACK_IMPORTED_MODULE_2__.eventBus.$on('changeRoute', this.changeRoute);
}
}]);
return Show;
}(vue_property_decorator__WEBPACK_IMPORTED_MODULE_1__.Vue);
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([(0,vue_property_decorator__WEBPACK_IMPORTED_MODULE_1__.Prop)({
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([(0,vue_property_decorator__WEBPACK_IMPORTED_MODULE_1__.Prop)({
default: {}
})], Show.prototype, "searcher", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([(0,vue_property_decorator__WEBPACK_IMPORTED_MODULE_1__.Prop)({
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([(0,vue_property_decorator__WEBPACK_IMPORTED_MODULE_1__.Prop)({
default: true
})], Show.prototype, "editable", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([(0,vue_property_decorator__WEBPACK_IMPORTED_MODULE_1__.Prop)({
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([(0,vue_property_decorator__WEBPACK_IMPORTED_MODULE_1__.Prop)({
default: true
})], Show.prototype, "standalone", void 0);
Show = (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([(0,vue_property_decorator__WEBPACK_IMPORTED_MODULE_1__.Component)({
Show = (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([(0,vue_property_decorator__WEBPACK_IMPORTED_MODULE_1__.Component)({
name: 'SearcherShow',
components: {
'searchers-editor': function searchersEditor() {

9
resources/js/components/Searchers/Show.vue

@ -157,6 +157,7 @@
<script lang="ts">
import {Component, Vue, Prop} from "vue-property-decorator";
import {eventBus} from "@/app";
@Component({
name: 'SearcherShow',
@ -242,6 +243,14 @@ export default class Show extends Vue {
get ducklingSearcher(): boolean {
return this.searcher.type !== 'custom' && ! this.searcher.hasOwnProperty('expression');
}
public async changeRoute(url: string) {
window.location.href = url;
}
created() {
eventBus.$on('changeRoute', this.changeRoute);
}
};
</script>

Loading…
Cancel
Save