Skip to content

Commit

Permalink
feat: override title and add google-cloud logging support on the UI f…
Browse files Browse the repository at this point in the history
…or togomak
  • Loading branch information
srevinsaju committed Mar 31, 2023
1 parent de8d3bc commit 3e69dc9
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions ops/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func PushFromStorage(repo *git.Repository, fs billy.Filesystem, infraMetaQueue *
return err
}
}
infraMeta.Title = cfg.Title

readmeString, infraJson, err := parser.InfrastructureMetaToString(infraMeta)
if err != nil {
Expand Down
43 changes: 43 additions & 0 deletions ui/go-cat-ui/src/CloudNativeLogging.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
<script lang="ts">
import type infra_json from "./infra.json";
export let infra: typeof infra_json["infra"][0];
function togomakURL(infra: typeof infra_json["infra"][0]) {
const deployedOn: Date = new Date(Date.parse(infra.deployed_on));
let stage: string = infra.name;
const overrideStage: any = infra.parameters["togomak.srev.in/v1/stage.id"];
if (overrideStage && overrideStage !== "") {
stage = overrideStage;
}
let instanceID: string = "";
const overrideInstanceId: any = infra.parameters["togomak.srev.in/v1/instance.id"];
if (overrideInstanceId && overrideInstanceId !== "") {
instanceID = overrideInstanceId;
}
let gcl: any = infra.parameters["togomak.srev.in/v1/logging"];
if (!gcl || (gcl !== "googlde-cloud")) {
return "";
}
let query: string = `jsonPayload.labels.stage = "${stage}"
labels.instanceId = "${instanceID}"`;
query = encodeURIComponent(query) + `;timeRange=${deployedOn.toISOString()}/${deployedOn.toISOString()}--PT24H;`;
return `https://console.cloud.google.com/logs/query;query=${query}?project=${infra.cloud_project_id}`;
}
</script>


Expand All @@ -13,4 +41,19 @@
</div>
</a>
</div>
{/if}

{#if infra.infra_type == 'togomak.srev.in/release'}
<div class="control">
<a href="{togomakURL(infra)}" target="_blank">
<div class="tags has-addons">

<span class="tag is-dark">
<i class="fas fa-clipboard"></i>
Logs
</span>
<span class="tag is-primary">Google Cloud Logging</span>
</div>
</a>
</div>
{/if}

0 comments on commit 3e69dc9

Please sign in to comment.