diff options
author | Thomas Duval <thomas.duval@orange.com> | 2020-06-03 10:06:52 +0200 |
---|---|---|
committer | Thomas Duval <thomas.duval@orange.com> | 2020-06-03 10:06:52 +0200 |
commit | 7bb53c64da2dcf88894bfd31503accdd81498f3d (patch) | |
tree | 4310e12366818af27947b5e2c80cb162da93a4b5 /dashboard/src/views/Models.vue | |
parent | cbea4e360e9bfaa9698cf7c61c83c96a1ba89b8c (diff) |
Update to new version 5.4HEADstable/jermamaster
Signed-off-by: Thomas Duval <thomas.duval@orange.com>
Change-Id: Idcd868133d75928a1ffd74d749ce98503e0555ea
Diffstat (limited to 'dashboard/src/views/Models.vue')
-rw-r--r-- | dashboard/src/views/Models.vue | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/dashboard/src/views/Models.vue b/dashboard/src/views/Models.vue new file mode 100644 index 00000000..bdd46483 --- /dev/null +++ b/dashboard/src/views/Models.vue @@ -0,0 +1,80 @@ +<template> + <div> + <orphans + @close="allowAlert = false" + v-if="showAlert" + :orphanMetaRules="orphanMetaRules" + :orphanSubjectCategories="orphanSubjectCategories" + :orphanObjectCategories="orphanObjectCategories" + :orphanActionCategories="orphanActionCategories" + ></orphans> + + <br /> + <form-header + placeholder="Filter" + buttonText="Create Model" + @click="creatingModel = true" + v-model="filter" + need-button + ></form-header> + <br /> + + <CreateModel v-if="creatingModel" @close="creatingModel = false"></CreateModel> + <div class="list-group row" v-else> + <Model v-for="model in filteredModels" :key="model.id" :model="model"></Model> + </div> + </div> +</template> + +<script> +import Model from "./../components/model/Model.vue"; +import CreateModel from "./../components/model/CreateModel.vue"; +import ModelService from "./../services/Model.service.js"; +import util from "./../services/Util.service.js"; +import Orphans from "./../components/model/Orphans.vue"; +import FormHeader from "./../components/FormHeader.vue"; + +export default { + name: "models", + components: { + Model, + CreateModel, + FormHeader, + Orphans + }, + mounted() { + ModelService.initialize(); + this.models = ModelService.models; + this.orphanMetaRules = ModelService.orphanMetaRules; + this.orphanSubjectCategories = ModelService.orphanSubjectCategories; + this.orphanObjectCategories = ModelService.orphanObjectCategories; + this.orphanActionCategories = ModelService.orphanActionCategories; + }, + data() { + return { + filter: "", + creatingModel: false, + allowAlert: true, + orphanMetaRules: [], + orphanSubjectCategories: [], + orphanActionCategories: [], + orphanObjectCategories: [], + models: [] + }; + }, + computed: { + showAlert() { + return ( + this.allowAlert && + (this.orphanMetaRules.length || + this.orphanSubjectCategories.length || + this.orphanActionCategories.length || + this.orphanObjectCategories.length) + ); + }, + filteredModels() { + return util.filterAndSortByName(this.models, this.filter); + } + } +}; +</script> |