Skip to content

Commit 4c96e1e

Browse files
committed
MET-6977 Chained Rerun Design
1 parent 8f81461 commit 4c96e1e

File tree

4 files changed

+85
-71
lines changed

4 files changed

+85
-71
lines changed

projects/sandbox/src/app/_services/sandbox-conf.service.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { FixedLengthArray, SandboxPage, SandboxPageType } from '../_models';
33

44
@Injectable({ providedIn: 'root' })
55
export class SandboxConfService {
6+
readonly ANCESTOR_MODE = 'ancestor-mode';
7+
68
sandboxNavConf: FixedLengthArray<SandboxPage, 8> = [
79
{
810
stepTitle: 'Home',
@@ -51,17 +53,23 @@ export class SandboxConfService {
5153
}
5254

5355
isAncestorMode(): boolean {
54-
return this.sandboxNavConf[2].stepSubClass === 'ancestor-mode';
56+
return (this.sandboxNavConf[2].stepSubClass ?? '').includes(this.ANCESTOR_MODE);
57+
}
58+
59+
setAncestorAlignment(alignment: string): void {
60+
if (this.sandboxNavConf[2].stepSubTitle) {
61+
this.sandboxNavConf[2].stepSubClass = `${this.ANCESTOR_MODE} ${alignment}`;
62+
}
5563
}
5664

57-
toggleAncestorMode(): void {
65+
toggleAncestorMode(alignment: string): void {
5866
if (this.sandboxNavConf[2].stepSubTitle) {
5967
this.sandboxNavConf[2].stepSubTitle = undefined;
6068
this.sandboxNavConf[2].stepSubClass = undefined;
6169
this.sandboxNavConf[2].stepSubTitleClick = undefined;
6270
} else {
6371
this.sandboxNavConf[2].stepSubTitle = true;
64-
this.sandboxNavConf[2].stepSubClass = 'ancestor-mode';
72+
this.sandboxNavConf[2].stepSubClass = `${this.ANCESTOR_MODE} ${alignment}`;
6573
this.sandboxNavConf[2].stepSubTitleClick = this.toggleAncestorMode.bind(this);
6674
}
6775
}

projects/sandbox/src/app/dataset-info/dataset-info.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@
201201
<li>
202202
<a
203203
tabindex="0"
204-
title="view rerun"
204+
title="view rerun ({{ item.id }}) - '{{ item.name }}'"
205205
#link
206206
class="rerun-nav"
207207
href="/dataset/{{ item.id }}"
@@ -274,7 +274,7 @@
274274
<li>
275275
<a
276276
tabindex="0"
277-
title="view rerun"
277+
title="view sibling rerun ({{ item.id }}) - '{{ item.name }}'"
278278
#link
279279
class="rerun-nav"
280280
href="/dataset/{{ item.id }}"

projects/sandbox/src/app/dataset-info/dataset-info.component.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,18 @@ export class DatasetInfoComponent extends SubscriptionManager implements OnInit
246246
}
247247
});
248248

249+
hierarchyAlignment = computed(() => {
250+
const hd = this.hierarchyData();
251+
if (hd) {
252+
if (hd.siblings.length && !hd.children.length) {
253+
return 'push-left';
254+
} else if (hd.children.length && !hd.siblings.length) {
255+
return 'push-right';
256+
}
257+
}
258+
return 'align-center';
259+
});
260+
249261
/**
250262
*
251263
**/
@@ -403,6 +415,10 @@ export class DatasetInfoComponent extends SubscriptionManager implements OnInit
403415
}
404416
});
405417

418+
effect(() => {
419+
this.sandboxConf.setAncestorAlignment(this.hierarchyAlignment());
420+
});
421+
406422
effect(() => {
407423
const di = this.datasetInfo();
408424
if (di) {
@@ -639,8 +655,15 @@ export class DatasetInfoComponent extends SubscriptionManager implements OnInit
639655
});
640656
}
641657

658+
/**
659+
* toggleAncestorMode
660+
* template utility
661+
**/
642662
toggleAncestorMode(): void {
643-
this.sandboxConf.toggleAncestorMode();
663+
const hd = this.hierarchyData();
664+
if (hd) {
665+
this.sandboxConf.toggleAncestorMode(this.hierarchyAlignment());
666+
}
644667
}
645668

646669
isAncestorMode(): boolean {

projects/sandbox/src/assets/sass/ancestry.scss

Lines changed: 48 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
@use 'shared-styles/assets/sass/scss/iconography/svg-icons-metis';
99
@use './mixins/circle';
1010

11-
$primary-nav-shift-left: 2rem;
1211
$mid-grey: #777;
1312

1413
$line-colour: variables-colours.$eu-grey-middle;
@@ -140,7 +139,7 @@ $z-blur: 4;
140139
}
141140
}
142141

