Skip to content

Commit

Permalink
Dev (#649)
Browse files Browse the repository at this point in the history
* update ky, fix ag to svelte example, RestDataApi will look for q and do stringify if its an object

* Fixed quick search

* Fixed search

* refactor select2 so uses same fomratter for displayFields

* comment out select tests since we dont support

* get tests working for jest and ts. revamp truthy and empty

* add jest to the checks

* remove the setup for now

* get jest tests working and move critical tests in, all tests are in __tests__

* Select fixes (#643)

* Fixed select with complex dataApiParams

* Lint fix

* esm to get mockserver working with imports

* reverted ts, to slow.

* fix and cleanup the listctrl dep (#644)

* fix and cleanup the listctrl dep

* should have a property that we pass to GRidCtrl for contextMenuClickAction

* pass everything through with the gridOpts

* fixed showSearchForm

* more clean up

* cleanup to get rid of extendFilters

* removed a bunch of console logs

* add init search to config

* Filtering refactoring

Co-authored-by: alexeyzvegintcev <[email protected]>

* Grid remove listctrl dep (#645)

* fix and cleanup the listctrl dep

* should have a property that we pass to GRidCtrl for contextMenuClickAction

* pass everything through with the gridOpts

* fixed showSearchForm

* more clean up

* cleanup to get rid of extendFilters

* removed a bunch of console logs

* add init search to config

* Filtering refactoring

* get sort squared away

* more lodash cleanup

* fix for es6

* rename to restrictSearch

* add start of the DataQuery class

Co-authored-by: alexeyzvegintcev <[email protected]>

* Grid remove listctrl dep (#646)

* fix and cleanup the listctrl dep

* should have a property that we pass to GRidCtrl for contextMenuClickAction

* pass everything through with the gridOpts

* fixed showSearchForm

* more clean up

* cleanup to get rid of extendFilters

* removed a bunch of console logs

* add init search to config

* Filtering refactoring

* get sort squared away

* more lodash cleanup

* fix for es6

* rename to restrictSearch

* add start of the DataQuery class

Co-authored-by: alexeyzvegintcev <[email protected]>

* fixed foo bar

* Grid fixes (#648)

* Fixed cors issue for grids

* Grid actions without listCtrl import

* Custom toolbar actions

* Fixed typo

Co-authored-by: alexeyzvegintcev <[email protected]>

* Datastore (#647)

* added mixer and batch of tests

* added getter

* added ky type

* get common stuff out on datastore

* rename

* removed grails from demo to cut down on noise

* fix session store

* working demos

* working grids, select2 is broken

* mostly working now

* renames

* simplify

* out of chaos comes order

* det names in order

* fix oageView sub, add unsun for destroy

* rm pwd

* lint fix

* added chip and fixed setting current item

* fix bad comma

* added chip css

* hack to fix sub on addJson

* add go to AppState and apiUrl

* redo api to standardize key instead of endpoint

* add some logging

* more logging

* remove pocs

* Restrict apply grids (#651)

* grids adde restrict search

* gridList restrictSearch

* Fixed grid toolbar (#652)

* TEmp quick fix (#653)

Co-authored-by: alexeyzvegintcev <[email protected]>
  • Loading branch information
basejump and alexeyzvegintcev authored Dec 28, 2021
1 parent 01761b5 commit 719e74b
Show file tree
Hide file tree
Showing 181 changed files with 4,733 additions and 9,012 deletions.
49 changes: 49 additions & 0 deletions examples/demo/rest-sandbox.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This is for VSCode `REST Client` plugin. Use it, it rocks
# @host = https://rcm-dev-api.9ci.io
@host = http://localhost:8080
@base_url = {{host}}/api/ar/customer
# @host = localhost:8080
@contentType = application/json
# @token = dfasfasdfadfs


# @name login
POST {{host}}/api/login
Content-Type: application/json

{"username":"admin","password":"123F"}

###
@token = {{login.response.body.$.access_token}}

### Get Customers### Get Customers
GET {{base_url}}?max=20&page=1&sort=org.calc.totalDue
Authorization: Bearer {{token}}

### get customers query
GET {{base_url}}?q=wal%

### post/create and put/update

# @name post_it
POST {{base_url}}
Content-Type: application/json

{
"num": {{$randomInt 100 10000}},
"name": "Test"
}

### Get it

@created_id = {{post_it.response.body.$.id}}

GET {{base_url}}/{{created_id}}

### update it

PUT {{base_url}}/{{created_id}}

{
"name": "TestUpdate"
}
29 changes: 8 additions & 21 deletions examples/demo/src/app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import _ from 'lodash'
import appName from './app.module'
import './config.router'
import appState from 'angle-grinder/src/tools/AppState'
import {setConfig} from 'angle-grinder/src/tools/AppConfig'
import {setClientConfig} from "angle-grinder/src/dataApi/kyApi";
import { KyFactory } from "angle-grinder/src/stores/ky";
KyFactory.enableAuthHeader()
KyFactory.defaults.prefixUrl = configData.base_url

const app = angular.module(appName)
// export default app.name
Expand Down Expand Up @@ -63,24 +64,10 @@ app.run(function($rootScope, $state, $stateParams) {
appState.sidenav.open = true

$rootScope.appState = appState
setClientConfig({
// configData comes from index.html - to be able to change backend url on fly after build, takes data from `config.js` in root folder of the app
// eslint-disable-next-line no-undef
prefixUrl: configData.base_url
})
// setClientConfig({
// // configData comes from index.html - to be able to change backend url on fly after build, takes data from `config.js` in root folder of the app
// // eslint-disable-next-line no-undef
// prefixUrl: configData.base_url
// })

const conf = {
controls: {
ranges: {
fromField: {
name: '$gt'
},
toField: {
name: '$lt'
}
}
}
}

setConfig(conf)
})
4 changes: 2 additions & 2 deletions examples/demo/src/grids/customGridList/list/ListCtrl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// import controller from './listCtrl'
// import template from './list.html'
import BaseListCtrl from 'angle-grinder/src/ng/gridz/list/BaseListCtrl'
import restStoreApi from '../../../store/RestStoreApi'
import dataApiFactory from '../../../store/dataApiFactory'
import toast from 'angle-grinder/src/tools/toast'

export default class ListCtrl extends BaseListCtrl {
Expand All @@ -17,7 +17,7 @@ export default class ListCtrl extends BaseListCtrl {
// static $inject = _.union(super.$inject, ['someService'])
constructor(...args) {
super(...args)
this.dataApi = restStoreApi.invoice
this.dataApi = dataApiFactory.invoice
}

async $onInit() {
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/src/grids/localStoreGrid/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const template = `\

export default angular
.module(compDemoModule)
.component('basicGridIndex', {
.component('localStoreIndex', {
template: template,
controller: function() {
this.rawHtml = require('./list.html')
Expand Down
4 changes: 2 additions & 2 deletions examples/demo/src/grids/localStoreGrid/list.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<div>
<basic-search-form ng-show="$ctrl.showSearchForm"></basic-search-form>

<gridz ng-if="$ctrl.isConfigured" grid-options="$ctrl.cfg.gridOptions"
<gridz-datastore ng-if="$ctrl.isConfigured" grid-options="$ctrl.cfg.gridOptions"
toolbar-options="$ctrl.cfg.toolbarOptions"
grid-id="basicGrid"
list-ctrl="$ctrl">
</gridz>
</gridz-datastore>

<pre ng-cloak class="mt-4">vm: {{$ctrl.vm | json}}</pre>
<pre ng-cloak class="mt-4">Selected Rows data: {{$ctrl.selectedRowsData | json}}</pre>
Expand Down
9 changes: 4 additions & 5 deletions examples/demo/src/grids/localStoreGrid/listComp.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
// import controller from './listCtrl'
import template from './list.html'
import BaseListCtrl from 'angle-grinder/src/ng/gridz/list/BaseListCtrl'
import ListDataApiCtrl from 'angle-grinder/src/ng/gridz/list-datastore/ListDataApiCtrl'
import buildOptions from './listCtrlOptions'
import localStoreApi from '../../store/LocalStoreApi'
import sessionStores from '../../store/sessionServices'
import Log from 'angle-grinder/src/utils/Log'
import Swal from 'angle-grinder/src/tools/swal'
import _ from 'lodash'

class ListCtrl extends BaseListCtrl {
class ListCtrl extends ListDataApiCtrl {
isLoaded = false

editTemplate = require('./templates/editDialog.html')
bulkUpdateTemplate = require('./templates/bulkUpdateForm.html')

constructor(...args) {
super(...args)
this.dataApi = localStoreApi.invoice
this.dataApi = sessionStores.invoice
}

async $onInit() {
// this.dataApi = localStoreApi.invoice
this.cfg = buildOptions(this)
await this.doConfig(this.cfg)
}
Expand Down
33 changes: 23 additions & 10 deletions examples/demo/src/grids/routes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import dataApiFactory from '../store/dataApiFactory'

const gridsStates = {
name: 'grids',
abstract: true,
Expand All @@ -7,15 +9,15 @@ const gridsStates = {
},
children: [
{
name: 'vanilla-agGridList',
data: { title: 'Customer Grid Example' },
abstract: 'fresh.grid.vanilla-agGridList.list',
url: '/customer',
name: 'agGridDatastore',
data: { title: 'Customer Grid' },
abstract: 'fresh.grid.agGridDatastore.list',
url: '/customer-ds',
children: [{
name: 'list',
isMenuItem: false,
url: '',
component: 'agGridList'
component: 'agGridDatastore'
}, {
name: 'Edit Customer',
isMenuItem: false,
Expand All @@ -24,6 +26,11 @@ const gridsStates = {
}],
resolve: {
apiKey: () => 'customer',
dataApi: () => {
let ds = dataApiFactory.customer
console.log("dataApiFactory.customer", ds)
return ds
},
// gridOptions: () => ({multiSort: true}),
notification: () => ({
class: 'is-primary is-light',
Expand All @@ -40,7 +47,7 @@ const gridsStates = {
name: 'list',
isMenuItem: false,
url: '',
component: 'agGridList'
component: 'agGridDatastore'
}, {
name: 'Edit Customer',
isMenuItem: false,
Expand All @@ -49,6 +56,9 @@ const gridsStates = {
}],
resolve: {
apiKey: () => 'customer',
dataApi: () => {
return dataApiFactory.customer
},
initSearch: () => ({ name: 'Yodo' }),
notification: () => ({
class: 'is-primary is-light',
Expand All @@ -59,10 +69,13 @@ const gridsStates = {
{
name: 'editOnly-agGridList',
url: '/tag',
component: 'agGridList',
component: 'agGridDatastore',
data: { title: 'Edit Only agGridList' },
resolve: {
apiKey: () => 'tag',
dataApi: () => {
return dataApiFactory.tag
},
notification: () => ({
class: 'is-primary is-light',
text: 'Uses ui-router to send rest apiKey to generic agGridList component, configured to only allow editing desc'
Expand All @@ -80,9 +93,9 @@ const gridsStates = {
component: 'basicGridRestIndex'
},
{
name: 'basic-grid',
component: 'basicGridIndex',
url: '/foo'
name: 'local-store-grid',
component: 'localStoreIndex',
url: '/localstore'
}
]
}
Expand Down
10 changes: 5 additions & 5 deletions examples/demo/src/grids/twoGrids/customerList/ListCtrl.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import BaseListCtrl from 'angle-grinder/src/ng/gridz/list/BaseListCtrl'
import restStoreApi from '../../../store/RestStoreApi'
import ListDataApiCtrl from 'angle-grinder/src/ng/gridz/list-datastore/ListDataApiCtrl'
import dataApiFactory from '../../../store/dataApiFactory'
import _ from 'lodash'

export default class ListCtrl extends BaseListCtrl {
static $inject = _.union(super.$inject, ['dataStoreApi', '$state', 'selectedRow'])
export default class ListCtrl extends ListDataApiCtrl {
static $inject = _.union(super.$inject, ['$state', 'selectedRow'])
apiKey = 'customer'
eventHandlers = {
onSelect: (event, id) => {
Expand All @@ -13,7 +13,7 @@ export default class ListCtrl extends BaseListCtrl {

constructor(...args) {
super(...args)
this.dataApi = restStoreApi.customer
this.dataApi = dataApiFactory.customer
}

async $onInit() {
Expand Down
4 changes: 2 additions & 2 deletions examples/demo/src/grids/twoGrids/customerList/list.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div >
<gridz ng-if="$ctrl.isConfigured" grid-options="$ctrl.cfg.gridOptions"
<gridz-datastore ng-if="$ctrl.isConfigured" grid-options="$ctrl.cfg.gridOptions"
toolbar-options="$ctrl.cfg.toolbarOptions"
grid-id="customerGrid"
list-ctrl="$ctrl">
</gridz>
</gridz-datastore>

</div>
14 changes: 7 additions & 7 deletions examples/demo/src/grids/twoGrids/invoistList/ListCtrl.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
// import controller from './listCtrl'
// import template from './list.html'
import BaseListCtrl from 'angle-grinder/src/ng/gridz/list/BaseListCtrl'
import restStoreApi from '../../../store/RestStoreApi'
import ListDataApiCtrl from 'angle-grinder/src/ng/gridz/list-datastore/ListDataApiCtrl'
import dataApiFactory from '../../../store/dataApiFactory'
import _ from 'lodash'

export default class ListCtrl extends BaseListCtrl {
static $inject = _.union(super.$inject, ['dataStoreApi', '$state', 'selectedRow'])
export default class ListCtrl extends ListDataApiCtrl {
static $inject = _.union(super.$inject, ['$state', 'selectedRow'])
apiKey = 'invoice'
searchModel= {}
eventHandlers = {
}
eventHandlers = {}

// static $inject = _.union(super.$inject, ['someService'])
constructor(...args) {
super(...args)
this.dataApi = restStoreApi.invoice
this.dataApi = dataApiFactory.invoice
}

async $onInit() {

this.isConfigured = false
this.cfg = {}
await this.doConfig()
Expand Down
4 changes: 2 additions & 2 deletions examples/demo/src/grids/twoGrids/invoistList/list.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div >
<gridz ng-if="$ctrl.isConfigured" grid-options="$ctrl.cfg.gridOptions"
<gridz-datastore ng-if="$ctrl.isConfigured" grid-options="$ctrl.cfg.gridOptions"
toolbar-options="$ctrl.cfg.toolbarOptions"
grid-id="invoiceGrid"
list-ctrl="$ctrl">
</gridz>
</gridz-datastore>
</div>
27 changes: 0 additions & 27 deletions examples/demo/src/store/LocalStoreApi.js

This file was deleted.

40 changes: 0 additions & 40 deletions examples/demo/src/store/RestStoreApi.js

This file was deleted.

Loading

0 comments on commit 719e74b

Please sign in to comment.