Skip to content

Commit 3e69dc9

Browse files
committed
feat: override title and add google-cloud logging support on the UI for togomak
1 parent de8d3bc commit 3e69dc9

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

ops/push.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ func PushFromStorage(repo *git.Repository, fs billy.Filesystem, infraMetaQueue *
7272
return err
7373
}
7474
}
75+
infraMeta.Title = cfg.Title
7576

7677
readmeString, infraJson, err := parser.InfrastructureMetaToString(infraMeta)
7778
if err != nil {

ui/go-cat-ui/src/CloudNativeLogging.svelte

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,34 @@
11
<script lang="ts">
22
import type infra_json from "./infra.json";
33
export let infra: typeof infra_json["infra"][0];
4+
5+
function togomakURL(infra: typeof infra_json["infra"][0]) {
6+
const deployedOn: Date = new Date(Date.parse(infra.deployed_on));
7+
8+
let stage: string = infra.name;
9+
const overrideStage: any = infra.parameters["togomak.srev.in/v1/stage.id"];
10+
if (overrideStage && overrideStage !== "") {
11+
stage = overrideStage;
12+
}
13+
14+
let instanceID: string = "";
15+
const overrideInstanceId: any = infra.parameters["togomak.srev.in/v1/instance.id"];
16+
if (overrideInstanceId && overrideInstanceId !== "") {
17+
instanceID = overrideInstanceId;
18+
}
19+
20+
let gcl: any = infra.parameters["togomak.srev.in/v1/logging"];
21+
if (!gcl || (gcl !== "googlde-cloud")) {
22+
return "";
23+
}
24+
25+
let query: string = `jsonPayload.labels.stage = "${stage}"
26+
labels.instanceId = "${instanceID}"`;
27+
query = encodeURIComponent(query) + `;timeRange=${deployedOn.toISOString()}/${deployedOn.toISOString()}--PT24H;`;
28+
29+
return `https://console.cloud.google.com/logs/query;query=${query}?project=${infra.cloud_project_id}`;
30+
31+
}
432
</script>
533

634

@@ -13,4 +41,19 @@
1341
</div>
1442
</a>
1543
</div>
44+
{/if}
45+
46+
{#if infra.infra_type == 'togomak.srev.in/release'}
47+
<div class="control">
48+
<a href="{togomakURL(infra)}" target="_blank">
49+
<div class="tags has-addons">
50+
51+
<span class="tag is-dark">
52+
<i class="fas fa-clipboard"></i>
53+
Logs
54+
</span>
55+
<span class="tag is-primary">Google Cloud Logging</span>
56+
</div>
57+
</a>
58+
</div>
1659
{/if}

0 commit comments

Comments
 (0)