Skip to content

Commit

Permalink
Updated gui
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafamat committed Oct 17, 2023
1 parent 3551bab commit 8aa2cd6
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 26 deletions.
16 changes: 8 additions & 8 deletions backend/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2673,24 +2673,24 @@ def nocrudschema_validate_f(self, obj):
except Exception as exc__:
return Misc().exception_f(exc__)

def savequery_f(self, obj):
def savequery_f(self, obj_):
"""
docstring is in progress
"""
try:
que_id_ = obj["id"] if "id" in obj and obj["id"] is not None else None
aggregate_ = obj["aggregate"] if "aggregate" in obj and obj["aggregate"] is not None else None
approved_ = "approved" in obj and obj["approved"] is True
user_ = obj["userindb"] if "userindb" in obj and obj["userindb"] is not None else None
que_id_ = obj_["id"] if "id" in obj_ and obj_["id"] is not None else None
aggregate_ = obj_["aggregate"] if "aggregate" in obj_ and obj_["aggregate"] is not None else None
approved_ = "approved" in obj_ and obj_["approved"] is True
user_ = obj_["userindb"] if "userindb" in obj_ and obj_["userindb"] is not None else None

if not user_:
raise AuthError("user not found")
raise AuthError("user not found", obj_)

if not aggregate_:
raise APIError("no aggregation provided")
raise APIError("no aggregation provided", obj_)

if not que_id_:
raise APIError("query not found")
raise APIError("query not found", obj_)

if not Auth().is_manager_f(user_) and not Auth().is_admin_f(user_):
raise AuthError("no permission to save")
Expand Down
2 changes: 1 addition & 1 deletion pwa/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "technoplatz-bi-pwa",
"version": "4.3.18",
"version": "4.3.19",
"author": "Mustafa Mat, Technoplatz IT Solutions GmbH",
"homepage": "https://bi.technoplatz.com",
"scripts": {
Expand Down
13 changes: 6 additions & 7 deletions pwa/src/app/pages/collection/collection.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ export class CollectionPage implements OnInit {
this.pager_ = this.page_;
this.build_schema_f(res.structure);
this.data = res.data;
this.structure_ = this.json_content_ = res.structure;
this.structure_ = res.structure;
this.json_content_ = res.structure;
this.actions = this.structure_.actions;
this.properties_ = res.structure.properties;
this.scan_ = true ? Object.keys(this.properties_).filter((key: any) => this.properties_[key].scan).length > 0 : false;
Expand Down Expand Up @@ -585,13 +586,11 @@ export class CollectionPage implements OnInit {
});
}

json_changed(ev: any) {
if (ev.isTrusted === false) {
console.error("*** event", ev);
json_changed(event_: any) {
if (!event_.isTrusted) {
this.json_content_ = event_;
} else {
setTimeout(() => {
this.json_content_ = ev;
}, 500);
console.error("*** event", event_);
}
}

Expand Down
3 changes: 3 additions & 0 deletions pwa/src/app/pages/home/home.page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ For more information on this, and how to apply and follow the GNU AGPL, see
https://www.gnu.org/licenses.
*/

h2 {
font-size: 24px !important;
}
19 changes: 9 additions & 10 deletions pwa/src/app/pages/query/query.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class QueryPage implements OnInit {
public perma_: boolean = false;
private collections_: any = [];
private schema_: any = {};
public json_content_: any = [];
public json_content_: any = null;
public col_: string = "";

constructor(
Expand Down Expand Up @@ -166,7 +166,8 @@ export class QueryPage implements OnInit {
this.que_scheduled_cron_ = res.query?.que_scheduled_cron;
this._tags = res.query?._tags;
this.subheader = res.query.que_title;
this.aggregate_ = this.json_content_ = res.query.que_aggregate;
this.json_content_ = res.query.que_aggregate;
this.aggregate_ = res.query.que_aggregate;
this.type_ = res.query.que_type;
this.fields_ = res.fields;
this.data_ = res.data;
Expand Down Expand Up @@ -217,7 +218,7 @@ export class QueryPage implements OnInit {
}

save_json_f(approved_: boolean) {
if (this.json_content_) {
if (this.json_content_ && this.json_content_.length > 0) {
this._saving = true;
this.aggregate_ = this.json_content_;
this.misc.api_call("crud", {
Expand All @@ -237,17 +238,15 @@ export class QueryPage implements OnInit {
this._saving = false;
});
} else {
this.misc.doMessage("invalid structure", "error");
this.misc.doMessage("invalid aggregation", "error");
}
}

json_changed(ev: any) {
if (ev.isTrusted === false) {
console.error("*** event", ev);
json_changed(event_: any) {
if (!event_.isTrusted) {
this.json_content_ = event_;
} else {
setTimeout(() => {
this.json_content_ = ev;
}, 500);
console.error("*** event", event_);
}
}

Expand Down

0 comments on commit 8aa2cd6

Please sign in to comment.