Minor visual tweaking and filemanager backend improvements.
This commit is contained in:
parent
ee309b095e
commit
de0b9beacb
10 changed files with 47 additions and 17 deletions
|
@ -64,7 +64,7 @@ class BaseController extends Controller
|
|||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'company' => 'required|between:1,256',
|
||||
'default_language' => 'required|alpha_dash|min:2|max:5',
|
||||
// 'default_language' => 'required|alpha_dash|min:2|max:5',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
|
@ -72,7 +72,7 @@ class BaseController extends Controller
|
|||
}
|
||||
|
||||
Settings::set('company', $request->input('company'));
|
||||
Settings::set('default_language', $request->input('default_language'));
|
||||
// Settings::set('default_language', $request->input('default_language'));
|
||||
|
||||
Alert::success('Settings have been successfully updated.')->flash();
|
||||
|
||||
|
|
|
@ -124,10 +124,17 @@ class NodesController extends Controller
|
|||
DB::raw('SUM(memory) as memory, SUM(disk) as disk')
|
||||
)->where('node_id', $node->id)->first()
|
||||
)->mapWithKeys(function ($item, $key) use ($node) {
|
||||
$percent = ($item / $node->{$key}) * 100;
|
||||
if ($node->{$key . '_overallocate'} > 0) {
|
||||
$withover = $node->{$key} * (1 + ($node->{$key . '_overallocate'} / 100));
|
||||
} else {
|
||||
$withover = $node->{$key};
|
||||
}
|
||||
|
||||
$percent = ($item / $withover) * 100;
|
||||
|
||||
return [$key => [
|
||||
'value' => $item,
|
||||
'value' => number_format($item),
|
||||
'max' => number_format($withover),
|
||||
'percent' => $percent,
|
||||
'css' => ($percent <= 75) ? 'green' : (($percent > 90) ? 'red' : 'yellow'),
|
||||
]];
|
||||
|
|
|
@ -144,12 +144,21 @@ class FileRepository
|
|||
throw new Exception('A valid directory must be specified in order to list its contents.');
|
||||
}
|
||||
|
||||
$res = $this->server->guzzleClient()->request('GET', '/server/directory/' . rawurlencode($directory));
|
||||
try {
|
||||
$res = $this->server->guzzleClient()->request('GET', '/server/directory/' . rawurlencode($directory));
|
||||
} catch(\GuzzleHttp\Exception\ClientException $ex) {
|
||||
$json = json_decode($ex->getResponse()->getBody());
|
||||
|
||||
throw new DisplayException($json->error);
|
||||
} catch (\GuzzleHttp\Exception\ServerException $ex) {
|
||||
throw new DisplayException('A remote server error was encountered while attempting to display this directory.');
|
||||
} catch (\GuzzleHttp\Exception\ConnectException $ex) {
|
||||
throw new DisplayException('A ConnectException was encountered: unable to contact daemon.');
|
||||
} catch (\Exception $ex) {
|
||||
throw $ex;
|
||||
}
|
||||
|
||||
$json = json_decode($res->getBody());
|
||||
if ($res->getStatusCode() !== 200) {
|
||||
throw new DisplayException('An error occured while attempting to save this file. ' . $res->getBody());
|
||||
}
|
||||
|
||||
// Iterate through results
|
||||
$files = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue