Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Button to remove procedure in local plug-in (in Admin app).

  • Loading branch information...
commit a95b5e6e5415641272f41fb2571af037c166e334 1 parent 15424d6
@cederberg authored
View
25 src/plugin/system/files/app/admin/app.js
@@ -18,6 +18,7 @@ AdminApp.prototype.start = function () {
appList: "System.App.List",
plugInList: "System.PlugIn.List",
procList: "System.Procedure.List",
+ procDelete: "System.Procedure.Delete",
userList: "System.User.List",
userChange: "System.User.Change"
});
@@ -33,7 +34,7 @@ AdminApp.prototype.start = function () {
MochiKit.Signal.connect(this.ui.appLaunchWindow, "onclick", this, "_launchAppWindow");
var func = function (td, data) {
if (data) {
- var styles = { marginLeft: "6px" };
+ var styles = { marginLeft: "3px" };
var attrs = { ref: "EXPAND", tooltip: "Open in new window", style: styles };
var img = RapidContext.Widget.Icon(attrs);
var link = MochiKit.DOM.A({ href: data, target: "_blank" }, data, img);
@@ -67,8 +68,13 @@ AdminApp.prototype.start = function () {
MochiKit.Signal.connectOnce(this.ui.procTab, "onenter", this.proc.procList, "call");
RapidContext.UI.connectProc(this.proc.procList, this.ui.procTreeLoading, this.ui.procTreeReload);
MochiKit.Signal.connect(this.proc.procList, "onsuccess", this, "_callbackProcedures");
+ RapidContext.UI.connectProc(this.proc.procDelete);
+ MochiKit.Signal.connect(this.proc.procDelete, "oncall", this.ui.overlay, "show");
+ MochiKit.Signal.connect(this.proc.procDelete, "onresponse", this.ui.overlay, "hide");
+ MochiKit.Signal.connect(this.proc.procDelete, "onsuccess", this.proc.procList, "recall");
MochiKit.Signal.connect(this.ui.procTree, "onselect", this, "_showProcedure");
MochiKit.Signal.connect(this.ui.procAdd, "onclick", this, "_addProcedure");
+ MochiKit.Signal.connect(this.ui.procRemove, "onclick", this, "_removeProcedure");
MochiKit.Signal.connect(this.ui.procEdit, "onclick", this, "_editProcedure");
MochiKit.Signal.connect(this.ui.procEditType, "onchange", this, "_updateProcEdit");
MochiKit.Signal.connect(this.ui.procEditAdd, "onclick", this, "_addProcBinding");
@@ -346,6 +352,7 @@ AdminApp.prototype._callbackProcedures = function (res) {
node.data = res[i];
}
this.ui.procTree.removeAllMarked();
+ this._showProcedure();
}
/**
@@ -371,6 +378,7 @@ AdminApp.prototype.showProcedure = function (name) {
AdminApp.prototype._showProcedure = function () {
var node = this.ui.procTree.selectedChild();
this.ui.procForm.reset();
+ this.ui.procRemove.hide();
this.ui.procEdit.hide();
this.ui.procReload.hide();
this.ui.procLoading.hide();
@@ -399,6 +407,9 @@ AdminApp.prototype._callbackShowProcedure = function (res) {
RapidContext.UI.showError(res);
} else {
this._currentProc = res;
+ if (res.plugin == "local") {
+ this.ui.procRemove.show();
+ }
if (res.type != "built-in") {
this.ui.procEdit.show();
}
@@ -510,6 +521,18 @@ AdminApp.prototype._addProcedure = function () {
}
/**
+ * Removes the currently shown procedure (if in the local plug-in).
+ */
+AdminApp.prototype._removeProcedure = function () {
+ var p = this._currentProc;
+ var msg = "Do you really want to delete the\nprocedure '" + p.name + "'?";
+ if (confirm(msg)) {
+ this.ui.overlay.setAttrs({ message: "Deleting..." });
+ this.proc.procDelete(p.name);
+ }
+}
+
+/**
* Opens the procedure editing dialog for an existing procedure.
*/
AdminApp.prototype._editProcedure = function () {
View
25 src/plugin/system/files/app/admin/ui.xml
@@ -35,7 +35,7 @@
<td>
<a id="appLink" href="#" target="_blank" class="hidden">
<Field name="*" format="/storage/plugin/{plugin}/app/{id}" />
- <Icon ref="EXPAND" tooltip="Open storage view" style="margin-left: 6px;" />
+ <Icon ref="EXPAND" tooltip="Open storage view" style="margin-left: 3px;" />
</a>
</td>
</tr>
@@ -63,7 +63,7 @@
</tr>
<tr>
<td colspan="2" style="padding-top: 10px;">
- <Button id="appLaunch" class="widgetHidden" style="margin-right: 6px"><Icon ref="OK" /> Launch</Button>
+ <Button id="appLaunch" class="widgetHidden" style="margin-right: 10px"><Icon ref="OK" /> Launch</Button>
<Button id="appLaunchWindow" class="widgetHidden"><Icon ref="EXPAND" /> Launch in new window</Button>
</td>
</tr>
@@ -85,7 +85,7 @@
<strong><Field name="name" /></strong>,
<Field name="approxSize" />,
<Field name="mimeType" />
- <Icon id="pluginFileDelete" ref="DELETE" style="margin-left: 6px;" />
+ <Icon id="pluginFileDelete" ref="DELETE" style="margin-left: 3px;" />
</Pane>
</td>
</tr>
@@ -130,7 +130,7 @@
<td>
<a id="pluginLink" href="#" target="_blank" class="hidden">
<Field name="*" format="/storage/plugin/{id}/" />
- <Icon ref="EXPAND" tooltip="Open storage view" style="margin-left: 6px;" />
+ <Icon ref="EXPAND" tooltip="Open storage view" style="margin-left: 3px;" />
</a>
</td>
</tr>
@@ -160,8 +160,8 @@
</tr>
<tr>
<td colspan="2" style="padding-top: 4px;">
- <Button id="pluginLoad" style="margin-right: 6px"><Icon ref="OK" tooltip="Load" /> Load</Button>
- <Button id="pluginUnload" style="margin-right: 6px"><Icon ref="ERROR" tooltip="Unload" /> Unload</Button>
+ <Button id="pluginLoad" style="margin-right: 10px"><Icon ref="OK" tooltip="Load" /> Load</Button>
+ <Button id="pluginUnload" style="margin-right: 10px"><Icon ref="ERROR" tooltip="Unload" /> Unload</Button>
</td>
</tr>
</tbody>
@@ -177,6 +177,7 @@
<Form id="procForm" style="width: 100%; height: 100%;">
<h3>Procedure Details:
<Icon id="procAdd" ref="ADD" style="margin-right: 3px;" />
+ <Icon id="procRemove" ref="REMOVE" style="margin-right: 3px;" />
<Icon id="procEdit" ref="EDIT" style="margin-right: 3px;" />
<Icon id="procReload" ref="RELOAD" />
<Icon id="procLoading" ref="LOADING" />
@@ -218,7 +219,7 @@
</tbody>
</table>
<div style="margin-top: 6px;">
- <Button id="procExec" disabled="true" style="margin-right: 6px;"><Icon ref="OK" /> Execute</Button>
+ <Button id="procExec" disabled="true" style="margin-right: 10px;"><Icon ref="OK" /> Execute</Button>
<Button id="procBatch" disabled="true"><Icon ref="DELAY" /> Execute Batch</Button>
</div>
<Tree id="procExecResult" w="100%" h="10%" style="margin-top: 6px;">
@@ -240,8 +241,8 @@
</div>
<TextArea name="value" w="100%-5" h="100%-65" />
<div style="position: absolute; bottom: 10px; right: 10px;">
- <Button id="procArgCancel" style="margin-left: 6px;"><Icon ref="CANCEL" /> Cancel</Button>
- <Button id="procArgSave" style="margin-left: 6px;"><Icon ref="OK" /> Save</Button>
+ <Button id="procArgCancel" style="margin-left: 10px;"><Icon ref="CANCEL" /> Cancel</Button>
+ <Button id="procArgSave" style="margin-left: 10px;"><Icon ref="OK" /> Save</Button>
</div>
</Form>
</Dialog>
@@ -302,8 +303,8 @@
</table>
</Form>
<div style="position: absolute; bottom: 10px; right: 10px;">
- <Button id="procEditCancel" style="margin-left: 6px;"><Icon ref="CANCEL" /> Cancel</Button>
- <Button id="procEditSave" style="margin-left: 6px;"><Icon ref="OK" /> Save</Button>
+ <Button id="procEditCancel" style="margin-left: 10px;"><Icon ref="CANCEL" /> Cancel</Button>
+ <Button id="procEditSave" style="margin-left: 10px;"><Icon ref="OK" /> Save</Button>
</div>
</Dialog>
</Pane>
@@ -397,7 +398,7 @@
</tr>
<tr>
<td colspan="2" style="padding-top: 4px;">
- <Button id="userSave" style="margin-right: 6px"><Icon ref="OK" /> Save</Button>
+ <Button id="userSave" style="margin-right: 10px"><Icon ref="OK" /> Save</Button>
</td>
</tr>
</tbody>
Please sign in to comment.
Something went wrong with that request. Please try again.