摘要:參考網(wǎng)址創(chuàng)建應(yīng)用創(chuàng)建應(yīng)用目錄創(chuàng)建菜單節(jié)點設(shè)置菜單節(jié)點圖標(biāo)內(nèi)創(chuàng)建對應(yīng)內(nèi)的張圖片創(chuàng)建設(shè)置面板刷新緩存創(chuàng)建腳本生成配置信息的腳本命令執(zhí)行添加默認(rèn)配置以下條命令用于安裝包安裝直接執(zhí)行可注釋掉創(chuàng)建刪除配置信息的腳本執(zhí)行命令
參考網(wǎng)址:https://forum.openmediavault....
創(chuàng)建應(yīng)用GUI
創(chuàng)建應(yīng)用目錄:/var/www/openmediavault/js/omv/module/admin/service/example
創(chuàng)建菜單節(jié)點: Node.js
// require("js/omv/WorkspaceManager.js") OMV.WorkspaceManager.registerNode({ id: "example", path: "/service", text: _("Example"), icon16: "images/example.png", iconSvg: "images/example.svg" });
設(shè)置菜單節(jié)點圖標(biāo)
var/www/openmediavault/images 內(nèi)創(chuàng)建對應(yīng)Node.js內(nèi)的2張圖片
創(chuàng)建設(shè)置面板: Settings.js
// require("js/omv/WorkspaceManager.js") // require("js/omv/workspace/form/Panel.js") Ext.define("OMV.module.admin.service.example.Settings", { extend: "OMV.workspace.form.Panel", rpcService: "Example", rpcGetMethod: "getSettings", rpcSetMethod: "setSettings", getFormItems: function() { return [{ xtype: "fieldset", title: _("General"), fieldDefaults: { labelSeparator: "" }, items: [{ xtype: "checkbox", name: "enable", fieldLabel: _("Enable"), checked: false }, { xtype: "numberfield", name: "max_value", fieldLabel: _("Max value"), minValue: 0, maxValue: 100, allowDecimals: false, allowBlank: true }] }]; } }); OMV.WorkspaceManager.registerPanel({ id: "settings", path: "/service/example", text: _("Settings"), position: 10, className: "OMV.module.admin.service.example.Settings" });
刷新js緩存:
source /usr/share/openmediavault/scripts/helper-functions && omv_purge_internal_cache
創(chuàng)建shell腳本
生成配置信息的腳本postinst 命令執(zhí)行:/bin/sh postinst configure
#!/bin/sh set -e . /etc/default/openmediavault . /usr/share/openmediavault/scripts/helper-functions case "$1" in configure) SERVICE_XPATH_NAME="example" SERVICE_XPATH="/config/services/${SERVICE_XPATH_NAME}" # 添加默認(rèn)配置 if ! omv_config_exists "${SERVICE_XPATH}"; then omv_config_add_element "/config/services" "${SERVICE_XPATH_NAME}" omv_config_add_element "${SERVICE_XPATH}" "enable" "0" omv_config_add_element "${SERVICE_XPATH}" "max_value" "0" fi # 以下2條命令用于安裝包安裝 直接執(zhí)行可注釋掉 dpkg-trigger update-fixperms dpkg-trigger update-locale ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument" >&2 exit 1 ;; esac #DEBHELPER# exit 0
創(chuàng)建刪除配置信息的shell腳本 postrm 執(zhí)行命令:/bin/sh postrm purge
#!/bin/sh set -e . /etc/default/openmediavault . /usr/share/openmediavault/scripts/helper-functions SERVICE_XPATH_NAME="example" SERVICE_XPATH="/config/services/${SERVICE_XPATH_NAME}" case "$1" in purge) if omv_config_exists ${SERVICE_XPATH}; then omv_config_delete ${SERVICE_XPATH} fi ;; remove) ;; upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) ;; *) echo "postrm called with unknown argument `$1"" >&2 exit 1 ;; esac #DEBHELPER# exit 0
創(chuàng)建rpc
在目錄/usr/share/openmediavault/engined/rpc創(chuàng)建example.inc
registerMethod("getSettings"); $this->registerMethod("setSettings"); } public function getSettings($params, $context) { // Validate the RPC caller context. $this->validateMethodContext($context, [ "role" => OMV_ROLE_ADMINISTRATOR ]); // Get the configuration object. $db = OMVConfigDatabase::getInstance(); $object = $db->get("conf.service.example"); // Remove useless properties from the object. return $object->getAssoc(); } public function setSettings($params, $context) { // Validate the RPC caller context. $this->validateMethodContext($context, [ "role" => OMV_ROLE_ADMINISTRATOR ]); // Validate the parameters of the RPC service method. $this->validateMethodParams($params, "rpc.example.setsettings"); // Get the existing configuration object. $db = OMVConfigDatabase::getInstance(); $object = $db->get("conf.service.example"); $object->setAssoc($params); $db->set($object); // Return the configuration object. return $object->getAssoc(); } }
創(chuàng)建對應(yīng)的配置文件
在usrshareopenmediavaultdatamodels創(chuàng)建conf.service.example.json
{ "type": "config", "id": "conf.service.example", "title": "EXAMPLE", "queryinfo": { "xpath": "http://services/example", "iterable": false }, "properties": { "enable": { "type": "boolean", "default": false }, "max_value": { "type": "integer", "minimum": 1, "maximum": 100, "default": 0 } } }
在usrshareopenmediavaultdatamodels創(chuàng)建rpc.example.json
[{ "type": "rpc", "id": "rpc.example.setsettings", "params": { "type": "object", "properties": { "enable": { "type": "boolean", "required": true }, "max_value": { "type": "integer", "minimum": 1, "maximum": 100, "required": true } } } }]
運行命令重啟omv服務(wù):service openmediavault-engined restart
創(chuàng)建shell腳本獲取配置信息
創(chuàng)建執(zhí)行腳本 example 執(zhí)行命令:omv-mkconf example
#!/bin/sh set -e . /etc/default/openmediavault . /usr/share/openmediavault/scripts/helper-functions OMV_EXAMPLE_XPATH="/config/services/example" OMV_EXAMPLE_CONF="/tmp/example.conf" cat <${OMV_EXAMPLE_CONF} enable = $(omv_config_get "${OMV_EXAMPLE_XPATH}/enable") max_value = $(omv_config_get "${OMV_EXAMPLE_XPATH}/max_value") EOF exit 0
為了監(jiān)聽觸發(fā)執(zhí)行腳本,將腳本放在/usr/share/openmediavault/mkconf目錄下
腳本權(quán)限改為 chmod 755 example
配置保存事件監(jiān)聽
/usr/share/openmediavault/engined/module創(chuàng)建監(jiān)聽的example.inc
setRedirect2to1(); $cmd->execute(); } function bindListeners(OMVEngineNotifyDispatcher $dispatcher) { $dispatcher->addListener(OMV_NOTIFY_MODIFY, "org.openmediavault.conf.service.example", // 和rpc內(nèi)的配置文件一致conf.service.example [ $this, "setDirty" ]); } }
運行命令重啟omv服務(wù):service openmediavault-engined restart
創(chuàng)建deb包 https://blog.csdn.net/gatieme...
文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請注明本文地址:http://specialneedsforspecialkids.com/yun/29536.html
摘要:參考網(wǎng)址創(chuàng)建應(yīng)用創(chuàng)建應(yīng)用目錄創(chuàng)建菜單節(jié)點設(shè)置菜單節(jié)點圖標(biāo)內(nèi)創(chuàng)建對應(yīng)內(nèi)的張圖片創(chuàng)建設(shè)置面板刷新緩存創(chuàng)建腳本生成配置信息的腳本命令執(zhí)行添加默認(rèn)配置以下條命令用于安裝包安裝直接執(zhí)行可注釋掉創(chuàng)建刪除配置信息的腳本執(zhí)行命令 參考網(wǎng)址:https://forum.openmediavault.... 創(chuàng)建應(yīng)用GUI 創(chuàng)建應(yīng)用目錄:/var/www/openmediavault/js/om...
摘要:這里使用的是數(shù)據(jù)庫啟動類上加上注解在啟動類中添加對包掃描掃描多個包下的可以有以下幾種方法掃描會自動加載相關(guān)配置,數(shù)據(jù)源就會自動注入到中,會自動注入到中,可以直接使用。有配置文件下的使用掃描多個包下的可以有以下幾種方法掃描 Spring-Boot 學(xué)習(xí)筆記 1 Spring-Boot 介紹 1.1 什么是Spring-Boot Spring-Boot是由Pivotal團隊提供的全新框架...
摘要:目前網(wǎng)上關(guān)于插件開發(fā)的文章少得可憐,下面分享最近的經(jīng)歷,如何快速上手開發(fā)一個插件。第六步調(diào)試插件在打開的網(wǎng)頁中可以看到工具欄中實現(xiàn)了插件。 TinyMCE是一個非常優(yōu)秀的輕量級的所見即所得HTML編輯器,歷史悠久,開源,在github的start也非常高的,且長期保持更新。TinyMCE的官方插件不少,基本能滿足日常需求,但是有時候我們還需要一些結(jié)合業(yè)務(wù)的功能。這時官方插件無法滿足,就...
摘要:提示插件可以重寫默認(rèn)的比如打開新時。這是在插件中定義的,因此不能后面做更改。把你的插件提交到的子版塊中。從圖中藍(lán)色點開始到后面的兩天曲線變化。曲線中間的那個小凸起,是二月份在發(fā)布的時候產(chǎn)生的。關(guān)于在插件中如何使用的教程在這里。 showImg(https://segmentfault.com/img/remote/1460000008971998?w=1920&h=1080); 本文...
閱讀 3205·2021-11-17 09:33
閱讀 3288·2021-11-15 11:37
閱讀 2950·2021-10-19 11:47
閱讀 3199·2019-08-29 15:32
閱讀 1001·2019-08-29 15:27
閱讀 1525·2019-08-29 13:15
閱讀 932·2019-08-29 12:47
閱讀 2023·2019-08-29 11:30