Skip to content

Commit

Permalink
Allow updating to the specified version from WebUI
Browse files Browse the repository at this point in the history
  • Loading branch information
VicDeo committed Nov 12, 2018
1 parent bdc20ce commit 79d1a44
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
10 changes: 6 additions & 4 deletions lib/Controller/MarketController.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,17 @@ public function uninstall($appId) {
* @return array | DataResponse
*/
public function update($appId) {
$targetVersion = $this->request->getParam('toVersion');
try {
$this->marketService->updateApp($appId);
$this->marketService->updateApp($appId, $targetVersion);
return [
'message' => $this->l10n->t('App %s updated successfully', $appId)
];
} catch(\Exception $ex) {
return new DataResponse([
'message' => $ex->getMessage()
], Http::STATUS_BAD_REQUEST);
return new DataResponse(
['message' => $ex->getMessage()],
Http::STATUS_BAD_REQUEST
);
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/components/Details.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
data () {
return {
// Key of releases array
// if length exeeds 1
// if length exceeds 1
updateVersion : 0
}
},
Expand Down Expand Up @@ -202,7 +202,11 @@
});
},
update () {
this.$store.dispatch('PROCESS_APPLICATION', [this.application.id, 'update'])
if (this.releases.length > 1) {
this.$store.dispatch('PROCESS_APPLICATION', [this.application.id, 'update', {'version' : this.releases[this.updateVersion].version}]);
} else {
this.$store.dispatch('PROCESS_APPLICATION', [this.application.id, 'update']);
}
},
setUpdateVersion (version) {
UIkit.dropdown('._multiupdate-uikit-element').hide();
Expand Down
2 changes: 1 addition & 1 deletion src/components/UpdateList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
methods: {
update (id, version) {
this.$store.dispatch('PROCESS_APPLICATION', [id, 'update'])
this.$store.dispatch('PROCESS_APPLICATION', [id, 'update', {'version' : version}])
},
processing(id) {
return _.contains(this.$store.state.processing, id)
Expand Down
4 changes: 3 additions & 1 deletion src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,10 @@ const actions = {

context.commit("START_PROCESSING", id);

let data = (options.version) ? {'toVersion' : options.version} : {};

return Axios.post(OC.generateUrl("/apps/market/apps/{id}/" + route, {id}),
{}, {
data, {
headers: {
requesttoken: OC.requestToken
}
Expand Down

0 comments on commit 79d1a44

Please sign in to comment.