Skip to content

Commit

Permalink
Merge pull request #22 from xingzhang-suse/main
Browse files Browse the repository at this point in the history
Reverse Rancher integration code from main branch
  • Loading branch information
BinX-Suse authored Jan 13, 2022
2 parents a0d29b5 + 3b211f6 commit 9a58947
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 37 deletions.
28 changes: 3 additions & 25 deletions admin/webapp/root/app_src/js/nv/dashboard/dashboardController.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"$sce",
"$sanitize",
"$mdDialog",
"$cookies",
"ImproveScoreFactory",
"AuthorizationFactory",
"$controller",
Expand All @@ -44,7 +43,6 @@
$sce,
$sanitize,
$mdDialog,
$cookies,
ImproveScoreFactory,
AuthorizationFactory,
$controller
Expand Down Expand Up @@ -73,8 +71,6 @@
},
};

let rancherCookie = $cookies.get("R_SESS");

$scope.isShowingScore = Utils.isAuthorized(
$scope.user.roles,
resource.seeScore
Expand Down Expand Up @@ -3869,9 +3865,6 @@
self.onmessage = (event) => {
let baseUrl = event.srcElement.origin;
let inputObj = JSON.parse(event.data);
if (inputObj.rancherCookie) {
baseUrl = `${inputObj.currUrl.split(inputObj.neuvectorProxy)[0]}${inputObj.neuvectorProxy}`;
}
let apiUrl = `${baseUrl}/${inputObj.apiUrl}`;
let domain = inputObj.domain;
let query = domain ? `?domain=${encodeURIComponent(domain)}` : "";
Expand All @@ -3898,9 +3891,6 @@
self.onmessage = (event) => {
let baseUrl = event.srcElement.origin;
let inputObj = JSON.parse(event.data);
if (inputObj.rancherCookie) {
baseUrl = `${inputObj.currUrl.split(inputObj.neuvectorProxy)[0]}${inputObj.neuvectorProxy}`;
}
let apiUrl = `${baseUrl}/${inputObj.apiUrl}`;
let isGlobalUser = inputObj.isGlobalUser;
let query = isGlobalUser ? `?isGlobalUser=${isGlobalUser.toString()}` : "?isGlobalUser=false";
Expand All @@ -3927,9 +3917,6 @@
self.onmessage = (event) => {
let baseUrl = event.srcElement.origin;
let inputObj = JSON.parse(event.data);
if (inputObj.rancherCookie) {
baseUrl = `${inputObj.currUrl.split(inputObj.neuvectorProxy)[0]}${inputObj.neuvectorProxy}`;
}
let apiUrl = `${baseUrl}/${inputObj.apiUrl}`;
let isGlobalUser = inputObj.isGlobalUser;
let exposures = inputObj.exposures;
Expand Down Expand Up @@ -3999,10 +3986,7 @@
$scope.worker.postMessage(
JSON.stringify({
apiUrl: DASHBOARD_NOTIFICATIONS_URL,
token: $scope.user.token.token,
currUrl: window.location.href,
rancherCookie: rancherCookie ? rancherCookie : "",
neuvectorProxy: PROXY_VALUE
token: $scope.user.token.token
})
);
$scope.worker.onmessage = (event) => {
Expand Down Expand Up @@ -4042,10 +4026,7 @@
JSON.stringify({
apiUrl: DASHBOARD_DETAILS_URL,
token: $scope.user.token.token,
isGlobalUser: $scope.isGlobalUser,
currUrl: window.location.href,
rancherCookie: rancherCookie ? rancherCookie : "",
neuvectorProxy: PROXY_VALUE
isGlobalUser: $scope.isGlobalUser
})
);
$scope.worker2.onmessage = (event) => {
Expand Down Expand Up @@ -4075,11 +4056,8 @@
egress: scoreData.egress
},
apiUrl: CONVERSATION_HISTORY_URL,
currUrl: window.location.href,
token: $scope.user.token.token,
isGlobalUser: $scope.isGlobalUser,
rancherCookie: rancherCookie ? rancherCookie : "",
neuvectorProxy: PROXY_VALUE
isGlobalUser: $scope.isGlobalUser
})
);
$scope.worker3.onmessage = (event) => {
Expand Down
15 changes: 3 additions & 12 deletions admin/webapp/root/app_src/js/nv/setting/multiClusterController.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"filterFilter",
"multiClusterService",
"$controller",
"$sanitize",
"$cookies"
"$sanitize"
];

function MultiClusterController(
Expand All @@ -42,8 +41,7 @@
filterFilter,
multiClusterService,
$controller,
$sanitize,
$cookies
$sanitize
) {
$scope.graphHeight = $window.innerHeight - 280;
angular.element($window).bind("resize", function() {
Expand All @@ -57,7 +55,6 @@
let worker = new Array(MAX_WEB_WORKER_CNT);
worker.fill(null);
let timer = null;
let rancherCookie = $cookies.get("R_SESS");
$scope.demoteWaiting = false;
$scope.leaveWaiting = false;

Expand Down Expand Up @@ -539,9 +536,6 @@
self.onmessage = (event) => {
let baseUrl = event.srcElement.origin;
let inputObj = JSON.parse(event.data);
if (inputObj.rancherCookie) {
baseUrl = `${inputObj.currUrl.split(inputObj.neuvectorProxy)[0]}${inputObj.neuvectorProxy}`;
}
let apiUrl = `${baseUrl}/${inputObj.apiUrl}`;
let isGlobalUser = inputObj.isGlobalUser;
let isMaster = inputObj.isMaster;
Expand Down Expand Up @@ -582,10 +576,7 @@
token: $scope.user.token.token,
isGlobalUser: true,
isMaster: $scope.clusters[index].clusterType === FED_ROLES.MASTER,
clusterId: $scope.clusters[index].id,
currUrl: window.location.href,
rancherCookie: rancherCookie ? rancherCookie : "",
neuvectorProxy: PROXY_VALUE
clusterId: $scope.clusters[index].id
})
);

Expand Down

0 comments on commit 9a58947

Please sign in to comment.