Skip to content

Commit

Permalink
updated all modules to allow for use by users with sudo access
Browse files Browse the repository at this point in the history
  • Loading branch information
markdhooper committed Mar 9, 2021
1 parent 47367ea commit 4465536
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 93 deletions.
10 changes: 8 additions & 2 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
cockpit-45drives-hardware (1.3.2-1focal) focal; urgency=medium

* All modules can now be used by users with sudo privelages.

-- 45Drives <[email protected]> Tue, 09 Mar 2021 12:20:03 +0000

cockpit-45drives-hardware (1.3.1-2focal) focal; urgency=medium

* updated requirements of 45drives-tools dependency to >= 1.8.6.

-- 45Drives <[email protected]> Mon, 08 Feb 2021 12:47:03 +0000
-- 45Drives <[email protected]> Mon, 08 Mar 2021 12:47:03 +0000

cockpit-45drives-hardware (1.3.1-1focal) focal; urgency=medium

* Packaging of cockpit-45drives-hardware now handled using docker.
* Added support for all Enhanced models with AMD processors.

-- 45Drives <[email protected]> Mon, 08 Feb 2021 10:47:03 +0000
-- 45Drives <[email protected]> Mon, 08 Mar 2021 10:47:03 +0000

cockpit-45drives-hardware (1.3.0-3focal) focal; urgency=medium

Expand Down
10 changes: 6 additions & 4 deletions rpm/cockpit-45drives-hardware.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
%define __os_install_post %{_dbpath}/brp-compress

Name: cockpit-45drives-hardware
Version: 1.3.1
Release: 2%{?dist}
Version: 1.3.2
Release: 1%{?dist}
Summary: A cockpit package for 45Drives Storinator Products.

Group: Development/Tools
Expand Down Expand Up @@ -62,9 +62,11 @@ rm -rf %{buildroot}
/usr/share/cockpit/45drives-motherboard/*

%changelog
* Thu Feb 25 2021 Mark Hooper <[email protected]> 1.3.1-2
* Tue Mar 09 2021 Mark Hooper <[email protected]> 1.3.2-1
- All modules can now be used by users with sudo privelages.
* Mon Mar 08 2021 Mark Hooper <[email protected]> 1.3.1-2
- Updated requirements for 45drives-tools version from >= 1.8.5 to >= 1.8.6.
* Thu Feb 25 2021 Mark Hooper <[email protected]> 1.3.1-1
* Mon Mar 08 2021 Mark Hooper <[email protected]> 1.3.1-1
- Packaging of cockpit-45drives-hardware now handled using docker.
- Added support for all Enhanced models with AMD processors.
* Thu Feb 25 2021 Mark Hooper <[email protected]> 1.3.0-1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
padding-right: 5px;
}

.content_block_msg {
text-align: center;
font-size: large;
color: #981C20;
font-family:"RedHatText","Overpass",overpass,helvetica,arial,sans-serif;
padding-top: 5em;
}

.header-45D > h2 {
color: #FFFFFF;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<div class="header-45D">
<img src="img/45drives-disks.svg">
</div>
<div class="disk_content">
<div class="disk_content" id="disk_content">
<div id="disk_output" class="disk_output">
<div id="disk_app">

Expand Down
38 changes: 25 additions & 13 deletions src/fakeroot/usr/share/cockpit/45drives-disks/disks.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,10 @@ var disk_app = function( d ) {
function get_drive_info(){
var drive_info_proc = cockpit.spawn(
[
"/usr/bin/pkexec",
"/opt/45drives/tools/lsdev",
"-j"
],
{err: "out"}
{err: "out", superuser: "require"}
);
drive_info_proc.done(
function(data){
Expand All @@ -429,10 +428,9 @@ var disk_app = function( d ) {
if (confirm("Disks requires a valid drive map.\n Would you like to run dmap?")) {
var dmap_proc = cockpit.spawn(
[
"/usr/bin/pkexec",
"/opt/45drives/tools/dmap"
],
{err: "out"}
{err: "out", superuser: "require"}
);
dmap_proc.done(
function(data){
Expand Down Expand Up @@ -462,14 +460,12 @@ var disk_app = function( d ) {
}

function get_server_info(){
//var server_info_promise = cockpit.defer();
// get the server_info.json file
var server_info_proc = cockpit.spawn(
[
"/usr/bin/pkexec",
"/usr/share/cockpit/45drives-disks/helper_scripts/server_info"
],
{err: "out"}
{err: "out", superuser: "require"}
);
server_info_proc.stream(
function(data){
Expand All @@ -487,10 +483,9 @@ var disk_app = function( d ) {
function get_zfs_info(){
var drive_info_proc = cockpit.spawn(
[
"/usr/bin/pkexec",
"/usr/share/cockpit/45drives-disks/helper_scripts/zfs_info"
],
{err: "out"}
{err: "out", superuser: "require"}
);
drive_info_proc.done(
function(data){
Expand All @@ -510,11 +505,10 @@ var disk_app = function( d ) {
d.jsonLoadRowPositions = function(){
var proc = cockpit.spawn(
[
"/usr/bin/pkexec",
"/usr/share/cockpit/45drives-disks/helper_scripts/dump_json",
"/img/disk/ROW.json"
],
{err: "out"}
{err: "out", superuser: "require"}
);
proc.stream(
function(data){
Expand Down Expand Up @@ -858,8 +852,26 @@ function resourceSleep(ms) {

async function startDiskApp(){
while(!document.getElementById("disk_app")){await resourceSleep(300);}
document.getElementById("disk_app").innerHTML = "";
diskP5 = new p5(disk_app, 'disk_app');
let root_check = cockpit.permission({ admin: true });
root_check.addEventListener(
"changed",
function() {
if(root_check.allowed){
//user is an administrator, start the module as normal
document.getElementById("disk_app").innerHTML = "";
diskP5 = new p5(disk_app, 'disk_app');
}else{
//user is not an administrator, replace the page content with message
let page_content = document.getElementById("disk_content");
page_content.innerHTML = "";
let user_msg = document.createElement("div");
user_msg.className = "content_block_msg";
user_msg.innerHTML = "You must be an administrator to use this feature.";
page_content.appendChild(user_msg);
}
}
)

}

startDiskApp();
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
align-self: center;
}

.content_block_msg {
text-align: center;
font-size: large;
color: #981C20;
font-family:"RedHatText","Overpass",overpass,helvetica,arial,sans-serif;
padding-top: 5em;
}

.detail-table-header{
background-color: #FFFFFF;
width: 100%;
Expand Down Expand Up @@ -56,7 +64,7 @@
padding: 8px;
}

.motherboard_content {
.motherboard_container {
display: flex;
flex-direction: row;
justify-content: flex-start;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
<div class="header-45D">
<img src="img/45drives-motherboard.svg">
</div>
<div class="motherboard_content">
<div id="motherboard_content">
<div class="motherboard_container" id="motherboard_container">
<div class=motherboard_output id="motherboard_output">
<div class="loading_message_box" id="loading_messages">
<h2> Gathering Server Information </h2>
Expand Down Expand Up @@ -56,7 +57,7 @@ <h2> Gathering Server Information </h2>
<img class="mobo_image hidden" id="mobo_image" src="data:,">
</div>
</div>

</div>

</div>
</div>
Expand Down
Loading

0 comments on commit 4465536

Please sign in to comment.