Skip to content

Commit 5776bb6

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents e832292 + c7d506c commit 5776bb6

File tree

14 files changed

+125
-96
lines changed

14 files changed

+125
-96
lines changed

gradle/wrapper/gradle-wrapper.jar

2.06 KB
Binary file not shown.
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
44
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists

gradlew

+17-12
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,8 @@ done
8383
# This is normally unused
8484
# shellcheck disable=SC2034
8585
APP_BASE_NAME=${0##*/}
86-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
87-
88-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
86+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87+
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
9088

9189
# Use the maximum available, or set MAX_FD != -1 to use that value.
9290
MAX_FD=maximum
@@ -133,26 +131,29 @@ location of your Java installation."
133131
fi
134132
else
135133
JAVACMD=java
136-
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
134+
if ! command -v java >/dev/null 2>&1
135+
then
136+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137137
138138
Please set the JAVA_HOME variable in your environment to match the
139139
location of your Java installation."
140+
fi
140141
fi
141142

142143
# Increase the maximum file descriptors if we can.
143144
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144145
case $MAX_FD in #(
145146
max*)
146147
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147-
# shellcheck disable=SC3045
148+
# shellcheck disable=SC2039,SC3045
148149
MAX_FD=$( ulimit -H -n ) ||
149150
warn "Could not query maximum file descriptor limit"
150151
esac
151152
case $MAX_FD in #(
152153
'' | soft) :;; #(
153154
*)
154155
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155-
# shellcheck disable=SC3045
156+
# shellcheck disable=SC2039,SC3045
156157
ulimit -n "$MAX_FD" ||
157158
warn "Could not set maximum file descriptor limit to $MAX_FD"
158159
esac
@@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
197198
done
198199
fi
199200

200-
# Collect all arguments for the java command;
201-
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
202-
# shell script including quotes and variable substitutions, so put them in
203-
# double quotes to make sure that they get re-expanded; and
204-
# * put everything else in single quotes, so that it's not re-expanded.
201+
202+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204+
205+
# Collect all arguments for the java command:
206+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207+
# and any embedded shellness will be escaped.
208+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209+
# treated as '${Hostname}' itself on the command line.
205210

206211
set -- \
207212
"-Dorg.gradle.appname=$APP_BASE_NAME" \

