Skip to content

Commit

Permalink
[IMP]connection_elasticsearch: show 'Already cleared' message
Browse files Browse the repository at this point in the history
  • Loading branch information
PicchiSeba committed Sep 10, 2024
1 parent 00de767 commit f4edf0a
Show file tree
Hide file tree
Showing 4 changed files with 591 additions and 0 deletions.
10 changes: 10 additions & 0 deletions connector_elasticsearch/components/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ def clear(self):
res = es.indices.delete(index=self._index_name, ignore=[400, 404])
# recreate the index
self._get_es_client()
if "error" in res.keys() and res["error"].get("index_uuid") == "_na_":
return {
"type": "ir.actions.client",
"tag": "display_notification",
"params": {
"title": _("Already cleared!"),
"message": _("There was nothing to clear!"),
"sticky": False,
},
}
return res["acknowledged"]

def each(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,30 @@ interactions:
status:
code: 200
message: OK
- request:
body: null
headers:
Content-Length:
- '0'
content-type:
- application/json
user-agent:
- elasticsearch-py/7.14.0a1 (Python 3.7.3)
x-elastic-client-meta:
- es=7.14.0p,py=3.7.3,t=7.14.0p,rq=2.21.0
method: DELETE
uri: http://elastic:9200/demo_elasticsearch_backend_res_partner_binding_fake_en_us
response:
body:
string: '{"acknowledged":true}'
headers:
content-length:
- '21'
content-type:
- application/json; charset=UTF-8
status:
code: 200
message: OK
- request:
body: null
headers:
Expand Down
Loading

0 comments on commit f4edf0a

Please sign in to comment.