-
Notifications
You must be signed in to change notification settings - Fork 831
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |