Skip to content

Commit

Permalink
fix: properly show the current manifests in the bootstrap manifest sync
Browse files Browse the repository at this point in the history
It was encoding b64 string instead of decoding it.
Fixes: #676

Signed-off-by: Artem Chernyshev <[email protected]>
  • Loading branch information
Unix4ever committed Oct 23, 2024
1 parent c904e3a commit 21455d9
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions frontend/src/views/cluster/Manifest/Sync.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ included in the LICENSE file.
>Apply Changes ({{ numChanges }})</t-button
>
</div>
<t-alert v-if="error"
title="Manifest Sync Error"
type="error"
>
{{ error }}.
</t-alert>
<div class="flex-1 font-sm overflow-y-auto" ref="resultsComponent">
<div
v-if="loading"
Expand Down Expand Up @@ -61,7 +67,7 @@ included in the LICENSE file.
</div>
<div class="diff" v-if="item.object">
{{
b64Encode(item.object as Uint8Array, 0, item.object.length)
textDecoder.decode(b64Decode(item.object))
}}
</div>
</template>
Expand All @@ -87,6 +93,7 @@ import TSpinner from "@/components/common/Spinner/TSpinner.vue";
import TListItem from "@/components/common/List/TListItem.vue";
import TButton from "@/components/common/Button/TButton.vue";
import { showSuccess } from "@/notification";
import TAlert from "@/components/TAlert.vue";

import {
KubernetesSyncManifestRequest,
Expand All @@ -98,7 +105,9 @@ import { subscribe, Stream } from "@/api/grpc";
import { withContext, withRuntime } from "@/api/options";
import { Runtime } from "@/api/common/omni.pb";
import { getContext } from "@/context";
import { b64Encode } from "@/api/fetch.pb";
import { b64Decode } from "@/api/fetch.pb";

const textDecoder = new TextDecoder();

const route = useRoute();
const context = getContext();
Expand Down Expand Up @@ -181,6 +190,8 @@ const highlightDiff = (line: string) => {
return "";
};

const error = ref<string>();

const setupSyncStream = () => {
const stream: Ref<
| Stream<KubernetesSyncManifestRequest, KubernetesSyncManifestResponse>
Expand Down Expand Up @@ -220,14 +231,12 @@ const setupSyncStream = () => {
[withRuntime(Runtime.Talos), withContext(context)],
undefined,
(e: Error) => {
processItem({
response_type: KubernetesSyncManifestResponseResponseType.UNKNOWN,
path: "Manifest Sync Error",
diff: e.message,
});
error.value = e.message;
loading.value = false;
},
() => {
loaded.value = true;
error.value = undefined;

if (!syncParams.value.dry_run) {
showSuccess("Bootstrap manifests updated successfully");
Expand All @@ -252,7 +261,7 @@ setupSyncStream();

<style scoped>
.diff {
@apply font-roboto whitespace-pre p-4;
@apply font-roboto whitespace-pre pt-2;
}

.bottom-line {
Expand Down

0 comments on commit 21455d9

Please sign in to comment.