Fix app info fields order

This commit is contained in:
Brahim Hadriche committed 2023-11-19 19:18:54 -05:00
1 parent 9ae8601a32
commit 89034378fb
3 files changed
+66 -27

No files matched your search

@@ -1,17 +1,32 @@
import "pkg:/source/asyncTask/asyncTask.bs"
function Init()
' TODO:P2 rename Add tooltip to each field with description of what it means
m.displayNames = {
"app_version": "Playlet App Version",
"lib_version": "Playlet Library Version",
"lib_version_latest": "Playlet Library Latest Version",
"lib_url": "Playlet Library URL",
"lib_url_type": "Playlet Library URL Type",
"git_commit_hash": "Playlet Git Commit Hash",
"lib_git_commit_hash": "Playlet Library Git Commit Hash",
"id": "App ID"
}
' TODO:P2 Add tooltip to each field with description of what it means
m.displayNames = [{
key: "app_version",
displayText: "Playlet App Version"
}, {
key: "lib_version",
displayText: "Playlet Library Version"
}, {
key: "lib_version_latest",
displayText: "Playlet Library Latest Version"
}, {
key: "lib_url",
displayText: "Playlet Library URL"
}, {
key: "lib_url_type",
displayText: "Playlet Library URL Type"
}, {
key: "app_git_commit_hash",
displayText: "Playlet App Git Commit Hash"
}, {
key: "lib_git_commit_hash",
displayText: "Playlet Library Git Commit Hash"
}, {
key: "id",
displayText: "App ID"
}]
m.keyValueList = m.top.findNode("KeyValueListContent")
end function
@@ -36,8 +51,8 @@ function UpdateKeyValueList()
m.keyValueList.removeChildIndex(0)
end while
for each item in m.appInfo
value = `${m.displayNames[item]}: ${m.appInfo[item]}`
for each item in m.displayNames
value = `${item.displayText}: ${m.appInfo[item.key]}`
contentNode = m.keyValueList.createChild("ContentNode")
contentNode.title = value
end for
@@ -34,7 +34,7 @@ class ApplicationInfo
m.appInfo = {
id: m.roAppInfo.GetID(),
app_version: m.roAppInfo.GetVersion(),
git_commit_hash: m.roAppInfo.GetValue("git_commit_sha"),
app_git_commit_hash: m.roAppInfo.GetValue("git_commit_sha"),
lib_version: m.GetLibVersion(),
lib_git_commit_hash: m.GetLibGitCommitHash()
}
+37 -13
View File
@@ -3,16 +3,40 @@
export let visibility: boolean;
const displayNames = {
app_version: "Playlet App Version",
lib_version: "Playlet Library Version",
lib_version_latest: "Playlet Library Latest Version",
lib_url: "Playlet Library URL",
lib_url_type: "Playlet Library URL Type",
git_commit_hash: "Playlet Git Commit Hash",
lib_git_commit_hash: "Playlet Library Git Commit Hash",
id: "App ID",
};
const displayNames = [
{
key: "app_version",
displayText: "Playlet App Version",
},
{
key: "lib_version",
displayText: "Playlet Library Version",
},
{
key: "lib_version_latest",
displayText: "Playlet Library Latest Version",
},
{
key: "lib_url",
displayText: "Playlet Library URL",
},
{
key: "lib_url_type",
displayText: "Playlet Library URL Type",
},
{
key: "app_git_commit_hash",
displayText: "Playlet App Git Commit Hash",
},
{
key: "lib_git_commit_hash",
displayText: "Playlet Library Git Commit Hash",
},
{
key: "id",
displayText: "App ID",
},
];
function transformValue(key, value) {
switch (key) {
@@ -110,10 +134,10 @@ ${JSON.stringify(preferencesInfo, null, 2)}
</tr>
</thead>
<tbody>
{#each Object.entries(displayNames) as [key, value]}
{#each displayNames as item}
<tr>
<td>{value}</td>
<td>{@html transformValue(key, appInfo[key])}</td>
<td>{item.displayText}</td>
<td>{@html transformValue(item.key, appInfo[item.key])}</td>
</tr>
{/each}
</tbody>