ui/console-src/modules/contents/pages/SinglePageEditor.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,10 @@ async function handleUploadImage(file: File, options?: AxiosRequestConfig) {
433433
/>
434434

435435
<UrlPreviewModal
436-
v-if="isUpdateMode"
437-
v-model:visible="previewModal"
436+
v-if="previewModal"
438437
:title="formState.page.spec.title"
439438
:url="`/preview/singlepages/${formState.page.metadata.name}`"
439+
@close="previewModal = false"
440440
/>
441441

442442
<VPageHeader :title="$t('core.page.title')">

ui/console-src/modules/contents/posts/PostEditor.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,10 @@ async function handleUploadImage(file: File, options?: AxiosRequestConfig) {
461461
/>
462462

463463
<UrlPreviewModal
464-
v-if="isUpdateMode"
465-
v-model:visible="previewModal"
464+
v-if="previewModal"
466465
:title="formState.post.spec.title"
467466
:url="`/preview/posts/${formState.post.metadata.name}`"
467+
@close="previewModal = false"
468468
/>
469469

470470
<VPageHeader :title="$t('core.post.title')">

ui/console-src/modules/dashboard/widgets/QuickLinkWidget.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,10 @@ const actions: Action[] = [
229229
</OverlayScrollbarsComponent>
230230
</VCard>
231231
<ThemePreviewModal
232-
v-model:visible="themePreviewVisible"
232+
v-if="themePreviewVisible"
233233
:title="
234234
$t('core.dashboard.widgets.presets.quicklink.actions.view_site.title')
235235
"
236+
@close="themePreviewVisible = false"
236237
/>
237238
</template>

ui/console-src/modules/interface/themes/components/list-tabs/InstalledThemes.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,9 @@ const handleOpenPreview = (theme: Theme) => {
106106
</ul>
107107
</Transition>
108108
<ThemePreviewModal
109-
v-model:visible="previewVisible"
109+
v-if="previewVisible"
110110
:theme="selectedPreviewTheme"
111+
@close="previewVisible = false"
111112
/>
112113
</div>
113114
</template>

ui/console-src/modules/interface/themes/components/preview/ThemePreviewModal.vue

+34-41
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import ThemePreviewListItem from "./ThemePreviewListItem.vue";
33
import { useSettingFormConvert } from "@console/composables/use-setting-form";
44
import { useThemeStore } from "@console/stores/theme";
5-
import { apiClient } from "@/utils/api-client";
5+
import { apiClient, axiosInstance } from "@/utils/api-client";
66
import type {
77
ConfigMap,
88
Setting,
@@ -22,28 +22,27 @@ import {
2222
IconTablet,
2323
IconRefreshLine,
2424
Toast,
25+
VLoading,
2526
} from "@halo-dev/components";
2627
import { storeToRefs } from "pinia";
27-
import { computed, markRaw, ref, toRaw, watch } from "vue";
28+
import { computed, markRaw, ref, toRaw } from "vue";
2829
import { useI18n } from "vue-i18n";
2930
import { OverlayScrollbarsComponent } from "overlayscrollbars-vue";
3031
import { useQuery } from "@tanstack/vue-query";
32+
import { onMounted } from "vue";
3133
3234
const props = withDefaults(
3335
defineProps<{
34-
visible: boolean;
3536
title?: string;
3637
theme?: Theme;
3738
}>(),
3839
{
39-
visible: false,
4040
title: undefined,
4141
theme: undefined,
4242
}
4343
);
4444
4545
const emit = defineEmits<{
46-
(event: "update:visible", visible: boolean): void;
4746
(event: "close"): void;
4847
}>();
4948
@@ -56,7 +55,6 @@ interface SettingTab {
5655
5756
const { activatedTheme } = storeToRefs(useThemeStore());
5857
59-
const previewFrame = ref<HTMLIFrameElement | null>(null);
6058
const themesVisible = ref(false);
6159
const switching = ref(false);
6260
const selectedTheme = ref<Theme>();
@@ -71,29 +69,11 @@ const { data: themes } = useQuery<Theme[]>({
7169
});
7270
return data.items;
7371
},
74-
enabled: computed(() => props.visible),
7572
});
7673
77-
watch(
78-
() => props.visible,
79-
(visible) => {
80-
if (visible) {
81-
selectedTheme.value = props.theme || activatedTheme?.value;
82-
} else {
83-
setTimeout(() => {
84-
themesVisible.value = false;
85-
settingsVisible.value = false;
86-
}, 200);
87-
}
88-
}
89-
);
90-
91-
const onVisibleChange = (visible: boolean) => {
92-
emit("update:visible", visible);
93-
if (!visible) {
94-
emit("close");
95-
}
96-
};
74+
onMounted(() => {
75+
selectedTheme.value = toRaw(props.theme) || toRaw(activatedTheme?.value);
76+
});
9777
9878
const handleOpenThemes = () => {
9979
settingsVisible.value = false;
@@ -122,6 +102,26 @@ const modalTitle = computed(() => {
122102
});
123103
});
124104
105+
const {
106+
data: previewHTML,
107+
isLoading,
108+
refetch: refetchPreviewHTML,
109+
} = useQuery({
110+
queryKey: ["site-preview", previewUrl],
111+
queryFn: async () => {
112+
const { data } = await axiosInstance.get(previewUrl.value, {
113+
headers: {
114+
Accept: "text/html",
115+
"Cache-Control": "no-cache",
116+
Pragma: "no-cache",
117+
Expires: "0",
118+
},
119+
});
120+
return data;
121+
},
122+
enabled: computed(() => !!previewUrl.value),
123+
});
124+
125125
// theme settings
126126
const saving = ref(false);
127127
const settingTabs = ref<SettingTab[]>([] as SettingTab[]);
@@ -150,9 +150,7 @@ const { data: setting } = useQuery<Setting>({
150150
151151
activeSettingTab.value = settingTabs.value[0].id;
152152
},
153-
enabled: computed(
154-
() => props.visible && !!selectedTheme.value?.spec.settingName
155-
),
153+
enabled: computed(() => !!selectedTheme.value?.spec.settingName),
156154
});
157155
158156
const { data: configMap, refetch: handleFetchConfigMap } = useQuery<ConfigMap>({
@@ -195,7 +193,7 @@ const handleSaveConfigMap = async () => {
195193
196194
saving.value = false;
197195
198-
handleRefresh();
196+
refetchPreviewHTML();
199197
};
200198
201199
const handleOpenSettings = (theme?: Theme) => {
@@ -206,10 +204,6 @@ const handleOpenSettings = (theme?: Theme) => {
206204
settingsVisible.value = !settingsVisible.value;
207205
};
208206
209-
const handleRefresh = () => {
210-
previewFrame.value?.contentWindow?.location.reload();
211-
};
212-
213207
// mock devices
214208
const mockDevices = [
215209
{
@@ -241,11 +235,10 @@ const iframeClasses = computed(() => {
241235
<template>
242236
<VModal
243237
:body-class="['!p-0']"
244-
:visible="visible"
245238
fullscreen
246239
:title="modalTitle"
247240
:mount-to-body="true"
248-
@update:visible="onVisibleChange"
241+
@close="emit('close')"
249242
>
250243
<template #center>
251244
<!-- TODO: Reactor VTabbar component to support icon prop -->
@@ -281,7 +274,7 @@ const iframeClasses = computed(() => {
281274
content: $t('core.common.buttons.refresh'),
282275
delay: 300,
283276
}"
284-
@click="handleRefresh"
277+
@click="refetchPreviewHTML()"
285278
>
286279
<IconRefreshLine />
287280
</span>
@@ -432,12 +425,12 @@ const iframeClasses = computed(() => {
432425
<div
433426
class="flex h-full flex-1 items-center justify-center transition-all duration-300"
434427
>
428+
<VLoading v-if="isLoading" />
435429
<iframe
436-
v-if="visible"
437-
ref="previewFrame"
430+
v-else
438431
class="border-none transition-all duration-500"
439432
:class="iframeClasses"
440-
:src="previewUrl"
433+
:srcdoc="previewHTML"
441434
></iframe>
442435
</div>
443436
</div>

ui/console-src/modules/interface/themes/layouts/ThemeLayout.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,10 @@ onMounted(() => {
269269
</div>
270270

271271
<ThemeListModal v-model:visible="themesModal" @select="onSelectTheme" />
272-
<ThemePreviewModal v-model:visible="previewModal" :theme="selectedTheme" />
272+
<ThemePreviewModal
273+
v-if="previewModal"
274+
:theme="selectedTheme"
275+
@close="previewModal = false"
276+
/>
273277
</BasicLayout>
274278
</template>
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { common, createLowlight } from "lowlight";
22
import xml from "highlight.js/lib/languages/xml";
3+
import dart from "highlight.js/lib/languages/dart";
34

45
const lowlight = createLowlight(common);
56
lowlight.register("html", xml);
7+
lowlight.register("dart", dart);
68
export default lowlight;

0 commit comments

Comments
 (0)