Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show descriptions for BackendGroups #29

Closed
m-mohr opened this issue Aug 16, 2019 · 6 comments
Closed

Show descriptions for BackendGroups #29

m-mohr opened this issue Aug 16, 2019 · 6 comments
Labels
enhancement New feature or request
Milestone

Comments

@m-mohr
Copy link
Member

m-mohr commented Aug 16, 2019

The back-end descriptions are missing and should be shown, similarly to your screenshot in #14:

image

Da die Beschreibungen länger sein können (und Markdown unterstützen -> Description component in vue-components), sollten nur ein paar Zeilen (zw. 3 und 5?) angezeigt werden und der Rest erst beim ausklappen. Das mehr Beschreibung zur Verfügung steht sollte in der UI sichtbar sein (... oder langsames Ausblenden, wie man es von einigen Zeitungen kennt).

@m-mohr m-mohr added this to the v0.3 milestone Aug 16, 2019
@m-mohr m-mohr added the enhancement New feature or request label Aug 16, 2019
@m-mohr
Copy link
Member Author

m-mohr commented Aug 16, 2019

Here's code for fading out, which I am using in the new UdfRuntimes component.

<template>
	<ul class="vue-component runtimes">
		<li @click.stop="expand(name)" v-for="(runtime, name) in udfRuntimes" :key="name" :class="{runtime: true, collapsible: initiallyCollapsed, collapsed: collapsed[name]}">
			<a class="anchor" :name="name"></a>
			<header @click.stop="toggle(name)">
				<span class="toggle">▸</span>{{ name }}
			</header>
			<article class="runtime-details">
				<Description v-if="runtime.description" :compact="true" :description="runtime.description" />
				...
			</article>
		</li>
	</ul>
</template>

<script>
import Utils from '../utils.js';
import Description from './Description.vue';
import LinkList from './LinkList.vue';
import { MigrateCapabilities } from '@openeo/js-commons';
import './base.css';

export default {
	name: 'UdfRuntimes',
	components: {
		Description,
		LinkList
	},
	props: {
		version: String,
		runtimes: Object,
		initiallyCollapsed: {
			type: Boolean,
			default: false
		}
	},
	data() {
		return {
			collapsed: {},
			udfRuntimes: {}
		};
	},
	created() {
		this.updateData();
	},
	beforeMount() {
		for (var name in this.runtimes) {
			this.$set(this.collapsed, name, this.initiallyCollapsed);
		}
	},
	watch: {
		runtimes() {
			this.updateData();
		},
		version() {
			this.updateData();
		}
	},
	methods: {
		updateData() {
			// MigrateCapabilities.convertUdfRuntimesToLatestSpec was not implemented in openeo-js-commons <= 0.4.5.
			// Once we upgraded the js-commons dependency, we can remove this check.
			if (typeof MigrateCapabilities.convertUdfRuntimesToLatestSpec === 'function') {
				this.udfRuntimes = MigrateCapabilities.convertUdfRuntimesToLatestSpec(this.runtimes, this.version);
			}
			else {
				this.udfRuntimes = this.runtimes;
			}
		},
		toggle(name) {
			console.log(name, this.collapsed[name]);
			if (this.initiallyCollapsed) {
				this.$set(this.collapsed, name, !this.collapsed[name]);
			}
			console.log(name, this.collapsed[name]);
		},
		expand(name) {
			if (this.initiallyCollapsed && this.collapsed[name]) {
			console.log("expand");
				this.toggle(name);
			}
		}
	}
}
</script>

<style>
ul.runtimes:empty::after {
	content: 'None';
	font-style: italic;
}
.vue-component.runtimes .collapsible {
	margin-left: 0;
}
.vue-component.runtimes .collapsible.collapsed .runtime-details {
	max-height: 3em;
	overflow-y: hidden;
	position: relative;
	cursor: pointer;
}
.vue-component.runtimes .collapsible.collapsed .runtime-details:before {
	content: '';
	width: 100%;
	height: 100%;	
	position: absolute;
	left: 0;
	top: 0;
	background: linear-gradient(rgba(255,255,255,0) 1em, white);
}
.runtimes header {
	font-size: 1.1em;
	font-weight: bold;
}
.runtimes li.runtime {
	list-style-type: none;
	margin-bottom: 1.5em;
}
.runtimes li.runtime:last-of-type {
	margin-bottom: 0;
}
</style>

Looks like this:
image

Maybe I should make a Collapsible component, we are using collapse things in quite some components now ;-)

@christophfriedrich
Copy link
Collaborator

Since implementing the grouping of backends (with tabs for each version), the "top-level component" within the DiscoverySection (and thus the component that is visible when opening the site) is BackendGroup. The individual Backends are hidden within the BackendGroups' collapse areas.

To implement a start screen like in the screenshot, it must be decided which description should be displayed by such a BackendGroup? It may contain multiple backends with different descriptions...

@m-mohr
Copy link
Member Author

m-mohr commented Aug 20, 2019

Until Open-EO/openeo-api#202 is available in 1.0, we could use the most recent one (i.e. the description of the back-end with the highest version number).

christophfriedrich added a commit that referenced this issue Aug 21, 2019
Technically speaking, they were of course already crawled, but discarded (more correct: not included) in the final processing pipeline that fills the `backends` collection in the DB.

Since those descriptions can contain Markdown, they are rendered via the `vue-components`'s `Description` component.
Since those descriptions can be very long and include things like code, tables etc., they show a scroll bar if their height exceeds 15em.
@christophfriedrich
Copy link
Collaborator

christophfriedrich commented Aug 21, 2019

With 29affc2, backends now show descriptions.

But backend groups (i.e. those components you see when you open the Hub) don't - because @m-mohr and I didn't like that the description would be shown in the initial state, but disappear upon expanding. We can again think about that for Hub v0.4 ➡️ changing title and milestone.

Long descriptions are (for now) not handled via a fancy fade-out or what not, but a simple scrollbar via overflow-y: auto once their height exceeds 15em. Please open another issue if you'd like to change this.

@christophfriedrich christophfriedrich changed the title Show back-end descriptions Show descriptions for BackendGroups Aug 21, 2019
@christophfriedrich christophfriedrich modified the milestones: v0.3, v0.4 Aug 21, 2019
@m-mohr m-mohr modified the milestones: v0.4, v0.5 Dec 6, 2019
@m-mohr
Copy link
Member Author

m-mohr commented Jan 3, 2020

Looking again over the Hub homepage, I think it's cleaner to not show the descriptions directly. It would really clutter the overview page. Let's open an issue whenever it becomes an actual issue. This is good for now, so closing.

@m-mohr m-mohr closed this as completed Jan 3, 2020
@m-mohr m-mohr modified the milestones: v0.5, v0.4 Jan 3, 2020
@christophfriedrich
Copy link
Collaborator

IMO the screenshot at the top looks quite neat, not overly cluttered. I would've been fine with realising this for the new field from Open-EO/openeo-api#202. But I'm also not overly sad if it's not included 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants