diff --git a/client/pages/auth/auth.py b/client/pages/auth/auth.py index 8603ef0..7cd6bf9 100644 --- a/client/pages/auth/auth.py +++ b/client/pages/auth/auth.py @@ -5,7 +5,38 @@ class Auth: def __init__(self, page: ft.Page): self.page = page self.login = Login(self.page, self) - self.placeholder = ft.Container(content=self.login.build()) + self.placeholder = ft.Container( + content=self.login.build(), + bgcolor=ft.Colors.WHITE, + padding=20, + border_radius=20 + ) def build(self): - return self.placeholder \ No newline at end of file + return ft.Container( + content= ft.Row( + [ + ft.Container( + content=ft.Column( + [ + ft.Container( + content = ft.Image("images/logo.png", width=300, height=300, fit=ft.ImageFit.CONTAIN), + ), + ft.Container( + content = ft.Image("images/danube_db_rectangle.png", width=300, height=300, fit=ft.ImageFit.CONTAIN), + ) + ] + ), + padding=10, + ), + ft.Container( + content = self.placeholder, + padding=3, + bgcolor=ft.Colors.BLUE_400, + border_radius=20 + ) + + ], + alignment=ft.MainAxisAlignment.SPACE_AROUND + ) + ) \ No newline at end of file diff --git a/client/pages/auth/forgot_password.py b/client/pages/auth/forgot_password.py index 68ce583..6e1149b 100644 --- a/client/pages/auth/forgot_password.py +++ b/client/pages/auth/forgot_password.py @@ -28,7 +28,7 @@ class ForgotPassword: return ft.Container( ft.Column( [ - ft.Text("Forgot Password?"), + ft.Text("FORGOT PASSWORD", weight=ft.FontWeight.BOLD, size=20), self.email, ft.Button("Recover"), self.error, diff --git a/client/pages/auth/login.py b/client/pages/auth/login.py index 92d3b6c..ba0c61c 100644 --- a/client/pages/auth/login.py +++ b/client/pages/auth/login.py @@ -45,6 +45,7 @@ class Login: return ft.Container( ft.Column( [ + ft.Text("LOGIN", weight=ft.FontWeight.BOLD, size=20), self.email, self.password, self.error, diff --git a/client/pages/auth/register.py b/client/pages/auth/register.py index 1807770..b4bad92 100644 --- a/client/pages/auth/register.py +++ b/client/pages/auth/register.py @@ -88,6 +88,7 @@ class Register: return ft.Container( ft.Column( [ + ft.Text("REGISTER", weight=ft.FontWeight.BOLD, size=20), self.email, self.password, self.confirm_password, diff --git a/client/pages/home/application_page.py b/client/pages/home/application_page.py index 44b9300..096b7cd 100644 --- a/client/pages/home/application_page.py +++ b/client/pages/home/application_page.py @@ -18,6 +18,7 @@ class ApplicationPage: self.access_token = self.get_access_token() self.access_code = ft.Text("***********") self.selected = None + self.show_hide_access_code = ft.Button("Show Acess Code",icon=ft.Icons.PASSWORD, on_click=self.show_access_code) self.all_data = self.get_data() self.data_list = ft.ListView( @@ -36,7 +37,7 @@ class ApplicationPage: ) self.editor = ft.TextField( #value=self.get_data(), - label='Editor', + label='Insert valid JSON data', multiline=True, min_lines=5, max_lines=10, @@ -45,7 +46,8 @@ class ApplicationPage: ) self.update_doc_id = ft.TextField(label="Doc Id") - self.update_fileds = ft.TextField(label="Update Fields") + self.update_filed = ft.TextField(label="Field") + self.update_value = ft.TextField(label="Value") self.query_field = ft.TextField(label="Field") self.query_value = ft.TextField(label="Value") self.query_operator = ft.Dropdown( @@ -83,8 +85,14 @@ class ApplicationPage: return resp_json['token'] def show_access_code(self, e): - self.access_code.value = self.app['access_code'] + if self.access_code.value == '***********': + self.access_code.value = self.app['access_code'] + self.show_hide_access_code.text = "Hide Acess Code" + else: + self.access_code.value = "***********" + self.show_hide_access_code.text = "Show Acess Code" self.access_code.update() + self.show_hide_access_code.update() def format_json(self, data): @@ -145,7 +153,7 @@ class ApplicationPage: if self.update_doc_id.value: json_file = { "doc_id": int(self.update_doc_id.value), - "fields": self.update_fileds.value, + "fields": {self.update_filed.value: self.update_value.value}, } else: json_file = { @@ -154,7 +162,7 @@ class ApplicationPage: "op": self.query_operator.value, "value": self.query_value.value, }, - "fields": self.update_fileds.value, + "fields": {self.update_filed.value: self.update_value.value}, } if self.update_doc_id.value or self.query_field.value: @@ -162,6 +170,18 @@ class ApplicationPage: print(response.text) result = json.loads(response.text) if response.status_code == 200 else [] self.refresh_list('') + self.update_filed.value = '' + self.update_filed.update() + self.update_value.value = '' + self.update_value.update() + self.query_field.value = '' + self.query_field.update() + self.query_value.value = '' + self.query_value.update() + self.update_doc_id.value = '' + self.update_doc_id.update() + self.placeholder.controls.clear() + def delete_data(self, e): headers = { @@ -185,6 +205,12 @@ class ApplicationPage: print(response.text) result = json.loads(response.text) if response.status_code == 200 else [] self.refresh_list('') + self.query_field.value = '' + self.query_field.update() + self.query_value.value = '' + self.query_value.update() + self.update_doc_id.value = '' + self.update_doc_id.update() def query_data(self, e): '''Added a tiny query DSL so you can filter with { "where": { "field":"user", "op":"==", "value":"abc" } } (supports ==, !=, >, >=, <, <=, in, contains).''' @@ -238,10 +264,10 @@ class ApplicationPage: self.placeholder.update() def on_update_btn_click(self, e): - self.placeholder.controls.clear() self.placeholder.controls = [ ft.Text("Update", weight=ft.FontWeight.BOLD, size=15), - self.update_fileds, + self.update_filed, + self.update_value, ft.Text('where'), self.query_field, self.query_operator, @@ -283,7 +309,7 @@ class ApplicationPage: ft.Row( [ ft.Text("Manage Application", weight=ft.FontWeight.BOLD, size=20), - ft.Button("Show Acess Code",icon=ft.Icons.PASSWORD, on_click=self.show_access_code) + self.show_hide_access_code ], alignment=ft.MainAxisAlignment.SPACE_BETWEEN ), diff --git a/client/pages/home/dashboard.py b/client/pages/home/dashboard.py index e7292ee..9232674 100644 --- a/client/pages/home/dashboard.py +++ b/client/pages/home/dashboard.py @@ -14,7 +14,7 @@ class Dashboard: min_width=100, min_extended_width=400, group_alignment=-0.9, - leading=ft.Text("Logo"), + leading=ft.Image('images/danube_db_logo_rectangle.png', width=80), destinations=[ ft.NavigationRailDestination( icon=ft.Icons.LIST_ALT_OUTLINED, diff --git a/solarDb/server.py b/solarDb/server.py index eaace62..f5bee29 100644 --- a/solarDb/server.py +++ b/solarDb/server.py @@ -258,9 +258,10 @@ def get_all(): data = db.all() _items = [] for item in data: - d = dict(item) - d["doc_id"] = item.doc_id - _items.append(d) + buffer = { + item.doc_id: item + } + _items.append(buffer) return jsonify(_items), 200