diff --git a/website/assets/js/pages/query-detail.page.js b/website/assets/js/pages/query-detail.page.js index 752921e50..1cd398736 100644 --- a/website/assets/js/pages/query-detail.page.js +++ b/website/assets/js/pages/query-detail.page.js @@ -20,6 +20,15 @@ parasails.registerPage('query-detail', { // ║║║║ ║ ║╣ ╠╦╝╠═╣║ ║ ║║ ║║║║╚═╗ // ╩╝╚╝ ╩ ╚═╝╩╚═╩ ╩╚═╝ ╩ ╩╚═╝╝╚╝╚═╝ methods: { - //… + castRemediationArray: function (remediation) { + if (_.isArray(remediation) && remediation.length) { + return remediation.filter((item) => _.isString(item) && item.length); + } + if (_.isString(remediation) && remediation.length) { + return [remediation]; + } + return ['N/A']; + } + } }); diff --git a/website/assets/js/pages/query-library.page.js b/website/assets/js/pages/query-library.page.js index 8df2ec787..979d448d8 100644 --- a/website/assets/js/pages/query-library.page.js +++ b/website/assets/js/pages/query-library.page.js @@ -3,7 +3,15 @@ parasails.registerPage('query-library', { // ║║║║║ ║ ║╠═╣║ ╚═╗ ║ ╠═╣ ║ ║╣ // ╩╝╚╝╩ ╩ ╩╩ ╩╩═╝ ╚═╝ ╩ ╩ ╩ ╩ ╚═╝ data: { - //… + selectedPurpose: 'all', // Initially set to all, the user may select a different option to filter queries by purpose (e.g., "all queries", "information", "detection") + selectedPlatform: 'all', // Initially set to all, the user may select a different option to filter queries by platform (e.g., "all platforms", "macOS", "Windows", "Linux") + }, + + computed: { + filteredQueries: function () { + return _.filter(this.queries, (query) => this.isIncluded(query.platforms, this.selectedPlatform) && this.isIncluded(query.purpose, this.selectedPurpose)); + }, + }, // ╦ ╦╔═╗╔═╗╔═╗╦ ╦╔═╗╦ ╔═╗ @@ -21,5 +29,20 @@ parasails.registerPage('query-library', { // ╩╝╚╝ ╩ ╚═╝╩╚═╩ ╩╚═╝ ╩ ╩╚═╝╝╚╝╚═╝ methods: { //… + clickCard: function (querySlug) { + window.location = '/sandbox/queries/' + querySlug.toLowerCase(); // TODO remove sandbox from path before deploy to production + }, + + isIncluded: function (queryProperty, selectedOption) { + if (selectedOption.startsWith('all') || selectedOption === '') { + return true; + } + if (_.isArray(queryProperty)) { + queryProperty = queryProperty.join(', '); + } + return _.isString(queryProperty) && queryProperty.toLowerCase().includes(selectedOption.toLowerCase()); + }, + } + }); diff --git a/website/assets/styles/pages/query-library.less b/website/assets/styles/pages/query-library.less index f80336081..4aee1b0e2 100644 --- a/website/assets/styles/pages/query-library.less +++ b/website/assets/styles/pages/query-library.less @@ -1,5 +1,76 @@ #query-library { - //… + h2 { + padding: 0px 30px 0px 30px; + } + + h5 { + font-size: 18px; + font-weight: bold; + line-height: 25px; + } + + h6 { + font-size: 16px; + line-height: 22px; + padding: 0px 30px 0px 30px; + + } + + a { + font-size: 18px; + color: @core-vibrant-blue; + } + + select { + color: @core-vibrant-blue; + border: none; + } + + .filter-and-search-bar { + margin-left: 30px; + margin-right: 30px; + } + + .contributors, .platforms { + + p { + font-size: 13px; + line-height: 20px; + } + + } + + .row { + min-height: 70px;; + } + + .card.results { + box-shadow: none; + border: none; + border-radius: 8px; + border-bottom: 1px solid; + border-color: #E2E4EA; + ; + + } + + .card.results:hover { + background-color: #F1F0FF; + + } + + .card.call-to-action { + background-color: @ui-off-white; + border-radius: 16px; + border-color: @ui-off-white; + box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.1); + margin-bottom: 90px; + + } + + .card-body { + padding: 30px; + } } diff --git a/website/views/pages/query-detail.ejs b/website/views/pages/query-detail.ejs index bee4c11ee..7af7a97cd 100644 --- a/website/views/pages/query-detail.ejs +++ b/website/views/pages/query-detail.ejs @@ -14,7 +14,7 @@

Remediation

diff --git a/website/views/pages/query-library.ejs b/website/views/pages/query-library.ejs index fed91d045..24c30c60f 100644 --- a/website/views/pages/query-library.ejs +++ b/website/views/pages/query-library.ejs @@ -1,14 +1,68 @@
-

TODO: Implement this page.

-

(See also assets/styles/pages/query-library.less, assets/js/pages/query-library.page.js, and api/controllers/view-query-library.js.)

- -

Queries \o/

- +
+
+

Standard query library

+
Fleet's standard query library includes a growing collection of useful queries for organizations deploying Fleet and osquery.
+ +
+
+
+
+
+
+
+
{{query.name}}
+
{{query.description}}
+
+

contributed by {{query.contributors}}

+
+
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+
+
+
+

Contributors

+

Want to add your own query? Please submit a pull request over on GitHub.

+
+
+
<%- /* Expose server-rendered data as window.SAILS_LOCALS :: */ exposeLocalsToBrowser() %>