Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/features/mixdb-context' into fea…
Browse files Browse the repository at this point in the history
…tures/mixdb-context
  • Loading branch information
nhathoang989 committed Oct 14, 2023
2 parents 508e6e5 + 8eab501 commit e407a64
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 65 deletions.
27 changes: 26 additions & 1 deletion src/app/app-portal/pages/application/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ app.controller("MixApplicationController", [
$scope.canDrag =
$scope.request.orderBy !== "Priority" || $scope.request.direction !== "0";

$scope.generateBaseRoute = (forceRename) => {
if (
forceRename ||
($scope.viewmodel.displayName && !$scope.viewmodel.baseRoute)
) {
$scope.viewmodel.baseRoute = `/app/${$rootScope.generateKeyword(
$scope.viewmodel.displayName,
"-",
false,
true
)}`;
}
};
$scope.init = async function () {
$scope.startConnection("mixThemeHub", null, (err) => {
console.log(err);
Expand Down Expand Up @@ -82,7 +95,9 @@ app.controller("MixApplicationController", [
if (index >= 0) {
$scope.progress = progress;
if (progress == 100) {
$scope.installStatus = "Installing";
setTimeout(() => {
$location.url("/admin/mix-application/list");
}, 200);
}
$scope.$apply();
}
Expand Down Expand Up @@ -129,5 +144,15 @@ app.controller("MixApplicationController", [
$scope.back = function () {
$scope.viewMode = "list";
};
$scope.validate = function () {
if ($scope.viewmodel.baseRoute.indexOf("/app/") != 0) {
$rootScope.showErrors(['baseRoute must start with "/app/"']);
return false;
}
return true;
};
$scope.updateAppSettings = (data) => {
$scope.viewmodel.appSettings = data;
};
},
]);
150 changes: 86 additions & 64 deletions src/app/app-portal/pages/application/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,20 @@ <h2 ng-if="!viewmodel.displayName" class="page-title text-white">
<aside class="bd-sidebar sub-sidebar">
<nav class="bd-links p-3" aria-label="Sub-section navigation">
<div class="card">
<a class="btn btn-primary btn-link" ng-click="install()">
<p>Install</p>
<a
ng-if="!viewmodel.id"
class="btn btn-primary btn-link text-white"
ng-click="install()"
>
Install
</a>
<a
ng-if="viewmodel.id"
class="btn btn-primary text-white"
ng-click="save()"
>
Save
</a>
<div class="mb-3"></div>
</div>
</nav>
</aside>
Expand All @@ -43,13 +53,16 @@ <h2 ng-if="!viewmodel.displayName" class="page-title text-white">
type="text"
class="form-control"
ng-model="viewmodel.displayName"
ng-blur="generateName()"
ng-blur="generateBaseRoute(false)"
/>
</div>
</div>
<div class="row mb-3">
<div class="col">
<label class="form-label">Base Route</label>
<span class="text-warning"
>(Must start with "/app/", ex: '/app/my-app')</span
>
<div class="input-group input-group-sm">
<input
type="text"
Expand All @@ -59,7 +72,7 @@ <h2 ng-if="!viewmodel.displayName" class="page-title text-white">
<button
class="btn btn-outline-secondary"
type="button"
ng-click="generateName(true)"
ng-click="generateBaseRoute(true)"
>
<span class="fa fa-redo"></span>
</button>
Expand All @@ -68,16 +81,18 @@ <h2 ng-if="!viewmodel.displayName" class="page-title text-white">
</div>
<div class="row mb-3">
<div class="col">
<label class="form-label"
>Packate File Path {{progress}}</label
<label class="form-label">Packate File Path</label>
<media-file-upload
header="'Media Upload'"
type="'Apps'"
folder="'Apps'"
auto="'true'"
src="viewmodel.packageFilePath"
src-url="viewmodel.packageFilePath"
>
<input
type="text"
class="form-control"
ng-model="viewmodel.packateFilePath"
/>
</media-file-upload>
</div>
<div class="row mb-3">
<div class="row mb-3" ng-if="progress">
<div class="d-flex justify-content-between">
<div class="col-5 p-0">
<div class="progress">
Expand All @@ -92,67 +107,74 @@ <h2 ng-if="!viewmodel.displayName" class="page-title text-white">
<small class="text-muted" ng-bind="installStatus"></small>
</div>
</div>
<section class="mb-3 manual" ng-init="init()">
<div class="row">
<div class="col-12">
<div
class="row"
data-masonry='{"percentPosition": true }'
>
<div
ng-repeat="post in data.items track by $index"
class="col-md-4"
>
<div class="card">
<img
class="card-img-top"
src="{{post.image}}"
style="height: 150px; object-fit: cover"
/>
<div class="card-body">
<h6 class="small mb-4">
{{post.title}}
<br />
<small class="text-muted"
>by
<b
><a
href="{{post.additionalData.authorUrl}}"
target="_blank"
>{{post.properties.authorName}}</a
></b
>
in
<b
>{{post.additionalData.category}}</b
></small
>
</h6>
</div>
</div>
<div class="row mb-3">
<div class="col">
<label class="form-label">App Settings</label>
<json-builder
ng-if="viewmodel.appSettings"
data="viewmodel.appSettings"
on-update="updateAppSettings(data)"
edit-mode="'text'"
>
</json-builder>
</div>
</div>
</section>
<section class="mb-3 manual" ng-if="!viewmodel.id" ng-init="init()">
<div class="row">
<div class="col-12">
<div class="row" data-masonry='{"percentPosition": true }'>
<div
ng-repeat="post in data.items track by $index"
class="col-md-4"
>
<div class="card">
<img
class="card-img-top"
src="{{post.image}}"
style="height: 150px; object-fit: cover"
/>
<div class="card-body">
<h6 class="small mb-4">
{{post.title}}
<br />
<small class="text-muted"
>by
<b
><a
href="{{post.additionalData.authorUrl}}"
target="_blank"
>{{post.properties.authorName}}</a
></b
>
in
<b>{{post.additionalData.category}}</b></small
>
</h6>

<!-- <div class="d-flex justify-content-left">
<!-- <div class="d-flex justify-content-left">
<h5 class="text-success">
$ {{ post.additionalData.price }}
</h5>
</div> -->
<div class="d-flex justify-content-between">
<div
class="col-12 justify-content-end text-end p-0"
>
<a
target="_blank"
ng-click="select(post)"
class="btn btn-sm btn-outline-secondary mr-1"
>Select</a
>
</div>
</div>
</div>
<div class="d-flex justify-content-between">
<div
class="col-12 justify-content-end text-end p-0"
>
<a
target="_blank"
ng-click="select(post)"
class="btn btn-sm btn-outline-secondary mr-1"
>Select</a
>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
</section>
Expand Down

0 comments on commit e407a64

Please sign in to comment.