Chef user name : + +
++
Infra Server URL : + +
++
Certificate file path : +
++ +
diff --git a/assets/css/main.css b/assets/css/main.css index 50a88848..2cb7e787 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -71,6 +71,17 @@ button.secondary:disabled { margin-right: 20px; } +#logo-alert-settings { + float: left; + background: url('../images/chef-ws-icon-black.svg'); + height: 64px; + width: 64px; + display: inline-block; + margin-left: 3px; + margin-right: 20px; + margin-top: 30px; +} + /* top panel and items placed inside */ #top-panel { padding-top: 15px; diff --git a/src/main.ts b/src/main.ts index 4352c882..6270b2fb 100644 --- a/src/main.ts +++ b/src/main.ts @@ -12,6 +12,7 @@ import { PreferencesDialog } from './preferences/preferences_dialog'; import AppConfigSingleton from './app-config/app-config'; import aboutDialog = require('./about-dialog/about_dialog.js'); +import settingDialog = require('./setting/setting_dialog.js'); import workstation = require('./helpers/chef_workstation.js'); import helpers = require('./helpers/helpers.js'); import WSTray = require('./ws_tray.js'); @@ -61,6 +62,11 @@ export class Main { click: () => { this.openPreferencesDialog() } }, {type: 'separator'}, + { + label: 'Settings...', + click: () => { settingDialog.open() } + }, + {type: 'separator'}, { label: 'Documentation', click: () => { this.openDocs() } diff --git a/src/setting/edit_setting.js b/src/setting/edit_setting.js new file mode 100644 index 00000000..1ca3e8e2 --- /dev/null +++ b/src/setting/edit_setting.js @@ -0,0 +1,40 @@ +document.querySelector('#btn-up').addEventListener('click', () => { + + var s = +`[default] +client_name = '${document.getElementById('username').value}' +client_key = '${document.getElementById('certificate').value}' +chef_server_url = '${document.getElementById('url').value}'\n` + +window.obj = { + "client_name ": document.getElementById('username').value, + "client_key ": document.getElementById('certificate').value, + "chef_server_url ": document.getElementById('url').value +} + +const fs = require('fs'); + +try { + fs.writeFileSync("/Users/ngupta/chef-repo/.chef/credentials", s); + // file written successfully + } catch (err) { + console.error(err); + } + + window.location.reload(); + alert("Your settings have been saved!"); + + document.querySelector('#edit-settings').style.display = 'none'; + document.querySelector('#settings').style.display = 'block'; +}) + +document.querySelector('#btn-ed').addEventListener('click', () => { + document.querySelector('#edit-settings').style.display = 'block'; + document.querySelector('#settings').style.display = 'none'; +}) + +document.querySelector('#btn-cn').addEventListener('click', () => { + document.querySelector('#edit-settings').style.display = 'none'; + document.querySelector('#settings').style.display = 'block'; +}) + diff --git a/src/setting/setting.html b/src/setting/setting.html new file mode 100644 index 00000000..e20b7c34 --- /dev/null +++ b/src/setting/setting.html @@ -0,0 +1,102 @@ + + +
+ +Chef user name : + +
+Infra Server URL : + +
+Certificate file path : +
+