fix: encode params

This commit is contained in:
Fine 2023-02-06 10:54:59 +08:00
parent 4124c568b0
commit e80774cf94
2 changed files with 7 additions and 5 deletions

View File

@ -65,13 +65,13 @@ limitations under the License. -->
const appStoreWithOut = useAppStoreWithOut(); const appStoreWithOut = useAppStoreWithOut();
const selectorStore = useSelectorStore(); const selectorStore = useSelectorStore();
const route = useRoute(); const route = useRoute();
const config = computed<any>(() => JSON.parse(route.params.config as string)); const config = computed<any>(() => JSON.parse(decodeURIComponent(route.params.config as string) as string));
const graph = computed(() => config.value.graph || {}); const graph = computed(() => config.value.graph || {});
const source = ref<unknown>({}); const source = ref<unknown>({});
const loading = ref<boolean>(false); const loading = ref<boolean>(false);
const dashboardStore = useDashboardStore(); const dashboardStore = useDashboardStore();
const title = computed(() => encodeURIComponent((config.value.widget && config.value.widget.title) || "")); const title = computed(() => (config.value.widget && config.value.widget.title) || "");
const tips = computed(() => encodeURIComponent((config.value.widget && config.value.widget.tips) || "")); const tips = computed(() => (config.value.widget && config.value.widget.tips) || "");
init(); init();
async function init() { async function init() {

View File

@ -97,8 +97,10 @@ limitations under the License. -->
metricConfig: metricConfig, metricConfig: metricConfig,
height: dashboardStore.selectedGrid.h * 20, height: dashboardStore.selectedGrid.h * 20,
}); });
const path = `/page/${dashboardStore.layerId}/${dashboardStore.entity}/${serviceId}/${podId}/${processId}/${destServiceId}/${destPodId}/${destProcessId}/${config}`; const path = `/page/${dashboardStore.layerId}/${
widgetLink.value = hasDuration.value ? `${path}/${duration}` : path; dashboardStore.entity
}/${serviceId}/${podId}/${processId}/${destServiceId}/${destPodId}/${destProcessId}/${encodeURIComponent(config)}`;
widgetLink.value = hasDuration.value ? `${path}/${encodeURIComponent(duration)}` : path;
} }
function viewPage() { function viewPage() {
const routeUrl = router.resolve({ path: widgetLink.value }); const routeUrl = router.resolve({ path: widgetLink.value });