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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6442bb42dbd73e86c09da30b7b10651a055108a43169ec9aa99b6ee9afe67cc4
4
- data.tar.gz: b65ed0dbeac486d6cfce23e4af226a1c87289284d4c4962482e6f74ad4f24a36
3
+ metadata.gz: '09cfa50efbe1f8e34246268b386aa7f2cdc0e6f723beda8aedf60a6edf372cbb'
4
+ data.tar.gz: 6124d140e2ddd581ff85c7d4c44bb6c3fed01a9e64050e39bf595bff485ca7bb
5
5
  SHA512:
6
- metadata.gz: 7f1f2cc08a2d6a1d312c302d27f965ce9bcf5c1dafb8de0d63299952f598478a1b9c5637f2b940e840d31836ec4a6a236cf176de53d25e980001efa41871dd7e
7
- data.tar.gz: 671329ba2b9539fd586d82092e77458b482a445e34c4cbed18d9d9e9854b4573a59f7e475aa7ae2ec41f1959938020a376a4adf2f48e09747023109fb518d1ae
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
 
@@ -1,3 +1,3 @@
1
1
  module ForemanTasks
2
- VERSION = '3.0.3'.freeze
2
+ VERSION = '3.0.4'.freeze
3
3
  end
@@ -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 { resolveSearchQuery, getCSVurl } from './TasksTableHelpers';
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 = searchQuery => {
39
- resolveSearchQuery(searchQuery, history);
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.3
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-01-07 00:00:00.000000000 Z
11
+ date: 2021-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dynflow