陈伟双 created KYLIN-4113:
--------------------------
Summary: Whether the cube name should be given to the backend to
judge
Key: KYLIN-4113
URL: https://issues.apache.org/jira/browse/KYLIN-4113
Project: Kylin
Issue Type: Improvement
Components: Web , Website
Affects Versions: v2.6.1
Environment: computery:macOS Mojave 10.14.5
Reporter: 陈伟双
Attachments: image-2019-07-25-15-26-05-703.png,
image-2019-07-25-15-42-39-130.png
After selecting the project-name, it will go to the backend to get the cube
under the current project, but there will be a request to get all the cubes,
even if the backend does not succeed in the permission control, but this is
superfluous. I checked and found that all the cubes were obtained only because
I need to judge whether there is a cube with the same name when editing or
creating the cube. This should not be done in the front end, but the
information is submitted to the back end when the cube is created. A unified
judgment is made by the back end. Otherwise, there will be a situation where
the number of cubes that can be viewed by the current logged-in user's
privilege is limited, so it is not complete to determine whether the cube is
renamed at the time of creation. This leads to the fact that even if the cube
with the same name is created, you can see two cubes with the same name when
you can view all cube users (admin). . .
The extra code path to get the cube request:
{code:java}
webapp/app/js/controllers/cubeSchema.js{code}
In this position :
!image-2019-07-25-15-42-39-130.png!
This code should not be written directly in the CubeSchemaCtrl controller,
otherwise it will trigger the execution of this code when a page references the
controller, and there is a case of repeated request to initiate the request. I
don't know why. Perhaps it is because the other properties or methods under
this controller change to trigger the execution of this code.
My suggestion is to leave the judgment of whether the cube name is duplicated
to the backend, and add an interface to the backend, specifically when calling
this method on the front end:
{code:java}
webapp/app/js/controllers/cubeSchema.js{code}
!image-2019-07-25-15-26-05-703.png!
The last condition in this judgment should be removed. As long as the remaining
conditions are true, you should internally initiate an ajax to the backend to
get the result of whether the cube is duplicated, like this:
{code:java}
$scope.check_cube_info = function () {
if (($scope.state.mode === "edit") && $scope.cubeMode == "addNewCube") {
$http.post('/cubesNameIsExists', {cubeName:
$scope.cubeMetaFrame.name}).success(function (data) {
if (data.result) {
SweetAlert.swal('Oops...', "The cube named [" +
$scope.cubeMetaFrame.name.toUpperCase() + "] already exists", 'warning');
return false;
} else {
return true;
}
})
}
}{code}
It is not accurate for the front end to determine whether the cube name is
duplicated, because the permissions may not be able to get all the cubes, and
should be done by the backend.
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)