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