Skip to content

Commit b453065

Browse files
committed
remove app.wq_config (see wq/wq#54)
1 parent 60cd668 commit b453065

File tree

3 files changed

+11
-23
lines changed

3 files changed

+11
-23
lines changed

packages/app/src/app.js

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ var app = {
1111
OFFLINE: 'offline',
1212
FAILURE: 'failure',
1313
ERROR: 'error',
14-
get wq_config() {
15-
return this.getAuthState().config || this.config;
16-
},
1714
get user() {
1815
return this.getAuthState().user;
1916
},
@@ -209,7 +206,7 @@ app.init = function (config) {
209206
// Register routes with wq/router.js
210207
var root = false;
211208
Object.keys(app.config.pages).forEach(function (page) {
212-
var conf = _getBaseConf(page);
209+
var conf = _getConf(page);
213210
if (!conf.url) {
214211
root = true;
215212
}
@@ -540,7 +537,7 @@ const syncUpdateUrl = {
540537

541538
// Return a list of all foreign key fields
542539
app.getParents = function (page) {
543-
var conf = _getBaseConf(page);
540+
var conf = _getConf(page);
544541
return conf.form
545542
.filter(function (field) {
546543
return field['wq:ForeignKey'];
@@ -630,7 +627,7 @@ function _extendRouteInfo(routeInfo) {
630627
const routeName = routeInfo.name,
631628
itemid = (page !== 'outbox' && routeInfo.slugs.slug) || null;
632629
var [page, mode, variant] = app.splitRoute(routeName),
633-
conf = _getConf(page, true, true),
630+
conf = _getConf(page, true),
634631
pageid = null;
635632

636633
if (conf) {
@@ -675,14 +672,14 @@ function _extendRouteInfo(routeInfo) {
675672
// Generate list view context and render with [url]_list template;
676673
// handles requests for [url] and [url]/
677674
_register.list = function (page) {
678-
const conf = _getBaseConf(page),
675+
const conf = _getConf(page),
679676
register = conf.url === '' ? router.registerLast : router.register,
680677
url = conf.url === '' ? '' : conf.url + '/';
681678
register(url, _joinRoute(page, 'list'), ctx => _displayList(ctx));
682679

683680
// Special handling for /[parent_list_url]/[parent_id]/[url]
684681
app.getParents(page).forEach(function (ppage) {
685-
var pconf = _getBaseConf(ppage);
682+
var pconf = _getConf(ppage);
686683
var url = pconf.url;
687684
var registerParent;
688685
if (url === '') {
@@ -866,7 +863,7 @@ async function _displayList(ctx, parentInfo) {
866863
// Generate item detail view context and render with [url]_detail template;
867864
// handles requests for [url]/[id]
868865
_register.detail = function (page, mode, contextFn = _displayItem) {
869-
var conf = _getBaseConf(page);
866+
var conf = _getConf(page);
870867
var url = _getDetailUrl(conf.url, mode);
871868
const register = conf.url === '' ? router.registerLast : router.register;
872869
register(url, _joinRoute(page, mode), contextFn);
@@ -886,7 +883,7 @@ function _getDetailUrl(url, mode) {
886883
// Generate item edit context and render with [url]_edit template;
887884
// handles requests for [url]/[id]/edit and [url]/new
888885
_register.edit = function (page) {
889-
var conf = _getBaseConf(page);
886+
var conf = _getConf(page);
890887
const register = conf.url === '' ? router.registerLast : router.register;
891888
register(
892889
_getDetailUrl(conf.url, 'edit'),
@@ -953,7 +950,7 @@ async function _displayItem(ctx) {
953950
// Render non-list pages with with [url] template;
954951
// handles requests for [url] and [url]/
955952
function _registerOther(page) {
956-
var conf = _getBaseConf(page);
953+
var conf = _getConf(page);
957954
router.register(
958955
conf.url,
959956
page,
@@ -1451,16 +1448,8 @@ function _default_attachments(field, context) {
14511448
}
14521449

14531450
// Load configuration based on page id
1454-
function _getBaseConf(page) {
1455-
return _getConf(page, false, true);
1456-
}
1457-
1458-
function _getConf(page, silentFail, baseConf) {
1459-
var conf = (baseConf ? app.config : app.wq_config).pages[page];
1460-
if (!conf && !baseConf) {
1461-
return _getConf(page, silentFail, true);
1462-
}
1463-
1451+
function _getConf(page, silentFail) {
1452+
var conf = app.config.pages[page];
14641453
if (!conf) {
14651454
if (silentFail) {
14661455
return;

packages/app/src/auth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export default {
130130
user,
131131
is_authenticated: !!user,
132132
app_config: this.app.config,
133-
wq_config: config,
133+
user_config: config,
134134
csrf_token: csrftoken,
135135
router_info: {
136136
...(ctx && ctx.router_info),

packages/react/src/components/DebugContext.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { useRenderContext, useRouteInfo, useComponents } from '../hooks';
33

44
const SKIP = [
55
'app_config',
6-
'wq_config',
76
'router_info',
87
'rt',
98
'svc',

0 commit comments

Comments
 (0)