summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoshie Muranaka <yoshiemuranaka@gmail.com>2020-07-29 23:26:10 +0300
committerGunnar Mills <gmills@us.ibm.com>2020-07-31 03:10:21 +0300
commitd9aa168f7665de46c89c40addce217ac04781209 (patch)
treeca6eca6cd4eae2a60a1335cb686c15c47dfbeeff
parent4008faac0abce2d51d556daae7e3aee004394efc (diff)
downloadwebui-vue-d9aa168f7665de46c89c40addce217ac04781209.tar.xz
Remove envConstants.js file
Removing because current implementations are not using this file but directly referencing process.env.VUE_APP_* value instead. Also removing reference to this file in the env documentation along with the conditional template rendering section. The conditional template pattern is something that should be avoided and currently researching ways to dynamically generate navigation items so we can avoid this pattern. Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Change-Id: Icbb92c423dac2b9b353c3701c330c3b9bfb00d7a
-rw-r--r--src/env/env.md58
-rw-r--r--src/envConstants.js5
2 files changed, 0 insertions, 63 deletions
diff --git a/src/env/env.md b/src/env/env.md
index 573809df..f07375a8 100644
--- a/src/env/env.md
+++ b/src/env/env.md
@@ -6,7 +6,6 @@ This document provides instructions for how to add environment specific modifica
- [Store](#store)
- [Router](#router)
- [Theming](#theming)
-- [Conditional template rendering](#conditional-template-rendering)
- [Local development](#local-development)
- [Production build](#production-build)
@@ -100,63 +99,6 @@ $theme-colors: (
);
```
-## Conditional template rendering
-
-For features that show or hide chunks of code in the template/markup, use the src/`envConstants.js` file, to determine which features are enabled/disabled depending on the `VUE_APP_ENV_NAME` value.
-
->Avoid complex v-if/v-else logic in the templates. If a template is being **heavily** modified, consider creating a separate View and [updating the router definition](#router).
-
-1. Add the environment specific feature name and value in the `envConstants.js` file
-2. Import the ENV_CONSTANTS object in the component needing conditional rendering
-3. Use v-if/else as needed in the component template
-
-Example for adding conditional navigation item to AppNavigation.vue component:
-
-`src/envConstants.js`
-
-```
-const envName = process.env.VUE_APP_ENV_NAME;
-
-export const ENV_CONSTANTS = {
- name: envName || 'openbmc',
- hmcEnabled: envName === 'openpower' ? true : false
-};
-
-```
-
-`src/components/AppNavigation/AppNavigation.vue`
-
-
-```
-<template>
-
-...
-
- <b-nav-item
- to="/access-control/hmc"
- v-if="hmcEnabled">
- HMC
- </b-nav-item>
-
-...
-
-</template>
-
-<script>
-import { ENV_CONSTANTS } from '@/envConstants.js';
-
-export default {
- data() {
- return {
- hmcEnabled: ENV_CONSTANTS.hmcEnabled
- }
- }
-}
-
-</script>
-
-```
-
## Local development
1. Add the same `VUE_APP_ENV_NAME` key value pair to your `env.development.local` file.
diff --git a/src/envConstants.js b/src/envConstants.js
deleted file mode 100644
index f9a4c3c6..00000000
--- a/src/envConstants.js
+++ /dev/null
@@ -1,5 +0,0 @@
-const envName = process.env.VUE_APP_ENV_NAME;
-
-export const ENV_CONSTANTS = {
- name: envName || 'openbmc'
-};