show drive overview
This commit is contained in:
parent
1b0ea97ed1
commit
99273756da
@ -38,6 +38,9 @@ public:
|
||||
uint32_t powerCycles);
|
||||
|
||||
string sCapacityToText();
|
||||
string sErrorCountToText();
|
||||
string sPowerOnHoursToText();
|
||||
string sPowerCyclesToText();
|
||||
|
||||
private:
|
||||
string sPath;
|
||||
|
@ -50,21 +50,14 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
static void searchDrives(vector <Drive>* pvecDrives);
|
||||
static void printDrives(vector <Drive>* pvecDrives);
|
||||
static void filterIgnoredDrives(vector <Drive>* pvecDrives);
|
||||
static void addSMARTData(vector <Drive>* pvecDrives);
|
||||
static void ThreadScannDevices();
|
||||
static void ThreadUserInput();
|
||||
|
||||
static void handleArrowKey(TUI::UserInput userInput);
|
||||
|
||||
static void filterNewDrives(vector <Drive>* pvecOldDrives, vector <Drive>* pvecNewDrives);
|
||||
|
||||
|
||||
|
||||
static void ThreadUserInput();
|
||||
static void handleArrowKey(TUI::UserInput userInput);
|
||||
static void filterNewDrives(vector <Drive>* pvecOldDrives, vector <Drive>* pvecNewDrives);
|
||||
|
||||
};
|
||||
|
||||
|
@ -43,7 +43,7 @@ private:
|
||||
|
||||
static void centerTitle(WINDOW *pwin, const char * title);
|
||||
static WINDOW *createOverViewWindow( int iXSize, int iYSize);
|
||||
static WINDOW *createDetailViewWindow( int iXSize, int iYSize, int iXStart);
|
||||
static WINDOW *createDetailViewWindow( int iXSize, int iYSize, int iXStart, Drive drive);
|
||||
static WINDOW *createEntryWindow(int iXSize, int iYSize, int iXStart, int iYStart,string sModelFamily, string sModelName, string sCapacity, bool bSelected);
|
||||
|
||||
};
|
||||
|
@ -69,9 +69,6 @@ void TUI::updateTUI(vector <Drive>* pvecDrives, int32_t i32SelectedEntry)
|
||||
overview=createOverViewWindow((int)(stdscrX/3), (stdscrY-15));
|
||||
wrefresh(overview);
|
||||
|
||||
detailview=createDetailViewWindow(((stdscrX)-(int)(stdscrX/3)-7), (stdscrY-3), (int)(stdscrX/3)+5);
|
||||
wrefresh(detailview);
|
||||
|
||||
vector <Drive>::iterator it;
|
||||
for (it = pvecDrives->begin(); it != pvecDrives->end(); ++it)
|
||||
{
|
||||
@ -84,6 +81,8 @@ void TUI::updateTUI(vector <Drive>* pvecDrives, int32_t i32SelectedEntry)
|
||||
if(i32SelectedEntry == (it - pvecDrives->begin()))
|
||||
{
|
||||
bSelectedEntry = true;
|
||||
detailview=createDetailViewWindow(((stdscrX)-(int)(stdscrX/3)-7), (stdscrY-3), (int)(stdscrX/3)+5, pvecDrives->at((it - pvecDrives->begin())));
|
||||
wrefresh(detailview);
|
||||
}
|
||||
|
||||
WINDOW * tmp = createEntryWindow( ((int)(stdscrX/3) - 2), 5, 3, (5* (it - pvecDrives->begin()) )+3, sModelFamily, sModelName, sCapacity, bSelectedEntry);
|
||||
@ -163,14 +162,36 @@ WINDOW* TUI::createOverViewWindow( int iXSize, int iYSize)
|
||||
return newWindow;
|
||||
}
|
||||
|
||||
WINDOW* TUI::createDetailViewWindow( int iXSize, int iYSize, int iXStart)
|
||||
WINDOW* TUI::createDetailViewWindow( int iXSize, int iYSize, int iXStart, Drive drive)
|
||||
{
|
||||
WINDOW *newWindow;
|
||||
newWindow = newwin(iYSize, iXSize, 2, iXStart);
|
||||
|
||||
wbkgd(newWindow, COLOR_PAIR(COLOR_AREA_OVERVIEW));
|
||||
box(newWindow, ACS_VLINE, ACS_HLINE);
|
||||
centerTitle(newWindow, "Selected Drive: xyz");
|
||||
string title = "Selected Drive: " + drive.getModelName() + " " + drive.sCapacityToText();
|
||||
centerTitle(newWindow, title.c_str());
|
||||
|
||||
|
||||
|
||||
|
||||
string sPath = "Path: " +drive.getPath();
|
||||
string sModelFamlily = "ModelFamily: " + drive.getModelFamily();
|
||||
string sModelName = "ModelName: " + drive.getModelName();
|
||||
string sCapacity = "Capacity: " + drive.sCapacityToText();
|
||||
string sSerial = "Serial: " + drive.getSerial();
|
||||
string sPowerOnHours = "PowerOnHours: " + drive.sPowerOnHoursToText();
|
||||
string sPowerCycle = "PowerCycle: " + drive.sPowerCyclesToText();
|
||||
string sErrorCount = "ErrorCount: " + drive.sErrorCountToText();
|
||||
|
||||
mvwaddstr(newWindow,2, 3, sPath.c_str());
|
||||
mvwaddstr(newWindow,3, 3, sModelFamlily.c_str());
|
||||
mvwaddstr(newWindow,4, 3, sModelName.c_str());
|
||||
mvwaddstr(newWindow,5, 3, sCapacity.c_str());
|
||||
mvwaddstr(newWindow,6, 3, sSerial.c_str());
|
||||
mvwaddstr(newWindow,7, 3, sPowerOnHours.c_str());
|
||||
mvwaddstr(newWindow,8, 3, sPowerCycle.c_str());
|
||||
mvwaddstr(newWindow,9, 3, sErrorCount.c_str());
|
||||
|
||||
keypad(newWindow, TRUE);
|
||||
return newWindow;
|
||||
|
@ -61,6 +61,22 @@ string Drive::sCapacityToText()
|
||||
return "ERROR";
|
||||
}
|
||||
|
||||
string Drive::sErrorCountToText(){
|
||||
return to_string(getErrorCount());
|
||||
}
|
||||
|
||||
|
||||
string Drive::sPowerOnHoursToText(){
|
||||
|
||||
//TODO show in human readable format
|
||||
|
||||
return to_string(getPowerOnHours());
|
||||
|
||||
}
|
||||
string Drive::sPowerCyclesToText(){
|
||||
return to_string(getPowerCycles());
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief set S.M.A.R.T. values in model
|
||||
* \param string modelFamily
|
||||
|
Loading…
Reference in New Issue
Block a user