-
Notifications
You must be signed in to change notification settings - Fork 7
/
NodeREDAPITokenManagerPage.java
69 lines (57 loc) · 2.28 KB
/
NodeREDAPITokenManagerPage.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package org.imdc.nodered;
import com.inductiveautomation.ignition.gateway.localdb.persistence.RecordMeta;
import com.inductiveautomation.ignition.gateway.web.components.RecordActionTable;
import com.inductiveautomation.ignition.gateway.web.models.ConfigCategory;
import com.inductiveautomation.ignition.gateway.web.models.DefaultConfigTab;
import com.inductiveautomation.ignition.gateway.web.models.IConfigTab;
import com.inductiveautomation.ignition.gateway.web.pages.IConfigPage;
import org.apache.commons.lang3.tuple.Pair;
import java.util.ArrayList;
import java.util.List;
public class NodeREDAPITokenManagerPage extends RecordActionTable<NodeREDAPITokens> {
transient List<ICalculatedField<NodeREDAPITokens>> calcFields;
public static ConfigCategory CONFIG_CATEGORY = new ConfigCategory("NodeRED", "NodeRED.MenuTitle");
public static IConfigTab MENU_ENTRY = DefaultConfigTab.builder()
.category(CONFIG_CATEGORY)
.name("apitokens")
.i18n("NodeRED.APITokens.MenuTitle")
.page(NodeREDAPITokenManagerPage.class)
.terms("Node-RED", "api", "token", "secret")
.build();
public NodeREDAPITokenManagerPage(IConfigPage configPage) {
super(configPage);
}
@Override
protected RecordMeta<NodeREDAPITokens> getRecordMeta() {
return NodeREDAPITokens.META;
}
@Override
public Pair<String, String> getMenuLocation() {
return MENU_ENTRY.getMenuLocation();
}
@Override
protected String getTitleKey() {
return "NodeRED.PageTitle";
}
@Override
protected List<ICalculatedField<NodeREDAPITokens>> getCalculatedFields() {
if (calcFields == null) {
calcFields = new ArrayList<>(1);
calcFields.add(new ICalculatedField<NodeREDAPITokens>() {
@Override
public String getFieldvalue(NodeREDAPITokens record) {
return Boolean.toString(record.getBoolean(record.Enabled));
}
@Override
public String getHeaderKey() {
return "NodeRED.Enabled.Name";
}
});
}
return calcFields;
}
@Override
protected String getNoRowsKey() {
return "NodeRED.APITokens.NoRows";
}
}