Make tags an object, style based on data value
This commit is contained in:
parent
b584816754
commit
bfa7539940
5 changed files with 34 additions and 8 deletions
|
@ -1,12 +1,23 @@
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
|
types: {
|
||||||
|
drupal: {
|
||||||
|
id: 'drupal',
|
||||||
|
name: 'Drupal'
|
||||||
|
},
|
||||||
|
nodejs: {
|
||||||
|
id: 'nodejs',
|
||||||
|
name: 'Node.js'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
applications: {
|
applications: {
|
||||||
1: {
|
1: {
|
||||||
id: 1,
|
id: 1,
|
||||||
name: 'Rebuilding Acquia',
|
name: 'Rebuilding Acquia',
|
||||||
machineName: 'rebuildingacquia',
|
machineName: 'rebuildingacquia',
|
||||||
type: 'Drupal',
|
type: 'drupal',
|
||||||
level: 'Enterprise',
|
level: 'Enterprise',
|
||||||
environments: {
|
environments: {
|
||||||
dev: {
|
dev: {
|
||||||
|
@ -138,7 +149,7 @@ const data = {
|
||||||
id: 2,
|
id: 2,
|
||||||
name: 'Oliver Davies',
|
name: 'Oliver Davies',
|
||||||
machineName: 'oliverdavies',
|
machineName: 'oliverdavies',
|
||||||
type: 'Drupal',
|
type: 'drupal',
|
||||||
level: 'Professional',
|
level: 'Professional',
|
||||||
environments: {
|
environments: {
|
||||||
dev: {
|
dev: {
|
||||||
|
@ -220,6 +231,10 @@ const data = {
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
|
getTypes() {
|
||||||
|
return data.types
|
||||||
|
},
|
||||||
|
|
||||||
getApplications () {
|
getApplications () {
|
||||||
return data.applications
|
return data.applications
|
||||||
},
|
},
|
||||||
|
@ -231,6 +246,10 @@ export default {
|
||||||
getEnvironment (applicationId, environment) {
|
getEnvironment (applicationId, environment) {
|
||||||
return _(this.getApplication(applicationId))
|
return _(this.getApplication(applicationId))
|
||||||
.get('environments')[environment]
|
.get('environments')[environment]
|
||||||
|
},
|
||||||
|
|
||||||
|
getApplicationType (application) {
|
||||||
|
return this.getTypes()[application.type]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<application-tags :type="application.type" :level="application.level" class="mt-6"></application-tags>
|
<application-tags :type="getApplicationType(application)" :level="application.level" class="mt-6"></application-tags>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex-none w-1/6 text-right">
|
<div class="flex-none w-1/6 text-right">
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
<router-link :to="{name: 'environments', params: {id: id}}" class="text-blue-300 no-underline hover:underline focus:underline"><h2 class="text-base font-normal mb-1">{{ application.name }}</h2></router-link>
|
<router-link :to="{name: 'environments', params: {id: id}}" class="text-blue-300 no-underline hover:underline focus:underline"><h2 class="text-base font-normal mb-1">{{ application.name }}</h2></router-link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<application-tags :type="application.type" :level="application.level" class="w-1/4 px-2"></application-tags>
|
<application-tags :type="getApplicationType(application)" :level="application.level" class="w-1/4 px-2"></application-tags>
|
||||||
|
|
||||||
<div class="w-2/5 px-2">
|
<div class="w-2/5 px-2">
|
||||||
<a href="#0" class="text-blue-300 no-underline hover:underline focus:underline">{{ application.environments['prod'].url }}</a>
|
<a href="#0" class="text-blue-300 no-underline hover:underline focus:underline">{{ application.environments['prod'].url }}</a>
|
||||||
|
@ -47,10 +47,13 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import ApiClient from '@/api-client.js'
|
||||||
import ApplicationTags from '@/components/Application/ApplicationTags'
|
import ApplicationTags from '@/components/Application/ApplicationTags'
|
||||||
import StarToggle from '@/components/Application/StarToggle'
|
import StarToggle from '@/components/Application/StarToggle'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [ApiClient],
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
ApplicationTags,
|
ApplicationTags,
|
||||||
StarToggle
|
StarToggle
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<ul class="list-reset flex flex-wrap -mr-2 -mb-2">
|
<ul class="list-reset flex flex-wrap -mr-2 -mb-2">
|
||||||
<li class="tag is-type">{{ type }}</li>
|
<li class="tag" :data-type="type.id">{{ type.name }}</li>
|
||||||
<li class="tag">{{ level }}</li>
|
<li class="tag">{{ level }}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
level: String,
|
level: String,
|
||||||
type: String
|
type: Object
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -24,4 +24,8 @@ export default {
|
||||||
.tag[data-type="drupal"] {
|
.tag[data-type="drupal"] {
|
||||||
@apply bg-blue-100 border-blue-100 text-white
|
@apply bg-blue-100 border-blue-100 text-white
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tag[data-type="nodejs"] {
|
||||||
|
@apply bg-green border-green text-white
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
<div>
|
<div>
|
||||||
<h1 class="text-4xl font-thin mb-2">Overview</h1>
|
<h1 class="text-4xl font-thin mb-2">Overview</h1>
|
||||||
|
|
||||||
<application-tags :type="application.type" :level="application.level"></application-tags>
|
<application-tags :type="getApplicationType(application)" :level="application.level"></application-tags>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="my-10">
|
<div class="my-10">
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
<div class="mr-16 mb-4 lg:mb-0">
|
<div class="mr-16 mb-4 lg:mb-0">
|
||||||
<h1 class="text-4xl font-thin mb-2">Environments</h1>
|
<h1 class="text-4xl font-thin mb-2">Environments</h1>
|
||||||
|
|
||||||
<application-tags :type="application.type" :level="application.level"></application-tags>
|
<application-tags :type="getApplicationType(application)" :level="application.level"></application-tags>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="lg:flex lg:flex-row-reverse flex-1 justify-between _bg-blue items-baseline">
|
<div class="lg:flex lg:flex-row-reverse flex-1 justify-between _bg-blue items-baseline">
|
||||||
|
|
Reference in a new issue