Skip to content

Commit

Permalink
Merge branch 'dev-properties' into dev-properties-backend
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrej33 committed May 10, 2024
2 parents c1f524f + 639c14e commit 1eec190
Show file tree
Hide file tree
Showing 20 changed files with 112 additions and 364 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script type="module" src="observations-import.ts"></script>
<title>Observations import</title>
</head>
<body>
<observations-import></observations-import>
</body>
</html>
<extends src="../../../dialog-base.html">
<block name="window">
<script type="module" src="observations-import.ts"></script>
<observations-import></observations-import>
</block>
</extends>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#import-wrapper {
height: 100%;
margin: 0.5em;
color: @text-light;
}

#table-wrapper {
Expand Down Expand Up @@ -87,3 +89,12 @@ h1 {
transform: rotate(360deg);
}
}

@media (prefers-color-scheme: dark) {
h1 {
color: @text-dark;
}
.sk-cube-grid .sk-cube {
background-color: @text-dark;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default class ObservationsImport extends LitElement {
<div id="import-wrapper">
<h1 class="uk-margin-small-bottom">Select rows to be imported</h1>
${this.table}
<div class="footer uk-flex-row uk-text-center ">
<div class="footer uk-flex-row uk-text-center uk-margin-small">
<button class="uk-button uk-button-primary"
?disabled="${this.submitDisabled}"
@click="${this.handleSubmit}">
Expand Down
26 changes: 13 additions & 13 deletions src/html/component/properties-editor/default-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ export const fixedPointDynamic = (id: string): IFixedPointDynamicProperty => {
id,
name: 'fixed-point',
variant: DynamicPropertyType.FixedPoint,
dataset: '',
observation: ''
dataset: undefined,
observation: undefined
}
}

export const trapSpaceDynamic = (id: string): ITrapSpaceDynamicProperty => {
return {
id,
name: 'dynamic-trap-space',
name: 'trap-space',
variant: DynamicPropertyType.TrapSpace,
dataset: '',
observation: '',
dataset: undefined,
observation: undefined,
minimal: false,
nonpercolable: false
}
Expand All @@ -39,16 +39,16 @@ export const trapSpaceDynamic = (id: string): ITrapSpaceDynamicProperty => {
export const existsTrajectoryDynamic = (id: string): IExistsTrajectoryDynamicProperty => {
return {
id,
name: 'exists-trajectory-dynamic',
name: 'exists-trajectory',
variant: DynamicPropertyType.ExistsTrajectory,
dataset: ''
dataset: undefined
}
}

export const attractorCountDynamic = (id: string): IAttractorCountDynamicProperty => {
return {
id,
name: 'attractor-count-dynamic',
name: 'attractor-count',
variant: DynamicPropertyType.AttractorCount,
minimal: 1,
maximal: 1
Expand All @@ -58,10 +58,10 @@ export const attractorCountDynamic = (id: string): IAttractorCountDynamicPropert
export const hasAttractorDynamic = (id: string): IHasAttractorDynamicProperty => {
return {
id,
name: 'has-attractor-dynamic',
name: 'has-attractor',
variant: DynamicPropertyType.HasAttractor,
dataset: '',
observation: ''
dataset: undefined,
observation: undefined
}
}

Expand Down Expand Up @@ -91,8 +91,8 @@ export const functionInputEssentialWithCondition = (id: string): IFunctionInputE
id,
name: 'function-input-essential',
variant: StaticPropertyType.FunctionInputEssentialWithCondition,
target: 'func',
input: 'var',
target: undefined,
input: undefined,
value: Essentiality.TRUE,
context: undefined
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import { css, html, type TemplateResult, unsafeCSS } from 'lit'
import { customElement, property, query } from 'lit/decorators.js'
import style_less from './dynamic-trap-space.less?inline'
import style_less from './dynamic-obs-selection.less?inline'
import { icon } from '@fortawesome/fontawesome-svg-core'
import { faTrash } from '@fortawesome/free-solid-svg-icons'
import { type IObservationSet, type ITrapSpaceDynamicProperty } from '../../../../util/data-interfaces'
import {
DynamicPropertyType,
type IObservationSet,
type ITrapSpaceDynamicProperty
} from '../../../../util/data-interfaces'
import { map } from 'lit/directives/map.js'
import AbstractDynamicProperty from '../abstract-dynamic-property'
import { when } from 'lit/directives/when.js'

@customElement('dynamic-trap-space')
export default class DynamicTrapSpace extends AbstractDynamicProperty {
const ALL = '*'

@customElement('dynamic-obs-selection')
export default class DynamicObsSelection extends AbstractDynamicProperty {
static styles = css`${unsafeCSS(style_less)}`
@property() declare property: ITrapSpaceDynamicProperty
@property() declare observations: IObservationSet[]
Expand All @@ -18,17 +25,19 @@ export default class DynamicTrapSpace extends AbstractDynamicProperty {
const datasetId = (event.target as HTMLSelectElement).value
this.updateProperty({
...this.property,
dataset: datasetId,
observation: ''
dataset: datasetId === '' ? undefined : datasetId,
observation: this.property.variant === DynamicPropertyType.HasAttractor ? ALL : undefined
})
this.observationSelector.selectedIndex = 0
if (this.property.variant !== DynamicPropertyType.ExistsTrajectory) {
this.observationSelector.selectedIndex = 0
}
}

observationChanged (event: Event): void {
const observation = (event.target as HTMLSelectElement).value
this.updateProperty({
...this.property,
observation
observation: observation === '' ? undefined : observation
})
}

Expand Down Expand Up @@ -56,6 +65,7 @@ export default class DynamicTrapSpace extends AbstractDynamicProperty {
${icon(faTrash).node}
</button>
</div>
<div class="uk-flex uk-flex-row uk-flex-around">
<div class="uk-flex uk-flex-row uk-flex-around uk-flex-middle">
<label for="dataset">Dataset:</label>
Expand All @@ -68,32 +78,41 @@ export default class DynamicTrapSpace extends AbstractDynamicProperty {
</select>
</div>
</div>
${when(this.property.variant !== DynamicPropertyType.ExistsTrajectory, () => html`
<div class="uk-flex uk-flex-row uk-flex-around uk-flex-middle">
<label for="observation">Observation:</label>
<div class="uk-width-3-4">
<select class="uk-select uk-margin-small-left" name="observation" id="observation"
@change=${this.observationChanged}>
<option value=${undefined}>---</option>
@change=${this.observationChanged}
?disabled="${this.property.dataset === undefined}">
${when(this.property.variant === DynamicPropertyType.HasAttractor,
() => html`
<option value=${'*'}>all</option>`,
() => html`
<option value=${undefined}>---</option>`)}
${map(this.observations[this.observations.findIndex(dataset => dataset.id === this.property.dataset)]?.observations,
(observation) => html`
<option value="${observation.id}">${observation.id}</option>
`)}
</select>
</div>
</div>
</div>
<div class="uk-flex uk-flex-row uk-flex-around">
<div class="toggle">
<input class="uk-checkbox" type="checkbox" id="minimal" name="minimal" value=${this.property.minimal}
@change=${this.minimalChanged} />
<label class="pointer" for="minimal">minimal</label>
</div>
<div class="pointer">
<input class="uk-checkbox" type="checkbox" id="non-percolable" name="non-percolable"
value=${this.property.nonpercolable} @change=${this.nonpercolableChanged} />
<label class="pointer" for="non-percolable">non-percolable</label>
</div>
</div>`)}
</div>
${when(this.property.variant === DynamicPropertyType.TrapSpace, () => html`
<div class="uk-flex uk-flex-row uk-flex-around">
<div class="toggle">
<input class="uk-checkbox" type="checkbox" id="minimal" name="minimal" value=${this.property.minimal}
@change=${this.minimalChanged} />
<label class="pointer" for="minimal">minimal</label>
</div>
<div class="pointer">
<input class="uk-checkbox" type="checkbox" id="non-percolable" name="non-percolable"
value=${this.property.nonpercolable} @change=${this.nonpercolableChanged} />
<label class="pointer" for="non-percolable">non-percolable</label>
</div>
</div>`)}
</div>
<hr>
`
Expand Down

This file was deleted.

Loading

0 comments on commit 1eec190

Please sign in to comment.