mirror of
https://gitlab.com/ryzen-controller-team/ryzen-controller.git
synced 2024-12-22 18:13:28 +07:00
Added log area.
This commit is contained in:
parent
5d324c0a15
commit
1380e6e2fd
@ -83,7 +83,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="uk-container">Will be available soon!</li>
|
<li class="uk-container">Will be available soon!</li>
|
||||||
<li class="uk-container">Will be available soon!</li>
|
<li class="uk-container">
|
||||||
|
<textarea class="uk-textarea" rows="20" id="logs" readonly></textarea>
|
||||||
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<script type="text/javascript" src="./js/methods.js"></script>
|
<script type="text/javascript" src="./js/methods.js"></script>
|
||||||
|
@ -12,7 +12,9 @@ function parseHTML(str) {
|
|||||||
* Return the current working directory.
|
* Return the current working directory.
|
||||||
*/
|
*/
|
||||||
function getCurrentWorkingDirectory() {
|
function getCurrentWorkingDirectory() {
|
||||||
return require('electron').remote.app.getAppPath();
|
const cwd = require('electron').remote.app.getAppPath()
|
||||||
|
appendLog(`getCurrentWorkingDirectory(): ${cwd}`);
|
||||||
|
return cwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,9 +70,9 @@ function checkForAdminRights() {
|
|||||||
exec('NET SESSION', function(err,so,se) {
|
exec('NET SESSION', function(err,so,se) {
|
||||||
if (se.length !== 0) {
|
if (se.length !== 0) {
|
||||||
notification('warning',
|
notification('warning',
|
||||||
`Warning: you should launch this app as administrator,
|
`Warning: you should launch this app as administrator,`
|
||||||
ryzenadj.exe doesn't seems to work correctly without administrator rights.
|
+ `ryzenadj.exe doesn't seems to work correctly without administrator rights.`
|
||||||
`);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -81,6 +83,7 @@ function checkForAdminRights() {
|
|||||||
* @param {string} message The message to be displayed, new line will be replaced by <br/>.
|
* @param {string} message The message to be displayed, new line will be replaced by <br/>.
|
||||||
*/
|
*/
|
||||||
function notification(type, message) {
|
function notification(type, message) {
|
||||||
|
appendLog(`notification(): ${type}\n${message}`);
|
||||||
UIkit.notification({
|
UIkit.notification({
|
||||||
message: (''+message).replace(/(?:\r\n|\r|\n)/g, '<br/>'),
|
message: (''+message).replace(/(?:\r\n|\r|\n)/g, '<br/>'),
|
||||||
status: type,
|
status: type,
|
||||||
@ -98,6 +101,7 @@ function getRyzenAdjExecutablePath() {
|
|||||||
if (!ryzen_adj_path) {
|
if (!ryzen_adj_path) {
|
||||||
ryzen_adj_path = getCurrentWorkingDirectory() + "\\bin\\ryzenadj.exe";
|
ryzen_adj_path = getCurrentWorkingDirectory() + "\\bin\\ryzenadj.exe";
|
||||||
}
|
}
|
||||||
|
appendLog(`getRyzenAdjExecutablePath(): ${ryzen_adj_path}`);
|
||||||
return ryzen_adj_path;
|
return ryzen_adj_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +122,7 @@ function askingForRyzenAdjExecutablePath() {
|
|||||||
var dialog = remote.require('electron').dialog;
|
var dialog = remote.require('electron').dialog;
|
||||||
|
|
||||||
var path = dialog.showOpenDialog({
|
var path = dialog.showOpenDialog({
|
||||||
properties: ['openFile']
|
properties: ['openFile']
|
||||||
}, function (filePaths) {
|
}, function (filePaths) {
|
||||||
if (typeof filePaths[0] !== 'undefined') {
|
if (typeof filePaths[0] !== 'undefined') {
|
||||||
const settings = require('electron-settings');
|
const settings = require('electron-settings');
|
||||||
@ -126,9 +130,15 @@ function askingForRyzenAdjExecutablePath() {
|
|||||||
ryzen_adj_path: filePaths[0]
|
ryzen_adj_path: filePaths[0]
|
||||||
});
|
});
|
||||||
notification('primary', 'Path to ryzenAdj.exe has been saved.');
|
notification('primary', 'Path to ryzenAdj.exe has been saved.');
|
||||||
|
appendLog(`askingForRyzenAdjExecutablePath(): ${filePaths[0]}`);
|
||||||
} else {
|
} else {
|
||||||
notification('warning', 'No path given, nothing changed.');
|
notification('warning', 'No path given, nothing changed.');
|
||||||
}
|
}
|
||||||
preFillSettings();
|
preFillSettings();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function appendLog(message) {
|
||||||
|
var log_area = document.getElementById('logs');
|
||||||
|
log_area.value += message + "\n";
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user