This is an automated email from the ASF dual-hosted git repository.

littlecui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-service-center.git


The following commit(s) were added to refs/heads/master by this push:
     new 031607f  [fix] modify schema url in frontend (#1289)
031607f is described below

commit 031607f6bce38ca5a8db2e179569a010e168c2c0
Author: robotljw <[email protected]>
AuthorDate: Mon Mar 14 09:20:07 2022 +0800

    [fix] modify schema url in frontend (#1289)
---
 .github/workflows/eventbase-ci.yml                 |  2 +-
 .github/workflows/static_check.yml                 | 16 +++++++-------
 .../serviceCenter/controllers/schemaCtrl.js        | 14 +++++-------
 .../serviceCenter/controllers/serviceInfoCtrl.js   | 25 +++++++++-------------
 frontend/app/scripts/scRouterConfig.js             | 23 +++++++-------------
 5 files changed, 32 insertions(+), 48 deletions(-)

diff --git a/.github/workflows/eventbase-ci.yml 
b/.github/workflows/eventbase-ci.yml
index db9d5fa..fdf0cbb 100644
--- a/.github/workflows/eventbase-ci.yml
+++ b/.github/workflows/eventbase-ci.yml
@@ -25,7 +25,7 @@ jobs:
       - name: Set up Go
         uses: actions/setup-go@v1
         with:
-          go-version: 1.16
+          go-version: 1.17
         id: go
       - name: Check out source code
         uses: actions/checkout@v1
diff --git a/.github/workflows/static_check.yml 
b/.github/workflows/static_check.yml
index b012651..f90bb10 100644
--- a/.github/workflows/static_check.yml
+++ b/.github/workflows/static_check.yml
@@ -5,10 +5,10 @@ jobs:
     name: Merge check
     runs-on: ubuntu-latest
     steps:
-      - name: Set up Go 1.16
+      - name: Set up Go 1.17
         uses: actions/setup-go@v1
         with:
-          go-version: 1.16
+          go-version: 1.17
         id: go
       - name: Check out code into the Go module directory
         uses: actions/checkout@v1
@@ -18,10 +18,10 @@ jobs:
   ut4etcd:
     runs-on: ubuntu-latest
     steps:
-      - name: Set up Go 1.16
+      - name: Set up Go 1.17
         uses: actions/setup-go@v1
         with:
-          go-version: 1.16
+          go-version: 1.17
         id: go
       - name: Check out code into the Go module directory
         uses: actions/checkout@v1
@@ -31,10 +31,10 @@ jobs:
   ut4mongo:
     runs-on: ubuntu-latest
     steps:
-      - name: Set up Go 1.16
+      - name: Set up Go 1.17
         uses: actions/setup-go@v1
         with:
-          go-version: 1.16
+          go-version: 1.17
         id: go
       - name: Check out code into the Go module directory
         uses: actions/checkout@v1
@@ -46,10 +46,10 @@ jobs:
   integration-test:
     runs-on: ubuntu-latest
     steps:
-      - name: Set up Go 1.16
+      - name: Set up Go 1.17
         uses: actions/setup-go@v1
         with:
-          go-version: 1.16
+          go-version: 1.17
         id: go
       - name: Check out code into the Go module directory
         uses: actions/checkout@v1
diff --git 
a/frontend/app/scripts/modules/serviceCenter/controllers/schemaCtrl.js 
b/frontend/app/scripts/modules/serviceCenter/controllers/schemaCtrl.js
index 0f37c95..544f84f 100644
--- a/frontend/app/scripts/modules/serviceCenter/controllers/schemaCtrl.js
+++ b/frontend/app/scripts/modules/serviceCenter/controllers/schemaCtrl.js
@@ -16,8 +16,8 @@
  */
 'use strict';
 angular.module('serviceCenter.sc')
-    .controller('schemaController', ['$scope', 'apiConstant', 'httpService', 
'$stateParams', 'servicesList', '$q', '$mdDialog', 'YAML', '$http', '$state', 
'$document', '$interval',
-        function($scope, apiConstant, httpService, $stateParams, servicesList, 
$q, $mdDialog, YAML, $http, $state, $document, $interval) {
+    .controller('schemaController', ['$scope', 'apiConstant', 'httpService', 
'$stateParams', 'servicesInfo', '$q', '$mdDialog', 'YAML', '$http', '$state', 
'$document', '$interval',
+        function($scope, apiConstant, httpService, $stateParams, servicesInfo, 
$q, $mdDialog, YAML, $http, $state, $document, $interval) {
 
             var serviceId = $stateParams.serviceId;
             $scope.schemaName = [];
@@ -26,13 +26,9 @@ angular.module('serviceCenter.sc')
             var addresses = [];
             var instances = [];
             var promises = [];
-            if (servicesList && servicesList.data && 
servicesList.data.allServicesDetail) {
-                
servicesList.data.allServicesDetail.forEach(function(serviceDetail) {
-                    var service = serviceDetail.microService;
-                    if (service.serviceId == serviceId) {
-                        $scope.schemaName = service.schemas || [];
-                    }
-                });
+            if (servicesInfo && servicesInfo.data && 
servicesInfo.data.service) {
+                var service = servicesInfo.data.service;
+                $scope.schemaName = service.schemas || [];
             }
 
             $scope.downloadAllSchema = function() {
diff --git 
a/frontend/app/scripts/modules/serviceCenter/controllers/serviceInfoCtrl.js 
b/frontend/app/scripts/modules/serviceCenter/controllers/serviceInfoCtrl.js
index 6d2769b..34aa30f 100644
--- a/frontend/app/scripts/modules/serviceCenter/controllers/serviceInfoCtrl.js
+++ b/frontend/app/scripts/modules/serviceCenter/controllers/serviceInfoCtrl.js
@@ -20,22 +20,17 @@ angular.module('serviceCenter.sc')
         '$stateParams','serviceInfo' ,function($scope, httpService, 
commonService, $q, apiConstant, $state, $stateParams, serviceInfo){
 
                        var serviceId = $stateParams.serviceId;
-                       if(serviceInfo && serviceInfo.data && 
serviceInfo.data.allServicesDetail){
-                               
serviceInfo.data.allServicesDetail.forEach(function(serviceDetail){
-                                       var service = 
serviceDetail.microService;
-                       if(service.serviceId == serviceId){
-                           $scope.serviceDetail = {
-                               serviceName: service.serviceName,
-                               status: service.status,
-                               appId: service.appId,
-                               version: service.version,
-                               createdAt: 
commonService.timeFormat(service.timestamp),
-                               serviceId: service.serviceId
-                           };
-                       }
-               });
+                       if(serviceInfo && serviceInfo.data && 
serviceInfo.data.service){
+                               var service = serviceInfo.data.service;
+                               $scope.serviceDetail = {
+                                       serviceName: service.serviceName,
+                                       status: service.status,
+                                       appId: service.appId,
+                                       version: service.version,
+                                       createdAt: 
commonService.timeFormat(service.timestamp),
+                                       serviceId: service.serviceId
+                               };
                        }
-                       
 
                        var apis = [];
                        var instanceUrl = apiConstant.api.instances.url;
diff --git a/frontend/app/scripts/scRouterConfig.js 
b/frontend/app/scripts/scRouterConfig.js
index c111c04..eca0ba5 100644
--- a/frontend/app/scripts/scRouterConfig.js
+++ b/frontend/app/scripts/scRouterConfig.js
@@ -57,15 +57,11 @@ angular.module('serviceCenter.router', [])
                         $(".loader").show();
                         var serviceId = $stateParams.serviceId;
                         var deferred = $q.defer();
-                        var url = apiConstant.api.allServices.url;
-                        var method = apiConstant.api.allServices.method;
+                        var url = 
apiConstant.api.particularService.url.replace('{{serviceId}}', serviceId);
+                        var method = apiConstant.api.particularService.method;
                         httpService.apiRequest(url, method, null, null, 
null).then(function(response) {
                             $(".loader").hide();
-                            if (response && response.data && 
response.data.allServicesDetail) {
-                                deferred.resolve(response);
-                            } else {
-                                deferred.resolve(response);
-                            }
+                            deferred.resolve(response);
                         }, function(error) {
                             $(".loader").hide();
                             deferred.reject(error);
@@ -116,18 +112,15 @@ angular.module('serviceCenter.router', [])
                     }
                 },
                 resolve: {
-                    servicesList: ['$q', 'httpService', 'apiConstant', 
function($q, httpService, apiConstant) {
+                    servicesInfo: ['$q', 'httpService', 'apiConstant', 
'$stateParams', function($q, httpService,  apiConstant, $stateParams) {
                         $(".loader").show();
                         var deferred = $q.defer();
-                        var url = apiConstant.api.allServices.url;
-                        var method = apiConstant.api.allServices.method;
+                        var serviceId = $stateParams.serviceId;
+                        var url = 
apiConstant.api.particularService.url.replace('{{serviceId}}', serviceId);
+                        var method = apiConstant.api.particularService.method;
                         httpService.apiRequest(url, method, null, null, 
null).then(function(response) {
                             $(".loader").hide();
-                            if (response && response.data && 
response.data.allServicesDetail) {
-                                deferred.resolve(response);
-                            } else {
-                                deferred.resolve(response);
-                            }
+                            deferred.resolve(response);
                         }, function(error) {
                             $(".loader").hide();
                             deferred.reject(error);

Reply via email to