Skip to content

Commit 9388dfc

Browse files
kodinkatcorsacca
andauthored
Support - Make some list functions globally available (#2659)
* Support Initial NLP to Filter List Query Generation * Exposed search_location_grid_by_name endpoint request function * Relocated ai filter to action bar * Support new dt_ai_action_bar_buttons action hook * Addressed formatting code smells * Introduced alternative mentions library * rename dt_ai_action_bar_buttons to archive_template_action_bar_buttons * remove tribute js --------- Co-authored-by: corsac <corsacca@gmail.com>
1 parent a074260 commit 9388dfc

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

dt-assets/js/modular-list.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,14 @@
11651165
favorite_edit_event();
11661166
};
11671167

1168+
window.SHAREDFUNCTIONS['empty_list'] = empty_list;
1169+
1170+
function empty_list() {
1171+
$('#table-content').html(
1172+
`<tr><td colspan="10">${window.SHAREDFUNCTIONS.escapeHTML(list_settings.translations.empty_list)}</td></tr>`,
1173+
);
1174+
}
1175+
11681176
function get_records(offset = 0, sort = null) {
11691177
loading_spinner.addClass('active');
11701178
let query = current_filter.query;
@@ -1258,6 +1266,9 @@
12581266
* Modal options
12591267
*/
12601268

1269+
// Promote as a shared function.
1270+
window.SHAREDFUNCTIONS['add_custom_filter'] = add_custom_filter;
1271+
12611272
//add the new filter in the filters list
12621273
function add_custom_filter(name, type, query, labels, load_records = true) {
12631274
query = query || current_filter.query;
@@ -1681,6 +1692,8 @@
16811692
return { newLabel: { id: key, name: value, field } };
16821693
}
16831694

1695+
// Promote as a shared function.
1696+
window.SHAREDFUNCTIONS['create_name_value_label'] = create_name_value_label;
16841697
function create_name_value_label(field, id, value, listSettings) {
16851698
let name = window.lodash.get(
16861699
listSettings,
@@ -3954,6 +3967,8 @@
39543967
return filter;
39553968
}
39563969

3970+
// Promote as a shared function.
3971+
window.SHAREDFUNCTIONS['reset_split_by_filters'] = reset_split_by_filters;
39573972
function reset_split_by_filters() {
39583973
let split_by_filter_select = $('#split_by_current_filter_select');
39593974
if (current_filter && current_filter['query']['fields'] !== undefined) {

dt-assets/js/shared-functions.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ window.API = {
171171

172172
search_users: (query) => makeRequest('GET', `users/get_users?s=${query}`),
173173

174+
search_location_grid_by_name: (query, filter = 'all') =>
175+
makeRequest(
176+
'GET',
177+
`mapping_module/search_location_grid_by_name?s=${query}&filter=${filter}`,
178+
),
179+
174180
get_filters: () => makeRequest('GET', 'users/get_filters'),
175181

176182
save_filters: (post_type, filter) =>

0 commit comments

Comments
 (0)