143-
@mixin header-plus() {
142+
@mixin header-plus($primary-nav-shift-left) {
144143
&::after,
145144
&::before {
146145
content: '';
@@ -363,7 +362,7 @@ body.theme-classic {
363362
@include hide-all(true);
364363
}
365364

366-
body.theme-white {
365+
@mixin ancestry($primary-nav-shift-left) {
367366
.child-datasets,
368367
.parent-dataset,
369368
.related-datasets {
@@ -571,48 +570,12 @@ body.theme-white {
571570
}
572571
}
573572

574-
/*
575-
@include apply-to-unfoldable {
576-
// right-aligned teeth
577-
@include teeth(1em, 13rem, false, true);
578-
ul {
579-
&:not(:empty) + .child-datasets-label::after {
580-
border-top: 1px solid $line-colour;
581-
border-right: 1px solid $line-colour;
582-
content: '';
583-
position: absolute;
584-
right: -1.5em;
585-
bottom: -1.25em;
586-
width: 3rem;
587-
height: 1.75rem;
588-
display: block;
589-
}
590-
591-
li {
592-
padding-left: 0;
593-
a {
594-
text-align: right;
595-
flex-direction: row-reverse;
596-
padding-right: 2rem;
597-
margin-left: auto;
598-
width: 100%;
599-
}
600-
.rerun-item-field {
601-
position: static;
602-
padding-right: 0.5rem;
603-
}
604-
}
605-
}
606-
}
607-
*/
608-
609573
.child-datasets-label:not(.inline) {
610574
display: flex;
611-
right: calc(-147px - $primary-nav-shift-left);
575+
left: 7rem;
612576
position: absolute;
613-
614-
// pushed up when content present
615577
top: -0.5rem;
578+
white-space: nowrap;
616579
}
617580

618581
ul:empty + .child-datasets-label {
@@ -1063,36 +1026,56 @@ body.theme-white {
10631026
}
10641027
}
10651028
}
1029+
}
10661030

1067-
.sandbox-navigation-head.ancestor-mode {
1068-
@include header-plus();
1069-
1070-
.nav-orb.labelled::before {
1071-
background-image: svg-icons-metis.svg-url-icon-rerun(#fff);
1072-
background-position-x: 1.5px;
1073-
background-position-y: 2.25px;
1074-
}
1031+
body.theme-white {
1032+
.sandbox-navigation-head {
1033+
&:not(.ancestor-mode) + .sandbox-navigation-content {
1034+
@include hide-all();
10751035

1076-
& + .sandbox-navigation-content {
1077-
.parent-dataset .parent-link {
1078-
transition: opacity $time1 linear $time1;
1079-
}
1080-
.title-id .rerun-nav {
1081-
color: variables-colours.$eu-orange;
1082-
@include ancestry-opener(variables-colours.$eu-orange);
1036+
.parent-dataset {
1037+
opacity: 0;
1038+
top: -3rem;
1039+
.parent-link,
1040+
.parent-label {
1041+
opacity: 0;
1042+
}
10831043
}
10841044
}
1085-
}
1045+
&.ancestor-mode {
1046+
.nav-orb.labelled::before {
1047+
background-image: svg-icons-metis.svg-url-icon-rerun(#fff);
1048+
background-position-x: 1.5px;
1049+
background-position-y: 2.25px;
1050+
}
10861051

1087-
.sandbox-navigation-head:not(.ancestor-mode) + .sandbox-navigation-content {
1088-
@include hide-all();
1052+
& + .sandbox-navigation-content {
1053+
.parent-dataset .parent-link {
1054+
transition: opacity $time1 linear $time1;
1055+
}
1056+
.title-id .rerun-nav {
1057+
color: variables-colours.$eu-orange;
1058+
@include ancestry-opener(variables-colours.$eu-orange);
1059+
}
1060+
}
10891061

1090-
.parent-dataset {
1091-
opacity: 0;
1092-
top: -3rem;
1093-
.parent-link,
1094-
.parent-label {
1095-
opacity: 0;
1062+
&.align-center {
1063+
@include header-plus(3.5rem);
1064+
& + .sandbox-navigation-content {
1065+
@include ancestry(3.5rem);
1066+
}
1067+
}
1068+
&.push-left {
1069+
@include header-plus(10em);
1070+
& + .sandbox-navigation-content {
1071+
@include ancestry(10em);
1072+
}
1073+
}
1074+
&.push-right {
1075+
@include header-plus(0em);
1076+
& + .sandbox-navigation-content {
1077+
@include ancestry(0rem);
1078+
}
10961079
}
10971080
}
10981081
}

0 commit comments

Comments
 (0)