Skip to content

Commit

Permalink
Merge pull request #17 from onshopVN/feature-update-plugin-template
Browse files Browse the repository at this point in the history
Fix bug notification pagination & display notification count on nav
  • Loading branch information
ndquocphong authored Aug 28, 2019
2 parents 8e4e355 + 158549d commit 50de0d9
Show file tree
Hide file tree
Showing 10 changed files with 788 additions and 973 deletions.
36 changes: 31 additions & 5 deletions app/Customize/Controller/Admin/Store/OwnerStoreController.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,9 @@ public function searchPlugin(Request $request, $page_no = null, Paginator $pagin
}

$categoriesResult = $this->httpClient->request($endpoint. '/api/v1/plugins/categories', $headers);
$pluginsResult = $this->httpClient->request($endpoint . '/api/v1/plugins?coreVersion=' . \Eccube\Common\Constant::VERSION, $headers);

return [
'categoriesAsJson' => $categoriesResult,
'pluginsAsJson' => $pluginsResult,
'installedPluginsAsJson' => json_encode($installedPlugins)
];
}
Expand Down Expand Up @@ -178,16 +176,13 @@ public function searchTemplate()
'Authorization: Bearer '. $this->baseInfo->getOsStoreAuthToken()
];
$categoriesResult = $this->httpClient->request($endpoint . '/api/v1/templates/categories', $headers);
$themesResult = $this->httpClient->request($endpoint . '/api/v1/templates?coreVersion=' . \Eccube\Common\Constant::VERSION, $headers);

$installedTemplates = [];
foreach ($this->templateRepository->findAll() as $template) {
$installedTemplates[$template->getCode()] = "1.0.0";
}

return [
'categoriesAsJson' => $categoriesResult,
'templatesAsJson' => $themesResult,
'installedTemplatesDataAsJson' => json_encode($installedTemplates)
];
}
Expand Down Expand Up @@ -270,6 +265,37 @@ public function installPlugin(Request $request)
return new JsonResponse(["result" => $result]);
}

/**
* @Route("/%eccube_admin_route%/store/plugin/api/ajax/update", name="customize_store_plugin_owners_ajax_update", methods={"POST"})
*
* @param Request $request
* @return JsonResponse
*/
public function updatePlugin(Request $request)
{
$result = false;
$packageUrl = $request->get("packageUrl", null);
$code = $request->get("code", null);
if ($code && $packageUrl) {
$plugin = $this->pluginRepository->findOneBy(["code" => $code]);
if ($plugin instanceof \Eccube\Entity\Plugin) {
$headers = [
'Authorization: Bearer '. $this->baseInfo->getOsStoreAuthToken()
];
try {
$filePath = $this->httpClient->download($packageUrl, $headers);
$result = (bool)$this->pluginService->update($plugin, $filePath);
$this->cacheUtil->clearCache(env('APP_ENV'));
} catch (\Exception $e) {
log_error(__METHOD__, [$e]);
$result = false;
}
}
}

return new JsonResponse(["result" => $result]);
}

/**
* @Route("/%eccube_admin_route%/store/template/api/ajax/install", name="customize_store_template_owners_ajax_install", methods={"POST"})
*
Expand Down
13 changes: 8 additions & 5 deletions app/Customize/Resource/locale/messages.vi.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
customize.ownerstore.categories: Danh mục
customize.ownerstore.plugin_type: Loại tiện ích
customize.store.theme.theme_owners_install: Tìm kiếm mẫu giao diện
customize.store.theme.theme_owners_install.owners: Owner's Store.
customize.store.theme.theme_owners_install.search: Tìm mẫu giao diện
customize.store.theme.theme_owners_install: Tìm kiếm giao diện
customize.store.theme.theme_owners_install.owners: Kho tiện ích.
customize.store.theme.theme_owners_install.search: Tìm giao diện
customize.store.price.free: Miễn Phí
customize.store.price.paid: Tính Phí
customize.store.confirm: Xác nhận
customize.store.plugin.confirm_install: Hệ thống sẽ tải và tiến hành cài đặt tiện ích. Bạn có chắc chắn tiếp tục không?
customize.store.uptodated: Phiên bản mới nhất
customize.store.template.confirm_install: Hệ thống sẽ tải và tiến hành cài đặt giao diện. Bạn có chắc chắn tiếp tục không?
customize.store.plugin.confirm_update: Hệ thống sẽ tải và tiến hành cập nhật tiện ích. Bạn có chắc nhắn tiếp tục không?
customize.store.uptodated: Đã cài đặt
customize.store.update: Cập nhật
customize.store.processing: Đang xử lý
customize.store.downloadCount: Lượt tải
customize.store.version: Phiên bản
customize.store.message.not_found: Không tìm thấy kết quả.
customize.store.message.install_success: Thao tác đã thành công. Bạn vui lòng truy cập _link_ để kích hoạt tiện ích.
customize.store.message.install_success: Thao tác đã thành công. Bạn vui lòng truy cập _link_ để kích hoạt/kiểm tra tiện ích (giao diện).
customize.store.message.system_error: Đã có lỗi xảy ra. Bạn vui lòng thử lại thao tác vừa thực hiện.
customize.nav.plugin: Quản lý tiện ích
customize.notification.no_items: Bạn chưa nhận được thông báo nào.
Expand Down
Loading

0 comments on commit 50de0d9

Please sign in to comment.