Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
IDsearch
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
IDsearch
IDsearch
Commits
fb5996e6
Commit
fb5996e6
authored
Jun 13, 2017
by
Nacim Goura
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test for search
parent
62b80078
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
373 additions
and
209 deletions
+373
-209
.eslintrc.json
.eslintrc.json
+23
-25
indexGeneric.js
imports/api/indexation/indexGeneric.js
+2
-2
indexWebsite.js
imports/api/indexation/indexWebsite.js
+1
-1
methods.js
imports/api/testSearch/methods.js
+23
-0
testSearchCollection.js
imports/collections/testSearchCollection.js
+30
-0
register-api.js
imports/startup/server/register-api.js
+2
-0
buttonTabular.html
imports/tabular/buttonTabular.html
+4
-0
configClient.js
imports/tabular/configClient.js
+9
-0
tabularTestSearch.js
imports/tabular/tabularTestSearch.js
+49
-0
testSearch.html
imports/ui/components/testSearch/testSearch.html
+24
-0
testSearch.js
imports/ui/components/testSearch/testSearch.js
+36
-0
list.js
imports/ui/pages/admin/account/list/list.js
+2
-7
home.html
imports/ui/pages/home/home.html
+2
-0
home.js
imports/ui/pages/home/home.js
+1
-0
package.json
package.json
+37
-38
yarn.lock
yarn.lock
+128
-136
No files found.
.eslintrc.json
View file @
fb5996e6
{
{
"env"
:
{
"env"
:
{
"meteor"
:
true
,
"meteor"
:
true
,
"node"
:
true
,
"node"
:
true
,
"browser"
:
true
,
"browser"
:
true
,
"mocha"
:
true
,
"mocha"
:
true
,
"es6"
:
true
"es6"
:
true
},
},
"parser"
:
"babel-eslint"
,
"parser"
:
"babel-eslint"
,
"parserOptions"
:
{
"parserOptions"
:
{
"allowImportExportEverywhere"
:
true
,
"allowImportExportEverywhere"
:
true
,
"ecmaVersion"
:
6
,
"ecmaVersion"
:
6
,
"ecmaFeatures"
:
{
"ecmaFeatures"
:
{
"jsx"
:
false
,
"jsx"
:
false
,
"experimentalObjectRestSpread"
:
true
"experimentalObjectRestSpread"
:
true
}
}
},
},
"plugins"
:
[
"plugins"
:
[
"meteor"
,
"meteor"
,
"promise"
,
"promise"
"lodash"
],
],
"extends"
:
[
"extends"
:
[
"@meteorjs/eslint-config-meteor"
,
"@meteorjs/eslint-config-meteor"
,
"plugin:meteor/recommended"
,
"plugin:meteor/recommended"
,
"airbnb"
,
"airbnb"
"plugin:lodash/recommended"
],
],
"settings"
:
{
"settings"
:
{
"import/resolver"
:
"meteor"
"import/resolver"
:
"meteor"
},
},
"rules"
:
{
"rules"
:
{
"indent"
:
[
"error"
,
4
,
{
"SwitchCase"
:
1
}],
"indent"
:
[
"error"
,
4
,
{
"SwitchCase"
:
1
}],
"import/extensions"
:
[
"off"
,
"never"
],
"import/extensions"
:
[
"off"
,
"never"
],
"import/no-extraneous-dependencies"
:
"off"
,
"import/no-extraneous-dependencies"
:
"off"
,
"no-underscore-dangle"
:
"off"
,
"no-underscore-dangle"
:
"off"
,
"class-methods-use-this"
:
"off"
"class-methods-use-this"
:
"off"
}
}
}
}
imports/api/indexation/indexGeneric.js
View file @
fb5996e6
...
@@ -60,7 +60,7 @@ export default class IndexGeneric {
...
@@ -60,7 +60,7 @@ export default class IndexGeneric {
query
:
term
,
query
:
term
,
fuzziness
:
'
AUTO
'
,
fuzziness
:
'
AUTO
'
,
fields
:
[
fields
:
[
'
title.stemmed
'
,
'
description
'
,
'
description.stemmed
'
,
'
description.stemmed
'
,
'
body
'
,
'
body
'
,
'
body.stemmed
'
,
'
body.stemmed
'
,
...
@@ -76,7 +76,7 @@ export default class IndexGeneric {
...
@@ -76,7 +76,7 @@ export default class IndexGeneric {
fuzziness
:
'
AUTO
'
,
fuzziness
:
'
AUTO
'
,
fields
:
[
fields
:
[
'
title
'
,
'
title
'
,
'
description
'
,
'
title.stemmed
'
,
'
url
'
,
'
url
'
,
'
breadcrumb
'
,
'
breadcrumb
'
,
'
h1
'
,
'
h1
'
,
...
...
imports/api/indexation/indexWebsite.js
View file @
fb5996e6
...
@@ -105,7 +105,7 @@ export default class IndexWebsite extends IndexGeneric {
...
@@ -105,7 +105,7 @@ export default class IndexWebsite extends IndexGeneric {
index
:
{
index
:
{
_index
:
Meteor
.
settings
.
private
.
elasticsearch
.
esIndex
,
_index
:
Meteor
.
settings
.
private
.
elasticsearch
.
esIndex
,
_type
:
Meteor
.
settings
.
private
.
elasticsearch
.
esType
,
_type
:
Meteor
.
settings
.
private
.
elasticsearch
.
esType
,
_id
:
url
,
_id
:
decodeURI
(
url
)
,
},
},
});
});
...
...
imports/api/testSearch/methods.js
0 → 100644
View file @
fb5996e6
import
{
check
}
from
'
meteor/check
'
;
import
{
Meteor
}
from
'
meteor/meteor
'
;
import
_
from
'
lodash
'
;
import
testSearchCollection
from
'
../../collections/testSearchCollection
'
;
Meteor
.
methods
({
addTest
(
test
)
{
check
(
test
,
Object
);
test
.
urlExpected
=
_
.
replace
(
test
.
urlExpected
,
'
https
'
,
'
http
'
);
const
results
=
Meteor
.
call
(
'
searchByTerm
'
,
test
.
term
);
_
.
forEach
(
results
.
list
,
(
result
,
index
)
=>
{
if
(
test
.
urlExpected
===
result
.
url
)
{
test
.
urlPosition
=
index
+
1
;
}
});
testSearchCollection
.
insert
(
test
);
},
deleteTest
(
id
)
{
check
(
id
,
String
);
testSearchCollection
.
remove
({
_id
:
id
});
},
});
imports/collections/testSearchCollection.js
0 → 100644
View file @
fb5996e6
import
SimpleSchema
from
'
simpl-schema
'
;
import
{
Mongo
}
from
'
meteor/mongo
'
;
/**
* this local collection keep tracks of all tabs of this application
* @type {Mongo.Collection}
*/
const
testSearchCollection
=
new
Mongo
.
Collection
(
'
testSearch
'
);
SimpleSchema
.
testSearchCollection
=
new
SimpleSchema
({
term
:
{
type
:
String
,
},
urlExpected
:
{
type
:
String
,
},
urlPosition
:
{
type
:
Number
,
required
:
false
,
},
createdAt
:
{
type
:
Date
,
defaultValue
:
new
Date
(),
},
});
testSearchCollection
.
attachSchema
(
SimpleSchema
.
testSearchCollection
);
export
default
testSearchCollection
;
imports/startup/server/register-api.js
View file @
fb5996e6
...
@@ -2,4 +2,6 @@
...
@@ -2,4 +2,6 @@
import
'
../../api/indexation/methods
'
;
import
'
../../api/indexation/methods
'
;
import
'
../../api/account/methods
'
;
import
'
../../api/account/methods
'
;
import
'
../../api/testSearch/methods
'
;
import
'
../../tabular/tabularUser
'
;
import
'
../../tabular/tabularUser
'
;
import
'
../../tabular/tabularTestSearch
'
;
imports/tabular/buttonTabular.html
View file @
fb5996e6
<template
name=
"accountActionTable"
>
<template
name=
"accountActionTable"
>
<button
type=
"button"
class=
"btn btn-xs btn-danger delete-account"
>
Supprimer
</button>
<button
type=
"button"
class=
"btn btn-xs btn-danger delete-account"
>
Supprimer
</button>
</template>
</template>
<template
name=
"testSearchActionTable"
>
<button
type=
"button"
class=
"btn btn-xs btn-danger delete-test-search"
>
Supprimer
</button>
</template>
imports/tabular/configClient.js
0 → 100644
View file @
fb5996e6
import
dataTablesBootstrap
from
'
datatables.net-bs
'
;
import
'
datatables.net-bs/css/dataTables.bootstrap.css
'
;
import
'
./buttonTabular.html
'
;
import
'
./tabularUser
'
;
import
'
./tabularTestSearch
'
;
dataTablesBootstrap
(
window
,
$
);
imports/tabular/tabularTestSearch.js
0 → 100644
View file @
fb5996e6
import
Tabular
from
'
meteor/aldeed:tabular
'
;
import
{
Meteor
}
from
'
meteor/meteor
'
;
import
testSearchCollection
from
'
../collections/testSearchCollection
'
;
new
Tabular
.
Table
({
name
:
'
testSearch
'
,
collection
:
testSearchCollection
,
columns
:
[
{
data
:
'
term
'
,
title
:
'
Terme
'
,
},
{
data
:
'
urlExpected
'
,
title
:
'
url Attendu
'
,
},
{
data
:
'
urlPosition
'
,
title
:
'
Position
'
,
},
{
data
:
'
createdAt
'
,
title
:
'
Date
'
,
},
{
tmpl
:
Meteor
.
isClient
&&
Template
.
testSearchActionTable
,
},
],
pageLength
:
20
,
language
:
{
sProcessing
:
'
Traitement en cours...
'
,
sSearch
:
'
Rechercher :
'
,
sLengthMenu
:
'
Afficher _MENU_ éléments
'
,
sInfo
:
"
Affichage de l'élément _START_ à _END_ sur _TOTAL_ éléments
"
,
sInfoEmpty
:
"
Affichage de l'élément 0 à 0 sur 0 élément
"
,
sInfoFiltered
:
'
(filtré de _MAX_ éléments au total)
'
,
sInfoPostFix
:
''
,
sLoadingRecords
:
'
Chargement en cours...
'
,
sZeroRecords
:
'
Aucun élément à afficher
'
,
sEmptyTable
:
'
Aucune donnée disponible dans le tableau
'
,
oPaginate
:
{
sFirst
:
'
Premier
'
,
sPrevious
:
'
Précédent
'
,
sNext
:
'
Suivant
'
,
sLast
:
'
Dernier
'
,
},
oAria
:
{
sSortAscending
:
'
: activer pour trier la colonne par ordre croissant
'
,
sSortDescending
:
'
: activer pour trier la colonne par ordre décroissant
'
,
},
},
});
imports/ui/components/testSearch/testSearch.html
0 → 100644
View file @
fb5996e6
<template
name=
"testSearchTpl"
>
<!-- testSearchTpl -->
Tester le système de recherche :
<form
class=
"form-inline"
role=
"form"
method=
"post"
>
<input
class=
"form-control"
name=
"termTestSearch"
type=
"text"
placeholder=
"terme"
>
<input
class=
"form-control"
name=
"urlTestSearch"
type=
"url"
placeholder=
"Url attendu"
>
<input
class=
"btn btn-success"
type=
"submit"
value=
"Tester"
>
</form>
<div
class=
"panel panel-default wrapper"
>
<div
class=
"panel-heading text-center"
>
Résultat des tests
</div>
<div
class=
"panel-body"
>
{{> tabular table=TabularTables.testSearch class="table table-striped table-bordered table-condensed text-center"}}
</div>
</div>
</template>
imports/ui/components/testSearch/testSearch.js
0 → 100644
View file @
fb5996e6
import
{
Meteor
}
from
'
meteor/meteor
'
;
import
{
Template
}
from
'
meteor/templating
'
;
import
'
./testSearch.html
'
;
import
'
../../../tabular/configClient
'
;
Template
.
testSearchTpl
.
events
({
'
submit form
'
:
(
event
)
=>
{
event
.
preventDefault
();
const
test
=
{
term
:
event
.
target
.
termTestSearch
.
value
,
urlExpected
:
event
.
target
.
urlTestSearch
.
value
,
};
Meteor
.
callPromise
(
'
addTest
'
,
test
)
.
then
((
results
)
=>
{
console
.
log
(
results
);
}).
catch
((
error
)
=>
{
console
.
log
(
error
);
});
},
});
Template
.
testSearchActionTable
.
events
({
'
click .delete-test-search
'
:
function
()
{
Meteor
.
callPromise
(
'
deleteTest
'
,
this
.
_id
)
.
then
((
results
)
=>
{
console
.
log
(
results
);
}).
catch
((
error
)
=>
{
console
.
log
(
error
);
});
},
});
imports/ui/pages/admin/account/list/list.js
View file @
fb5996e6
import
{
Meteor
}
from
'
meteor/meteor
'
;
import
{
Meteor
}
from
'
meteor/meteor
'
;
import
{
Template
}
from
'
meteor/templating
'
;
import
{
Template
}
from
'
meteor/templating
'
;
import
dataTablesBootstrap
from
'
datatables.net-bs
'
;
import
'
datatables.net-bs/css/dataTables.bootstrap.css
'
;
import
displayNotif
from
'
../../../../components/notifs/notifs
'
;
import
'
../../../../../tabular/buttonTabular.html
'
;
import
displayNotif
from
'
../../../../components/notifs/notifs
'
;
import
'
../../../../../tabular/
tabularUser
'
;
import
'
../../../../../tabular/
configClient
'
;
import
'
./list.html
'
;
import
'
./list.html
'
;
dataTablesBootstrap
(
window
,
$
);
Template
.
accountActionTable
.
events
({
Template
.
accountActionTable
.
events
({
'
click .delete-account
'
:
function
()
{
'
click .delete-account
'
:
function
()
{
Meteor
.
callPromise
(
'
deleteAccount
'
,
this
.
_id
)
Meteor
.
callPromise
(
'
deleteAccount
'
,
this
.
_id
)
...
...
imports/ui/pages/home/home.html
View file @
fb5996e6
...
@@ -4,4 +4,6 @@
...
@@ -4,4 +4,6 @@
{{> searchTpl ""}}
{{> searchTpl ""}}
{{> testSearchTpl ""}}
</template>
</template>
imports/ui/pages/home/home.js
View file @
fb5996e6
import
'
../../components/search/search
'
;
import
'
../../components/search/search
'
;
import
'
../../components/testSearch/testSearch
'
;
import
'
./home.html
'
;
import
'
./home.html
'
;
package.json
View file @
fb5996e6
{
{
"name"
:
"meteorSearch"
,
"name"
:
"meteorSearch"
,
"author"
:
"Nacim"
,
"author"
:
"Nacim"
,
"private"
:
true
,
"private"
:
true
,
"scripts"
:
{
"scripts"
:
{
"start"
:
"meteor --settings settings.json"
,
"start"
:
"meteor --settings settings.json"
,
"test"
:
"meteor test --driver-package practicalmeteor:mocha --port 3001"
,
"test"
:
"meteor test --driver-package practicalmeteor:mocha --port 3001"
,
"eslint"
:
"eslint .; exit 0"
"eslint"
:
"eslint .; exit 0"
},
},
"dependencies"
:
{
"dependencies"
:
{
"
babel-runtime
"
:
"
^6.23.0
"
,
"
babel-runtime
"
:
"
^6.23.0
"
,
"
bcrypt
"
:
"
^1.0.2
"
,
"
bcrypt
"
:
"
^1.0.2
"
,
"
bootstrap-sass
"
:
"
^3.3.7
"
,
"
bootstrap-sass
"
:
"
^3.3.7
"
,
"
crawler
"
:
"
^1.0.5
"
,
"
crawler
"
:
"
^1.0.5
"
,
"
datatables.net-bs
"
:
"
^1.10.15
"
,
"
datatables.net-bs
"
:
"
^1.10.15
"
,
"
elasticsearch
"
:
"
^13.1.0
"
,
"
elasticsearch
"
:
"
^13.1.0
"
,
"
izitoast
"
:
"
^1.1.1
"
,
"
izitoast
"
:
"
^1.1.1
"
,
"
jquery
"
:
"
^1.11.2
"
,
"
jquery
"
:
"
^1.11.2
"
,
"
lodash
"
:
"
^4.17.4
"
,
"
lodash
"
:
"
^4.17.4
"
,
"
meteor-node-stubs
"
:
"
~0.2.11
"
,
"
meteor-node-stubs
"
:
"
~0.2.11
"
,
"
sanitize-html
"
:
"
^1.14.1
"
,
"
sanitize-html
"
:
"
^1.14.1
"
,
"
simpl-schema
"
:
"
^0.3.0
"
,
"
simpl-schema
"
:
"
^0.3.0
"
,
"
sitemapper
"
:
"
^2.1.13
"
,
"
sitemapper
"
:
"
^2.1.13
"
,
"
slug
"
:
"
^0.9.1
"
,
"
slug
"
:
"
^0.9.1
"
,
"
sweetalert2
"
:
"
^6.6.5
"
"
sweetalert2
"
:
"
^6.6.5
"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
"
@meteorjs/eslint-config-meteor
"
:
"
^1.0.5
"
,
"
@meteorjs/eslint-config-meteor
"
:
"
^1.0.5
"
,
"
babel-eslint
"
:
"
^7.2.3
"
,
"
babel-eslint
"
:
"
^7.2.3
"
,
"
eslint
"
:
"
^4.0.0
"
,
"
eslint
"
:
"
^3.19.0
"
,
"
eslint-config-airbnb
"
:
"
^15.0.1
"
,
"
eslint-config-airbnb
"
:
"
^15.0.1
"
,
"
eslint-import-resolver-meteor
"
:
"
^0.4.0
"
,
"
eslint-import-resolver-meteor
"
:
"
^0.4.0
"
,
"
eslint-plugin-import
"
:
"
^2.3.0
"
,
"
eslint-plugin-import
"
:
"
^2.3.0
"
,
"
eslint-plugin-jsx-a11y
"
:
"
^5.0.3
"
,
"
eslint-plugin-jsx-a11y
"
:
"
^5.0.3
"
,
"
eslint-plugin-lodash
"
:
"
^2.4.2
"
,
"
eslint-plugin-meteor
"
:
"
^4.0.1
"
,
"
eslint-plugin-meteor
"
:
"
^4.0.1
"
,
"
eslint-plugin-promise
"
:
"
^3.5.0
"
,
"
eslint-plugin-promise
"
:
"
^3.5.0
"
,
"
eslint-plugin-react
"
:
"
^7.0.1
"
"
eslint-plugin-react
"
:
"
^7.0.1
"
}
}
}
}
yarn.lock
View file @
fb5996e6
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment