From bfa75399405b49cb47a67087943818b6b3aa9562 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sun, 31 Mar 2019 19:05:34 +0100 Subject: [PATCH] Make tags an object, style based on data value --- src/api-client.js | 23 +++++++++++++++++-- .../Application/ApplicationCard.vue | 7 ++++-- .../Application/ApplicationTags.vue | 8 +++++-- src/views/Environment.vue | 2 +- src/views/Environments.vue | 2 +- 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/api-client.js b/src/api-client.js index 7a54abe..43acdd3 100644 --- a/src/api-client.js +++ b/src/api-client.js @@ -1,12 +1,23 @@ import _ from 'lodash' const data = { + types: { + drupal: { + id: 'drupal', + name: 'Drupal' + }, + nodejs: { + id: 'nodejs', + name: 'Node.js' + } + }, + applications: { 1: { id: 1, name: 'Rebuilding Acquia', machineName: 'rebuildingacquia', - type: 'Drupal', + type: 'drupal', level: 'Enterprise', environments: { dev: { @@ -138,7 +149,7 @@ const data = { id: 2, name: 'Oliver Davies', machineName: 'oliverdavies', - type: 'Drupal', + type: 'drupal', level: 'Professional', environments: { dev: { @@ -220,6 +231,10 @@ const data = { export default { methods: { + getTypes() { + return data.types + }, + getApplications () { return data.applications }, @@ -231,6 +246,10 @@ export default { getEnvironment (applicationId, environment) { return _(this.getApplication(applicationId)) .get('environments')[environment] + }, + + getApplicationType (application) { + return this.getTypes()[application.type] } } } diff --git a/src/components/Application/ApplicationCard.vue b/src/components/Application/ApplicationCard.vue index c64e7eb..80894f2 100644 --- a/src/components/Application/ApplicationCard.vue +++ b/src/components/Application/ApplicationCard.vue @@ -13,7 +13,7 @@ - +
@@ -30,7 +30,7 @@

{{ application.name }}

- +
{{ application.environments['prod'].url }} @@ -47,10 +47,13 @@ @@ -24,4 +24,8 @@ export default { .tag[data-type="drupal"] { @apply bg-blue-100 border-blue-100 text-white } + +.tag[data-type="nodejs"] { + @apply bg-green border-green text-white +} diff --git a/src/views/Environment.vue b/src/views/Environment.vue index d89e076..8066cd2 100644 --- a/src/views/Environment.vue +++ b/src/views/Environment.vue @@ -44,7 +44,7 @@

Overview

- +
diff --git a/src/views/Environments.vue b/src/views/Environments.vue index 351ccd2..54a1dfa 100644 --- a/src/views/Environments.vue +++ b/src/views/Environments.vue @@ -48,7 +48,7 @@

Environments

- +