diff options
author | ramon <ramongomez@us.es> | 2017-10-13 08:24:59 +0000 |
---|---|---|
committer | ramon <ramongomez@us.es> | 2017-10-13 08:24:59 +0000 |
commit | 72bbcf8591f01f284e8901b3683d4222b08312a1 (patch) | |
tree | e2b04413dee905f9a62a7767d29e9a948ca4edf1 /admin | |
parent | 8f34f3a8d39a0e8944d7295ec115b66b722eb755 (diff) |
#810: Internacionalización de propiedades de repositorio; corrección al calcular porcentaje de uso y actualizar documentación de la API REST.
git-svn-id: https://opengnsys.es/svn/branches/version1.1@5458 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'admin')
6 files changed, 99 insertions, 43 deletions
diff --git a/admin/WebConsole/idiomas/php/cat/propiedades_repositorios_cat.php b/admin/WebConsole/idiomas/php/cat/propiedades_repositorios_cat.php index 2e72361a..fec234b2 100644 --- a/admin/WebConsole/idiomas/php/cat/propiedades_repositorios_cat.php +++ b/admin/WebConsole/idiomas/php/cat/propiedades_repositorios_cat.php @@ -23,4 +23,10 @@ $TbMsg[14]="% Ocupat"; $TbMsg[15]='Sin acceso a información del repositorio'; $TbMsg[16]='Revise la conexión con el repositorio<br>Revise la clave de acceso (campo Api Token debe coincidir con su valor en fichero "ogAdmRepo.cfg")'; $TbMsg[17]='Api Token'; +$TbMsg['MSG_CONTENT']='Contenido'; +$TbMsg['MSG_IMAGE']='Imatge'; +$TbMsg['MSG_TYPE']='Tipo'; +$TbMsg['MSG_SIZEBYTES']='Tama&ndile;o (bytes)'; +$TbMsg['MSG_MODIFIED']='Modificado'; +$TbMsg['MSG_PERMISSIONS']='Permisos'; ?> diff --git a/admin/WebConsole/idiomas/php/eng/propiedades_repositorios_eng.php b/admin/WebConsole/idiomas/php/eng/propiedades_repositorios_eng.php index 0b679d02..f74906e7 100644 --- a/admin/WebConsole/idiomas/php/eng/propiedades_repositorios_eng.php +++ b/admin/WebConsole/idiomas/php/eng/propiedades_repositorios_eng.php @@ -23,4 +23,10 @@ $TbMsg[14]="% Taken"; $TbMsg[15]='Unable to access repository information'; $TbMsg[16]='Check repository connection<br>Check access key (Api Token field must match its value in "ogAdmRepo" file)'; $TbMsg[17]='Api Token'; +$TbMsg['MSG_CONTENT']='Content'; +$TbMsg['MSG_IMAGE']='Image'; +$TbMsg['MSG_TYPE']='Type'; +$TbMsg['MSG_SIZEBYTES']='Size (bytes)'; +$TbMsg['MSG_MODIFIED']='Modified'; +$TbMsg['MSG_PERMISSIONS']='Permissions'; ?> diff --git a/admin/WebConsole/idiomas/php/esp/propiedades_repositorios_esp.php b/admin/WebConsole/idiomas/php/esp/propiedades_repositorios_esp.php index 1ef535ed..5d63bbcf 100644 --- a/admin/WebConsole/idiomas/php/esp/propiedades_repositorios_esp.php +++ b/admin/WebConsole/idiomas/php/esp/propiedades_repositorios_esp.php @@ -23,4 +23,10 @@ $TbMsg[14]="% Ocupado"; $TbMsg[15]='Sin acceso a información del repositorio'; $TbMsg[16]='Revise la conexión con el repositorio<br>Revise la clave de acceso (campo Api Token debe coincidir con su valor en fichero "ogAdmRepo.cfg")'; $TbMsg[17]='Api Token'; +$TbMsg['MSG_CONTENT']='Contenido'; +$TbMsg['MSG_IMAGE']='Imagen'; +$TbMsg['MSG_TYPE']='Tipo'; +$TbMsg['MSG_SIZEBYTES']='Tama&ndile;o (bytes)'; +$TbMsg['MSG_MODIFIED']='Modificado'; +$TbMsg['MSG_PERMISSIONS']='Permisos'; ?> diff --git a/admin/WebConsole/propiedades/propiedades_repositorios.php b/admin/WebConsole/propiedades/propiedades_repositorios.php index 0137901b..3759d7ad 100644 --- a/admin/WebConsole/propiedades/propiedades_repositorios.php +++ b/admin/WebConsole/propiedades/propiedades_repositorios.php @@ -172,15 +172,16 @@ if($apiKeyRepo != ""){ <?php
// Si tenemos informacion del repositorio remoto, mostramos las imagenes
if($repoWithApi == true && is_array($repoImages)){
- echo "<tr class='tabla_listados_sin'><th colspan='4'>Contenido $repodir</th></tr>";
- echo "<tr><td>File</td><td>Size</td><td>Modified</td><td>Permissions</td></tr>";
+ echo "<tr class='tabla_listados_sin'><th colspan='4'>".$TbMsg['MSG_CONTENT']." $repodir</th></tr>";
+
+echo "<tr><td>".$TbMsg['MSG_IMAGE']."</td><td>".$TbMsg['MSG_TYPE']."</td><td>".$TbMsg['MSG_SIZEBYTES']."</td><td>".$TbMsg['MSG_MODIFIED']."</td><td>".$TbMsg['MSG_PERMISSIONS']."</td></tr>\n";
foreach($repoImages as $image){
echo "<tr class='tabla_listados_sin'>";
echo "<td>".$image->name." (".$image->type.")</td>";
echo "<td>".$image->size." bytes</td>";
echo "<td>".$image->modified."</td>";
echo "<td>".$image->mode."</td>";
- echo "</tr>";
+ echo "</tr>\n";
}
foreach($repoOus as $ou) {
foreach($ou->images as $image) {
@@ -189,7 +190,7 @@ if($apiKeyRepo != ""){ echo "<td>".$image->size." bytes</td>";
echo "<td>".$image->modified."</td>";
echo "<td>".$image->mode."</td>";
- echo "</tr>";
+ echo "</tr>\n";
}
}
}
diff --git a/admin/WebConsole/rest/opengnsys-api.yml b/admin/WebConsole/rest/opengnsys-api.yml index 9704ff5c..e37559d5 100644 --- a/admin/WebConsole/rest/opengnsys-api.yml +++ b/admin/WebConsole/rest/opengnsys-api.yml @@ -948,6 +948,28 @@ paths: schema: type: object properties: + directory: + description: repository directory + type: string + images: + description: information about repository-global images + type: array + items: + $ref: "#/definitions/ImageModel" + ous: + description: OUs defined + type: array + items: + type: object + properties: + subdir: + description: OU subdirectory + type: string + images: + description: information about OU-based images + type: array + items: + $ref: "#/definitions/ImageModel" disk: description: repository disk information type: object @@ -965,30 +987,7 @@ paths: description: percentage of used space type: string required: [ total, used, free, percent ] - images: - description: information about stored images - type: object - properties: - file: - description: image file information - type: object - properties: - name: - description: file name - type: string - size: - description: file size (bytes) - type: integer - format: int64 - modified: - description: file modification date - type: string - format: date-time - permissions: - description: file permissions - type: string - required: [ name, size, modified, permissions ] - required: [ disk, images ] + required: [ directory, images, ous, disk ] security: - apikey: [] tags: @@ -1191,3 +1190,41 @@ definitions: minimum: 1 required: [ id ] required: [ id, name, mac, ip, lab, ou ] + ImageModel: + type: object + properties: + name: + description: image name (file name without extension) + type: string + type: + description: image type (file extension or ''dir'' for directory image) + type: string + clientname: + description: source client name + type: string + clonator: + description: clonation program + type: string + compressor: + description: compression program + type: string + filesystem: + description: filesystem type + type: string + datasize: + description: data size (bytes) + type: integer + format: int64 + size: + description: image size (bytes) + type: integer + format: int64 + modified: + description: image modification date + type: string + format: date-time + mode: + description: image access permissions (four octal digits) + type: string + required: [ name, type, clientname, clonator, compressor, filesystem, datasize, size, modified, mode ] + diff --git a/admin/WebConsole/rest/repository.php b/admin/WebConsole/rest/repository.php index 8bb0c66c..bbd365ce 100644 --- a/admin/WebConsole/rest/repository.php +++ b/admin/WebConsole/rest/repository.php @@ -77,11 +77,11 @@ function humanSize($bytes) /** * @brief List all images in the repository - * @note Route: /images, Method: GET + * @note Route: /repository/images, Method: GET * @param no - * @return JSON array with imagename, file size + * @return JSON object with directory, images array, ous array and disk data. */ -$app->get('/repository/images', 'validateRepositoryApiKey', +$app->get('/repository/images(/)', 'validateRepositoryApiKey', function() use ($app) { $response = array(); // Read repository information file. @@ -92,29 +92,29 @@ $app->get('/repository/images', 'validateRepositoryApiKey', if (is_dir($imgPath)) { // Complete global image information. for ($i=0; $i<sizeof(@$response['images']); $i++) { - $img=$response['images'][$i]; - $file=$imgPath."/".($img['type']==="dir" ? $img["name"] : $img["name"].".".$img["type"]); + $img = $response['images'][$i]; + $file = $imgPath."/".($img['type']==="dir" ? $img["name"] : $img["name"].".".$img["type"]); $response['images'][$i]['size'] = @stat($file)['size']; - $response['images'][$i]['modified'] = date("Y-m-d H:i:s T", @stat($file)['mtime']); + $response['images'][$i]['modified'] = date("Y-m-d H:i:s", @stat($file)['mtime']); $response['images'][$i]['mode'] = substr(decoct(@stat($file)['mode']), -4); } // Complete image in OUs information. for ($j=0; $j<sizeof(@$response['ous']); $j++) { for ($i=0; $i<sizeof(@$response['ous'][$j]['images']); $i++) { - $img=$response['ous'][$j]['images'][$i]; - $file=$imgPath."/".$response['ous'][$j]['subdir']."/".($img['type']==="dir" ? $img["name"] : $img["name"].".".$img["type"]); + $img = $response['ous'][$j]['images'][$i]; + $file = $imgPath."/".$response['ous'][$j]['subdir']."/".($img['type']==="dir" ? $img["name"] : $img["name"].".".$img["type"]); $response['ous'][$j]['images'][$i]['size'] = @stat($file)['size']; - $response['ous'][$j]['images'][$i]['modified'] = date("Y-m-d H:i:s T", @stat($file)['mtime']); + $response['ous'][$j]['images'][$i]['modified'] = date("Y-m-d H:i:s", @stat($file)['mtime']); $response['ous'][$j]['images'][$i]['mode'] = substr(decoct(@stat($file)['mode']), -4); } } // Retrieve disk information. - $total=disk_total_space($imgPath); - $free=disk_free_space($imgPath); - $response['disk']['total']=humanSize($total); - $response['disk']['used']=humanSize($total - $free); - $response['disk']['free']=humanSize($free); - $response['disk']['percent']=floor(100 * $free / $total) . " %"; + $total = disk_total_space($imgPath); + $free = disk_free_space($imgPath); + $response['disk']['total'] = humanSize($total); + $response['disk']['used'] = humanSize($total - $free); + $response['disk']['free'] = humanSize($free); + $response['disk']['percent'] = 100 - floor(100 * (100 - $free) / $total) . " %"; // JSON response. jsonResponse(200, $response); } else { |