Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*egg-info
*pyc
/dist/
/.coverage
/.mxmake
/.vscode
Expand Down
19 changes: 10 additions & 9 deletions js/src/tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ export class TokensOverview {
this.container = container;
this.tokens_elem = $('#tokens-overview', container);
this.tokens = $('object.token_qr', this.tokens_elem);
this.tokens_title = $('#tokens-overview-title', container);
this.filter_options = $('#tokens-filter-options', container);
this.create_options = $('#tokens-create-options', container);
this.token_settings = this.container.data('token-settings');

// add tokens
this.add_tokens_container = $('.add-tokens', this.tokens_title);
this.add_tokens_container = $('.add-tokens', this.create_options);
this.add_tokens_input = $(
'input[name="amount"]',
this.add_tokens_container
Expand All @@ -30,18 +31,18 @@ export class TokensOverview {
this.add_tokens_btn.on('click', this.add_tokens);

// date filter
this.start = $('input[name="start"]', this.tokens_title)
this.start = $('input[name="start"]', this.filter_options)
.addClass('datepicker')
.data('date-locale', 'de');
this.end = $('input[name="end"]', this.tokens_title)
this.end = $('input[name="end"]', this.filter_options)
.addClass('datepicker')
.data('date-locale', 'de');
this.filter = $('button[name="filter"]', this.tokens_title);
this.filter = $('button[name="filter"]', this.filter_options);
this.filter_tokens = this.filter_tokens.bind(this);
this.filter.on('click', this.filter_tokens);

// delete tokens
this.delete_tokens_container = $('.delete-tokens', this.tokens_title);
this.delete_tokens_container = $('.delete-tokens', this.create_options);
this.delete_tokens_btn = $(
'button[name="delete-tokens"]',
this.delete_tokens_container
Expand All @@ -50,7 +51,7 @@ export class TokensOverview {
this.delete_tokens_btn.on('click', this.delete_tokens);

this.set_token_size = this.set_token_size.bind(this);
this.size_input = $('input[name="token-size"]', this.tokens_title);
this.size_input = $('input[name="token-size"]', this.filter_options);
this.size_input.on('change', this.set_token_size);
if (this.tokens.length) {
this.original_size = parseInt($(this.tokens[0]).attr('width'));
Expand Down Expand Up @@ -222,13 +223,13 @@ export class TokenScanner {
let input = this._input = $('<input type="text">');
wrapper.append(input);
this.elem.append(wrapper);
button.removeClass('inactive').addClass('active');
button.removeClass('inactive btn-danger').addClass('active btn-success');
input[0].focus();
} else {
this._input_wrapper.remove();
this._input_wrapper = null;
this._input = null;
button.removeClass('active').addClass('inactive');
button.removeClass('active btn-success').addClass('inactive btn-danger');
}
}

Expand Down
31 changes: 19 additions & 12 deletions js/tests/test_tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,41 @@ import ts from 'treibstoff';

QUnit.module('TokensOverview', hooks => {
let elem,
tokens_title,
tokens_filter,
tokens_elem,
add_tokens_input,
token_size_input,
start_input,
end_input;
hooks.beforeEach(() => {
elem = $('<div />')
.addClass('tokens-overview-container')
.appendTo('body');
tokens_title = $('<div id="tokens-overview-title" />')
.appendTo(elem);
tokens_elem = $('<div id="tokens-overview" />')
.appendTo(elem);
let token_size_input = $('<input name="token-size" />')
.appendTo(tokens_title);
// filter
tokens_filter = $('<div id="tokens-filter-options" />')
.appendTo(elem);
token_size_input = $('<input name="token-size" />')
.appendTo(tokens_filter);
start_input = $('<input name="start" />')
.appendTo(tokens_filter);
end_input = $('<input name="end" />')
.appendTo(tokens_filter);
// add tokens
let add_tokens = $('<div id="tokens-create-options" />')
.appendTo(elem);
let add_tokens_container = $('<div class="add-tokens" />')
.appendTo(tokens_title);
.appendTo(add_tokens);
add_tokens_input = $('<input name="amount" />')
.appendTo(add_tokens_container);
start_input = $('<input name="start" />')
.appendTo(tokens_title);
end_input = $('<input name="end" />')
.appendTo(tokens_title);

});
hooks.afterEach(() => {
elem.empty().remove();
elem = null;
tokens_elem = null;
tokens_title = null;
tokens_filter = null;
});

QUnit.test('constructor no tokens', assert => {
Expand Down Expand Up @@ -120,6 +126,7 @@ QUnit.module('TokensOverview', hooks => {

// reset ts ajax
ts.ajax.action = original_ts_action;
assert.ok(true)
});

QUnit.test('add_tokens', assert => {
Expand Down Expand Up @@ -331,8 +338,8 @@ QUnit.module('TokenScanner', hooks => {
assert.verifySteps(['query_token token-1']);
});

let force_success = false;
QUnit.test('query_token', assert => {
let force_success = false;
let force_data_success = false;
let data_token = false;

Expand Down
39 changes: 18 additions & 21 deletions mx.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ cs_push = git@github.com:conestack
# checkout source packages
checkout_packages = true

# feature branch to checkout
feature_branch = master

# main package
main-package = -e .[test]

Expand Down Expand Up @@ -41,15 +38,15 @@ environment = env
use = ${settings:checkout_packages}
url = ${settings:cs}/odict.git
pushurl = ${settings:cs_push}/odict.git
branch = ${settings:feature_branch}
branch = master
mxmake-test-path = tests
mxmake-source-path = src/odict

[plumber]
use = ${settings:checkout_packages}
url = ${settings:cs}/plumber.git
pushurl = ${settings:cs_push}/plumber.git
branch = ${settings:feature_branch}
branch = master
extras = test
mxmake-test-path = tests
mxmake-source-path = src/plumber
Expand All @@ -62,15 +59,15 @@ mxmake-source-path = src/plumber
use = ${settings:checkout_packages}
url = ${settings:cs}/node.git
pushurl = ${settings:cs_push}/node.git
branch = ${settings:feature_branch}
branch = master
mxmake-test-path = src
mxmake-source-path = src/node

[node.ext.ugm]
use = ${settings:checkout_packages}
url = ${settings:cs}/node.ext.ugm.git
pushurl = ${settings:cs_push}/node.ext.ugm.git
branch = ${settings:feature_branch}
branch = master
extras = test
mxmake-test-path = src
mxmake-source-path = src/node/ext/ugm
Expand All @@ -83,7 +80,7 @@ mxmake-source-path = src/node/ext/ugm
use = ${settings:checkout_packages}
url = ${settings:cs}/yafowil.git
pushurl = ${settings:cs_push}/yafowil.git
branch = ${settings:feature_branch}
branch = master
extras = test
mxmake-test-path = src
mxmake-source-path = src/yafowil
Expand All @@ -92,31 +89,31 @@ mxmake-source-path = src/yafowil
use = ${settings:checkout_packages}
url = ${settings:cs}/yafowil.yaml.git
pushurl = ${settings:cs_push}/yafowil.yaml.git
branch = ${settings:feature_branch}
branch = master
mxmake-test-path = src
mxmake-source-path = src/yafowil/yaml

[yafowil.webob]
use = ${settings:checkout_packages}
url = ${settings:cs}/yafowil.webob.git
pushurl = ${settings:cs_push}/yafowil.webob.git
branch = ${settings:feature_branch}
branch = master
mxmake-test-path = src
mxmake-source-path = src/yafowil/webob

[yafowil.bootstrap]
use = ${settings:checkout_packages}
url = ${settings:cs}/yafowil.bootstrap.git
pushurl = ${settings:cs_push}/yafowil.bootstrap.git
branch = ${settings:feature_branch}
branch = master
mxmake-test-path = src
mxmake-source-path = src/yafowil/bootstrap

[yafowil.widget.array]
use = ${settings:checkout_packages}
url = ${settings:cs}/yafowil.widget.array.git
pushurl = ${settings:cs_push}/yafowil.widget.array.git
branch = ${settings:feature_branch}
branch = master
extras = test
mxmake-test-path = src
mxmake-source-path = src/yafowil/widget/array
Expand All @@ -126,7 +123,7 @@ mxmake-omit-path = src/yafowil/widget/array/example.py
use = ${settings:checkout_packages}
url = ${settings:cs}/yafowil.widget.autocomplete.git
pushurl = ${settings:cs_push}/yafowil.widget.autocomplete.git
branch = ${settings:feature_branch}
branch = master
extras = test
mxmake-test-path = src
mxmake-source-path = src/yafowil/widget/autocomplete
Expand All @@ -136,7 +133,7 @@ mxmake-omit-path = src/yafowil/widget/autocomplete/example.py
use = ${settings:checkout_packages}
url = ${settings:cs}/yafowil.widget.datetime.git
pushurl = ${settings:cs_push}/yafowil.widget.datetime.git
branch = ${settings:feature_branch}
branch = master
extras = test
mxmake-test-path = src
mxmake-source-path = src/yafowil/widget/datetime
Expand All @@ -146,7 +143,7 @@ mxmake-omit-path = src/yafowil/widget/datetime/example.py
use = ${settings:checkout_packages}
url = ${settings:cs}/yafowil.widget.dict.git
pushurl = ${settings:cs_push}/yafowil.widget.dict.git
branch = ${settings:feature_branch}
branch = master
extras = test
mxmake-test-path = src
mxmake-source-path = src/yafowil/widget/dict
Expand All @@ -156,7 +153,7 @@ mxmake-omit-path = src/yafowil/widget/dict/example.py
use = ${settings:checkout_packages}
url = ${settings:cs}/yafowil.widget.image.git
pushurl = ${settings:cs_push}/yafowil.widget.image.git
branch = ${settings:feature_branch}
branch = master
extras = test
mxmake-test-path = src
mxmake-source-path = src/yafowil/widget/image
Expand All @@ -170,7 +167,7 @@ mxmake-omit-path = src/yafowil/widget/image/example.py
use = ${settings:checkout_packages}
url = ${settings:cs}/treibstoff.git
pushurl = ${settings:cs_push}/treibstoff.git
branch = ${settings:feature_branch}
branch = 2.0

[webresource]
use = ${settings:checkout_packages}
Expand All @@ -185,7 +182,7 @@ mxmake-source-path = webresource
use = ${settings:checkout_packages}
url = ${settings:cs}/cone.tile.git
pushurl = ${settings:cs_push}/cone.tile.git
branch = ${settings:feature_branch}
branch = master
extras = test
mxmake-test-path = src
mxmake-source-path = src/cone/tile
Expand All @@ -194,7 +191,7 @@ mxmake-source-path = src/cone/tile
use = ${settings:checkout_packages}
url = ${settings:cs}/cone.app.git
pushurl = ${settings:cs_push}/cone.app.git
branch = ${settings:feature_branch}
branch = 2.0
extras = test
mxmake-test-path = src
mxmake-source-path = src/cone/app
Expand All @@ -203,7 +200,7 @@ mxmake-source-path = src/cone/app
use = ${settings:checkout_packages}
url = ${settings:cs}/cone.sql.git
pushurl = ${settings:cs_push}/cone.sql.git
branch = ${settings:feature_branch}
branch = master
extras = test
mxmake-test-path = src
mxmake-source-path = src/cone/sql
Expand All @@ -212,7 +209,7 @@ mxmake-source-path = src/cone/sql
use = ${settings:checkout_packages}
url = ${settings:cs}/cone.ugm.git
pushurl = ${settings:cs_push}/cone.ugm.git
branch = ${settings:feature_branch}
branch = 2.0
extras = test
mxmake-test-path = src
mxmake-source-path = src/cone/ugm
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"qunit": "^2.20.1",
"rollup": "^2.79.2",
"rollup-plugin-cleanup": "^3.2.1",
"sass": "^1.94.2",
"sass": "^1.96.0",
"web-test-runner-qunit": "^2.0.0"
},
"packageManager": "pnpm@9.3.0+sha512.ee7b93e0c2bd11409c6424f92b866f31d3ea1bef5fbe47d3c7500cdc3c9668833d2e55681ad66df5b640c61fa9dc25d546efa54d76d7f8bf54b13614ac293631"
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "cone.tokens"
version = "1.1.0.dev0"
version = "2.0.0.dev0"
description = "cone token api"
dynamic = ["readme"]
requires-python = ">=3.10"
Expand All @@ -22,7 +22,7 @@ classifiers = [
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
]
dependencies = [
"cone.app>1.0.99,<2.0.0",
"cone.app>1.99",
"cone.sql>1.0.99",
"python-dateutil",
"qrcode[pil]",
Expand Down
Loading