]> git.proxmox.com Git - proxmox-widget-toolkit.git/blobdiff - data/model/Realm.js
add Realm model and RealmComboBox
[proxmox-widget-toolkit.git] / data / model / Realm.js
diff --git a/data/model/Realm.js b/data/model/Realm.js
new file mode 100644 (file)
index 0000000..dce270d
--- /dev/null
@@ -0,0 +1,29 @@
+Ext.define('pmx-domains', {
+    extend: "Ext.data.Model",
+    fields: [
+       'realm', 'type', 'comment', 'default',
+       {
+           name: 'tfa',
+           allowNull: true,
+       },
+       {
+           name: 'descr',
+           convert: function(value, { data={} }) {
+               if (value) return Ext.String.htmlEncode(value);
+
+               let text = data.comment || data.realm;
+
+               if (data.tfa) {
+                   text += ` (+ ${data.tfa})`;
+               }
+
+               return Ext.String.htmlEncode(text);
+           },
+       },
+    ],
+    idProperty: 'realm',
+    proxy: {
+       type: 'proxmox',
+       url: "/api2/json/access/domains",
+    },
+});