Skip to content
Merged

. #2

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,185 changes: 955 additions & 230 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/dash-panels/_allPanels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const panelLookup: { [key: string]: AsyncComponent } = {

// full-screen map visualizations:
aequilibrae: defineAsyncComponent(() => import('./aequilibrae.vue')),
polaris: defineAsyncComponent(() => import('./polaris.vue')),
carriers: defineAsyncComponent(() => import('./carriers.vue')),
flowmap: defineAsyncComponent(() => import('./flowmap.vue')),
links: defineAsyncComponent(() => import('./links.vue')),
Expand Down
49 changes: 49 additions & 0 deletions src/dash-panels/polaris.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<template lang="pug">
polaris-reader.polaris-panel(
:root="fileSystemConfig.slug"
:subfolder="subfolder"
:config="config"
:thumbnail="false"
@isLoaded="isLoaded"
@error="$emit('error', $event)"
)

</template>

<script lang="ts">
import { defineComponent } from 'vue'
import type { PropType } from 'vue'

import PolarisReader from '@/plugins/polaris/PolarisReader.vue'

export default defineComponent({
name: 'PolarisPanel',
components: { PolarisReader },
props: {
config: Object,
datamanager: Object,
fileSystemConfig: Object,
subfolder: String,
yamlConfig: String,
},
methods: {
isLoaded() {
this.$emit('isLoaded')
},
},
})
</script>

<style scoped lang="scss">
@import '@/styles.scss';

.polaris-panel {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
display: flex;
flex-direction: column;
}
</style>
5 changes: 5 additions & 0 deletions src/plugins/pluginRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ const plugins = [
kebabName: "aeq-reader",
filePatterns: ['**/aeqviz-*.y?(a)ml'],
component: defineAsyncComponent(() => import('./aequilibrae/AequilibraEReader.vue')),
},
{
kebabName: "polaris-reader",
filePatterns: ['**/polaris.y?(a)ml'],
component: defineAsyncComponent(() => import('./polaris/PolarisReader.vue')),
}
]

Expand Down
81 changes: 81 additions & 0 deletions src/plugins/polaris/PolarisFileSystem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/**
* POLARIS File System Handler
*
* Extends HTTPFileSystem to handle POLARIS project structures
* and SQLite database files. Provides methods to detect
* POLARIS projects and locate database files.
*/

import HTTPFileSystem from '../../js/HTTPFileSystem'
import { FileSystemConfig, DirectoryEntry } from '@/Globals'
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import DirectoryEntry.

Suggested change
import { FileSystemConfig, DirectoryEntry } from '@/Globals'
import { FileSystemConfig } from '@/Globals'

Copilot uses AI. Check for mistakes.

/**
* Interface representing the structure of a POLARIS project
* with its typical database components
*/
export interface PolarisProject {
/** Supply database buffer */
supplyDb?: ArrayBuffer
/** Demand database buffer */
demandDb?: ArrayBuffer
/** Result database buffer */
resultDb?: ArrayBuffer
}

/**
* File system handler specifically designed for POLARIS projects
* Provides detection and database listing capabilities
*/
export default class PolarisFileSystem extends HTTPFileSystem {
constructor(project: FileSystemConfig, store?: any) {
super(project, store)
}

/**
* Detects if a folder contains a POLARIS project
* by looking for polaris.yaml configuration file
*
* @param subfolder - The subfolder path to check
* @returns Promise<boolean> - True if POLARIS project is detected
*/
public async isPolarisProject(subfolder: string): Promise<boolean> {
try {
const { files } = await this.getDirectory(subfolder)

// Look for polaris.yaml configuration file
const hasPolarisConfig = files.some(
f => f.toLowerCase() === 'polaris.yaml' || f.toLowerCase() === 'polaris.yml'
)

return hasPolarisConfig
} catch (error) {
return false
}
}

/**
* Lists all SQLite database files in a POLARIS project folder
*
* @param subfolder - The subfolder path to search
* @returns Promise<string[]> - Array of SQLite database filenames
*/
public async listPolarisDatabases(subfolder: string): Promise<string[]> {
const { files } = await this.getDirectory(subfolder)
return files.filter(f => f.endsWith('.sqlite') || f.endsWith('.db'))
}

/**
* Loads a POLARIS database file as an ArrayBuffer
*
* @param filepath - Path to the database file
* @returns Promise<ArrayBuffer | null> - Database as ArrayBuffer, or null if failed
*/
public async loadPolarisDatabase(filepath: string): Promise<ArrayBuffer | null> {
try {
const blob = await this.getFileBlob(filepath)
return blob ? await blob.arrayBuffer() : null
} catch (error) {
return null
}
}
}
Loading