Closed github-actions[bot] closed 3 years ago
Add some entity details
https://github.com/VolantisDev/Launchpad/blob/b839d6001fe9db7038a427f3c1ed06d03507f8ac/Lib/Launchpad/Window/ManageWindow/MainWindow.ahk#L262
return this.app.Service("AuthService").IsAuthenticated() } FormatDate(timestamp) { shortDate := FormatTime(timestamp, "ShortDate") shortTime := FormatTime(timestamp, "Time") return shortDate . " " . shortTime } AddDetailsPane(y, key := "") { launcher := "" iconPath := "" displayName := "" status := "" apiStatus := "" created := "" updated := "" built := "" if (key) { launcher := this.launcherManager.Entities[key] if (launcher) { iconPath := this.GetItemImage(launcher) displayName := launcher.DisplayName status := launcher.GetStatus() apiStatus := launcher.DataSourceItemKey ? "Linked" : "Not linked" created := this.FormatDate(this.app.State.GetLauncherCreated(key)) updated := this.FormatDate(this.app.State.GetLauncherInfo("Config")["Timestamp"]) built := this.FormatDate(this.app.State.GetLauncherInfo("Build")["Timestamp"]) } } paneW := this.windowSettings["contentWidth"] - this.lvWidth - this.margin paneX := this.margin + this.lvWidth + (this.margin*2) imgW := 64 opts := "vDetailsIcon x" . paneX . " y" . y . " h" . imgW . " w" . imgW if (!key) { opts .= " Hidden" } this.guiObj.AddPicture(opts, iconPath) textW := paneW - imgW - this.margin opts := "vDetailsTitle x+" . this.margin . " yp h64 w" . textW if (!key) { opts .= " Hidden" } this.AddText(displayName, opts, "large", "Bold") this.detailsFields.Push("DetailsTitle") opts := ["x" . paneX, "y+" . (this.margin*2), "vDetailsRunButton", "h25", "w75"] if (!key) { opts.Push("Hidden") } this.Add("ButtonControl", opts, "Run", "vDetailsRunButton", "detailsButton") opts := ["x+" . this.margin, "yp", "h25", "vDetailsBuildButton"] if (!key) { opts.Push("Hidden") } this.Add("ButtonControl", opts, "Build", "OnDetailsBuildButton", "detailsButton") opts := ["x+" . this.margin, "yp", "h25", "vDetailsEditButton"] if (!key) { opts.Push("Hidden") } this.Add("ButtonControl", opts, "Edit", "OnDetailsEditButton", "detailsButton") opts := ["x+" . this.margin, "yp", "h25", "vDetailsDeleteButton"] if (!key) { opts.Push("Hidden") } this.Add("ButtonControl", opts, "Delete", "OnDetailsDeleteButton", "detailsButton") this.AddDetailsField("Status", "Status", status, "+" . (this.margin*2)) this.AddDetailsField("ApiStatus", "API Status", apiStatus) this.AddDetailsField("Created", "Created", created) this.AddDetailsField("Updated", "Updated", updated) this.AddDetailsField("Built", "Built", built) ; TODO: Add some entity details } AddDetailsField(fieldName, label, text, y := "") { if (!y) { y := "+" . (this.margin/2) } paneX := this.margin + this.lvWidth + (this.margin*2) paneW := this.windowSettings["contentWidth"] - this.lvWidth - this.margin opts := "vDetails" . fieldName . "Label x" . paneX . " y" . y if (!text) { opts .= " Hidden" } ctl := this.AddText(label . ": ", opts, "normal", "Bold") ctl.GetPos(,, &w) textX := paneX + this.margin + w ; TODO: Set status text color based on status fieldW := paneW - w opts := "vDetails" . fieldName . "Text x" . textX . " yp w" . fieldW if (!text) { opts .= " Hidden" } this.AddText(text, opts) this.detailsFields.Push("Details" . fieldName . "Text") } OnDetailsRunButton(btn, info) { selected := this.listView.GetSelected("", true) if (selected.Length > 0) { this.RunLauncher(selected[1]) } } OnDetailsBuildButton(btn, info) { selected := this.listView.GetSelected("", true) if (selected.Length > 0) { key := selected[1] launcher := this.launcherManager.Entities[key] this.app.Service("BuilderManager").BuildLaunchers(Map(key, launcher), true) this.UpdateListView() } } OnDetailsEditButton(btn, info) { selected := this.listView.GetSelected("", true) if (selected.Length > 0) { this.EditLauncher(selected[1]) } } OnDetailsDeleteButton(btn, info) { selected := this.listView.GetSelected("", true) if (selected.Length > 0) { this.DeleteLauncher(selected[1]) } } UpdateDetailsPane(key := "") { iconPath := "" displayName := "" status := "" apiStatus := "" created := "" updated := "" built := "" if (key != "") { launcher := this.launcherManager.Entities[key] iconPath := this.GetItemImage(launcher) displayName := launcher.DisplayName status := launcher.GetStatus() apiStatus := launcher.DataSourceItemKey ? "Linked" : "Not linked" created := this.FormatDate(this.app.State.GetLauncherCreated(key)) updated := this.FormatDate(this.app.State.GetLauncherInfo(key, "Config")["Timestamp"]) built := this.FormatDate(this.app.State.GetLauncherInfo(key, "Build")["Timestamp"]) } this.guiObj["DetailsIcon"].Value := iconPath this.guiObj["DetailsIcon"].Move(,, 64, 64) this.guiObj["DetailsIcon"].Visible := (key != "") this.guiObj["DetailsTitle"].Text := displayName this.guiObj["DetailsTitle"].Visible := (key != "") this.guiObj["DetailsRunButton"].Visible := (key != "") this.guiObj["DetailsBuildButton"].Visible := (key != "") this.guiObj["DetailsEditButton"].Visible := (key != "") this.guiObj["DetailsDeleteButton"].Visible := (key != "") this.guiObj["DetailsStatusLabel"].Visible := (key != "") this.guiObj["DetailsStatusText"].Text := status this.guiObj["DetailsStatusText"].Visible := (key != "") this.guiObj["DetailsApiStatusLabel"].Visible := (key != "") this.guiObj["DetailsApiStatusText"].Text := apiStatus this.guiObj["DetailsApiStatusText"].Visible := (key != "") this.guiObj["DetailsBuiltLabel"].Visible := (key != "") this.guiObj["DetailsBuiltText"].Text := built this.guiObj["DetailsBuiltText"].Visible := (key != "") this.guiObj["DetailsCreatedLabel"].Visible := (key != "") this.guiObj["DetailsCreatedText"].Text := created this.guiObj["DetailsCreatedText"].Visible := (key != "") this.guiObj["DetailsUpdatedLabel"].Visible := (key != "") this.guiObj["DetailsUpdatedText"].Text := updated this.guiObj["DetailsUpdatedText"].Visible := (key != "") } GetListViewData(lv) { data := Map()
1fd27692f0f7f30eabee62a877fb57af51f69b51
Add some entity details
https://github.com/VolantisDev/Launchpad/blob/b839d6001fe9db7038a427f3c1ed06d03507f8ac/Lib/Launchpad/Window/ManageWindow/MainWindow.ahk#L262
1fd27692f0f7f30eabee62a877fb57af51f69b51