Bladeren bron

add support for custom list entries

pull/1/head
Jonathan Cobb 4 jaren geleden
bovenliggende
commit
66eab3f6c7
3 gewijzigde bestanden met toevoegingen van 39 en 28 verwijderingen
  1. +3
    -2
      src/_services/app.service.js
  2. +2
    -2
      src/_store/apps.module.js
  3. +34
    -24
      src/account/AppConfigPage.vue

+ 3
- 2
src/_services/app.service.js Bestand weergeven

@@ -95,6 +95,7 @@ function takeConfigItemAction(userId, appId, viewId, itemId, params, action, mes
return fetch(`${config.apiUrl}/users/${userId}/apps/${appId}/config/${viewId}/actions/${action}?id=${itemId}`, util.postWithAuth(params)).then(util.handleCrudResponse(messages, errors));
}

function takeConfigAppAction(userId, appId, viewId, params, action, messages, errors) {
return fetch(`${config.apiUrl}/users/${userId}/apps/${appId}/config/${viewId}/actions/${action}`, util.putWithAuth(params)).then(util.handleCrudResponse(messages, errors));
function takeConfigAppAction(userId, appId, viewId, itemId, params, action, messages, errors) {
const id = (typeof itemId !== 'undefined' && itemId !== null ? `?id=${itemId}` : '');
return fetch(`${config.apiUrl}/users/${userId}/apps/${appId}/config/${viewId}/actions/${action}${id}`, util.putWithAuth(params)).then(util.handleCrudResponse(messages, errors));
}

+ 2
- 2
src/_store/apps.module.js Bestand weergeven

@@ -173,9 +173,9 @@ const actions = {
);
},

takeConfigAppAction({ commit }, {userId, appId, viewId, params, action, messages, errors}) {
takeConfigAppAction({ commit }, {userId, appId, viewId, itemId, params, action, messages, errors}) {
commit('takeConfigAppActionRequest');
appService.takeConfigAppAction(userId, appId, viewId, params, action, messages, errors)
appService.takeConfigAppAction(userId, appId, viewId, itemId, params, action, messages, errors)
.then(
actionResult => commit('takeConfigAppActionSuccess', actionResult),
error => commit('takeConfigAppActionFailure', error)


+ 34
- 24
src/account/AppConfigPage.vue Bestand weergeven

@@ -202,32 +202,43 @@
}
},
appAction(action) {
this.lastAction = action;
this.errors.clear();
this.takeConfigAppAction({
userId: this.user.name,
appId: this.appId,
viewId: this.viewId,
params: this.appActionParams[action.name],
action: action.name,
messages: this.messages,
errors: this.errors
});
if (typeof action.view !== 'undefined' && action.view !== null) {
this.$router.push({path: '/app/'+this.appId+'/config/'+action.view+(this.itemId ? +'/'+this.itemId : '')});
this.initView();
} else {
this.lastAction = action;
this.errors.clear();
this.takeConfigAppAction({
userId: this.user.name,
appId: this.appId,
viewId: this.viewId,
itemId: this.itemId,
params: this.appActionParams[action.name],
action: action.name,
messages: this.messages,
errors: this.errors
});
}
},
singleItemAction(action) {
if (typeof action === 'undefined' || action === null) return;
this.lastAction = action;
this.errors.clear();
this.takeConfigItemAction({
userId: this.user.name,
appId: this.appId,
viewId: this.viewId,
itemId: this.itemId,
params: this.appConfigData,
action: action.name,
messages: this.messages,
errors: this.errors
});
if (typeof action.view !== 'undefined' && action.view !== null) {
this.$router.push({path: '/app/'+this.appId+'/config/'+action.view+'/'+this.itemId});
this.initView();
} else {
this.lastAction = action;
this.errors.clear();
this.takeConfigItemAction({
userId: this.user.name,
appId: this.appId,
viewId: this.viewId,
itemId: this.itemId,
params: this.appConfigData,
action: action.name,
messages: this.messages,
errors: this.errors
});
}
}
},
watch: {
@@ -286,7 +297,6 @@

if (this.lastAction && typeof this.lastAction.successView !== 'undefined' && this.lastAction.successView !== null) {
const successView = this.lastAction.successView.parseMessage(this);
console.log('parsed this.lastAction.successView ('+this.lastAction.successView+') => '+successView);
this.$router.push({path: '/app/'+this.appId+'/config/'+successView});
this.initView();
} else {


Laden…
Annuleren
Opslaan