Ernesto Menéndez avatar Ernesto Menéndez committed 5937352

apps.admin: estilo de mantenimiento de llaves

Comments (0)

Files changed (5)

nxweb/apps/admin/html/js/pkey-controller.js

         Pkey.delete({key:attribute});
         refresh();
     }
+
+    $scope.showCreateWindow = function() {
+        $("#pkey-window").data("kendoWindow").refresh("/window.html#/pkey/").center().open().unbind('close').bind('close', refresh);
+    }
+
+    $scope.showEditWindow = function(id) {
+        $("#pkey-window").data("kendoWindow").refresh("/window.html#/pkey/"+id).center().open().unbind('close').bind('close', refresh);
+    }
+
     refresh();
 }
 

nxweb/apps/admin/html/partials/attribute-list.html

                             {{values.join(', ')}}
                         </td>
                         <td>
-                            <!-- <a ng-href="#/attribute/{{attribute}}"" class="k-button k-button-icontext k-grid-edit"> -->
+                            <!-- <a ng-href="#/attribute/{{attribute}}" class="k-button k-button-icontext k-grid-edit"> -->
                             <a ng-click="showEditWindow(attribute)" class="k-button k-button-icontext k-grid-edit">
                                 <span class="k-icon k-edit"></span>
                                 Edit

nxweb/apps/admin/html/partials/pkey-list.html

-<a href="/#/pkey">Create</a>
-<table>
-  <tr>
-    <td>Name</td><td>Status</td><td>Key</td>
-  </tr>
+<div class="k-content">
+    <div class="k-grid k-widget" tabindex="0" style="height: 540px;">
+        <div class="k-toolbar k-grid-toolbar">
+            <!-- <a href="/#/pkey" class="k-button k-button-icontext k-grid-add"> -->
+            <a ng-click="showCreateWindow()" class="k-button k-button-icontext k-grid-add">
+                <span class="k-icon k-add"></span>
+                Create new key
+            </a>
+        </div>
+        <div class="k-grid-header" style="padding-right: 16px;">
+            <div class="k-grid-header-wrap">
+                <table cellspacing="0">
+                    <colgroup><col><col><col><col></colgroup>
+                    <thead>
+                        <tr>
+                            <th class="k-header">Name</th>
+                            <th class="k-header">Status</th>
+                            <th class="k-header">Key</th>
+                            <th class="k-header"></th>
+                        </tr>
+                    </thead>
+                </table>
+            </div>
+        </div>
 
-  <tr ng-repeat="(key, data) in pkeys">
-    <td><a ng-href="#/pkey/{{key}}">{{data['name']}}</a></td>
-    <td><a ng-click="delete(key)" ng-show="data['valid']">Invalidate?</a><p ng-hide="data['valid']">Invalid</p>
-    </td>
-    <td>{{key}}</td>
-  </tr>
-</table>
+        <div class="k-grid-content" style="height: 468px;">
+            <table cellspacing="0" id="grid" style="height: auto;" class="k-focusable">
+                <colgroup><col><col><col><col></colgroup>
+                <tbody>
+                    <tr ng-repeat="(key, data) in pkeys" ng-class-even="'k-alt'">
+                        <td>
+                            {{data['name']}}
+                        </td>
+                        <td>
+                            <span ng-show="data['valid']">Ok</span>
+                            <span ng-hide="data['valid']">Invalid</span>
+                        </td>
+                        <td>
+                            {{key}}
+                        </td>
+                        <td>
+                            <!-- <a ng-href="#/pkey/{{key}}" class="k-button k-button-icontext k-grid-edit"> -->
+                            <a ng-click="showEditWindow(key)" class="k-button k-button-icontext k-grid-edit">
+                                <span class="k-icon k-edit"></span>
+                                Edit
+                            </a>
+                            <a ng-click="delete(key)" class="k-button k-button-icontext k-grid-delete">
+                                <span class="k-icon k-delete"></span>
+                                Invalidate
+                            </a>
+                        </td>
+                    </tr>
+                </tbody>
+            </table>
+        </div>
+    </div>
+</div>
+
+<div id="pkey-window">
+</div>
+
+<script type="text/javascript">
+    $(document).ready(function() {
+        $("#pkey-window").kendoWindow({
+            iframe: true,
+            modal: true,
+            content: "about:blank",
+            height: "400px",
+            width: "600px",
+            visible: false
+        });
+    });
+</script>

nxweb/apps/admin/html/partials/pkey.html

 <button ng-click="update(name,pkey)"  ng-disabled="form.$invalid">Save</button>
 
 </form>
-<a href="#/pkeys">Back</a>
+<!-- <a href="#/pkeys">Back</a> -->
 <p ng-show=message> {{message}} </p>

nxweb/data/dkvs/pubkey.py

     bucket = _get_bucket()
     return bucket.get(pkid)
 
+
 def get(pkid):
     bucket = _get_bucket()
     return bucket.get(pkid).get_data()
     else:
         raise InvalidatedPublicKey(pkid)
 
-def delete_all():
-    _get_bucket.get_keys()
-    for key in keys:
-        bucket.get(key).delete()
 
 def delete(pkid):
     pubkey = _get_bucket().get(pkid)
     if pubkey:
         pubkey.delete()
 
+
 def invalidate(pkid):
     """A key, once invalidated, can never be used again."""
-
-    #TODO: remove this
-    delete(pkid)
-    return
-    #
-
     pubkey = _get_bucket().get(pkid)
     data = pubkey.get_data()
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.