Skip to content

Commit

Permalink
NFS Exports plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Apr 24, 2013
1 parent 33851f9 commit ee8a894
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ajenti/plugins/exports/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from ajenti.api import *
from ajenti.plugins import *


info = PluginInfo(
title='NFS Exports',
icon='hdd',
dependencies=[
PluginDependency('main'),
BinaryDependency('nfsstat')
],
)


def init():
import main
69 changes: 69 additions & 0 deletions ajenti/plugins/exports/layout/main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<vc xmlns:bind="bind">
<body>
<pad>
<box width="750">
<bind:collection bind="exports" id="exports">
<vc>
<dt bind="__items" />
<bind:template>
<collapserow>
<box>
<right>
<button bind="__delete" icon="remove" style="icon" warning="Confirm deletion" />
</right>
<hc>
<icon icon="hdd" />
<label bind="name" />
</hc>
</box>

<pad>
<vc>
<formline text="Directory">
<textbox bind="name" />
</formline>
<vc>
<bind:collection id="clients" bind="clients">
<formline text="Clients">
<vc>
<dt bind="__items">
<dtr>
<dth width="1" />
<dth text="Address" />
<dth text="Options" />
<dth width="1" />
</dtr>
</dt>
<button bind="__add" icon="plus" text="Create" />
</vc>
</formline>
<bind:template>
<dtr>
<dtd>
<icon icon="desktop" />
</dtd>
<dtd>
<textbox bind="name" />
</dtd>
<dtd>
<textbox bind="options" />
</dtd>
<dtd>
<button bind="__delete" icon="remove" style="icon" />
</dtd>
</dtr>
</bind:template>
</bind:collection>
</vc>
</vc>
</pad>
</collapserow>
</bind:template>
<button bind="__add" icon="plus" text="Create" />
</vc>
</bind:collection>
</box>
</pad>
</body>
<button id="save" text="Save" icon="ok" />
</vc>
31 changes: 31 additions & 0 deletions ajenti/plugins/exports/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from ajenti.api import *
from ajenti.plugins.main.api import SectionPlugin
from ajenti.ui import on
from ajenti.ui.binder import Binder

from reconfigure.configs import ExportsConfig
from reconfigure.items.exports import ExportData, ClientData


@plugin
class Exports (SectionPlugin):
def init(self):
self.title = 'NFS Exports'
self.icon = 'hdd'
self.category = 'System'
self.append(self.ui.inflate('exports:main'))

self.config = ExportsConfig(path='/etc/exports')
self.binder = Binder(None, self)
self.find('exports').new_item = lambda c: ExportData()
self.find('clients').new_item = lambda c: ClientData()

def on_page_load(self):
self.config.load()
self.binder.reset(self.config.tree).autodiscover().populate()

@on('save', 'click')
def save(self):
self.binder.update()
self.config.save()
self.context.notify('info', 'Saved')

0 comments on commit ee8a894

Please sign in to comment.