Skip to content

Commit

Permalink
Website: Update OS settings page (#26398)
Browse files Browse the repository at this point in the history
Changes:
- Updated the content of the /os-settings page to match the latest
wireframes and commented out the profile generator experiment on that
page.
- Added the os-settings page to the "Docs" navigation menu and
navigation component
  • Loading branch information
eashaw authored Feb 17, 2025
1 parent b23d331 commit 5251309
Show file tree
Hide file tree
Showing 7 changed files with 323 additions and 215 deletions.
4 changes: 3 additions & 1 deletion website/api/controllers/view-os-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ module.exports = {
fn: async function () {

// Respond with view.
return {};
return {
algoliaPublicKey: sails.config.custom.algoliaPublicKey,
};

}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ parasails.registerComponent('docsNavAndSearch', {
<a :class="[currentSection === 'queries' ? 'active' : '']" purpose="docs-top-nav-menu-link" href="/queries" style="text-decoration: none; text-decoration-line: none;">Queries</a>
<a :class="[currentSection === 'policies' ? 'active' : '']" purpose="docs-top-nav-menu-link" href="/policies" style="text-decoration: none; text-decoration-line: none;">Policies</a>
<a :class="[currentSection === 'software' ? 'active' : '']" purpose="docs-top-nav-menu-link" href="/app-library" style="text-decoration: none; text-decoration-line: none;">Software</a>
<!-- <a :class="[currentSection === 'osSettings' ? 'active' : '']" purpose="docs-top-nav-menu-link" href="/os-settings" style="text-decoration: none; text-decoration-line: none;">OS settings</a> -->
<a :class="[currentSection === 'osSettings' ? 'active' : '']" purpose="docs-top-nav-menu-link" href="/os-settings" style="text-decoration: none; text-decoration-line: none;">OS settings</a>
<a :class="[currentSection === 'tables' ? 'active' : '']" purpose="docs-top-nav-menu-link" href="/tables" style="text-decoration: none; text-decoration-line: none;">Data tables</a>
</div>
</div>
Expand Down
174 changes: 88 additions & 86 deletions website/assets/js/pages/os-settings.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,107 +3,109 @@ parasails.registerPage('os-settings', {
// ║║║║║ ║ ║╠═╣║ ╚═╗ ║ ╠═╣ ║ ║╣
// ╩╝╚╝╩ ╩ ╩╩ ╩╩═╝ ╚═╝ ╩ ╩ ╩ ╩ ╚═╝
data: {
generatedOutput: ``,
ace: undefined,
parsedItemsInProfile: [],
formData: {
profileType: 'mobileconfig'

},

// For tracking client-side validation errors in our form.
// > Has property set to `true` for each invalid property in `formData`.
formErrors: { /* … */ },
// Form rules
formRules: {
naturalLanguageInstructions: {required: true},
profileType: {required: true},
},
// Syncing / loading state
syncing: false,
queryResult: '',
// Server error state
cloudError: '',
modal: '',
filenameOfGeneratedProfile: 'Generated profile',
hasGeneratedProfile: false,
selectedPlatform: 'apple', // Initially set to 'macos'
// Commented-out variables used by configuration profile generator.
// generatedOutput: ``,
// ace: undefined,
// parsedItemsInProfile: [],
// formData: {
// profileType: 'mobileconfig'
// },
// // For tracking client-side validation errors in our form.
// // > Has property set to `true` for each invalid property in `formData`.
// formErrors: { /* … */ },
// // Form rules
// formRules: {
// naturalLanguageInstructions: {required: true},
// profileType: {required: true},
// },
// // Syncing / loading state
// syncing: false,
// queryResult: '',
// // Server error state
// cloudError: '',
// modal: '',
// filenameOfGeneratedProfile: 'Generated profile',
// hasGeneratedProfile: false,
},

// ╦ ╦╔═╗╔═╗╔═╗╦ ╦╔═╗╦ ╔═╗
// ║ ║╠╣ ║╣ ║ ╚╦╝║ ║ ║╣
// ╩═╝╩╚ ╚═╝╚═╝ ╩ ╚═╝╩═╝╚═╝

watch: {
//…
},
beforeMount: function() {
//…
},
mounted: async function() {
this._setUpAceEditor();
//…
// this._setUpAceEditor();
if(bowser.windows){
this.selectedPlatform = 'windows';
}
},

// ╦╔╗╔╔╦╗╔═╗╦═╗╔═╗╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
// ║║║║ ║ ║╣ ╠╦╝╠═╣║ ║ ║║ ║║║║╚═╗
// ╩╝╚╝ ╩ ╚═╝╩╚═╩ ╩╚═╝ ╩ ╩╚═╝╝╚╝╚═╝
methods: {
handleSubmittingForm: async function() {
let argins = this.formData;
this.syncing = true;
let generatedResult = await Cloud.getLlmGeneratedConfigurationProfile.with(argins)
.tolerate((err)=>{
this.cloudError = err;
this.syncing = false;
});
if(!this.cloudError) {
this.generatedOutput = generatedResult.profile;
this.filenameOfGeneratedProfile = generatedResult.profileFilename;
this.hasGeneratedProfile = true;
ace.edit('editor').setValue(generatedResult.profile);
this.parsedItemsInProfile = generatedResult.items;
this.modal = '';
this.syncing = false;
}
},
closeModal: async function() {
if(!this.syncing){
this.modal = '';
await this.forceRender();
}
clickSelectPlatform: function(platform) {
this.selectedPlatform = platform;
},
// handleSubmittingForm: async function() {
// let argins = this.formData;
// this.syncing = true;
// let generatedResult = await Cloud.getLlmGeneratedConfigurationProfile.with(argins)
// .tolerate((err)=>{
// this.cloudError = err;
// this.syncing = false;
// });
// if(!this.cloudError) {
// this.generatedOutput = generatedResult.profile;
// this.filenameOfGeneratedProfile = generatedResult.profileFilename;
// this.hasGeneratedProfile = true;
// ace.edit('editor').setValue(generatedResult.profile);
// this.parsedItemsInProfile = generatedResult.items;
// this.modal = '';
// this.syncing = false;
// }
// },
// closeModal: async function() {
// if(!this.syncing){
// this.modal = '';
// await this.forceRender();
// }
// },

getUpdatedValueFromEditor: function() {
this.generatedOutput = ace.edit('editor').getValue();
},
clickDownloadResult: function() {
let exportUrl = URL.createObjectURL(new Blob([this.generatedOutput], { type: 'text/xml;' }));
let exportDownloadLink = document.createElement('a');
exportDownloadLink.href = exportUrl;
// Parse the XML to determine if it is a .mobileconfig or a CSP.
let parser = new DOMParser();
let xmlDoc = parser.parseFromString(this.generatedOutput, 'application/xml');
let hasPlistNode = xmlDoc.getElementsByTagName('plist')[0];
if(!this.filenameOfGeneratedProfile) {
if(hasPlistNode){
exportDownloadLink.download = `Generated configuration profile.mobileconfig`;
} else {
exportDownloadLink.download = 'Generated CSP.xml';
}
} else {
exportDownloadLink.download = this.filenameOfGeneratedProfile;
}
exportDownloadLink.click();
URL.revokeObjectURL(exportUrl);
},
_setUpAceEditor: function() {
var editor = ace.edit('editor');
editor.setTheme('ace/theme/fleet');
editor.session.setMode('ace/mode/xml');
editor.setOptions({
minLines: this.minLines ? this.minLines : 20 ,
maxLines: this.maxLines ? this.maxLines : 40 ,
});
editor.setReadOnly(true);
},
// getUpdatedValueFromEditor: function() {
// this.generatedOutput = ace.edit('editor').getValue();
// },
// clickDownloadResult: function() {
// let exportUrl = URL.createObjectURL(new Blob([this.generatedOutput], { type: 'text/xml;' }));
// let exportDownloadLink = document.createElement('a');
// exportDownloadLink.href = exportUrl;
// // Parse the XML to determine if it is a .mobileconfig or a CSP.
// let parser = new DOMParser();
// let xmlDoc = parser.parseFromString(this.generatedOutput, 'application/xml');
// let hasPlistNode = xmlDoc.getElementsByTagName('plist')[0];
// if(!this.filenameOfGeneratedProfile) {
// if(hasPlistNode){
// exportDownloadLink.download = `Generated configuration profile.mobileconfig`;
// } else {
// exportDownloadLink.download = 'Generated CSP.xml';
// }
// } else {
// exportDownloadLink.download = this.filenameOfGeneratedProfile;
// }
// exportDownloadLink.click();
// URL.revokeObjectURL(exportUrl);
// },
// _setUpAceEditor: function() {
// var editor = ace.edit('editor');
// editor.setTheme('ace/theme/fleet');
// editor.session.setMode('ace/mode/xml');
// editor.setOptions({
// minLines: this.minLines ? this.minLines : 20 ,
// maxLines: this.maxLines ? this.maxLines : 40 ,
// });
// editor.setReadOnly(true);
// },
}
});
Loading

0 comments on commit 5251309

Please sign in to comment.