Now the file path displayed on UI is "/data/debugreports/<reportname>/",
It's misleading because people could assume it's path on file system,
but it's the uri path in fact. We don't need expose the URI path because
the download button can help user to get the file. So this patch removes
it from UI. And this patch also renames debug report's 'file' attribute
to 'uri', because we use it to represent the download uri path.
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
docs/API.md | 2 +-
src/kimchi/control/debugreports.py | 4 ++--
src/kimchi/mockmodel.py | 2 +-
src/kimchi/model/debugreports.py | 2 +-
tests/test_rest.py | 2 +-
ui/css/theme-default/host.css | 4 ----
ui/js/src/kimchi.host.js | 4 ----
ui/pages/i18n.html.tmpl | 1 -
8 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/docs/API.md b/docs/API.md
index 8d6682b..a380558 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -672,7 +672,7 @@ specific to the low level collection tool being used.
* **GET**: Retrieve the full description of Debug Report
* name: The debug report name used to identify the report
- * file: The debug report file name used to identify the report
+ * uri: The URI path to download a debug report
* time: The time when the debug report is created
* **DELETE**: Remove the Debug Report
diff --git a/src/kimchi/control/debugreports.py b/src/kimchi/control/debugreports.py
index 9922cfa..3c12230 100644
--- a/src/kimchi/control/debugreports.py
+++ b/src/kimchi/control/debugreports.py
@@ -37,7 +37,7 @@ class DebugReport(Resource):
@property
def data(self):
return {'name': self.ident,
- 'file': self.info['file'],
+ 'uri': self.info['uri'],
'time': self.info['ctime']}
@@ -47,4 +47,4 @@ class DebugReportContent(Resource):
def get(self):
self.lookup()
- raise internal_redirect(self.info['file'])
+ raise internal_redirect(self.info['uri'])
diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
index d40f61a..01480f4 100644
--- a/src/kimchi/mockmodel.py
+++ b/src/kimchi/mockmodel.py
@@ -311,7 +311,7 @@ class MockModel(object):
ctime = time.strftime("%Y-%m-%d-%H:%M:%S", time.localtime(ctime))
file_target = os.path.split(file_target)[-1]
file_target = os.path.join("/data/debugreports", file_target)
- return {'file': file_target,
+ return {'uri': file_target,
'ctime': ctime}
def debugreportcontent_lookup(self, name):
diff --git a/src/kimchi/model/debugreports.py b/src/kimchi/model/debugreports.py
index c6e698b..6ae282a 100644
--- a/src/kimchi/model/debugreports.py
+++ b/src/kimchi/model/debugreports.py
@@ -162,7 +162,7 @@ class DebugReportModel(object):
ctime = time.strftime("%Y-%m-%d-%H:%M:%S", time.localtime(ctime))
file_target = os.path.split(file_target)[-1]
file_target = os.path.join("/data/debugreports", file_target)
- return {'file': file_target,
+ return {'uri': file_target,
'ctime': ctime}
def delete(self, name):
diff --git a/tests/test_rest.py b/tests/test_rest.py
index fe8d3c4..3f2e449 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -1507,7 +1507,7 @@ class RestTests(unittest.TestCase):
self.assertEquals(200, resp.status)
resp = request(host, port, '/debugreports/report1')
debugre = json.loads(resp.read())
- resp = request(host, port, debugre['file'])
+ resp = request(host, port, debugre['uri'])
self.assertEquals(200, resp.status)
def test_host(self):
diff --git a/ui/css/theme-default/host.css b/ui/css/theme-default/host.css
index 0f8b941..8af34f5 100644
--- a/ui/css/theme-default/host.css
+++ b/ui/css/theme-default/host.css
@@ -215,14 +215,10 @@
}
.debug-report-name,
-.debug-report-file,
.debug-report-time {
width: 200px;
}
-.debug-report-file {
- width: 300px;
-}
/* End of Debug Report */
/* Software Updates */
diff --git a/ui/js/src/kimchi.host.js b/ui/js/src/kimchi.host.js
index ae2ee7d..5d32c4a 100644
--- a/ui/js/src/kimchi.host.js
+++ b/ui/js/src/kimchi.host.js
@@ -188,10 +188,6 @@ kimchi.host_main = function() {
label: i18n['KCHDR6003M'],
'class': 'debug-report-name'
}, {
- name: 'file',
- label: i18n['KCHDR6004M'],
- 'class': 'debug-report-file'
- }, {
name: 'time',
label: i18n['KCHDR6005M'],
'class': 'debug-report-time'
diff --git a/ui/pages/i18n.html.tmpl b/ui/pages/i18n.html.tmpl
index 2f47e50..a626759 100644
--- a/ui/pages/i18n.html.tmpl
+++ b/ui/pages/i18n.html.tmpl
@@ -92,7 +92,6 @@ var i18n = {
'KCHDR6001M': "$_("Debug report will be removed permanently and
can't be recovered. Do you want to continue?")",
'KCHDR6002M': "$_("Debug Reports")",
'KCHDR6003M': "$_("Name")",
- 'KCHDR6004M': "$_("File Path")",
'KCHDR6005M': "$_("Generated Time")",
'KCHDR6006M': "$_("Generate")",
'KCHDR6007M': "$_("Generating...")",
--
1.8.4.2