Merge pull request #3712 from TDT-AG/pr/20200303-luci-base
authorJo-Philipp Wich <jo@mein.io>
Wed, 4 Mar 2020 19:26:57 +0000 (20:26 +0100)
committerGitHub <noreply@github.com>
Wed, 4 Mar 2020 19:26:57 +0000 (20:26 +0100)
luci-base: extended network.js for check if new interface is createable

modules/luci-base/htdocs/luci-static/resources/network.js

index 796b613beeb2cb20ffa237bee0faa907925ff2b2..c79022968ccc99132ab83285e40716f1f8b63dd4 100644 (file)
@@ -2302,6 +2302,23 @@ Protocol = L.Class.extend(/** @lends LuCI.Network.Protocol.prototype */ {
                return null;
        },
 
+       /**
+        * Check function for the protocol handler if a new interface is createable.
+        *
+        * This function should be overwritten by protocol specific subclasses.
+        *
+        * @abstract
+        *
+        * @param {string} ifname
+        * The name of the interface to be created.
+        *
+        * @returns {Promise<null|error message>}
+        * Returns `null` if new interface is createable, else returns (error) message.
+        */
+       isCreateable: function(ifname) {
+               return Promise.resolve(null);
+       },
+
        /**
         * Checks whether the protocol functionality is installed.
         *