Skip to content

Commit b52cc53

Browse files
Fix showing logic for notices, add compact style (#107)
* Fix notices not showing if description not set * Fix typo * Add `compact` prop to FederationMissingNotice * Change CSS class names to fix #108 see also Open-EO/openeo-web-editor#353 (comment) * Hide "Description" h3 if section contains notices only see #107 (comment) * Add example for compact FedMissingNotice * Fix DeprecationWarning during example generation see da82a57#r155870123 * Restructure description `v-if`s see #107 (comment)
1 parent b046cde commit b52cc53

13 files changed

+67
-26
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- `FederationMissingNotice`: Prop `compact`
13+
1014
## [2.18.3] - 2025-01-15
1115

1216
### Fixed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ Show a message that a response is incomplete due to missing data from an inacces
252252
- `missing` (array, required): The identifiers of the federated back-ends that are not providing data for the list of processes due to an issue.
253253
- `federation` (object): The data of the `federation` property obtained from the capabilities.
254254
- `retry` (function): Displays a "retry" button which executes the given function.
255+
- `compact` (boolean): Renders the notice more compact if set to `true`. Defaults to `false`.
255256

256257
**Slots:**
257258

components/Collection.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616

1717
<slot name="before-description" v-bind="$props"></slot>
1818

19-
<section class="description" v-if="stac.description">
20-
<h3>Description</h3>
21-
22-
<Description :description="stac.description"></Description>
19+
<section class="description" v-if="stac.description || stac.deprecated || supportedBy || affectedByMissing">
20+
<template v-if="stac.description">
21+
<h3>Description</h3>
22+
<Description :description="stac.description"></Description>
23+
</template>
2324
<DeprecationNotice v-if="stac.deprecated" entity="collection" />
2425
<FederationNotice v-if="supportedBy" :backends="supportedBy" :federation="federation" entity="collection" />
2526
<FederationMissingNotice v-if="affectedByMissing" :missing="missing" :federation="federation" />

components/FederationMissingNotice.vue

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<section v-if="services" class="vue-component message-block federation federation-backends">
2+
<section v-if="services" class="vue-component message-block federation federation-backends federation-missing-notice" :class="{compact: compact}">
33
<AsyncButton v-if="retry" confirm class="retry" :fn="retry">Retry</AsyncButton>
44
<strong class="header">Incomplete</strong>
55
<p>
@@ -9,7 +9,7 @@
99
<li v-for="service in services" :key="service.url">
1010
<div class="fed-header">
1111
<strong class="fed-title">{{ service }}</strong>
12-
<ul class="badges small inline">
12+
<ul v-if="!compact" class="badges small inline">
1313
<li class="badge red">offline</li>
1414
</ul>
1515
</div>
@@ -35,6 +35,10 @@ export default {
3535
type: Function,
3636
default: null
3737
},
38+
compact: {
39+
type: Boolean,
40+
default: false
41+
},
3842
federation: {
3943
type: Object,
4044
default: () => ({})
@@ -62,7 +66,7 @@ export default {
6266
<style lang="scss">
6367
@use './base.scss';
6468
65-
.vue-component.federation-backends {
69+
.vue-component.federation-missing-notice {
6670
background-color: rgba(255, 69, 0, 0.1);
6771
border: 1px solid orangered;
6872
@@ -78,4 +82,25 @@ export default {
7882
float: right;
7983
}
8084
}
85+
86+
.vue-component.federation-missing-notice.compact {
87+
margin: 0;
88+
padding: 0.25em;
89+
90+
strong, p, ul, ul li, ul li div {
91+
display: inline;
92+
}
93+
94+
strong.header, p {
95+
margin-right: 5px;
96+
}
97+
98+
ul {
99+
padding-left: 0;
100+
}
101+
102+
li:not(:last-child)::after {
103+
content: ", "
104+
}
105+
}
81106
</style>

components/FileFormat.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@
2424

2525
<slot name="before-description" v-bind="$props"></slot>
2626

27-
<section class="description" v-if="format.description">
28-
<h3>Description</h3>
29-
<Description :description="format.description" />
27+
<section class="description" v-if="format.description || format.deprecated || format.experimental || format['federation:backends']">
28+
<template v-if="format.description">
29+
<h3>Description</h3>
30+
<Description :description="format.description" />
31+
</template>
3032
<DeprecationNotice v-if="format.deprecated" entity="file format" />
3133
<ExperimentalNotice v-if="format.experimental" entity="file format" />
3234
<FederationNotice v-if="format['federation:backends']" :backends="format['federation:backends']" :federation="federation" entity="file format" />

components/Item.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
<slot name="before-description" v-bind="$props"></slot>
1010

11-
<summary class="description" v-if="properties.description">
12-
<Description :description="properties.description"></Description>
11+
<summary class="description" v-if="properties.description || properties.deprecated || stac['federation:missing']">
12+
<Description v-if="properties.description" :description="properties.description"></Description>
1313

1414
<DeprecationNotice v-if="properties.deprecated" entity="item" />
1515
<FederationMissingNotice v-if="stac['federation:missing']" :missing="stac['federation:missing']" :federation="federation" />

components/Job.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@
4747

4848
<slot name="before-description" v-bind="$props"></slot>
4949

50-
<summary class="description" v-if="job.description">
51-
<h3>Description</h3>
52-
<Description :description="job.description" />
53-
50+
<summary class="description" v-if="job.description || job['federation:missing']">
51+
<template v-if="job.description">
52+
<h3>Description</h3>
53+
<Description :description="job.description" />
54+
</template>
5455
<FederationMissingNotice v-if="job['federation:missing']" :missing="job['federation:missing']" :federation="federation" />
5556
</summary>
5657

components/Process.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333

3434
<slot name="before-description" :v-bind="$props"></slot>
3535

36-
<section class="description" v-if="process.description">
36+
<section class="description" v-if="process.description || process.deprecated || process.experimental || process['federation:backends']">
3737
<h3>Description</h3>
3838
<code class="signature" v-html="signature"></code>
39-
<Description :description="process.description" :processUrl="processUrl" />
39+
<Description v-if="process.description" :description="process.description" :processUrl="processUrl" />
4040
<DeprecationNotice v-if="process.deprecated" entity="process" />
4141
<ExperimentalNotice v-if="process.experimental" entity="process" />
4242
<FederationNotice v-if="process['federation:backends']" :backends="process['federation:backends']" :federation="federation" entity="process" />

components/ServiceType.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414

1515
<slot name="before-description" v-bind="$props"></slot>
1616

17-
<section class="description" v-if="service.description">
18-
<h3>Description</h3>
19-
<Description :description="service.description" />
17+
<section class="description" v-if="service.description || service.deprecated || service.experimental || service['federation:backends']">
18+
<template v-if="service.description">
19+
<h3>Description</h3>
20+
<Description :description="service.description" />
21+
</template>
2022
<DeprecationNotice v-if="service.deprecated" entity="type of secondary web service" />
2123
<ExperimentalNotice v-if="service.experimental" entity="type of secondary web service" />
2224
<FederationNotice v-if="service['federation:backends']" :backends="service['federation:backends']" :federation="federation" entity="type of secondary web service" />

components/UdfRuntime.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121

2222
<slot name="before-description" v-bind="$props"></slot>
2323

24-
<section class="description" v-if="runtime.description">
25-
<Description :description="runtime.description"></Description>
24+
<section class="description" v-if="runtime.description || runtime.deprecated || runtime.experimental || runtime['federation:backends']">
25+
<Description v-if="runtime.description" :description="runtime.description"></Description>
2626
<DeprecationNotice v-if="runtime.deprecated" entity="UDF runtime" />
2727
<ExperimentalNotice v-if="runtime.experimental" entity="UDF runtime" />
2828
<FederationNotice v-if="runtime['federation:backends']" :backends="runtime['federation:backends']" :federation="federation" entity="UDF runtime" />

0 commit comments

Comments
 (0)