Skip to content

Commit

Permalink
Update vite config and package version
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Nov 25, 2024
1 parent 5eba07c commit ddd8842
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 63 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ dist-ssr
*.njsproj
*.sln
*.sw?

.vitepress/cache
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"charts"
],
"license": "MIT",
"version": "0.0.32",
"version": "0.0.35",
"type": "module",
"main": "./dist/galaxy-charts.umd.cjs",
"module": "./dist/galaxy-charts.js",
Expand Down
6 changes: 3 additions & 3 deletions public/galaxy-charts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,20 @@
<value>Text</value>
</input>
<input>
<name>track_column_0</name>
<name>x</name>
<label>Track: Column (Auto, Text)</label>
<type>data_column</type>
<is_auto>true</is_auto>
<is_text>true</is_text>
</input>
<input>
<name>track_column_1</name>
<name>y</name>
<label>Track: Column (Number)</label>
<type>data_column</type>
<is_number>true</is_number>
</input>
<input>
<name>track_column_2</name>
<name>z</name>
<label>Track: Column (Any)</label>
<type>data_column</type>
</input>
Expand Down
7 changes: 6 additions & 1 deletion src/Plugin.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup lang="ts">
import { onMounted, ref, watch } from "vue";
import type { InputValuesType } from "galaxy-charts";
import { useColumnsStore } from "galaxy-charts";
const props = defineProps<{
datasetId: string;
Expand All @@ -18,8 +19,12 @@ const emit = defineEmits<{
const viewport = ref(null);
function render() {
const columnsStore = useColumnsStore();
async function render() {
/** Place your render function here! */
const columnsList = await columnsStore.fetchColumns(props.datasetId, props.tracks, ["x", "y", "z"]);
console.log(columnsList);
}
function onSave() {
Expand Down
10 changes: 7 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import App from "./App.vue";
import { parseXML } from "galaxy-charts-xml-parser";

async function main() {
// Build the incoming data object
// Construct the incoming data object with mock configuration and data
const dataIncoming = {
visualization_config: {
dataset_url: null,
dataset_id: "12e4b4feedfe9f3f",
// Placeholder for dataset URL (can be replaced during actual development)
dataset_url: "MY_DATASET_URL",
// Placeholder for dataset ID
dataset_id: process.env.dataset_id,
// Placeholder for additional visualization settings
settings: {
setting_text: "My Test Setting",
setting_boolean: true,
Expand All @@ -17,6 +20,7 @@ async function main() {
},
},
},
// Parse and load the visualization XML configuration
visualization_plugin: await parseXML("galaxy-charts.xml"),
};

Expand Down
6 changes: 3 additions & 3 deletions src/store/columnsStore.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ref } from "vue";
import { datasetsGetColumns } from "@/api/datasets";

const SPECIAL_KEYS = ["auto", undefined];
const SPECIAL_KEYS = ["auto"];

// Define the structure for columns
const columns = ref<Record<string, Record<string, any>>>({});
Expand All @@ -16,7 +16,7 @@ export function useColumnsStore() {
for (const track of tracks) {
for (const key of keys) {
const column = track[key];
if (column && ![...columnsList, ...SPECIAL_KEYS].includes(column)) {
if (column !== undefined && ![...columnsList, ...SPECIAL_KEYS].includes(column)) {
columnsList.push(column);
}
}
Expand All @@ -43,7 +43,7 @@ export function useColumnsStore() {
const trackEntry: Record<string, any> = {};
keys.forEach((key) => {
const column = track[key];
if (column && !SPECIAL_KEYS.includes(column)) {
if (column !== undefined && !SPECIAL_KEYS.includes(column)) {
trackEntry[key] = columns.value[datasetId][column];
}
});
Expand Down
59 changes: 59 additions & 0 deletions vite.config.charts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { defineConfig } from "vite";

const env = {
GALAXY_DATASET_ID: "",
GALAXY_HISTORY_ID: "",
GALAXY_KEY: "",
GALAXY_ROOT: "http://127.0.0.1:8080",
};

// add history id for testing
Object.keys(env).forEach((key) => {
if (process.env[key]) {
env[key] = process.env[key];
} else {
console.log(`${key} not available. Please provide as environment variable.`);
}
});

// https://vitejs.dev/config/
export const viteConfigCharts = defineConfig({
build: {
outDir: "./static/dist",
emptyOutDir: true,
rollupOptions: {
output: {
manualChunks: () => "app.js",
entryFileNames: "[name].js",
chunkFileNames: "[name].js",
assetFileNames: "[name][extname]",
},
},
},
define: {
"process.env.credentials": JSON.stringify(env.GALAXY_KEY ? "omit" : "include"),
"process.env.dataset_id": JSON.stringify(env.GALAXY_DATASET_ID),
"process.env.history_id": JSON.stringify(env.GALAXY_HISTORY_ID),
},
resolve: {
alias: {
"@": "/src",
},
},
server: {
proxy: {
"/api": {
changeOrigin: true,
rewrite: (path) => {
if (env.GALAXY_KEY) {
const separator = path.includes("?") ? "&" : "?";
return `${path}${separator}key=${env.GALAXY_KEY}`;
} else {
return path;
}
},
target: env.GALAXY_ROOT,
},
},
},
});
51 changes: 7 additions & 44 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
import { defineConfig } from "vite";
import tailwindcss from "tailwindcss";
import vue from "@vitejs/plugin-vue";
import path from "path";
import { libInjectCss } from "vite-plugin-lib-inject-css";
import { configDefaults } from "vitest/config";
import { libInjectCss } from "vite-plugin-lib-inject-css";
import Checker from "vite-plugin-checker";

// collect Galaxy server root
let GALAXY_ROOT = "http://127.0.0.1:8080";
if (process.env.GALAXY_ROOT) {
GALAXY_ROOT = process.env.GALAXY_ROOT;
} else {
console.log("GALAXY_ROOT not available. Please provide as environment variable.");
}
import path from "path";
import tailwindcss from "tailwindcss";
import vue from "@vitejs/plugin-vue";

// collect Galaxy API key
let GALAXY_KEY = "";
if (process.env.GALAXY_KEY) {
GALAXY_KEY = process.env.GALAXY_KEY;
} else {
console.log("GALAXY_KEY not available. Please provide as environment variable.");
}
import { viteConfigCharts } from "./vite.config.charts";

// https://vitejs.dev/config/
export default defineConfig({
...viteConfigCharts,
build: {
lib: {
entry: path.resolve(__dirname, "lib/galaxy-charts.js"),
Expand All @@ -37,34 +24,10 @@ export default defineConfig({
},
},
},
define: {
"process.env.credentials": JSON.stringify(GALAXY_KEY ? "omit" : "include"),
},
plugins: [vue(), tailwindcss(), libInjectCss(), Checker({ typescript: true })],
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
},
},
server: {
proxy: {
"/api": {
changeOrigin: true,
rewrite: (path) => {
if (GALAXY_KEY) {
const separator = path.includes("?") ? "&" : "?";
return `${path}${separator}key=${GALAXY_KEY}`;
} else {
return path;
}
},
target: GALAXY_ROOT,
},
},
},
test: {
globals: true,
environment: "jsdom",
exclude: configDefaults.exclude,
exclude: [...configDefaults.exclude, "e2e/*"],
},
});
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1033,9 +1033,9 @@ copy-anything@^3.0.2:
is-what "^4.1.8"

cross-spawn@^7.0.0:
version "7.0.3"
resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz"
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
version "7.0.6"
resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz"
integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==
dependencies:
path-key "^3.1.0"
shebang-command "^2.0.0"
Expand Down

0 comments on commit ddd8842

Please sign in to comment.