Skip to content
This repository has been archived by the owner on Oct 6, 2019. It is now read-only.

Commit

Permalink
Checkbox to allow for deleting database table
Browse files Browse the repository at this point in the history
during “removal of app”
  • Loading branch information
Thomas Hansen committed Oct 6, 2017
1 parent 9d365ac commit 7989018
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions helpers/databind-grid.hl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ for-each:x:/@list-files/*?name
innerValue:Confirm deletion of app
p
innerValue:Are you sure you want to delete this app? This action is permanent, and your application will also be uninstalled.
label
widgets
input:delete-data
type:checkbox
span
innerValue:Also delete the data for app
div
class:right
widgets
Expand All @@ -94,13 +100,6 @@ for-each:x:/@list-files/*?name
*/
_filename:x:/@_dp?value

/*
* Deleting app declaration file, for then to simply
* delete modal widget.
*/
delete-file:x:/@_filename?value
delete-widget:camphora-confirm-deletion

/*
* Making sure we also uninstall app.
*/
Expand All @@ -110,6 +109,29 @@ for-each:x:/@list-files/*?name
desktop.uninstall-app:/modules/{0}/
:x:/@split/0/-2?name

/*
* Then checking if we should delete the database table for our app.
*/
get-widget-property:delete-data
checked
if:x:/@get-widget-property/*/*

/*
* Opening up database connection to camphora, and deleting the table, making
* sure we wrap it in a try/catch block, in case it doesn't exist, or some other
* error occurs.
*/
p5.mysql.connect:[camphora]
p5.mysql.execute:@"drop table `{0}`"
:x:/@split/0/-2?name

/*
* Deleting app declaration file, for then to simply
* delete modal widget.
*/
delete-file:x:/@_filename?value
delete-widget:camphora-confirm-deletion

/*
* Re-databinding grid.
*/
Expand Down

0 comments on commit 7989018

Please sign in to comment.