Commit d04d8feb by Johannes Edmeier

Fix instance tabs for smaller screen sizes

parent 63de195c
...@@ -16,7 +16,9 @@ ...@@ -16,7 +16,9 @@
<template> <template>
<div class="card panel"> <div class="card panel">
<header v-if="title || $slots['header']" class="card-header"> <header v-if="title || $slots['header']" class="card-header"
:class="{'panel__header--sticky': headerSticksBelow}"
v-sticks-below="headerSticksBelow">
<p class="card-header-title"> <p class="card-header-title">
<span v-text="title"/> <span v-text="title"/>
<slot name="header"/> <slot name="header"/>
...@@ -33,9 +35,11 @@ ...@@ -33,9 +35,11 @@
<script> <script>
import SbaIconButton from './sba-icon-button'; import SbaIconButton from './sba-icon-button';
import sticksBelow from '@/directives/sticks-below';
export default { export default {
components: {SbaIconButton}, components: {SbaIconButton},
directives: {sticksBelow},
props: { props: {
title: { title: {
type: String, type: String,
...@@ -44,6 +48,10 @@ ...@@ -44,6 +48,10 @@
closeable: { closeable: {
type: Boolean, type: Boolean,
default: false default: false
},
headerSticksBelow: {
type: Array,
default: undefined
} }
}, },
methods: { methods: {
...@@ -67,5 +75,11 @@ ...@@ -67,5 +75,11 @@
align-items: center; align-items: center;
justify-self: flex-end; justify-self: flex-end;
} }
&__header--sticky {
position: sticky;
background: $white;
top: ($navbar-height-px + $tabs-height-px);
}
} }
</style> </style>
/*
* Copyright 2014-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const bind = (el, binding) => {
if (!binding.value) {
return;
}
const top = binding.value.map(v => document.querySelector(v))
.filter(v => Boolean(v))
.map(v => v.getBoundingClientRect().height)
.reduce((a, b) => a + b, 0);
el.style.top = `${top}px`;
el.style.position = 'sticky';
};
export default {
bind,
update(el, binding) {
if (binding.value === binding.oldValue) {
return
}
bind(el, binding)
}
}
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<input class="input" type="search" placeholder="name / value filter" v-model="filter"> <input class="input" type="search" placeholder="name / value filter" v-model="filter">
</p> </p>
</div> </div>
<sba-panel class="property-source" <sba-panel class="property-source" :header-sticks-below="['#navigation', '#instance-tabs']"
v-for="propertySource in propertySources" :key="propertySource.name" v-for="propertySource in propertySources" :key="propertySource.name"
:title="propertySource.name"> :title="propertySource.name">
<table class="table is-fullwidth" <table class="table is-fullwidth"
...@@ -135,13 +135,3 @@ ...@@ -135,13 +135,3 @@
} }
} }
</script> </script>
<style lang="scss">
@import "~@/assets/css/utilities";
.property-source .card-header {
position: sticky;
background: $white;
top: ($navbar-height-px + $tabs-height-px);
}
</style>
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
<template v-for="(context, ctxName) in contexts"> <template v-for="(context, ctxName) in contexts">
<h3 class="title" v-text="ctxName" :key="ctxName"/> <h3 class="title" v-text="ctxName" :key="ctxName"/>
<sba-panel v-for="(report, name) in context.flywayBeans" :key="`${ctxName}-${name}`" :title="name" <sba-panel v-for="(report, name) in context.flywayBeans" :key="`${ctxName}-${name}`" :title="name"
:header-sticks-below="['#navigation', '#instance-tabs']"
class="migration"> class="migration">
<table class="table"> <table class="table">
<thead> <thead>
...@@ -123,13 +124,3 @@ ...@@ -123,13 +124,3 @@
} }
} }
</script> </script>
<style lang="scss">
@import "~@/assets/css/utilities";
.migration .card-header {
position: sticky;
background: $white;
top: ($navbar-height-px + $tabs-height-px);
}
</style>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
</div> </div>
<div class="columns"> <div class="columns">
<div class="column is-narrow"> <div class="column is-narrow">
<nav class="menu domain-list"> <nav class="menu domain-list" v-sticks-below="['#navigation', '#instance-tabs']">
<p class="menu-label">domains</p> <p class="menu-label">domains</p>
<ul class="menu-list"> <ul class="menu-list">
<li> <li>
...@@ -94,6 +94,7 @@ ...@@ -94,6 +94,7 @@
import {directive as onClickaway} from 'vue-clickaway'; import {directive as onClickaway} from 'vue-clickaway';
import mBeanAttributes from './m-bean-attributes'; import mBeanAttributes from './m-bean-attributes';
import mBeanOperations from './m-bean-operations'; import mBeanOperations from './m-bean-operations';
import sticksBelow from '@/directives/sticks-below';
const getOperationName = (name, descriptor) => { const getOperationName = (name, descriptor) => {
const params = descriptor.args.map(arg => arg.type).join(','); const params = descriptor.args.map(arg => arg.type).join(',');
...@@ -138,7 +139,7 @@ ...@@ -138,7 +139,7 @@
} }
}, },
components: {mBeanOperations, mBeanAttributes}, components: {mBeanOperations, mBeanAttributes},
directives: {onClickaway}, directives: {onClickaway, sticksBelow},
data: () => ({ data: () => ({
hasLoaded: false, hasLoaded: false,
error: null, error: null,
...@@ -219,11 +220,6 @@ ...@@ -219,11 +220,6 @@
<style lang="scss"> <style lang="scss">
@import "~@/assets/css/utilities"; @import "~@/assets/css/utilities";
.domain-list {
position: sticky;
top: (($gap / 2) + $navbar-height-px + $tabs-height-px);
}
.m-bean { .m-bean {
transition: all $easing $speed; transition: all $easing $speed;
......
...@@ -29,7 +29,8 @@ ...@@ -29,7 +29,8 @@
<template v-for="(context, ctxName) in contexts"> <template v-for="(context, ctxName) in contexts">
<h3 class="title" v-text="ctxName" :key="ctxName"/> <h3 class="title" v-text="ctxName" :key="ctxName"/>
<template v-for="(report, name) in context.liquibaseBeans"> <template v-for="(report, name) in context.liquibaseBeans">
<sba-panel :key="`${ctxName}-${name}`" :title="`name`" class="change-set"> <sba-panel :key="`${ctxName}-${name}`" :title="`name`" class="change-set"
:header-sticks-below="['#navigation', '#instance-tabs']">
<table class="table is-hoverable is-fullwidth"> <table class="table is-hoverable is-fullwidth">
<thead> <thead>
<tr> <tr>
...@@ -142,14 +143,4 @@ ...@@ -142,14 +143,4 @@
} }
} }
} }
</script> </script>å
<style lang="scss">
@import "~@/assets/css/utilities";
.change-set .card-header {
position: sticky;
background: $white;
top: ($navbar-height-px + $tabs-height-px);
}
</style>
...@@ -15,36 +15,32 @@ ...@@ -15,36 +15,32 @@
--> -->
<template> <template>
<section class="hero instance-tabs"> <section id="instance-tabs" class="hero instance-tabs">
<div class="hero-foot"> <div class="hero-foot">
<div class="container"> <div class="container instance-tabs__tabs">
<div class="level">
<div class="level-left"> <div class="instance-tabs__name"
<div class="instance-tabs__name" :class="{ 'is-active' : isStuck }">
:class="{ 'is-active' : isStuck }"> <h1 class="title is-5" v-if="instance" v-text="instance.registration.name"/>
<h1 class="title is-5" v-if="instance" v-text="instance.registration.name"/> <h1 class="subtitle is-6" v-if="instance"><strong v-text="instance.id"/> (of <span
<h1 class="subtitle is-6" v-if="instance"><strong v-text="instance.id"/> (of <span v-text="application.instances.length"/>)</h1>
v-text="application.instances.length"/>)</h1>
</div>
</div>
<div class="level-right">
<nav class="tabs is-boxed is-right">
<ul>
<li v-if="instance" v-for="view in activeViews" :key="view.name"
:class="{'is-active' : $route.name === view.name}">
<a v-if="view.href" :href="view.href({ 'instanceId' : instance.id })"
target="_blank">
<component :is="view.handle"/>
</a>
<router-link v-else
:to="{ name: view.name, params: { 'instanceId' : instance.id } }">
<component :is="view.handle"/>
</router-link>
</li>
</ul>
</nav>
</div>
</div> </div>
<nav class="instance-tabs__tabs tabs is-boxed">
<ul>
<li v-if="instance" v-for="view in activeViews" :key="view.name"
:class="{'is-active' : $route.name === view.name}">
<a v-if="view.href" :href="view.href({ 'instanceId' : instance.id })"
target="_blank">
<component :is="view.handle"/>
</a>
<router-link v-else
:to="{ name: view.name, params: { 'instanceId' : instance.id } }">
<component :is="view.handle"/>
</router-link>
</li>
</ul>
</nav>
</div> </div>
</div> </div>
</section> </section>
...@@ -106,6 +102,22 @@ ...@@ -106,6 +102,22 @@
top: $navbar-height-px; top: $navbar-height-px;
overflow: hidden; overflow: hidden;
&__tabs {
display: flex;
align-items: flex-end;
& ul {
flex: 1 1 100%;
overflow: hidden;
}
& li {
flex-shrink: 1;
text-overflow: ellipsis;
overflow: hidden;
}
}
&__name { &__name {
transition: all $easing $speed; transition: all $easing $speed;
will-change: transform; will-change: transform;
...@@ -117,9 +129,5 @@ ...@@ -117,9 +129,5 @@
visibility: visible; visibility: visible;
} }
} }
& .level {
align-items: flex-end;
}
} }
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment