Skip to content

Commit

Permalink
Merge pull request #47 from ansibleguy76/release/v3.0.3
Browse files Browse the repository at this point in the history
v3.0.3 into main
  • Loading branch information
ansibleguy76 authored Jun 2, 2022
2 parents ea5d5c9 + 020aea5 commit 4664262
Show file tree
Hide file tree
Showing 14 changed files with 713 additions and 215 deletions.
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.0.3] - 2022-06-02

### Changed

- Improved gui management (table format with paging and filtering)
- Updated all packages and no-cache build

### Fixed

- You cannot remove a group with users

## [3.0.2] - 2022-04-25

### Added
Expand Down Expand Up @@ -263,7 +274,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Allow change password for current local user
- Start tracking versions

[Unreleased]: https://github.com/ansibleguy76/ansibleforms/compare/3.0.2...HEAD
[Unreleased]: https://github.com/ansibleguy76/ansibleforms/compare/3.0.3...HEAD

[3.0.3]: https://github.com/ansibleguy76/ansibleforms/compare/3.0.2...3.0.3

[3.0.2]: https://github.com/ansibleguy76/ansibleforms/compare/3.0.1...3.0.2

Expand Down
4 changes: 2 additions & 2 deletions app_versions.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ext.version_code = 30002
ext.version_name = "3.0.2"
ext.version_code = 30003
ext.version_name = "3.0.3"
28 changes: 14 additions & 14 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ansible_forms_vue",
"version": "3.0.2",
"version": "3.0.3",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand All @@ -12,16 +12,16 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "~3.21.1",
"core-js": "~3.22.8",
"vue": "~2.6.14",
"axios": "~0.26.0",
"axios": "~0.27.2",
"es6-promise": "~4.2.8",
"vuelidate": "~0.7.6",
"vue-router": "~3.5.3",
"vuelidate": "~0.7.7",
"vue-router": "~3.5.4",
"vue-toastification" : "1.7.14",
"vue-json-pretty" : "1.8.2",
"vue-json-pretty" : "1.8.3",
"copy-to-clipboard" : "*",
"bulma" : "*",
"bulma" : "0.9.4",
"bulma-quickview" : "*",
"bulma-checkradio": "~2.1.3",
"bulma-pageloader": "~0.3.0",
Expand All @@ -30,13 +30,13 @@
"vue-highlight.js": "3.1.0",
"vue-bulma-paginate" : "*",
"vue-moment" : "*",
"yaml": "*",
"yaml": "1.10.2",
"thenby": "*",
"vue-showdown": "2.4.1",
"@fortawesome/fontawesome-svg-core":"~1.3.0",
"@fortawesome/free-solid-svg-icons":"~6",
"@fortawesome/free-regular-svg-icons":"~6",
"@fortawesome/free-brands-svg-icons":"~6",
"@fortawesome/fontawesome-svg-core":"~6.1.1",
"@fortawesome/free-solid-svg-icons":"~6.1.1",
"@fortawesome/free-regular-svg-icons":"~6.1.1",
"@fortawesome/free-brands-svg-icons":"~6.1.1",
"@fortawesome/vue-fontawesome":"2.0.6",
"@femessage/log-viewer":"*"

Expand All @@ -50,8 +50,8 @@
"eslint": "~7.5.0",
"eslint-plugin-vue": "~6.2.2",
"vue-template-compiler": "~2.6.11",
"nodemon": "~2.0.15",
"sass" :"~1.49.9",
"nodemon": "~2.0.16",
"sass" :"~1.49.11",
"sass-loader":"10.1.1"
},
"eslintConfig": {
Expand Down
122 changes: 122 additions & 0 deletions client/src/components/BulmaAdminTable.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<template>
<div>
<table class="table is-bordered is-striped is-fullwidth">
<thead class="has-background-primary" @click="$emit('reset')">
<tr>
<th class="has-text-white is-first">Actions</th>
<th class="has-text-white" v-for="label,idx in labels" :key="'label_'+label">{{label}}

<span
v-if="filters.includes(columns[idx])"
class="icon dropdown is-clickable is-active"
:class="{'has-text-warning':filterValues[columns[idx]]!=''}"
@click="showFilters=!showFilters"
>
<font-awesome-icon class="dropdown-trigger" icon="filter" size="xs" />

</span>
</th>
</tr>
</thead>
<tbody>
<tr class="has-background-success-light" v-if="showFilters">
<th class="has-text-white is-first"></th>
<th class="has-text-white" v-for="column in columns" :key="'filter_'+column">
<p v-if="filters.includes(column)" class="control has-icons-left has-icons-right">
<input class="input" v-model="filterValues[column]" />
<span class="icon is-small is-left">
<font-awesome-icon icon="filter" />
</span>
</p>
</th>
</tr>
<tr v-for="item in displayedList" :key="'item_'+((identifier)?item[identifier]:item)" :class="{'has-background-link-light':(identifier)?currentItem==item[identifier]:currentItem==item}">
<td class="is-first">
<template v-for="a in actions" >
<span :key="'action_'+a.name" v-if="item['allow'+a.name]==undefined || item['allow'+a.name]==true" class="icon is-clickable" :class="a.color" :title="a.title" @click="(identifier)?action(a.name,item[identifier]):action(a.name,item)"><font-awesome-icon :icon="a.icon" /></span>
<span :key="'action_'+a.name" v-else class="icon has-text-grey-light"><font-awesome-icon :icon="a.icon" /></span>
</template>
</td>
<td
class="is-clickable"
@click="(identifier)?action(actions[0].name,item[identifier]):action(actions[0].name,item)"
v-for="column in columns"
:key="'item_'+item.name+'_value_'+column"
>
{{ (column)?item[column]:item }}
</td>
</tr>
</tbody>
</table>
<BulmaNavigation
:dataList="filteredList"
:perPage="perPage"
:buttonsShown="buttonsShown"
@change="setDisplayedList"
/>
</div>
</template>
<script>
import Vue from 'vue'
import BulmaNavigation from './BulmaNavigation.vue'
export default{
name:"BulmaAdminTable",
components: {BulmaNavigation},
props:{
dataList:{type:Array},
labels:{type:Array},
columns:{type:Array},
filters:{type:Array,default:()=>{return []}},
actions:{type:Array},
identifier:{type:String},
currentItem:{type:[String,Number]},
perPage:{type:Number,default:10},
buttonsShown:{type:Number,default:3}
},
data(){
return {
displayedList:[],
filterValues:{},
showFilters:false
}
},methods:{
action(name,id){
this.$emit(name,id)
},
setDisplayedList(list){
this.displayedList=list
}
},
computed:{
filteredList(){
var ref=this
var idx
return this.dataList.filter(record => {
var found=true
ref.filters.forEach(field => {
if(ref.filterValues[field] && !record[field].toUpperCase().includes(ref.filterValues[field].toUpperCase()))found=false
});
return found
})
}
},
mounted(){
var ref=this
ref.filters.forEach(field => {
Vue.set(ref.filterValues,field,"")
});
}
}
</script>
<style scoped>
.table td,.table th{
max-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
table thead th.is-first,table tbody td.is-first{
width:8em!important;
max-width:8em!important;
}
</style>
110 changes: 110 additions & 0 deletions client/src/components/BulmaNavigation.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<template>
<nav v-if="dataList.length>perPage" class="pagination" role="pagination" aria-label="pagination">
<a class="pagination-previous" v-if="page != 1" @click="setPage(page-1)">Previous</a>
<a class="pagination-next" @click="setPage(page+1)" v-if="page < pages.length">Next page</a>
<ul class="pagination-list">
<li>
<a class="pagination-link" v-if="showFirstPage" :class="{'is-current':1==page}" @click="setPage(1)" aria-label="Goto page 1">1</a>
</li>
<li>
<span class="pagination-ellipsis" v-if="showFirstEllipsis">&hellip;</span>
</li>
<li v-for="pageNumber in displayedPages" :key="pageNumber">
<a class="pagination-link" :class="{'is-current':pageNumber==page}" @click="setPage(pageNumber)" :aria-label="'Goto page '+pageNumber">{{pageNumber}}</a>
</li>
<li>
<span class="pagination-ellipsis" v-if="showLastEllipsis">&hellip;</span>
</li>
<li>
<a class="pagination-link" v-if="showLastPage" :class="{'is-current':page==(pages.length)}" @click="setPage(pages.length)" :aria-label="'Goto page '+pages.length">{{pages.length}}</a>
</li>
</ul>
</nav>
</template>
<script>
import Vue from 'vue'
export default{
name:"BulmaNavigation",
components: {},
props:{
dataList:{type:Array},
perPage:{type:Number},
buttonsShown:{type:Number},
index:{type:Number}
},
data(){
return {
page:1
}
},methods:{
setPage(page){
this.page=page
this.change()
},
paginate (list) {
let page = this.page;
let perPage = this.perPage;
let from = (page * perPage) - perPage;
let to = (page * perPage);
return list.slice(from, to);
},
change(){
this.$emit('change',this.displayedItems)
}
},
watch: {
displayedItems() {
this.$emit('change',this.displayedItems)
}
},
computed:{
displayedItems () {
return this.paginate(this.dataList);
},
displayedPages(){
var from=this.page-1 // from the first
if(from==0)from=1 // force on first
var to = this.page+this.buttonsShown
// for x from the last
if(this.page>=this.pages.length-this.buttonsShown){
from=this.pages.length-this.buttonsShown-1
}
// make sure the have the right amount of buttons
if((to-from)!=this.buttonsShown)to=this.buttonsShown+from
// if all can be show, show all - otherwise a subset
if(this.buttonsShown>=this.pages.length){
return this.pages
}else{
return this.pages.slice(from, to)
}
},
showFirstPage(){
return !(this.displayedPages.includes(1))
},
showLastPage(){
return !(this.displayedPages.includes(this.pages.length))
},
showFirstEllipsis(){
return (this.page>2 && this.pages.length>=2 && !this.displayedPages.includes(2))
},
showLastEllipsis(){
return (!this.displayedPages.includes(this.pages.length-1) && this.page<(this.pages.length-1))
},
pages () {
let numberOfPages = Math.ceil(this.dataList.length / this.perPage);
return Array.from(Array(numberOfPages), (_,x) => x+1);
},
pageByIndex(){
if(!(this.index>0))return 1
var x = this.index/this.perPage
return Math.floor(x+1)
},
},
mounted(){
this.page=this.pageByIndex
this.change()
}
}
</script>
<style scoped>
</style>
Loading

0 comments on commit 4664262

Please sign in to comment.