Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
nhathoang989 committed Dec 30, 2023
1 parent 02880c6 commit 5a4f341
Show file tree
Hide file tree
Showing 19 changed files with 67 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
function ($rootScope, $scope, columnService, service) {
var ctrl = this;
BaseHub.call(this, ctrl);
$scope.host = `${$rootScope.globalSettings.domain}/${ctrl.host}`;
ctrl.mixConfigurations = $rootScope.globalSettings;
ctrl.user = {
loggedIn: false,
Expand Down
1 change: 0 additions & 1 deletion src/app/app-client/components/service-hub-client/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
function ($rootScope, $scope, columnService, service) {
var ctrl = this;
BaseHub.call(this, ctrl);
$scope.host = `${$rootScope.globalSettings.domain}/${ctrl.host}`;
ctrl.mixConfigurations = $rootScope.globalSettings;
ctrl.user = {
loggedIn: false,
Expand Down
1 change: 0 additions & 1 deletion src/app/app-portal/app-portal-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ app.controller("AppPortalController", [
localStorageService
) {
BaseHub.call(this, $scope);
$scope.host = `${$rootScope.globalSettings.domain}/${$scope.host}`;
$scope.isInit = false;
$scope.pageTagName = "";
$scope.pageTagTypeName = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ app.controller("HighFrequencyMessagesController", [
"AuthService",
function ($scope, $rootScope, authService) {
BaseHub.call(this, $scope);
$scope.host = `${$rootScope.globalSettings.domain}/${$scope.host}`;
authService.fillAuthData();
$scope.newMsgCount = 0;
$scope.messages = [];
Expand Down
2 changes: 1 addition & 1 deletion src/app/app-portal/components/hub-messages/hub-messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ app.controller("HubMessagesController", [
"AuthService",
function ($scope, $rootScope, authService) {
BaseHub.call(this, $scope);
$scope.host = `${$rootScope.globalSettings.domain}/${$scope.host}`;

authService.fillAuthData();
$scope.newMsgCount = 0;
$scope.messages = [];
Expand Down
3 changes: 3 additions & 0 deletions src/app/app-portal/components/list-mix-column/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ modules.component("listMixColumn", {
controller: [
"$rootScope",
"$scope",
"$routeParams",
"ngAppSettings",
"RestMixRelationshipPortalService",
"RestMixDatabasePortalService",
"RestMixDatabaseColumnPortalService",
function (
$rootScope,
$scope,
$routeParams,
ngAppSettings,
relationshipService,
databaseService,
Expand All @@ -35,6 +37,7 @@ modules.component("listMixColumn", {
};
ctrl.$onInit = async function () {
ctrl.dataTypes = $rootScope.globalSettings.dataTypes;
ctrl.request.mixDatabaseContextId = $routeParams.mixDatabaseContextId;
ctrl.databases = await databaseService.getList(ctrl.request);
var getDefaultAttr = await service.getDefault();
if (getDefaultAttr.success) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/app-portal/components/log-stream/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ app.controller("LogStreamController", [
"AuthService",
function ($scope, $rootScope, authService) {
BaseHub.call(this, $scope);
$scope.host = `${$rootScope.globalSettings.domain}/${$scope.host}`;

authService.fillAuthData();
$scope.keyword = "";
$scope.newMsgCount = 0;
Expand Down
67 changes: 36 additions & 31 deletions src/app/app-portal/components/mix-database-form/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ modules.component("mixDatabaseForm", {
});
ctrl.mixDataContent = getData.data;
if (ctrl.mixDataContent) {
ctrl.mixDataContent.intParentId = ctrl.intParentId;
ctrl.mixDataContent.guidParentId = ctrl.guidParentId;
ctrl.mixDataContent.parentType = ctrl.parentType;
// ctrl.mixDatabaseId = ctrl.mixDataContent.mixDatabaseId;
// ctrl.mixDatabaseName = ctrl.mixDataContent.mixDatabaseName;
ctrl.mixDatabaseTitle =
ctrl.mixDatabaseTitle ||
$routeParams.mixDatabaseTitle ||
Expand Down Expand Up @@ -170,31 +165,37 @@ modules.component("mixDatabaseForm", {
// await ctrl.loadDefaultModel();
ctrl.isBusy = false;
}
if ($routeParams.parentId && $routeParams.parentName) {
var getAssociation = await associationService.getAssociation(
$routeParams.parentName,
ctrl.mixDatabaseName,
$routeParams.parentId,
ctrl.mixDataContent.id
);
if (getAssociation.success) {
ctrl.association = getAssociation.data;
} else {
ctrl.association = {
parentId: $routeParams.parentId,
parentDatabaseName: $routeParams.parentName,
childDatabaseName: ctrl.mixDatabaseName,
};
}
var parentIdNameFieldName = `${$routeParams.parentName
.charAt(0)
.toLowerCase()}${
$routeParams.parentName.slice(1) || $routeParams.parentName
}Id`;
if (!ctrl.mixDataContent[parentIdNameFieldName]) {
ctrl.mixDataContent[parentIdNameFieldName] = $routeParams.parentId;
}
if ($routeParams.parentId) {
ctrl.mixDataContent.parentId = $routeParams.parentId;
ctrl.mixDataContent.parentDatabaseName = $routeParams.parentName;
ctrl.mixDataContent.childDatabaseName = ctrl.mixDatabaseName;
}
// TODO: refactor db relationship
// if ($routeParams.parentId && $routeParams.parentName) {
// var getAssociation = await associationService.getAssociation(
// $routeParams.parentName,
// ctrl.mixDatabaseName,
// $routeParams.parentId,
// ctrl.mixDataContent.id
// );
// if (getAssociation.success) {
// ctrl.association = getAssociation.data;
// } else {
// ctrl.association = {
// parentId: $routeParams.parentId,
// parentDatabaseName: $routeParams.parentName,
// childDatabaseName: ctrl.mixDatabaseName,
// };
// }
// var parentIdNameFieldName = `${$routeParams.parentName
// .charAt(0)
// .toLowerCase()}${
// $routeParams.parentName.slice(1) || $routeParams.parentName
// }Id`;
// if (!ctrl.mixDataContent[parentIdNameFieldName]) {
// ctrl.mixDataContent[parentIdNameFieldName] = $routeParams.parentId;
// }
// }
};

ctrl.reload = async function () {
Expand All @@ -205,8 +206,12 @@ modules.component("mixDatabaseForm", {
ctrl.mixDataContent = ctrl.selectedList.data[0];
ctrl.mixDataContent.mixDatabaseId = ctrl.mixDatabaseId;
ctrl.mixDataContent.mixDatabaseName = ctrl.mixDatabaseName;
ctrl.mixDataContent.intParentId = ctrl.intParentId;
ctrl.mixDataContent.guidParentId = ctrl.guidParentId;
if (ctrl.parentId) {
ctrl.mixDataContent.parentId = ctrl.parentId;
}
if (ctrl.guidParentId) {
ctrl.mixDataContent.parentId = ctrl.guidParentId;
}
ctrl.mixDataContent.parentType = ctrl.parentType;
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/app/app-portal/components/mix-database-form/view.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<form
ng-class="{'submitted': submitted}"
ng-submit="$ctrl.hubCreateData()"
ng-submit="$ctrl.submit()"
ng-if="$ctrl.database.columns.length"
>
<div class="row" ng-if="!$ctrl.hideAction">
Expand Down
2 changes: 1 addition & 1 deletion src/app/app-portal/pages/application/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ app.controller("MixApplicationController", [
service
);
BaseHub.call(this, $scope);
$scope.host = `${$rootScope.globalSettings.domain}/${$scope.host}`;

$scope.progress = 0;
$scope.viewMode = "list";
$scope.current = null;
Expand Down
2 changes: 1 addition & 1 deletion src/app/app-portal/pages/audit-log/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ app.controller("AuditLogController", [
service
);
BaseHub.call(this, $scope);
$scope.host = `${$rootScope.globalSettings.domain}/${$scope.host}`;

authService.fillAuthData();
$scope.request.status = null;
$scope.messages = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
>
<td>
<a
href="/admin/mix-database/details/{{item.id}}"
href="/admin/mix-database/details/{{item.id}}?mixDatabaseContextId={{$ctrl.model.id}}"
title="Config database"
class="btn-link"
>
Expand Down
2 changes: 1 addition & 1 deletion src/app/app-portal/pages/order-detail/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ app.controller("OrderDetailController", [
service
);
BaseHub.call(this, $scope);
$scope.host = `${$rootScope.globalSettings.domain}/${$scope.host}`;

$scope.progress = 0;
$scope.viewMode = "list";
$scope.current = null;
Expand Down
2 changes: 1 addition & 1 deletion src/app/app-portal/pages/template/template-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ app.controller("TemplateController", [
service
);
BaseHub.call(this, $scope);
$scope.host = `${$rootScope.globalSettings.domain}/${$scope.host}`;

$scope.folderTypes = [
"Masters",
"Layouts",
Expand Down
2 changes: 1 addition & 1 deletion src/app/app-portal/pages/user/user-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ app.controller("UserController", [
};
$scope.loadAdditionalData = async function () {
mixDbService.initDbName("sysUserData");
const getData = await mixDbService.getSingleByParent(
const getData = await mixDbService.getSingleByGuidParent(
"User",
$scope.activedUser.id
);
Expand Down
16 changes: 8 additions & 8 deletions src/app/app-shared/components/medias/media-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ appShared.controller("MediaController", [
});
};
$scope.getListSuccessCallback = function () {
angular.forEach($scope.data.items, function (e) {
e.isImage = $scope.isImage(e.fullPath);
if (e.isImage) {
e.fullPath = `${e.fullPath.split(".")[0]}-XXS.${
e.fullPath.split(".")[1]
}`;
}
});
// angular.forEach($scope.data.items, function (e) {
// e.isImage = $scope.isImage(e.fullPath);
// if (e.isImage) {
// e.fullPath = `${e.fullPath.split(".")[0]}-XXS.${
// e.fullPath.split(".")[1]
// }`;
// }
// });
};
$scope.isImage = function (url) {
return url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ appShared.controller("MessengerController", [
$scope.loadMsgButton = function () {};
$scope.init = function () {
BaseHub.call(this, $scope);
$scope.host = `${$rootScope.globalSettings.domain}/${$scope.host}`;

authService.fillAuthData().then(() => {
$scope.user.loggedIn = true;
$scope.user.info = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ appShared.controller("VideoCallController", [
"$scope",
function ($scope) {
BaseHub.call(this, $scope);
$scope.host = `${$rootScope.globalSettings.domain}/${$scope.host}`;

$scope.user = {
loggedIn: false,
info: {},
Expand Down
9 changes: 9 additions & 0 deletions src/app/app-shared/services/mix-database/_mixdb-services.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,20 @@ appShared.factory("MixDbService", [
};
return await this.getRestApiResult(req);
};
var _getSingleByGuidParent = async function (parentType, parentId) {
var url = `${this.prefixUrl}/get-by-guid-parent/${parentType}/${parentId}`;
var req = {
method: "GET",
url: url,
};
return await this.getRestApiResult(req);
};
serviceFactory.initDbName = _initDbName;
serviceFactory.filter = _filter;
serviceFactory.export = _export;
serviceFactory.import = _import;
serviceFactory.getSingleByParent = _getSingleByParent;
serviceFactory.getSingleByGuidParent = _getSingleByGuidParent;
return serviceFactory;
},
]);

0 comments on commit 5a4f341

Please sign in to comment.