Commit 9b883120 authored by Spakes's avatar Spakes

Fixing quick menu redirection for SudoManagement and centering windows based...

Fixing quick menu redirection for SudoManagement and centering windows based on cursor location upon their creation
parent f17fe3af
Pipeline #22880 passed with stages
in 1 minute and 6 seconds
......@@ -6,7 +6,7 @@ if [[ ${CI_COMMIT_REF_NAME} == 'master' ]]; then
else
BRANCH="-${CI_COMMIT_REF_NAME}"
fi
VERSION_NUMBER='1.0.7'
VERSION_NUMBER='1.0.8'
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -ivh epel-release-latest-7.noarch.rpm
sudo yum -y install nodejs npm ruby-devel gcc make rpm-build rubygems
......@@ -14,7 +14,7 @@ gem install --no-ri --no-rdoc fpm
npm install electron
npm install electron-packager
sed -i "s/VERSION_NUMBER/$VERSION_NUMBER/" ./about/about.html
npm run build
npm run build
mv ./Releases/ornltoolbox-linux-x64 ./ornltoolbox
sudo /usr/local/bin/fpm -s dir -f -n ornltoolbox${BRANCH} --provides ornltoolbox --deb-no-default-config-files -v $VERSION_NUMBER --description "A collection of ORNL Linux tools" -t deb -p /opt/ornltoolbox${BRANCH}-${VERSION_NUMBER}.deb --prefix /opt --after-install ./packages/packagePostInstall.bash --after-remove ./packages/packagePostRemove.bash --before-upgrade ./packages/packagePostRemove.bash --after-upgrade ./packages/packagePostInstall.bash -d 'libgconf-2-4' -d 'gnome-screensaver' -d 'yubico-piv-tool' -d 'sox' -d 'smartmontools' -d 'policykit-1-gnome' -d 'desktop-file-utils' ./ornltoolbox
sudo /usr/local/bin/fpm -s dir -f -n ornltoolbox${BRANCH} --provides ornltoolbox --deb-no-default-config-files -v $VERSION_NUMBER --description "A collection of ORNL Linux tools" -t rpm -p /opt/ornltoolbox${BRANCH}-${VERSION_NUMBER}.rpm --prefix /opt --after-install ./packages/packagePostInstall.bash --after-remove ./packages/packagePostRemove.bash --before-upgrade ./packages/packagePostRemove.bash --after-upgrade ./packages/packagePostInstall.bash -d 'libXScrnSaver' -d 'gnome-screensaver' -d 'yubico-piv-tool' -d 'sox' -d 'smartmontools' -d 'polkit-gnome' ./ornltoolbox
......
......@@ -4,6 +4,8 @@ const ipcMain = require('electron').ipcMain
const execSync = require('child_process').execSync
const path = require('path')
const url = require('url')
const mainWinWidth = 800
const mainWinHeight = 600
//Allows changes while app is running
/*require('electron-reload')(__dirname, {
......@@ -15,12 +17,21 @@ global.addWindow = null //Secondary minor window
global.promptWindow = null //Add User prompt window
function createWindow() {
//Center this main window on the display the cursor is on
let screen = require('electron').screen
let bounds = screen.getDisplayNearestPoint(screen.getCursorScreenPoint()).bounds
let x = Math.ceil(bounds.x + (bounds.width - mainWinWidth) / 2)
let y = Math.ceil(bounds.y + (bounds.height - mainWinHeight) / 2)
//Load the inital window
mainWindow = new BrowserWindow({
show: false,
width:800,
height:600,
resizable:false,
width: mainWinWidth,
height: mainWinHeight,
x: x,
y: y,
resizable: false,
center: true,
backgroundColor: '#FFFFFF',
icon: __dirname + '/images/if_gear_1055051.png'
})
......@@ -97,7 +108,7 @@ function createWindow() {
}, {
label: 'Sudo Management',
click: () => {
//Go to button page
mainWindow.webContents.send('openSudoManagement')
}
}
]
......@@ -249,12 +260,20 @@ function addWin(file, title, width, height) {
} else {
// Create a new window if one does not exist
if(addWindow == null) {
//Center new window on the display the cursor is on
let screen = require('electron').screen
let bounds = screen.getDisplayNearestPoint(screen.getCursorScreenPoint()).bounds
let x = Math.ceil(bounds.x + (bounds.width - width) / 2)
let y = Math.ceil(bounds.y + (bounds.height - height) / 2)
addWindow = new BrowserWindow({
title: title,
show: false,
parent: mainWindow,
width: width,
height: height,
x: x,
y: y,
resizable: false,
alwaysOnTop: true
})
......@@ -286,6 +305,7 @@ function addWin(file, title, width, height) {
//Based off of electron-prompt from https://github.com/konsumer/electron-prompt
//It has been modified to fit my needs
//This is a tertiary window unique to Add User - appears for users not in UCAMS
var promptResponse
ipcMain.on('prompt', function(eventRet, arg) {
promptResponse = null
......
......@@ -12,6 +12,10 @@ ipcRenderer.on('openSyncPasswords', () => {
addWinMain('./userManagement/syncPasswords/syncPasswords.html', 'Sync Passwords', 350, 210)
})
ipcRenderer.on('openSudoManagement', () => {
addWinMain('./userManagement/sudoManagement/sudoManagement.html', 'Sudo Management', 260, 200)
})
ipcRenderer.on('openBadgeMinder', () => {
addWinMain('./badgeManagement/badgeMinder/badgeMinder.html', 'Badge Minder', 450, 360)
})
......
......@@ -43,7 +43,7 @@
<span title="Opens a new window with the function of syncing UCAMS passwords with local passwords.">
<div id="buttons" onclick="addWinMain('./userManagement/syncPasswords/syncPasswords.html', 'Sync Passwords', 350, 210)"><font color="white">Sync Passwords</font></div>
</span>
<span title="Opens a new window with the function of adding or removing sudo privileges of users.">
<span title="Opens a new window with the function of giving or revoking sudo privileges of users.">
<div id="buttons" onclick="addWinMain('./userManagement/sudoManagement/sudoManagement.html', 'Sudo Management', 260, 200)"><font color="white">Sudo Management</font></div>
</span>
<div id="userManagementHiddenbuttons"></div>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment