Skip to content

Commit c58531d

Browse files
authored
Merge pull request #338 from open-uem/task-337
task: fix some go suggestions
2 parents a192b5e + 092789f commit c58531d

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

internal/views/agents_views/agents.templ

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ templ AgentsTableBody(p partials.PaginationAndSort, agents []*ent.Agent, tags []
437437
<uk-icon hx-history="false" icon="monitor-pause" custom-class="h-7 w-7 text-orange-600" uk-cloack></uk-icon>
438438
</div>
439439
case "Enabled":
440-
if (time.Now().Sub(agent.LastContact).Hours()) > 24 {
440+
if (time.Since(time.Now()).Hours()) > 24 {
441441
<div class="h-7 w-7" uk-tooltip={ i18n.T(ctx, "No Contact") }>
442442
<uk-icon hx-history="false" icon="monitor-x" custom-class="h-7 w-7 text-red-600" uk-cloack></uk-icon>
443443
</div>
@@ -618,7 +618,7 @@ type LogEntry struct {
618618
}
619619

620620
templ AgentsLog(c echo.Context, agent *ent.Agent, agentLog, updaterLog []LogEntry, category, successMessage, errMessage string, refresh int, commonInfo *partials.CommonInfo) {
621-
@partials.Header(c, []partials.Breadcrumb{{Title: "Agents", Url: string(templ.URL(partials.GetNavigationUrl(commonInfo, "/agents")))}, {Title: agent.Nickname, Url: string(templ.URL(partials.GetNavigationUrl(commonInfo, fmt.Sprintf("/agents"))))}, {Title: "logs"}}, commonInfo)
621+
@partials.Header(c, []partials.Breadcrumb{{Title: "Agents", Url: string(templ.URL(partials.GetNavigationUrl(commonInfo, "/agents")))}, {Title: agent.Nickname, Url: string(templ.URL(partials.GetNavigationUrl(commonInfo, "/agents")))}, {Title: "logs"}}, commonInfo)
622622
<main class="grid flex-1 items-start gap-4 p-4 sm:px-6 sm:py-0 md:gap-8">
623623
<div id="error" class="hidden"></div>
624624
<div class="uk-width-1-2@m uk-card uk-card-default">
@@ -688,7 +688,7 @@ templ AgentsLog(c echo.Context, agent *ent.Agent, agentLog, updaterLog []LogEntr
688688
}
689689

690690
templ AgentSettings(c echo.Context, agent *ent.Agent, successMessage, errMessage string, refresh int, commonInfo *partials.CommonInfo) {
691-
@partials.Header(c, []partials.Breadcrumb{{Title: "Agents", Url: string(templ.URL(partials.GetNavigationUrl(commonInfo, "/agents")))}, {Title: agent.Nickname, Url: string(templ.URL(partials.GetNavigationUrl(commonInfo, fmt.Sprintf("/agents"))))}, {Title: i18n.T(ctx, "Settings")}}, commonInfo)
691+
@partials.Header(c, []partials.Breadcrumb{{Title: "Agents", Url: string(templ.URL(partials.GetNavigationUrl(commonInfo, "/agents")))}, {Title: agent.Nickname, Url: string(templ.URL(partials.GetNavigationUrl(commonInfo, "/agents")))}, {Title: i18n.T(ctx, "Settings")}}, commonInfo)
692692
<main class="grid flex-1 items-start gap-4 p-4 sm:px-6 sm:py-0 md:gap-8">
693693
if successMessage != "" {
694694
@partials.SuccessMessage(successMessage)

internal/views/computers_views/computers_views.templ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ templ ComputersBody(p partials.PaginationAndSort, agents []models.Computer, avai
144144
>
145145
<div class="flex items-center gap-2">
146146
<span class="underline">{ agent.Nickname }</span>
147-
if (time.Now().Sub(agent.LastContact).Hours()) > 24 {
147+
if (time.Since(time.Now()).Hours()) > 24 {
148148
<div uk-tooltip={ i18n.T(ctx, "agents.no_contact_in_last_day") }>
149149
<uk-icon hx-history="false" icon="clock-8" custom-class="h-5 w-5 text-red-600" uk-cloack></uk-icon>
150150
</div>

internal/views/deploy_views/deploy_views.templ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ templ DeployNavbar(active string, commonInfo *partials.CommonInfo) {
110110
<li class={ templ.KV("uk-active", active == "install") }>
111111
<a
112112
href={ templ.URL(partials.GetNavigationUrl(commonInfo, "/deploy/install")) }
113-
hx-get={ string(templ.URL(partials.GetNavigationUrl(commonInfo, fmt.Sprintf("/deploy/install")))) }
113+
hx-get={ string(templ.URL(partials.GetNavigationUrl(commonInfo, "/deploy/install"))) }
114114
hx-push-url="true"
115115
hx-target="#main"
116116
hx-swap="outerHTML"

internal/views/profiles_views/profiles_edit.templ

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ templ EditProfile(c echo.Context, p partials.PaginationAndSort, profile *ent.Pro
7070
end
7171
"
7272
>
73-
<option value={ "dontApplyToAll" } selected?={ !profile.ApplyToAll && (profile.Edges.Tags == nil || len(profile.Edges.Tags) == 0) }>{ i18n.T(ctx, "profiles.dont_assign") }</option>
73+
<option value={ "dontApplyToAll" } selected?={ !profile.ApplyToAll && len(profile.Edges.Tags) == 0 }>{ i18n.T(ctx, "profiles.dont_assign") }</option>
7474
<option value={ "applyToAll" } selected?={ profile.ApplyToAll }>{ i18n.T(ctx, "profiles.assign_all") }</option>
75-
<option value={ "useTags" } selected?={ profile.Edges.Tags != nil && len(profile.Edges.Tags) > 0 }>{ i18n.T(ctx, "profiles.assign_tags") }</option>
75+
<option value={ "useTags" } selected?={ len(profile.Edges.Tags) > 0 }>{ i18n.T(ctx, "profiles.assign_tags") }</option>
7676
</select>
7777
</div>
7878
</div>
7979
<div>
80-
<div id="profile-tags" class={ templ.KV("invisible", profile.Edges.Tags == nil || len(profile.Edges.Tags) == 0), templ.KV("visible", len(profile.Edges.Tags) > 0) }>
80+
<div id="profile-tags" class={ templ.KV("invisible", len(profile.Edges.Tags) == 0), templ.KV("visible", len(profile.Edges.Tags) > 0) }>
8181
<label class="uk-form-label" for="profile-tags-section">
8282
{ i18n.T(ctx, "profiles.edit.select_tags") }
8383
</label>
@@ -115,7 +115,7 @@ templ EditProfile(c echo.Context, p partials.PaginationAndSort, profile *ent.Pro
115115
</button>
116116
</div>
117117
</div>
118-
if profile.Edges.Tasks == nil || len(profile.Edges.Tasks) == 0 {
118+
if len(profile.Edges.Tasks) == 0 {
119119
<p class="uk-text-small uk-text-muted">
120120
{ i18n.T(ctx, "profiles.edit.no_tasks") }
121121
</p>

internal/views/profiles_views/profiles_views.templ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ templ Profiles(c echo.Context, p partials.PaginationAndSort, profiles []*ent.Pro
9191
if profile.ApplyToAll {
9292
@ShowAppliedToAll()
9393
} else {
94-
if profile.Edges.Tags != nil && len(profile.Edges.Tags) > 0 {
94+
if len(profile.Edges.Tags) > 0 {
9595
@partials.ShowAppliedTagsWithoutRemoveOption(profile.Edges.Tags)
9696
} else {
9797
@ShowAppliedToNone()

0 commit comments

Comments
 (0)