Skip to content

Commit

Permalink
Website: enable search on policy and vital pages. (#25728)
Browse files Browse the repository at this point in the history
Related to: #25718


Changes:
- Added search to vitals and policy pages.
  • Loading branch information
eashaw authored Jan 24, 2025
1 parent 3060f45 commit 9bac36c
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 48 deletions.
26 changes: 13 additions & 13 deletions website/assets/js/pages/policy-details.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ parasails.registerPage('policy-details', {
mounted: async function () {
// Note: Docsearch will be disabled on this page until a search index has been created for it.
// Note: Docsearch will only be enabled if sails.config.custom.algoliaPublicKey is set. If the value is undefined, the documentation search will be disabled.
// if(this.algoliaPublicKey) {
// docsearch({
// appId: 'NZXAYZXDGH',
// apiKey: this.algoliaPublicKey,
// indexName: 'fleetdm',
// container: '#docsearch-query',
// placeholder: 'Search',
// debug: false,
// searchParameters: {
// 'facetFilters': ['section:queries']
// },
// });
// }
if(this.algoliaPublicKey) {
docsearch({
appId: 'NZXAYZXDGH',
apiKey: this.algoliaPublicKey,
indexName: 'fleetdm',
container: '#docsearch-query',
placeholder: 'Search',
debug: false,
searchParameters: {
'facetFilters': ['section:policies']
},
});
}
let columnNamesForThisQuery = [];
let tableNamesForThisQuery = [];
if(this.columnNamesForSyntaxHighlighting){
Expand Down
26 changes: 13 additions & 13 deletions website/assets/js/pages/policy-library.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ parasails.registerPage('policy-library', {
//…
},
mounted: async function () {
// if(this.algoliaPublicKey) { // Note: Docsearch will only be enabled if sails.config.custom.algoliaPublicKey is set. If the value is undefined, the documentation search will be disabled.
// docsearch({
// appId: 'NZXAYZXDGH',
// apiKey: this.algoliaPublicKey,
// indexName: 'fleetdm',
// container: '#docsearch-query',
// placeholder: 'Search',
// debug: false,
// searchParameters: {
// 'facetFilters': ['section:queries']
// },
// });
// }
if(this.algoliaPublicKey) { // Note: Docsearch will only be enabled if sails.config.custom.algoliaPublicKey is set. If the value is undefined, the documentation search will be disabled.
docsearch({
appId: 'NZXAYZXDGH',
apiKey: this.algoliaPublicKey,
indexName: 'fleetdm',
container: '#docsearch-query',
placeholder: 'Search',
debug: false,
searchParameters: {
'facetFilters': ['section:policies']
},
});
}
},

// ╦╔╗╔╔╦╗╔═╗╦═╗╔═╗╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
Expand Down
28 changes: 13 additions & 15 deletions website/assets/js/pages/vital-details.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,20 @@ parasails.registerPage('vital-details', {
if(['#apple','#linux','#windows','#chrome'].includes(window.location.hash)){
this.selectedPlatform = window.location.hash.split('#')[1];
}

// Note: Docsearch will be disabled on this page until a search index has been created for it.
// Note: Docsearch will only be enabled if sails.config.custom.algoliaPublicKey is set. If the value is undefined, the documentation search will be disabled.
// if(this.algoliaPublicKey) {
// docsearch({
// appId: 'NZXAYZXDGH',
// apiKey: this.algoliaPublicKey,
// indexName: 'fleetdm',
// container: '#docsearch-query',
// placeholder: 'Search',
// debug: false,
// searchParameters: {
// 'facetFilters': ['section:queries']
// },
// });
// }
if(this.algoliaPublicKey) {
docsearch({
appId: 'NZXAYZXDGH',
apiKey: this.algoliaPublicKey,
indexName: 'fleetdm',
container: '#docsearch-query',
placeholder: 'Search',
debug: false,
searchParameters: {
'facetFilters': ['section:vitals']
},
});
}
let columnNamesForThisQuery = [];
let tableNamesForThisQuery = [];
if(this.columnNamesForSyntaxHighlighting){
Expand Down
2 changes: 1 addition & 1 deletion website/assets/styles/pages/policy-library.less
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@
[purpose='policy-search'] {
margin-top: 32px;
width: 100%;
.input-group {
.input-group, .DocSearch-Button {
width: 100%;
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/views/pages/policy-details.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<span><%- policy.name %></span>
</div>
</div>
<!-- <div purpose="search" id="docsearch-query" class="d-flex">
<div purpose="search" id="docsearch-query" class="d-flex">
<div purpose="disabled-search" class="d-flex w-100">
<div class="input-group">
<div class="input-group-prepend">
Expand All @@ -25,7 +25,7 @@
</div>
</div>
</div>
</div> -->
</div>
</div>
<div purpose="policy-details-and-sidebar" class="d-flex flex-lg-row flex-column">
<div purpose="policy-details" class="d-flex flex-column">
Expand Down
4 changes: 2 additions & 2 deletions website/views/pages/policy-library.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<p>A collection of policies, OS settings, and scripts for macOS, Windows, and Linux.</p>
<p>Contributions welcome <a target="_blank" href="https://github.com/fleetdm/fleet/blob/main/docs/01-Using-Fleet/standard-query-library/standard-query-library.yml">over on GitHub.</a></p>
</div>
<!-- <div purpose="policy-search" id="docsearch-query" class="d-flex">
<div purpose="policy-search" id="docsearch-query" class="d-flex">
<div purpose="disabled-search" class="d-flex">
<div class="input-group d-flex flex-nowrap">
<div class="input-group-prepend">
Expand All @@ -23,7 +23,7 @@
</div>
</div>
</div>
</div> -->
</div>
</div>
<div purpose="platform-filters" class="d-flex flex-row justify-content-center">
<div purpose="platform-filter" :class="[selectedPlatform === 'macos' ? 'selected' : '']" class="d-flex flex-row justify-content-center align-items-center" @click="clickSelectPlatform('macos')">
Expand Down
4 changes: 2 additions & 2 deletions website/views/pages/vital-details.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<h2>Vitals</h2>
<p>Fleet’s built-in queries for collecting and storing important device information.</p>
</div>
<!-- <div purpose="vitals-search" id="docsearch-query" class="d-flex">
<div purpose="vitals-search" id="docsearch-query" class="d-flex">
<div purpose="disabled-search" class="d-flex">
<div class="input-group d-flex flex-nowrap">
<div class="input-group-prepend">
Expand All @@ -21,7 +21,7 @@
</div>
</div>
</div>
</div> -->
</div>
</div>
<div purpose="platform-filters" class="d-flex flex-row justify-content-center">
<div purpose="platform-filter" :class="[selectedPlatform === 'apple' ? 'selected' : '']" class="d-flex flex-row justify-content-center align-items-center" @click="clickSelectPlatform('apple')">
Expand Down

0 comments on commit 9bac36c

Please sign in to comment.