Skip to content

Commit c403da7

Browse files
committed
fix: properly show the current manifests in the bootstrap manifest sync
It was encoding b64 string instead of decoding it. Fixes: #676 Signed-off-by: Artem Chernyshev <[email protected]> (cherry picked from commit 21455d9)
1 parent 23c33e7 commit c403da7

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

.conform.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ policies:
1212
gitHubOrganization: siderolabs
1313
spellcheck:
1414
locale: US
15-
maximumOfOneCommit: true
15+
maximumOfOneCommit: false
1616
header:
1717
length: 89
1818
imperative: true

frontend/src/views/cluster/Manifest/Sync.vue

+17-8
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ included in the LICENSE file.
1515
>Apply Changes ({{ numChanges }})</t-button
1616
>
1717
</div>
18+
<t-alert v-if="error"
19+
title="Manifest Sync Error"
20+
type="error"
21+
>
22+
{{ error }}.
23+
</t-alert>
1824
<div class="flex-1 font-sm overflow-y-auto" ref="resultsComponent">
1925
<div
2026
v-if="loading"
@@ -61,7 +67,7 @@ included in the LICENSE file.
6167
</div>
6268
<div class="diff" v-if="item.object">
6369
{{
64-
b64Encode(item.object as Uint8Array, 0, item.object.length)
70+
textDecoder.decode(b64Decode(item.object))
6571
}}
6672
</div>
6773
</template>
@@ -87,6 +93,7 @@ import TSpinner from "@/components/common/Spinner/TSpinner.vue";
8793
import TListItem from "@/components/common/List/TListItem.vue";
8894
import TButton from "@/components/common/Button/TButton.vue";
8995
import { showSuccess } from "@/notification";
96+
import TAlert from "@/components/TAlert.vue";
9097

9198
import {
9299
KubernetesSyncManifestRequest,
@@ -98,7 +105,9 @@ import { subscribe, Stream } from "@/api/grpc";
98105
import { withContext, withRuntime } from "@/api/options";
99106
import { Runtime } from "@/api/common/omni.pb";
100107
import { getContext } from "@/context";
101-
import { b64Encode } from "@/api/fetch.pb";
108+
import { b64Decode } from "@/api/fetch.pb";
109+
110+
const textDecoder = new TextDecoder();
102111

103112
const route = useRoute();
104113
const context = getContext();
@@ -181,6 +190,8 @@ const highlightDiff = (line: string) => {
181190
return "";
182191
};
183192

193+
const error = ref<string>();
194+
184195
const setupSyncStream = () => {
185196
const stream: Ref<
186197
| Stream<KubernetesSyncManifestRequest, KubernetesSyncManifestResponse>
@@ -220,14 +231,12 @@ const setupSyncStream = () => {
220231
[withRuntime(Runtime.Talos), withContext(context)],
221232
undefined,
222233
(e: Error) => {
223-
processItem({
224-
response_type: KubernetesSyncManifestResponseResponseType.UNKNOWN,
225-
path: "Manifest Sync Error",
226-
diff: e.message,
227-
});
234+
error.value = e.message;
235+
loading.value = false;
228236
},
229237
() => {
230238
loaded.value = true;
239+
error.value = undefined;
231240

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

253262
<style scoped>
254263
.diff {
255-
@apply font-roboto whitespace-pre p-4;
264+
@apply font-roboto whitespace-pre pt-2;
256265
}
257266

258267
.bottom-line {

0 commit comments

Comments
 (0)