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 selectorStore = useSelectorStore();
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 source = ref<unknown>({});
const loading = ref<boolean>(false);
const dashboardStore = useDashboardStore();
const title = computed(() => encodeURIComponent((config.value.widget && config.value.widget.title) || ""));
const tips = computed(() => encodeURIComponent((config.value.widget && config.value.widget.tips) || ""));
const title = computed(() => (config.value.widget && config.value.widget.title) || "");
const tips = computed(() => (config.value.widget && config.value.widget.tips) || "");
init();
async function init() {

View File

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