|
|
@ -2187,7 +2187,11 @@ var Home = /*#__PURE__*/function (_Vue) { |
|
|
|
_this.uiBlocked = false; |
|
|
|
_this.uploading = false; |
|
|
|
_this.fileUploaded = false; |
|
|
|
_this.uploadResult = null; |
|
|
|
_this.uploadResult = { |
|
|
|
id: '', |
|
|
|
file: '', |
|
|
|
path: '' |
|
|
|
}; |
|
|
|
return _this; |
|
|
|
} |
|
|
|
/** |
|
|
@ -2206,40 +2210,60 @@ var Home = /*#__PURE__*/function (_Vue) { |
|
|
|
|
|
|
|
}, { |
|
|
|
key: "uploadFile", |
|
|
|
value: function uploadFile(event) { |
|
|
|
var _this2 = this; |
|
|
|
|
|
|
|
this.uploading = true; |
|
|
|
this.fileUploaded = false; |
|
|
|
this.$toast.add({ |
|
|
|
severity: 'success', |
|
|
|
summary: 'Success Message', |
|
|
|
detail: 'Order submitted', |
|
|
|
life: 3000 |
|
|
|
}); |
|
|
|
var file = event.files[0]; |
|
|
|
setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee() { |
|
|
|
var response; |
|
|
|
value: function () { |
|
|
|
var _uploadFile = _asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee(event) { |
|
|
|
var file, response; |
|
|
|
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) { |
|
|
|
while (1) { |
|
|
|
switch (_context.prev = _context.next) { |
|
|
|
case 0: |
|
|
|
_context.next = 2; |
|
|
|
return _this2.$api.uploadFile(file); |
|
|
|
this.uploading = true; |
|
|
|
this.fileUploaded = false; |
|
|
|
this.$toast.add({ |
|
|
|
severity: 'info', |
|
|
|
summary: 'Uploading...', |
|
|
|
detail: 'Uploading your file...', |
|
|
|
life: 3000 |
|
|
|
}); |
|
|
|
_context.prev = 3; |
|
|
|
file = event.files[0]; |
|
|
|
_context.next = 7; |
|
|
|
return this.$api.uploadFile(file); |
|
|
|
|
|
|
|
case 2: |
|
|
|
case 7: |
|
|
|
response = _context.sent; |
|
|
|
_this2.fileUploaded = true; |
|
|
|
_this2.uploadResult = response; |
|
|
|
this.fileUploaded = true; |
|
|
|
this.uploadResult = response; |
|
|
|
_context.next = 18; |
|
|
|
break; |
|
|
|
|
|
|
|
case 5: |
|
|
|
case 12: |
|
|
|
_context.prev = 12; |
|
|
|
_context.t0 = _context["catch"](3); |
|
|
|
console.log('Error uploading file: ', _context.t0); |
|
|
|
this.$toast.add({ |
|
|
|
severity: 'error', |
|
|
|
summary: 'Error!', |
|
|
|
detail: 'There was an error uploading your file. Please try again later', |
|
|
|
life: 3000 |
|
|
|
}); |
|
|
|
this.uploading = false; |
|
|
|
this.fileUploaded = false; |
|
|
|
|
|
|
|
case 18: |
|
|
|
case "end": |
|
|
|
return _context.stop(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, _callee); |
|
|
|
})), 500); |
|
|
|
} |
|
|
|
}, _callee, this, [[3, 12]]); |
|
|
|
})); |
|
|
|
|
|
|
|
function uploadFile(_x) { |
|
|
|
return _uploadFile.apply(this, arguments); |
|
|
|
} |
|
|
|
|
|
|
|
return uploadFile; |
|
|
|
}() |
|
|
|
}]); |
|
|
|
|
|
|
|
return Home; |
|
|
@ -2320,6 +2344,7 @@ var ProcessFile = /*#__PURE__*/function (_Vue) { |
|
|
|
_this.selectedSearchers = []; //The list of expanded rows in the selected filters/searchers table
|
|
|
|
|
|
|
|
_this.expandedRows = []; |
|
|
|
_this.searchersOptions = {}; |
|
|
|
return _this; |
|
|
|
} |
|
|
|
/** |
|
|
@ -2341,7 +2366,7 @@ var ProcessFile = /*#__PURE__*/function (_Vue) { |
|
|
|
this.intervalId = setInterval(this.waitForFile, 3000); |
|
|
|
} |
|
|
|
/** |
|
|
|
* |
|
|
|
* Wait for the file to be processed in ingest |
|
|
|
*/ |
|
|
|
|
|
|
|
}, { |
|
|
@ -2359,7 +2384,7 @@ var ProcessFile = /*#__PURE__*/function (_Vue) { |
|
|
|
case 2: |
|
|
|
response = _context.sent; |
|
|
|
|
|
|
|
if (response.text !== null && response.ready === true) { |
|
|
|
if (response.content !== null) { |
|
|
|
if (response.ingest_status === 'fail') { |
|
|
|
this.$toast.add({ |
|
|
|
severity: 'error', |
|
|
@ -2368,7 +2393,7 @@ var ProcessFile = /*#__PURE__*/function (_Vue) { |
|
|
|
life: 3000 |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.fileContent = response.documentContent; |
|
|
|
this.fileContent = response.content; |
|
|
|
this.$toast.add({ |
|
|
|
severity: 'success', |
|
|
|
summary: 'File loaded', |
|
|
@ -2377,8 +2402,6 @@ var ProcessFile = /*#__PURE__*/function (_Vue) { |
|
|
|
}); |
|
|
|
clearInterval(this.intervalId); |
|
|
|
} |
|
|
|
} else { |
|
|
|
console.log('FILE NOT READY YET!'); |
|
|
|
} |
|
|
|
|
|
|
|
case 4: |
|
|
@ -2395,34 +2418,66 @@ var ProcessFile = /*#__PURE__*/function (_Vue) { |
|
|
|
|
|
|
|
return waitForFile; |
|
|
|
}() |
|
|
|
/** |
|
|
|
* Toggle the menu containing the list of available searchers |
|
|
|
* |
|
|
|
* @param $event |
|
|
|
*/ |
|
|
|
|
|
|
|
}, { |
|
|
|
key: "toggleSearchersMenu", |
|
|
|
value: function toggleSearchersMenu($event) { |
|
|
|
this.$refs['searchers-overlay'].toggle($event); |
|
|
|
} |
|
|
|
}, { |
|
|
|
key: "onRowSelect", |
|
|
|
value: function onRowSelect($event) { |
|
|
|
console.log('SELECT: ', $event); |
|
|
|
console.log(this.selectedSearchers); |
|
|
|
} |
|
|
|
}, { |
|
|
|
key: "onRowUnselect", |
|
|
|
value: function onRowUnselect($event) { |
|
|
|
console.log('UNSELECT: ', $event); |
|
|
|
console.log(this.selectedSearchers); |
|
|
|
} |
|
|
|
}, { |
|
|
|
key: "onSelectedSearchersReorder", |
|
|
|
value: function onSelectedSearchersReorder($event) { |
|
|
|
this.selectedSearchers = $event.value; |
|
|
|
} |
|
|
|
/** |
|
|
|
* Run the filters |
|
|
|
*/ |
|
|
|
|
|
|
|
}, { |
|
|
|
key: "onSelectedSearcherExpand", |
|
|
|
value: function onSelectedSearcherExpand($event) {} |
|
|
|
}, { |
|
|
|
key: "onSelectedSearcherCollapse", |
|
|
|
value: function onSelectedSearcherCollapse($event) {} |
|
|
|
key: "runFilters", |
|
|
|
value: function () { |
|
|
|
var _runFilters = _asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee2() { |
|
|
|
var _this2 = this; |
|
|
|
|
|
|
|
var searchers, response; |
|
|
|
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee2$(_context2) { |
|
|
|
while (1) { |
|
|
|
switch (_context2.prev = _context2.next) { |
|
|
|
case 0: |
|
|
|
searchers = []; |
|
|
|
this.selectedSearchers.forEach(function (searcher) { |
|
|
|
searchers.push({ |
|
|
|
'key': searcher.id, |
|
|
|
'replace_with': _this2.searchersOptions[searcher.id] || '' |
|
|
|
}); |
|
|
|
}); |
|
|
|
_context2.next = 4; |
|
|
|
return this.$api.filterDocument(this.fileContent, searchers); |
|
|
|
|
|
|
|
case 4: |
|
|
|
response = _context2.sent; |
|
|
|
console.log(response); |
|
|
|
this.fileContent = response.content; |
|
|
|
|
|
|
|
case 7: |
|
|
|
case "end": |
|
|
|
return _context2.stop(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, _callee2, this); |
|
|
|
})); |
|
|
|
|
|
|
|
function runFilters() { |
|
|
|
return _runFilters.apply(this, arguments); |
|
|
|
} |
|
|
|
|
|
|
|
return runFilters; |
|
|
|
}() |
|
|
|
}]); |
|
|
|
|
|
|
|
return ProcessFile; |
|
|
@ -2505,18 +2560,24 @@ var ApiService = /*#__PURE__*/function () { |
|
|
|
function ApiService() { |
|
|
|
_classCallCheck(this, ApiService); |
|
|
|
|
|
|
|
/** @type {string} */ |
|
|
|
this.baseUrl = 'http://core.sandd'; |
|
|
|
/** @type { [key:string] : string; } */ |
|
|
|
|
|
|
|
this.apiRoutes = { |
|
|
|
file: '/api/file', |
|
|
|
searchAndDisplace: '/search-and-displace' |
|
|
|
file: this.baseUrl + '/api/file', |
|
|
|
searchAndDisplace: this.baseUrl + '/search-and-displace' |
|
|
|
}; |
|
|
|
} |
|
|
|
/** |
|
|
|
* Upload a file to the server and return its response. |
|
|
|
* Throws an error if the response wasn't successful |
|
|
|
* |
|
|
|
* @param file |
|
|
|
* @returns |
|
|
|
* TODO: Annotate the return type correctly |
|
|
|
* |
|
|
|
* @param {File} file The file we want to upload |
|
|
|
* |
|
|
|
* @returns {Promise<FileUploadResponse>} The response from the server |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
@ -2533,7 +2594,7 @@ var ApiService = /*#__PURE__*/function () { |
|
|
|
formData.append('file', file); |
|
|
|
_context.prev = 2; |
|
|
|
_context.next = 5; |
|
|
|
return axios__WEBPACK_IMPORTED_MODULE_1___default().post(this.baseUrl + this.apiRoutes.file, formData, { |
|
|
|
return axios__WEBPACK_IMPORTED_MODULE_1___default().post(this.apiRoutes.file, formData, { |
|
|
|
headers: { |
|
|
|
'Content-Type': 'multipart/form-data' |
|
|
|
} |
|
|
@ -2566,8 +2627,11 @@ var ApiService = /*#__PURE__*/function () { |
|
|
|
* Get data for a file from the server. |
|
|
|
* Throws an error if the response wasn't successful |
|
|
|
* |
|
|
|
* @param fileId |
|
|
|
* @returns |
|
|
|
* @param {string} fileId The id of the file we want to query |
|
|
|
* |
|
|
|
* @returns {Promise<FileStatusResponse>} The response from the server |
|
|
|
* |
|
|
|
* @throws |
|
|
|
*/ |
|
|
|
|
|
|
|
}, { |
|
|
@ -2581,7 +2645,7 @@ var ApiService = /*#__PURE__*/function () { |
|
|
|
case 0: |
|
|
|
_context2.prev = 0; |
|
|
|
_context2.next = 3; |
|
|
|
return axios__WEBPACK_IMPORTED_MODULE_1___default().get(this.baseUrl + this.apiRoutes.searchAndDisplace + "/".concat(fileId)); |
|
|
|
return axios__WEBPACK_IMPORTED_MODULE_1___default().get(this.apiRoutes.searchAndDisplace + "/".concat(fileId)); |
|
|
|
|
|
|
|
case 3: |
|
|
|
response = _context2.sent; |
|
|
@ -2606,6 +2670,52 @@ var ApiService = /*#__PURE__*/function () { |
|
|
|
|
|
|
|
return getFileData; |
|
|
|
}() |
|
|
|
/** |
|
|
|
* Perform a search and displace operation on a document |
|
|
|
* |
|
|
|
* @param {string} content The content of the document |
|
|
|
* @param {Array} searchers The list of searchers and their replace values |
|
|
|
*/ |
|
|
|
|
|
|
|
}, { |
|
|
|
key: "filterDocument", |
|
|
|
value: function () { |
|
|
|
var _filterDocument = _asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee3(content, searchers) { |
|
|
|
var response; |
|
|
|
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee3$(_context3) { |
|
|
|
while (1) { |
|
|
|
switch (_context3.prev = _context3.next) { |
|
|
|
case 0: |
|
|
|
_context3.prev = 0; |
|
|
|
_context3.next = 3; |
|
|
|
return axios__WEBPACK_IMPORTED_MODULE_1___default().post(this.apiRoutes.searchAndDisplace, { |
|
|
|
'content': content, |
|
|
|
'searchers': searchers |
|
|
|
}); |
|
|
|
|
|
|
|
case 3: |
|
|
|
response = _context3.sent; |
|
|
|
return _context3.abrupt("return", response.data); |
|
|
|
|
|
|
|
case 7: |
|
|
|
_context3.prev = 7; |
|
|
|
_context3.t0 = _context3["catch"](0); |
|
|
|
throw _context3.t0; |
|
|
|
|
|
|
|
case 10: |
|
|
|
case "end": |
|
|
|
return _context3.stop(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, _callee3, this, [[0, 7]]); |
|
|
|
})); |
|
|
|
|
|
|
|
function filterDocument(_x3, _x4) { |
|
|
|
return _filterDocument.apply(this, arguments); |
|
|
|
} |
|
|
|
|
|
|
|
return filterDocument; |
|
|
|
}() |
|
|
|
}]); |
|
|
|
|
|
|
|
return ApiService; |
|
|
@ -3136,7 +3246,7 @@ __webpack_require__.r(__webpack_exports__); |
|
|
|
|
|
|
|
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]}); |
|
|
|
// Module
|
|
|
|
___CSS_LOADER_EXPORT___.push([module.id, ".file-card {\n flex: 0 1 74%;\n}\n.filters-card {\n flex: 0 1 24%;\n}\n.p-overlaypanel {\n min-width: 300px;\n}", ""]); |
|
|
|
___CSS_LOADER_EXPORT___.push([module.id, ".file-card {\n flex: 0 1 74%;\n}\n.filters-card {\n flex: 0 1 24%;\n}\n.p-overlaypanel {\n min-width: 450px;\n}", ""]); |
|
|
|
// Exports
|
|
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___); |
|
|
|
|
|
|
@ -30540,7 +30650,7 @@ var render = function() { |
|
|
|
"div", |
|
|
|
{ staticClass: "wrap" }, |
|
|
|
[ |
|
|
|
_c("Toast", { attrs: { position: "top-right" } }), |
|
|
|
_c("Toast"), |
|
|
|
_vm._v(" "), |
|
|
|
_c( |
|
|
|
"Panel", |
|
|
@ -30582,18 +30692,25 @@ var render = function() { |
|
|
|
{ staticClass: "wrap" }, |
|
|
|
[ |
|
|
|
_c("Skeleton"), |
|
|
|
_c("br"), |
|
|
|
_vm._v(" "), |
|
|
|
_c("Skeleton"), |
|
|
|
_c("br"), |
|
|
|
_vm._v(" "), |
|
|
|
_c("Skeleton"), |
|
|
|
_c("br"), |
|
|
|
_vm._v(" "), |
|
|
|
_c("Skeleton"), |
|
|
|
_c("br"), |
|
|
|
_vm._v(" "), |
|
|
|
_c("Skeleton"), |
|
|
|
_c("br"), |
|
|
|
_vm._v(" "), |
|
|
|
_c("Skeleton"), |
|
|
|
_c("br"), |
|
|
|
_vm._v(" "), |
|
|
|
_c("Skeleton") |
|
|
|
_c("Skeleton"), |
|
|
|
_c("br") |
|
|
|
], |
|
|
|
1 |
|
|
|
) |
|
|
@ -30635,8 +30752,6 @@ var render = function() { |
|
|
|
"div", |
|
|
|
{ staticClass: "p-d-flex p-flex-row p-jc-between p-ai-stretch" }, |
|
|
|
[ |
|
|
|
_c("Toast"), |
|
|
|
_vm._v(" "), |
|
|
|
_c("Card", { |
|
|
|
staticClass: "p-mr-2 p-as-stretch file-card", |
|
|
|
scopedSlots: _vm._u([ |
|
|
@ -30652,6 +30767,28 @@ var render = function() { |
|
|
|
return [_c("h3", [_vm._v("File preview")])] |
|
|
|
}, |
|
|
|
proxy: true |
|
|
|
}, |
|
|
|
{ |
|
|
|
key: "right", |
|
|
|
fn: function() { |
|
|
|
return [ |
|
|
|
_c("Button", { |
|
|
|
staticClass: |
|
|
|
"p-button-success p-button-outlined p-button-sm", |
|
|
|
attrs: { |
|
|
|
label: "Run filters", |
|
|
|
icon: "pi pi-play", |
|
|
|
disabled: _vm.fileContent == "" |
|
|
|
}, |
|
|
|
on: { |
|
|
|
click: function($event) { |
|
|
|
return _vm.runFilters() |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
] |
|
|
|
}, |
|
|
|
proxy: true |
|
|
|
} |
|
|
|
]) |
|
|
|
}) |
|
|
@ -30741,6 +30878,7 @@ var render = function() { |
|
|
|
_c( |
|
|
|
"DataTable", |
|
|
|
{ |
|
|
|
staticClass: "p-datatable-sm", |
|
|
|
attrs: { |
|
|
|
value: _vm.selectedSearchers, |
|
|
|
dataKey: "id", |
|
|
@ -30756,9 +30894,7 @@ var render = function() { |
|
|
|
"update:expanded-rows": function($event) { |
|
|
|
_vm.expandedRows = $event |
|
|
|
}, |
|
|
|
"row-reorder": _vm.onSelectedSearchersReorder, |
|
|
|
"row-expand": _vm.onSelectedSearcherExpand, |
|
|
|
"row-collapse": _vm.onSelectedSearcherCollapse |
|
|
|
"row-reorder": _vm.onSelectedSearchersReorder |
|
|
|
}, |
|
|
|
scopedSlots: _vm._u([ |
|
|
|
{ |
|
|
@ -30766,12 +30902,6 @@ var render = function() { |
|
|
|
fn: function(slotProps) { |
|
|
|
return [ |
|
|
|
_c("div", { staticClass: "options-subtable" }, [ |
|
|
|
_c("h5", [ |
|
|
|
_vm._v( |
|
|
|
"Options for " + _vm._s(slotProps.data.name) |
|
|
|
) |
|
|
|
]), |
|
|
|
_vm._v(" "), |
|
|
|
_c("div", { staticClass: "p-fluid" }, [ |
|
|
|
_c( |
|
|
|
"div", |
|
|
@ -30779,31 +30909,41 @@ var render = function() { |
|
|
|
[ |
|
|
|
_c( |
|
|
|
"label", |
|
|
|
{ attrs: { for: "firstname" } }, |
|
|
|
[_vm._v("Option 1")] |
|
|
|
), |
|
|
|
_vm._v(" "), |
|
|
|
_c("InputText", { |
|
|
|
staticClass: "p-inputtext-sm", |
|
|
|
attrs: { id: "firstname", type: "text" } |
|
|
|
}) |
|
|
|
], |
|
|
|
1 |
|
|
|
), |
|
|
|
_vm._v(" "), |
|
|
|
_c( |
|
|
|
"div", |
|
|
|
{ staticClass: "p-field" }, |
|
|
|
[ |
|
|
|
_c( |
|
|
|
"label", |
|
|
|
{ attrs: { for: "lastname" } }, |
|
|
|
[_vm._v("Option 2")] |
|
|
|
{ |
|
|
|
attrs: { |
|
|
|
for: |
|
|
|
"replace_with__" + slotProps.data.id |
|
|
|
} |
|
|
|
}, |
|
|
|
[ |
|
|
|
_vm._v( |
|
|
|
"\n Replace values with:\n " |
|
|
|
) |
|
|
|
] |
|
|
|
), |
|
|
|
_vm._v(" "), |
|
|
|
_c("InputText", { |
|
|
|
staticClass: "p-inputtext-sm", |
|
|
|
attrs: { id: "lastname", type: "text" } |
|
|
|
attrs: { |
|
|
|
id: |
|
|
|
"replace_with__" + slotProps.data.id, |
|
|
|
type: "text" |
|
|
|
}, |
|
|
|
model: { |
|
|
|
value: |
|
|
|
_vm.searchersOptions[ |
|
|
|
slotProps.data.id |
|
|
|
], |
|
|
|
callback: function($$v) { |
|
|
|
_vm.$set( |
|
|
|
_vm.searchersOptions, |
|
|
|
slotProps.data.id, |
|
|
|
$$v |
|
|
|
) |
|
|
|
}, |
|
|
|
expression: |
|
|
|
"searchersOptions[slotProps.data.id]" |
|
|
|
} |
|
|
|
}) |
|
|
|
], |
|
|
|
1 |
|
|
@ -30854,7 +30994,12 @@ var render = function() { |
|
|
|
selection: _vm.selectedSearchers, |
|
|
|
dataKey: "id", |
|
|
|
selectionMode: "multiple", |
|
|
|
metaKeySelection: false |
|
|
|
metaKeySelection: false, |
|
|
|
paginator: true, |
|
|
|
rows: 10, |
|
|
|
paginatorTemplate: |
|
|
|
"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown", |
|
|
|
rowsPerPageOptions: [10, 20, 50] |
|
|
|
}, |
|
|
|
on: { |
|
|
|
"update:value": function($event) { |
|
|
|