foreman-tasks 3.0.3 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/foreman_tasks/task/search.rb +1 -1
- data/lib/foreman_tasks/version.rb +1 -1
- data/test/unit/task_test.rb +8 -0
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableHelpers.js +0 -8
- data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.js +13 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09cfa50efbe1f8e34246268b386aa7f2cdc0e6f723beda8aedf60a6edf372cbb'
|
4
|
+
data.tar.gz: 6124d140e2ddd581ff85c7d4c44bb6c3fed01a9e64050e39bf595bff485ca7bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ee3cd1aee581db4ab76b9278624d00b28271965655cc9c154d2cd18ac3d9284244886d74bd6f6654847d5ae19f9dc8245eb517227ee1b4c8b88281066f43a19
|
7
|
+
data.tar.gz: 67c6b3edfd673e60489884f2dbb18fec2a03c7a2a33a04933f1a087686c2b18324038ca2f283a3c07608cae8d335b1f4e441ceffa92dad094468a3ac77cccaaa
|
@@ -20,7 +20,7 @@ module ForemanTasks
|
|
20
20
|
foreman_tasks_locks_taxonomy#{uniq_suffix}.resource_type = '#{resource_type}')
|
21
21
|
SQL
|
22
22
|
# Select only those tasks which either have the correct taxonomy or are not related to any
|
23
|
-
sql = "foreman_tasks_locks_taxonomy#{uniq_suffix}.resource_id #{operator} ? OR foreman_tasks_locks_taxonomy#{uniq_suffix}.resource_id IS NULL"
|
23
|
+
sql = "foreman_tasks_locks_taxonomy#{uniq_suffix}.resource_id #{operator} (?) OR foreman_tasks_locks_taxonomy#{uniq_suffix}.resource_id IS NULL"
|
24
24
|
{ :conditions => sanitize_sql_for_conditions([sql, value]), :joins => joins }
|
25
25
|
end
|
26
26
|
|
data/test/unit/task_test.rb
CHANGED
@@ -129,6 +129,14 @@ class TasksTest < ActiveSupport::TestCase
|
|
129
129
|
_ { proc { ForemanTasks::Task.search_for('duration = "25 potatoes"') } }.must_raise ScopedSearch::QueryNotSupported
|
130
130
|
end
|
131
131
|
end
|
132
|
+
|
133
|
+
context 'by taxonomies' do
|
134
|
+
test 'can search by taxonomies using IN' do
|
135
|
+
assert_nothing_raised(PG::SyntaxError) { ForemanTasks::Task.search_for('location_id ^ (1)').first }
|
136
|
+
assert_nothing_raised(PG::SyntaxError) { ForemanTasks::Task.search_for('organization_id ^ (1)').first }
|
137
|
+
assert_nothing_raised(PG::SyntaxError) { ForemanTasks::Task.search_for('organization_id = 1').first }
|
138
|
+
end
|
139
|
+
end
|
132
140
|
end
|
133
141
|
|
134
142
|
describe 'users' do
|
@@ -14,14 +14,6 @@ export const getApiPathname = url => {
|
|
14
14
|
return uri.pathname().replace('foreman_tasks/', 'foreman_tasks/api/');
|
15
15
|
};
|
16
16
|
|
17
|
-
export const resolveSearchQuery = (search, history) => {
|
18
|
-
const uriQuery = {
|
19
|
-
search,
|
20
|
-
page: 1,
|
21
|
-
};
|
22
|
-
updateURlQuery(uriQuery, history);
|
23
|
-
};
|
24
|
-
|
25
17
|
export const getCSVurl = (path, query) => {
|
26
18
|
let url = new URI(path);
|
27
19
|
url = url.pathname(`${url.pathname()}.csv`);
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
|
+
import URI from 'urijs';
|
3
4
|
import { getURIsearch } from 'foremanReact/common/urlHelpers';
|
4
5
|
import { Spinner, Button, Icon } from 'patternfly-react';
|
5
6
|
import PageLayout from 'foremanReact/routes/common/PageLayout/PageLayout';
|
@@ -10,7 +11,7 @@ import { STATUS } from 'foremanReact/constants';
|
|
10
11
|
import { useForemanModal } from 'foremanReact/components/ForemanModal/ForemanModalHooks';
|
11
12
|
import TasksDashboard from '../TasksDashboard';
|
12
13
|
import TasksTable from './TasksTable';
|
13
|
-
import {
|
14
|
+
import { getCSVurl, updateURlQuery } from './TasksTableHelpers';
|
14
15
|
import ConfirmModal from './Components/ConfirmModal/';
|
15
16
|
import {
|
16
17
|
TASKS_SEARCH_PROPS,
|
@@ -35,8 +36,17 @@ const TasksTablePage = ({
|
|
35
36
|
}) => {
|
36
37
|
const url = history.location.pathname + history.location.search;
|
37
38
|
const uriQuery = getURIQuery(url);
|
38
|
-
const onSearch =
|
39
|
-
|
39
|
+
const onSearch = search => {
|
40
|
+
const uri = new URI(url);
|
41
|
+
if (uri.search(true).search === search && uri.search(true).page === '1') {
|
42
|
+
props.getTableItems(uri);
|
43
|
+
} else {
|
44
|
+
const newUriQuery = {
|
45
|
+
search,
|
46
|
+
page: 1,
|
47
|
+
};
|
48
|
+
updateURlQuery(newUriQuery, history);
|
49
|
+
}
|
40
50
|
};
|
41
51
|
|
42
52
|
const { setModalOpen, setModalClosed } = useForemanModal({
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman-tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Nečas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dynflow
|