fontastic 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +16 -0
- package/.eslintrc.json +54 -0
- package/.github/FUNDING.yml +12 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/.github/dependabot.yml +6 -0
- package/.github/pull_request_template.md +21 -0
- package/.github/stale.yml +17 -0
- package/.github/workflows/macos.yml +58 -0
- package/.github/workflows/ubuntu.yml +70 -0
- package/.github/workflows/windows.yml +64 -0
- package/.node-version +1 -0
- package/.vscode/launch.json +46 -0
- package/.vscode/tasks.json +49 -0
- package/CODE_OF_CONDUCT.md +45 -0
- package/CONTRIBUTING.md +72 -0
- package/LICENSE +21 -0
- package/README.md +111 -0
- package/_config.yml +1 -0
- package/angular.json +194 -0
- package/angular.webpack.js +32 -0
- package/app/Application.js +40 -0
- package/app/Application.ts +38 -0
- package/app/config/alert.ts +32 -0
- package/app/config/database.js +203 -0
- package/app/config/database.ts +202 -0
- package/app/config/index.js +20 -0
- package/app/config/index.ts +3 -0
- package/app/config/mimes.js +49 -0
- package/app/config/mimes.ts +54 -0
- package/app/config/system.js +497 -0
- package/app/config/system.ts +498 -0
- package/app/config/themes.ts +38 -0
- package/app/core/AppLogger.js +31 -0
- package/app/core/AppLogger.ts +38 -0
- package/app/core/ConfigManager.js +114 -0
- package/app/core/ConfigManager.ts +137 -0
- package/app/core/ConnectionManager.js +83 -0
- package/app/core/ConnectionManager.ts +95 -0
- package/app/core/FontCatalog.js +51 -0
- package/app/core/FontCatalog.ts +42 -0
- package/app/core/FontFinder.js +86 -0
- package/app/core/FontFinder.ts +96 -0
- package/app/core/FontInstaller.js +67 -0
- package/app/core/FontInstaller.ts +63 -0
- package/app/core/FontManager.js +165 -0
- package/app/core/FontManager.ts +172 -0
- package/app/core/FontObject.js +54 -0
- package/app/core/FontObject.ts +62 -0
- package/app/core/MessageHandler.js +272 -0
- package/app/core/MessageHandler.ts +337 -0
- package/app/core/SystemManager.js +140 -0
- package/app/core/SystemManager.ts +171 -0
- package/app/core/menu/Example.ts +280 -0
- package/app/core/menu/MenuBuilder.js +45 -0
- package/app/core/menu/MenuBuilder.ts +53 -0
- package/app/core/menu/templates/DarwinTemplate.js +127 -0
- package/app/core/menu/templates/DarwinTemplate.ts +142 -0
- package/app/core/menu/templates/SystemTemplate.js +124 -0
- package/app/core/menu/templates/SystemTemplate.ts +139 -0
- package/app/database/entity/Collection.schema.js +99 -0
- package/app/database/entity/Collection.schema.ts +68 -0
- package/app/database/entity/Logger.schema.js +50 -0
- package/app/database/entity/Logger.schema.ts +26 -0
- package/app/database/entity/Store.schema.js +165 -0
- package/app/database/entity/Store.schema.ts +116 -0
- package/app/database/entity/index.js +20 -0
- package/app/database/entity/index.ts +3 -0
- package/app/database/repository/Collection.repository.js +181 -0
- package/app/database/repository/Collection.repository.ts +190 -0
- package/app/database/repository/Logger.repository.js +25 -0
- package/app/database/repository/Logger.repository.ts +11 -0
- package/app/database/repository/Store.repository.js +328 -0
- package/app/database/repository/Store.repository.ts +358 -0
- package/app/database/repository/User.repository.js +12 -0
- package/app/database/repository/User.repository.ts +8 -0
- package/app/database/repository/index.js +20 -0
- package/app/database/repository/index.ts +3 -0
- package/app/enums/ChannelType.js +62 -0
- package/app/enums/ChannelType.ts +65 -0
- package/app/enums/StorageType.js +19 -0
- package/app/enums/index.js +19 -0
- package/app/enums/index.ts +2 -0
- package/app/enums/storageType.ts +14 -0
- package/app/helpers/command.js +28 -0
- package/app/helpers/command.ts +20 -0
- package/app/helpers/random.js +16 -0
- package/app/helpers/random.ts +12 -0
- package/app/main.js +82 -0
- package/app/main.ts +94 -0
- package/app/package-lock.json +2649 -0
- package/app/package.json +35 -0
- package/app/types/AppAlert.js +3 -0
- package/app/types/AppAlert.ts +8 -0
- package/app/types/AuthUser.js +7 -0
- package/app/types/AuthUser.ts +5 -0
- package/app/types/Breadcrumb.js +3 -0
- package/app/types/Breadcrumb.ts +5 -0
- package/app/types/ImportOptions.js +7 -0
- package/app/types/ImportOptions.ts +3 -0
- package/app/types/QueryOptions.js +3 -0
- package/app/types/QueryOptions.ts +12 -0
- package/app/types/SystemConfig.js +3 -0
- package/app/types/SystemConfig.ts +132 -0
- package/app/types/SystemStats.js +3 -0
- package/app/types/SystemStats.ts +7 -0
- package/app/types/SystemTheme.js +3 -0
- package/app/types/SystemTheme.ts +5 -0
- package/app/types/index.js +25 -0
- package/app/types/index.ts +8 -0
- package/docs/logo.png +0 -0
- package/docs/screenshots/readme.md +7 -0
- package/docs/screenshots/screen-grab1.png +0 -0
- package/docs/screenshots/screen-grab2.png +0 -0
- package/docs/screenshots/screen-grab3.png +0 -0
- package/e2e/main.spec.ts +59 -0
- package/e2e/playwright.config.ts +19 -0
- package/e2e/tsconfig.e2e.json +13 -0
- package/electron-builder.json +71 -0
- package/package.json +121 -0
- package/src/app/app-routing.module.ts +15 -0
- package/src/app/app.component.html +1 -0
- package/src/app/app.component.scss +0 -0
- package/src/app/app.component.spec.ts.dist +33 -0
- package/src/app/app.component.ts +37 -0
- package/src/app/app.module.ts +63 -0
- package/src/app/core/core.module.ts +11 -0
- package/src/app/core/model/AuthUserModel.ts +7 -0
- package/src/app/core/model/CustomThemeModel.ts +7 -0
- package/src/app/core/model/DbConnectionModel.ts +16 -0
- package/src/app/core/model/ImportOptionsModel.ts +5 -0
- package/src/app/core/model/LatestNewsModel.ts +7 -0
- package/src/app/core/model/SearchFormModel.ts +10 -0
- package/src/app/core/model/index.ts +6 -0
- package/src/app/core/services/alert/alert.service.spec.ts +22 -0
- package/src/app/core/services/alert/alert.service.ts +71 -0
- package/src/app/core/services/auth/auth.service.ts +30 -0
- package/src/app/core/services/boot/boot.service.ts +33 -0
- package/src/app/core/services/breadcrumb/breadcrumb.service.spec.ts +22 -0
- package/src/app/core/services/breadcrumb/breadcrumb.service.ts +30 -0
- package/src/app/core/services/config/config.service.ts +63 -0
- package/src/app/core/services/database/database.service.ts +286 -0
- package/src/app/core/services/electron/electron.service.spec.ts +12 -0
- package/src/app/core/services/electron/electron.service.ts +62 -0
- package/src/app/core/services/font/font.service.ts +79 -0
- package/src/app/core/services/gravatar/gravatar.service.spec.ts +16 -0
- package/src/app/core/services/gravatar/gravatar.service.ts +18 -0
- package/src/app/core/services/index.ts +14 -0
- package/src/app/core/services/message/message.service.ts +289 -0
- package/src/app/core/services/modal/modal.service.spec.ts +16 -0
- package/src/app/core/services/modal/modal.service.ts +34 -0
- package/src/app/core/services/news/news.service.ts +94 -0
- package/src/app/core/services/presentation/presentation.service.ts +341 -0
- package/src/app/core/services/utils/utils.service.spec.ts +12 -0
- package/src/app/core/services/utils/utils.service.ts +144 -0
- package/src/app/layout/aside/aside.component.html +9 -0
- package/src/app/layout/aside/aside.component.scss +1 -0
- package/src/app/layout/aside/aside.component.ts +26 -0
- package/src/app/layout/footer/footer.component.html +11 -0
- package/src/app/layout/footer/footer.component.scss +27 -0
- package/src/app/layout/footer/footer.component.ts +32 -0
- package/src/app/layout/header/header.component.html +35 -0
- package/src/app/layout/header/header.component.scss +60 -0
- package/src/app/layout/header/header.component.ts +229 -0
- package/src/app/layout/layout.component.html +14 -0
- package/src/app/layout/layout.component.scss +119 -0
- package/src/app/layout/layout.component.ts +23 -0
- package/src/app/layout/layout.module.ts +32 -0
- package/src/app/layout/layout.service.ts +13 -0
- package/src/app/layout/navigation/navigation.component.html +142 -0
- package/src/app/layout/navigation/navigation.component.scss +0 -0
- package/src/app/layout/navigation/navigation.component.ts +302 -0
- package/src/app/pages/main/grid/grid.component.html +160 -0
- package/src/app/pages/main/grid/grid.component.scss +3 -0
- package/src/app/pages/main/grid/grid.component.ts +98 -0
- package/src/app/pages/main/inspect/inspect.component.html +7 -0
- package/src/app/pages/main/inspect/inspect.component.scss +3 -0
- package/src/app/pages/main/inspect/inspect.component.ts +66 -0
- package/src/app/pages/main/main-routing.module.ts +30 -0
- package/src/app/pages/main/main.component.html +6 -0
- package/src/app/pages/main/main.component.scss +191 -0
- package/src/app/pages/main/main.component.ts +35 -0
- package/src/app/pages/main/main.module.ts +28 -0
- package/src/app/pages/main/preview/preview.component.html +46 -0
- package/src/app/pages/main/preview/preview.component.scss +0 -0
- package/src/app/pages/main/preview/preview.component.ts +239 -0
- package/src/app/pages/main/toolbar/toolbar.component.html +78 -0
- package/src/app/pages/main/toolbar/toolbar.component.scss +3 -0
- package/src/app/pages/main/toolbar/toolbar.component.ts +132 -0
- package/src/app/shared/components/alert/alert.component.html +9 -0
- package/src/app/shared/components/alert/alert.component.scss +0 -0
- package/src/app/shared/components/alert/alert.component.ts +37 -0
- package/src/app/shared/components/breadcrumbs/breadcrumbs.component.html +14 -0
- package/src/app/shared/components/breadcrumbs/breadcrumbs.component.scss +0 -0
- package/src/app/shared/components/breadcrumbs/breadcrumbs.component.ts +36 -0
- package/src/app/shared/components/button/button.component.html +3 -0
- package/src/app/shared/components/button/button.component.scss +2 -0
- package/src/app/shared/components/button/button.component.ts +22 -0
- package/src/app/shared/components/collection/create-collection/create-collection.component.html +41 -0
- package/src/app/shared/components/collection/create-collection/create-collection.component.scss +0 -0
- package/src/app/shared/components/collection/create-collection/create-collection.component.ts +68 -0
- package/src/app/shared/components/collection/form-collection/form-collection.component.html +1 -0
- package/src/app/shared/components/collection/form-collection/form-collection.component.scss +0 -0
- package/src/app/shared/components/collection/form-collection/form-collection.component.ts +15 -0
- package/src/app/shared/components/collection/update-collection/update-collection.component.html +40 -0
- package/src/app/shared/components/collection/update-collection/update-collection.component.scss +0 -0
- package/src/app/shared/components/collection/update-collection/update-collection.component.ts +71 -0
- package/src/app/shared/components/glyph-list/glyph-list.component.html +40 -0
- package/src/app/shared/components/glyph-list/glyph-list.component.scss +1 -0
- package/src/app/shared/components/glyph-list/glyph-list.component.ts +165 -0
- package/src/app/shared/components/glyph-view/glyph-view.component.html +23 -0
- package/src/app/shared/components/glyph-view/glyph-view.component.scss +0 -0
- package/src/app/shared/components/glyph-view/glyph-view.component.ts +228 -0
- package/src/app/shared/components/index.ts +16 -0
- package/src/app/shared/components/loading/loading.component.html +1 -0
- package/src/app/shared/components/loading/loading.component.scss +0 -0
- package/src/app/shared/components/loading/loading.component.ts +26 -0
- package/src/app/shared/components/modal/modal.component.html +31 -0
- package/src/app/shared/components/modal/modal.component.scss +0 -0
- package/src/app/shared/components/modal/modal.component.ts +51 -0
- package/src/app/shared/components/page-not-found/page-not-found.component.html +3 -0
- package/src/app/shared/components/page-not-found/page-not-found.component.scss +0 -0
- package/src/app/shared/components/page-not-found/page-not-found.component.ts +12 -0
- package/src/app/shared/components/paginator/paginator.component.html +21 -0
- package/src/app/shared/components/paginator/paginator.component.scss +3 -0
- package/src/app/shared/components/paginator/paginator.component.ts +133 -0
- package/src/app/shared/components/pairing/pairing.component.html +20 -0
- package/src/app/shared/components/pairing/pairing.component.scss +0 -0
- package/src/app/shared/components/pairing/pairing.component.ts +33 -0
- package/src/app/shared/components/search/search.component.html +54 -0
- package/src/app/shared/components/search/search.component.scss +10 -0
- package/src/app/shared/components/search/search.component.ts +77 -0
- package/src/app/shared/components/settings/database/database.component.html +151 -0
- package/src/app/shared/components/settings/database/database.component.scss +0 -0
- package/src/app/shared/components/settings/database/database.component.ts +145 -0
- package/src/app/shared/components/settings/general/general.component.html +170 -0
- package/src/app/shared/components/settings/general/general.component.scss +0 -0
- package/src/app/shared/components/settings/general/general.component.ts +150 -0
- package/src/app/shared/components/settings/logs/logs.component.html +44 -0
- package/src/app/shared/components/settings/logs/logs.component.scss +0 -0
- package/src/app/shared/components/settings/logs/logs.component.ts +37 -0
- package/src/app/shared/components/settings/news/news.component.html +41 -0
- package/src/app/shared/components/settings/news/news.component.scss +0 -0
- package/src/app/shared/components/settings/news/news.component.ts +52 -0
- package/src/app/shared/components/settings/settings.component.html +46 -0
- package/src/app/shared/components/settings/settings.component.scss +0 -0
- package/src/app/shared/components/settings/settings.component.ts +23 -0
- package/src/app/shared/components/settings/system/system.component.html +30 -0
- package/src/app/shared/components/settings/system/system.component.scss +0 -0
- package/src/app/shared/components/settings/system/system.component.ts +43 -0
- package/src/app/shared/components/settings/theme/theme.component.html +22 -0
- package/src/app/shared/components/settings/theme/theme.component.scss +0 -0
- package/src/app/shared/components/settings/theme/theme.component.ts +50 -0
- package/src/app/shared/components/spinner/spinner.component.html +1 -0
- package/src/app/shared/components/spinner/spinner.component.scss +0 -0
- package/src/app/shared/components/spinner/spinner.component.ts +26 -0
- package/src/app/shared/components/store/store.component.html +22 -0
- package/src/app/shared/components/store/store.component.scss +10 -0
- package/src/app/shared/components/store/store.component.ts +58 -0
- package/src/app/shared/components/tables/tables.component.html +47 -0
- package/src/app/shared/components/tables/tables.component.scss +10 -0
- package/src/app/shared/components/tables/tables.component.ts +81 -0
- package/src/app/shared/components/typescale/typescale.component.html +53 -0
- package/src/app/shared/components/typescale/typescale.component.scss +0 -0
- package/src/app/shared/components/typescale/typescale.component.ts +168 -0
- package/src/app/shared/directives/gravatar/gravatar.directive.ts +29 -0
- package/src/app/shared/directives/index.ts +2 -0
- package/src/app/shared/directives/webview/webview.directive.ts +8 -0
- package/src/app/shared/pipes/installable.pipe.ts +10 -0
- package/src/app/shared/pipes/prettybytes.pipe.ts +10 -0
- package/src/app/shared/pipes/safehtml.pipe.ts +10 -0
- package/src/app/shared/shared.module.ts +92 -0
- package/src/assets/.gitkeep +0 -0
- package/src/assets/fonts/fa/fa-brands-400.eot +0 -0
- package/src/assets/fonts/fa/fa-brands-400.svg +3535 -0
- package/src/assets/fonts/fa/fa-brands-400.ttf +0 -0
- package/src/assets/fonts/fa/fa-brands-400.woff +0 -0
- package/src/assets/fonts/fa/fa-brands-400.woff2 +0 -0
- package/src/assets/fonts/fa/fa-regular-400.eot +0 -0
- package/src/assets/fonts/fa/fa-regular-400.svg +803 -0
- package/src/assets/fonts/fa/fa-regular-400.ttf +0 -0
- package/src/assets/fonts/fa/fa-regular-400.woff +0 -0
- package/src/assets/fonts/fa/fa-regular-400.woff2 +0 -0
- package/src/assets/fonts/fa/fa-solid-900.eot +0 -0
- package/src/assets/fonts/fa/fa-solid-900.svg +4700 -0
- package/src/assets/fonts/fa/fa-solid-900.ttf +0 -0
- package/src/assets/fonts/fa/fa-solid-900.woff +0 -0
- package/src/assets/fonts/fa/fa-solid-900.woff2 +0 -0
- package/src/assets/fonts/md/MaterialIcons-Regular.eot +0 -0
- package/src/assets/fonts/md/MaterialIcons-Regular.ijmap +1 -0
- package/src/assets/fonts/md/MaterialIcons-Regular.svg +2373 -0
- package/src/assets/fonts/md/MaterialIcons-Regular.ttf +0 -0
- package/src/assets/fonts/md/MaterialIcons-Regular.woff +0 -0
- package/src/assets/fonts/md/MaterialIcons-Regular.woff2 +0 -0
- package/src/assets/fonts/md/README.md +9 -0
- package/src/assets/fonts/md/codepoints +932 -0
- package/src/assets/fonts/md/material-icons.css +36 -0
- package/src/assets/fonts/octicon/octicon.eot +0 -0
- package/src/assets/fonts/octicon/octicon.svg +378 -0
- package/src/assets/fonts/octicon/octicon.ttf +0 -0
- package/src/assets/fonts/octicon/octicon.woff +0 -0
- package/src/assets/fonts/octicon/octicon.woff2 +0 -0
- package/src/assets/fonts/roboto/Roboto-Bold-webfont.eot +0 -0
- package/src/assets/fonts/roboto/Roboto-Bold-webfont.svg +607 -0
- package/src/assets/fonts/roboto/Roboto-Bold-webfont.ttf +0 -0
- package/src/assets/fonts/roboto/Roboto-Bold-webfont.woff +0 -0
- package/src/assets/fonts/roboto/Roboto-Medium-webfont.eot +0 -0
- package/src/assets/fonts/roboto/Roboto-Medium-webfont.svg +607 -0
- package/src/assets/fonts/roboto/Roboto-Medium-webfont.ttf +0 -0
- package/src/assets/fonts/roboto/Roboto-Medium-webfont.woff +0 -0
- package/src/assets/fonts/roboto/Roboto-Regular-webfont.eot +0 -0
- package/src/assets/fonts/roboto/Roboto-Regular-webfont.svg +635 -0
- package/src/assets/fonts/roboto/Roboto-Regular-webfont.ttf +0 -0
- package/src/assets/fonts/roboto/Roboto-Regular-webfont.woff +0 -0
- package/src/assets/i18n/en.json +12 -0
- package/src/assets/icons/android-chrome-192x192.png +0 -0
- package/src/assets/icons/android-chrome-512x512.png +0 -0
- package/src/assets/icons/apple-touch-icon.png +0 -0
- package/src/assets/icons/favicon-16x16.png +0 -0
- package/src/assets/icons/favicon-32x32.png +0 -0
- package/src/assets/icons/favicon.ico +0 -0
- package/src/assets/icons/site.webmanifest +1 -0
- package/src/assets/images/electron.bmp +0 -0
- package/src/bin/activator +0 -0
- package/src/bin/activator.exe +0 -0
- package/src/environments/environment.dev.ts +4 -0
- package/src/environments/environment.prod.ts +4 -0
- package/src/environments/environment.ts +4 -0
- package/src/environments/environment.web.prod.ts +4 -0
- package/src/environments/environment.web.ts +4 -0
- package/src/favicon.ico +0 -0
- package/src/index.html +55 -0
- package/src/karma.conf.js +50 -0
- package/src/main.ts +15 -0
- package/src/polyfills-test.ts +1 -0
- package/src/polyfills.ts +53 -0
- package/src/styles/base/loading.scss +87 -0
- package/src/styles/base/reset.scss +408 -0
- package/src/styles/components/alert.scss +54 -0
- package/src/styles/components/buttons.scss +93 -0
- package/src/styles/components/forms.scss +96 -0
- package/src/styles/components/inputs.scss +113 -0
- package/src/styles/components/modal.scss +52 -0
- package/src/styles/components/paginator.scss +108 -0
- package/src/styles/components/scrollbox.scss +71 -0
- package/src/styles/components/spinner.scss +11 -0
- package/src/styles/components/tables.scss +42 -0
- package/src/styles/components/tabs.scss +44 -0
- package/src/styles/components/toolbar.scss +130 -0
- package/src/styles/fonts/md.scss +54 -0
- package/src/styles/fonts/octicons.scss +1351 -0
- package/src/styles/fonts/roboto.scss +32 -0
- package/src/styles/themes/dashboard.scss +294 -0
- package/src/styles/themes/euphoria.scss +283 -0
- package/src/styles/themes/mellow.scss +280 -0
- package/src/styles/themes/midnight.scss +283 -0
- package/src/styles/themes/passion.scss +280 -0
- package/src/styles/themes/swiss.scss +283 -0
- package/src/styles/tools/_functions.scss +5 -0
- package/src/styles/tools/_mixins.scss +159 -0
- package/src/styles/tools/_placeholders.scss +17 -0
- package/src/styles/tools/_variables.scss +67 -0
- package/src/styles.scss +37 -0
- package/src/test.ts +22 -0
- package/src/tsconfig.app.json +20 -0
- package/src/tsconfig.spec.json +23 -0
- package/src/typings.d.ts +9 -0
- package/tailwind.config.js +67 -0
- package/tsconfig.json +42 -0
- package/tsconfig.serve.json +27 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { Component, OnInit } from '@angular/core';
|
|
2
|
+
import { DatabaseService } from '@app/core/services';
|
|
3
|
+
import { QueryOptions } from '@main/types';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'app-paginator',
|
|
7
|
+
templateUrl: './paginator.component.html',
|
|
8
|
+
styleUrls: ['./paginator.component.scss']
|
|
9
|
+
})
|
|
10
|
+
export class PaginatorComponent implements OnInit {
|
|
11
|
+
|
|
12
|
+
resultSetCount = 0;
|
|
13
|
+
resultSetTotal = 0;
|
|
14
|
+
|
|
15
|
+
page = 1;
|
|
16
|
+
pages = 1;
|
|
17
|
+
limit = 100;
|
|
18
|
+
offset = 0;
|
|
19
|
+
|
|
20
|
+
deactivatePrev = false;
|
|
21
|
+
deactivateNext = false;
|
|
22
|
+
|
|
23
|
+
limitOptions: any[] = [
|
|
24
|
+
{ value: 100, title: '100' },
|
|
25
|
+
{ value: 150, title: '150' },
|
|
26
|
+
{ value: 200, title: '200' },
|
|
27
|
+
{ value: 250, title: '250' },
|
|
28
|
+
{ value: 300, title: '300' }
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
constructor(
|
|
32
|
+
private databaseService: DatabaseService
|
|
33
|
+
) { }
|
|
34
|
+
|
|
35
|
+
ngOnInit(): void {
|
|
36
|
+
this.databaseService.watchActivePage$.subscribe((result) => this.page = result);
|
|
37
|
+
|
|
38
|
+
this.databaseService.watchResultSetCount$.subscribe((result) => this.resultSetCount = result);
|
|
39
|
+
|
|
40
|
+
this.databaseService.watchResultSetTotal$.subscribe((result) => {
|
|
41
|
+
this.resultSetTotal = result;
|
|
42
|
+
const pages = Math.ceil(this.resultSetTotal / this.limit);
|
|
43
|
+
this.pages = (pages) ? pages : 1;
|
|
44
|
+
this.checkButtonStatus();
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
getQueryOptions(): QueryOptions {
|
|
49
|
+
return this.databaseService.getQueryOptions();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
handlePageInput(event: any): void {
|
|
53
|
+
const el = event.srcElement;
|
|
54
|
+
const target = event.target;
|
|
55
|
+
const page = target.value;
|
|
56
|
+
|
|
57
|
+
if (page < 1) {
|
|
58
|
+
this.page = 1;
|
|
59
|
+
} else if (page > this.pages) {
|
|
60
|
+
this.page = this.pages;
|
|
61
|
+
} else {
|
|
62
|
+
this.page = page;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
this.calculateOffset();
|
|
66
|
+
|
|
67
|
+
this.checkButtonStatus();
|
|
68
|
+
|
|
69
|
+
this.paginate();
|
|
70
|
+
|
|
71
|
+
if (event.keyCode === 13) {
|
|
72
|
+
el.blur();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
onButtonClick(direction: string) {
|
|
77
|
+
if (direction === 'next') {
|
|
78
|
+
this.page++;
|
|
79
|
+
} else {
|
|
80
|
+
this.page--;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
this.calculateOffset();
|
|
84
|
+
this.checkButtonStatus();
|
|
85
|
+
this.paginate();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
onSelectChange(event: Event): void {
|
|
89
|
+
const target = event.target as HTMLInputElement;
|
|
90
|
+
this.limit = Number(target.value);
|
|
91
|
+
this.databaseService.resetPage(1);
|
|
92
|
+
this.calculateOffset();
|
|
93
|
+
this.checkButtonStatus();
|
|
94
|
+
this.paginate();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
paginate(): void {
|
|
98
|
+
const options: QueryOptions = {
|
|
99
|
+
...this.getQueryOptions(),
|
|
100
|
+
skip: this.offset,
|
|
101
|
+
take: this.limit
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
this.databaseService.execute(options);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
checkButtonStatus(): void {
|
|
108
|
+
if (this.resultSetTotal > this.limit) {
|
|
109
|
+
if (this.page === 1) {
|
|
110
|
+
this.setButtonStatus(true, false);
|
|
111
|
+
} else if (this.page > 1 && this.page < this.pages) {
|
|
112
|
+
this.setButtonStatus(false, false);
|
|
113
|
+
} else {
|
|
114
|
+
this.setButtonStatus(false, true);
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
this.setButtonStatus(true, true);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
setButtonStatus(prev: boolean, next: boolean): void {
|
|
122
|
+
this.deactivatePrev = prev;
|
|
123
|
+
this.deactivateNext = next;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
calculateOffset(): void {
|
|
127
|
+
if (this.page === 1) {
|
|
128
|
+
this.offset = 0;
|
|
129
|
+
} else {
|
|
130
|
+
this.offset = (this.page - 1) * this.limit;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<div class="component">
|
|
2
|
+
<div class="component__panel">
|
|
3
|
+
|
|
4
|
+
<div class="controls flex justify-between items-center border-top border-bottom">
|
|
5
|
+
<div class="controls__item flex justify-start items-center">
|
|
6
|
+
<div>
|
|
7
|
+
Pairing Component
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="controls__item flex justify-end items-center">
|
|
11
|
+
<i class="material-icons" (click)="onComponentSwitch();">more_horiz</i>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div class="hover-scrollbox-y h-full min-h-full">
|
|
16
|
+
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Component, Input, OnChanges, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { PresentationService } from '@app/core/services';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'app-pairing',
|
|
6
|
+
templateUrl: './pairing.component.html',
|
|
7
|
+
styleUrls: ['./pairing.component.scss']
|
|
8
|
+
})
|
|
9
|
+
export class PairingComponent implements OnChanges, OnInit, OnDestroy {
|
|
10
|
+
|
|
11
|
+
@Input() fontObject: opentype.Font;
|
|
12
|
+
@Input() fontFamily: string;
|
|
13
|
+
@Input() latestNews: any[] = [];
|
|
14
|
+
|
|
15
|
+
fontColor: string;
|
|
16
|
+
|
|
17
|
+
constructor(
|
|
18
|
+
private presentationService: PresentationService
|
|
19
|
+
) { }
|
|
20
|
+
|
|
21
|
+
ngOnInit(): void {
|
|
22
|
+
const root = document.documentElement as HTMLElement;
|
|
23
|
+
this.fontColor = root.style.getPropertyValue('--fill-color');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
ngOnDestroy() { }
|
|
27
|
+
|
|
28
|
+
ngOnChanges() { }
|
|
29
|
+
|
|
30
|
+
onComponentSwitch() {
|
|
31
|
+
this.presentationService.setInspectComponent('glyph-list');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<figure class="border-bottom">
|
|
2
|
+
<figcaption>
|
|
3
|
+
<span class="material-icons">arrow_drop_down</span>
|
|
4
|
+
<span class="grow whitespace-nowrap">Font Search</span>
|
|
5
|
+
<span class="flex items-center justify-end material-icons-rounded">
|
|
6
|
+
<span title="Collapse" class="material-icons" (click)="onComponentSwitch();">more_horiz</span>
|
|
7
|
+
</span>
|
|
8
|
+
</figcaption>
|
|
9
|
+
</figure>
|
|
10
|
+
|
|
11
|
+
<div class="hover-scrollbox-y overflow-x-hidden">
|
|
12
|
+
|
|
13
|
+
<form class="p-5" (ngSubmit)="onSubmit()" #form="ngForm">
|
|
14
|
+
|
|
15
|
+
<div class="form-group">
|
|
16
|
+
<label form="term">Search term</label>
|
|
17
|
+
<input type="text" class="form-control" [(ngModel)]="model.term" #term="ngModel" name="term" id="term" />
|
|
18
|
+
<span class="form-text text-muted">Please enter a search term.</span>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<div class="form-group">
|
|
22
|
+
<label for="mimes">Mime types</label>
|
|
23
|
+
<select class="form-control" [(ngModel)]="model.mimes" #mimes="ngModel" name="mimes" id="mimes" multiple>
|
|
24
|
+
<option *ngFor="let item of fontTypes;" [value]="item.type">{{item.name}}</option>
|
|
25
|
+
</select>
|
|
26
|
+
<span class="form-text text-muted">Please select mime type.</span>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<div class="form-group">
|
|
30
|
+
<label for="sort">Sort by</label>
|
|
31
|
+
<select class="form-control" [(ngModel)]="model.sort" #sort="ngModel" name="sort" id="sort">
|
|
32
|
+
<option *ngFor="let item of dbColumns; let i = index;" [value]="item.name">{{item.name}}</option>
|
|
33
|
+
</select>
|
|
34
|
+
<span class="form-text text-muted">Select column sort.</span>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<div class="form-group">
|
|
38
|
+
<label for="order">Order by</label>
|
|
39
|
+
<select class="form-control" [(ngModel)]="model.order" #order="ngModel" name="order" id="order">
|
|
40
|
+
<option *ngFor="let item of orderBy; let i = index;" [value]="item">{{item}}</option>
|
|
41
|
+
</select>
|
|
42
|
+
<span class="form-text text-muted">Select orer by.</span>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<div class="form__actions">
|
|
46
|
+
<app-button [type]="'submit'" [title]="'Submit'"
|
|
47
|
+
[ngClass]="'app-button__xl app-button__rounded'">Submit</app-button>
|
|
48
|
+
<app-button [type]="'reset'" [title]="'Submit'" [ngClass]="'app-button__xl app-button__rounded'"
|
|
49
|
+
(click)="onReset();">Reset</app-button>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
</form>
|
|
53
|
+
|
|
54
|
+
</div>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Component, OnInit, ViewChild } from '@angular/core';
|
|
2
|
+
import { NgForm } from '@angular/forms';
|
|
3
|
+
import { BreadcrumbService, DatabaseService, PresentationService } from '@app/core/services';
|
|
4
|
+
import { SearchFormModel } from '@app/core/model';
|
|
5
|
+
import { fontMimeTypes } from '@main/config/mimes';
|
|
6
|
+
import { dbColumns } from '@main/config/database';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'app-search',
|
|
10
|
+
templateUrl: './search.component.html',
|
|
11
|
+
styleUrls: ['./search.component.scss']
|
|
12
|
+
})
|
|
13
|
+
export class SearchComponent implements OnInit {
|
|
14
|
+
|
|
15
|
+
@ViewChild(NgForm) form: NgForm;
|
|
16
|
+
|
|
17
|
+
model: SearchFormModel = new SearchFormModel('', [], 'id', 'ASC', true);
|
|
18
|
+
|
|
19
|
+
fontTypes = fontMimeTypes;
|
|
20
|
+
dbColumns = dbColumns;
|
|
21
|
+
orderBy = ['ASC', 'DESC'];
|
|
22
|
+
|
|
23
|
+
constructor(
|
|
24
|
+
private databaseService: DatabaseService,
|
|
25
|
+
private breadcrumbService: BreadcrumbService,
|
|
26
|
+
private presentationService: PresentationService
|
|
27
|
+
) { }
|
|
28
|
+
|
|
29
|
+
ngOnInit(): void {
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
onSubmit(): void {
|
|
33
|
+
const value = this.form.value;
|
|
34
|
+
|
|
35
|
+
this.databaseService.resetWhere();
|
|
36
|
+
|
|
37
|
+
this.databaseService.setSearch(true);
|
|
38
|
+
this.databaseService.stats = false;
|
|
39
|
+
|
|
40
|
+
if (value?.term) {
|
|
41
|
+
this.databaseService.setWhere('term', value.term);
|
|
42
|
+
this.addBreadcrumb(value.term);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (value?.mimes?.length) {
|
|
46
|
+
this.databaseService.setWhere('file_type', value.mimes);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (value?.sort && value?.order) {
|
|
50
|
+
this.databaseService.setOrder(value.sort, value.order);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
this.databaseService.run();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
addBreadcrumb(searchTerm: string): void {
|
|
57
|
+
this.breadcrumbService.set([{
|
|
58
|
+
title: 'System Search',
|
|
59
|
+
link: '/main',
|
|
60
|
+
type: 'collection'
|
|
61
|
+
}, {
|
|
62
|
+
title: searchTerm,
|
|
63
|
+
link: '',
|
|
64
|
+
type: 'collection'
|
|
65
|
+
}]);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
onReset(): void {
|
|
69
|
+
this.databaseService.setSearch(false);
|
|
70
|
+
this.databaseService.resetWhere().run();
|
|
71
|
+
this.breadcrumbService.setNavigation(this.databaseService.getCollectionId(), this.databaseService.getCollectionResultSet());
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
onComponentSwitch() {
|
|
75
|
+
this.presentationService.setAsideComponent('tables');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
<div class="page">
|
|
2
|
+
|
|
3
|
+
<div class="page__header border-bottom">
|
|
4
|
+
<div class="page__header-title">
|
|
5
|
+
<h1>Database Management</h1>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="flex items-center justify-end p-0 text-right">
|
|
8
|
+
<div>
|
|
9
|
+
<app-button [type]="'button'" [title]="'Add New'" [ngClass]="'app-button__md'" (click)="toggleForm()">Add
|
|
10
|
+
New</app-button>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<form class="form" (ngSubmit)="onSubmit(databaseForm)" #databaseForm="ngForm" *ngIf="screenToggle">
|
|
16
|
+
|
|
17
|
+
<div class="page__body">
|
|
18
|
+
|
|
19
|
+
<input type="hidden" name="name" id="name" [(ngModel)]="dbConnection.name" readonly>
|
|
20
|
+
|
|
21
|
+
<div class="form-group" *ngIf="drivers.length">
|
|
22
|
+
<label for="type">Database Type</label>
|
|
23
|
+
<select class="form-control" name="type" id="type" [(ngModel)]="dbConnection.type" #type="ngModel" required>
|
|
24
|
+
<option *ngFor="let item of drivers;" [value]="item">{{item}}</option>
|
|
25
|
+
</select>
|
|
26
|
+
<span class="form-text text-muted" [hidden]="type.valid || type.pristine">A database type is
|
|
27
|
+
required.</span>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<div class="form-group">
|
|
31
|
+
<label for="title">Title</label>
|
|
32
|
+
<input type="text" class="form-control" name="title" id="title" [(ngModel)]="dbConnection.title"
|
|
33
|
+
#title="ngModel" placeholder="My Connection" required>
|
|
34
|
+
<span class="form-text text-muted">A unique name to identify the connection.</span>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<div class="form-group">
|
|
38
|
+
<label for="host">Host</label>
|
|
39
|
+
<input type="text" class="form-control" name="host" id="host" [(ngModel)]="dbConnection.host" #host="ngModel"
|
|
40
|
+
placeholder="localhost">
|
|
41
|
+
<span class="form-text text-muted">The hostname used to make a connection.</span>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<div class="form-group">
|
|
45
|
+
<label for="port">Port</label>
|
|
46
|
+
<input type="text" class="form-control" name="port" id="port" [(ngModel)]="dbConnection.port" #port="ngModel"
|
|
47
|
+
placeholder="3306">
|
|
48
|
+
<span class="form-text text-muted">The port used to make a connection.</span>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div class="form-group">
|
|
52
|
+
<label for="username">Username</label>
|
|
53
|
+
<input type="text" class="form-control" name="username" id="username" [(ngModel)]="dbConnection.username"
|
|
54
|
+
#username="ngModel">
|
|
55
|
+
<span class="form-text text-muted">Please enter your database username.</span>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<div class="form-group">
|
|
59
|
+
<label for="password">Password</label>
|
|
60
|
+
<input type="password" class="form-control" name="password" id="password" [(ngModel)]="dbConnection.password"
|
|
61
|
+
#password="ngModel">
|
|
62
|
+
<span class="form-text text-muted">Please enter your database password.</span>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<div class="form-group">
|
|
66
|
+
<label for="database">Database</label>
|
|
67
|
+
<input type="text" class="form-control" name="database" id="database" [(ngModel)]="dbConnection.database"
|
|
68
|
+
#database="ngModel" required>
|
|
69
|
+
<span class="form-text text-muted">Please enter a database name.</span>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
<div class="form-group">
|
|
73
|
+
<label for="logging">Logging</label>
|
|
74
|
+
<select class="form-control" name="logging" id="logging" [(ngModel)]="dbConnection.logging" #logging="ngModel">
|
|
75
|
+
<option *ngFor="let item of loggingTypes;" [value]="item.value">{{item.key}}</option>
|
|
76
|
+
</select>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<div class="form-group">
|
|
80
|
+
<label for="synchronize">Synchronize</label>
|
|
81
|
+
<select class="form-control" name="synchronize" id="synchronize" [(ngModel)]="dbConnection.synchronize"
|
|
82
|
+
#synchronize="ngModel">
|
|
83
|
+
<option *ngFor="let item of synchronizeTypes;" [value]="item.value">{{item.key}}</option>
|
|
84
|
+
</select>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<div class="form-group form-group-last">
|
|
88
|
+
<label for="description">Description</label>
|
|
89
|
+
<textarea class="form-control" name="description" id="description" [(ngModel)]="dbConnection.description"
|
|
90
|
+
#description="ngModel" rows="3" required></textarea>
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<div class="page__footer border-top">
|
|
96
|
+
<div class="flex items-center justify-end w-full">
|
|
97
|
+
<app-button [type]="'reset'" [title]="'Reset'" [ngClass]="'app-button__md app-button__success'" (click)="handleReset($event); databaseForm.reset()">Reset</app-button>
|
|
98
|
+
<app-button [type]="'submit'" [title]="'Submit'" [ngClass]="'app-button__md'" [attr.disabled]="buttonDisabled(databaseForm.form.valid)">Submit</app-button>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
</form>
|
|
103
|
+
|
|
104
|
+
<!-- Body -->
|
|
105
|
+
<div class="flex flex-col p-5" *ngIf="!screenToggle">
|
|
106
|
+
|
|
107
|
+
<table class="table table-auto striped">
|
|
108
|
+
<thead>
|
|
109
|
+
<tr>
|
|
110
|
+
<th class="text-center sort_input">ID</th>
|
|
111
|
+
<th class="text-left">Title</th>
|
|
112
|
+
<th class="text-left">Description</th>
|
|
113
|
+
<th class="text-center">Type</th>
|
|
114
|
+
<th class="text-center">Enabled</th>
|
|
115
|
+
<th class="text-center">Synchronize</th>
|
|
116
|
+
<th class="text-center">Logging</th>
|
|
117
|
+
<th class="text-right">Actions</th>
|
|
118
|
+
</tr>
|
|
119
|
+
</thead>
|
|
120
|
+
<tbody>
|
|
121
|
+
<ng-container *ngFor="let item of connections; let i = index;">
|
|
122
|
+
<tr>
|
|
123
|
+
<td class="text-center">
|
|
124
|
+
<span class="material-icons" (click)="updateConnection($event, item)"
|
|
125
|
+
title="Update Connection">settings</span>
|
|
126
|
+
</td>
|
|
127
|
+
<td class="text-left">{{item.title}}</td>
|
|
128
|
+
<td class="text-left">{{item.description}}</td>
|
|
129
|
+
<td class="text-center">{{item.type}}</td>
|
|
130
|
+
<td class="text-center">
|
|
131
|
+
<span class="material-icons" *ngIf="item.enabled">done</span>
|
|
132
|
+
</td>
|
|
133
|
+
<td class="text-center">{{filterBoolean(item.synchronize)}}</td>
|
|
134
|
+
<td class="text-center">{{filterBoolean(item.logging)}}</td>
|
|
135
|
+
<td class="text-center">
|
|
136
|
+
<div class="flex items-center justify-end w-full">
|
|
137
|
+
<span class="material-icons" (click)="testConnection($event, item)"
|
|
138
|
+
title="Test Connection">refresh</span>
|
|
139
|
+
<span class="material-icons" (click)="enableConnection($event, item)"
|
|
140
|
+
title="Set As Default">grade</span>
|
|
141
|
+
<span class="material-icons" (click)="deleteConnection($event, item)"
|
|
142
|
+
title="Delete Connection">delete_outline</span>
|
|
143
|
+
</div>
|
|
144
|
+
</td>
|
|
145
|
+
</tr>
|
|
146
|
+
</ng-container>
|
|
147
|
+
</tbody>
|
|
148
|
+
</table>
|
|
149
|
+
</div>
|
|
150
|
+
|
|
151
|
+
</div>
|
|
File without changes
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { Component, OnInit } from '@angular/core';
|
|
2
|
+
import { NgForm } from '@angular/forms';
|
|
3
|
+
import { ConfigService, MessageService, UtilsService } from '@app/core/services';
|
|
4
|
+
import { DbConnectionModel } from '@app/core/model';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'app-settings-database',
|
|
8
|
+
templateUrl: './database.component.html',
|
|
9
|
+
styleUrls: ['./database.component.scss']
|
|
10
|
+
})
|
|
11
|
+
export class DatabaseComponent implements OnInit {
|
|
12
|
+
|
|
13
|
+
config: any;
|
|
14
|
+
|
|
15
|
+
connections = [];
|
|
16
|
+
drivers = [];
|
|
17
|
+
|
|
18
|
+
loggers = [];
|
|
19
|
+
|
|
20
|
+
loggingTypes = [{
|
|
21
|
+
key: 'Yes',
|
|
22
|
+
value: true
|
|
23
|
+
}, {
|
|
24
|
+
key: 'No',
|
|
25
|
+
value: false
|
|
26
|
+
}];
|
|
27
|
+
|
|
28
|
+
synchronizeTypes = [{
|
|
29
|
+
key: 'Yes',
|
|
30
|
+
value: true
|
|
31
|
+
}, {
|
|
32
|
+
key: 'No',
|
|
33
|
+
value: false
|
|
34
|
+
}];
|
|
35
|
+
|
|
36
|
+
screenToggle = false;
|
|
37
|
+
|
|
38
|
+
dbConnection: DbConnectionModel = new DbConnectionModel('', '', '', '', '');
|
|
39
|
+
|
|
40
|
+
constructor(
|
|
41
|
+
private configService: ConfigService,
|
|
42
|
+
private messageService: MessageService,
|
|
43
|
+
private utils: UtilsService
|
|
44
|
+
) {
|
|
45
|
+
this.config = this.configService.getConfig();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
ngOnInit(): void {
|
|
49
|
+
if (this.config?.database) {
|
|
50
|
+
this.connections = this.config.database.connections;
|
|
51
|
+
this.drivers = this.config.database.drivers;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
toggleForm(): void {
|
|
56
|
+
this.screenToggle = !this.screenToggle;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
filterBoolean(value: boolean): string {
|
|
60
|
+
return value ? 'Yes' : 'No';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
deleteConnection(_event: Event, item: any): void {
|
|
64
|
+
if (item.name === 'default') {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (item.enabled) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const options = {
|
|
73
|
+
type: 'question',
|
|
74
|
+
buttons: ['Yes', 'No'],
|
|
75
|
+
title: 'Confirm',
|
|
76
|
+
message: 'Are you sure you want to delete this connection?'
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
this.messageService.showMessageBox(options).then((res: any) => {
|
|
80
|
+
if (res.response === 0) {
|
|
81
|
+
const result = this.connections.find(x => x.name === item.name);
|
|
82
|
+
if (result) {
|
|
83
|
+
this.connections = this.connections.filter((connection) => connection.name !== result.name);
|
|
84
|
+
this.messageService.deleteDbConnection(result.name).then((connections: any) => this.connections = connections);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
updateConnection(_event: Event, item: any): void {
|
|
91
|
+
if (item?.name === 'default') {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const result = this.connections.find(x => x.name === item.name);
|
|
96
|
+
|
|
97
|
+
if (result) {
|
|
98
|
+
this.toggleForm();
|
|
99
|
+
this.dbConnection = new DbConnectionModel(result.name, result.title, result.description, result.type, result.database, result.username, result.password, result.host, result.port, result.logging, result.synchronize);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
enableConnection(_event: Event, item: any): void {
|
|
104
|
+
this.messageService.enableDbConnection(item).then(() => this.messageService.reloadWindow());
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
testConnection(_event: Event, item: any): void {
|
|
108
|
+
this.messageService.testDbConnection(item).then((result: any) => {
|
|
109
|
+
if (result.type === 'success') {
|
|
110
|
+
//this.alertService.success(result.message);
|
|
111
|
+
} else {
|
|
112
|
+
//this.alertService.error(result.message);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
buttonDisabled(isValid: boolean) {
|
|
118
|
+
return (isValid) ? null : true;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
handleReset(_event: Event): void {
|
|
122
|
+
this.toggleForm();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
onSubmit(form: NgForm): void {
|
|
126
|
+
if (!form.valid) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const values = form.value;
|
|
131
|
+
if (values?.name === 'default') {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const isUpdate = (values?.name !== '') ? true : false;
|
|
136
|
+
values.name = (isUpdate) ? values.name : this.utils.randomString(5).toUpperCase();
|
|
137
|
+
|
|
138
|
+
this.messageService.createDbConnection(values).then((result: any) => {
|
|
139
|
+
this.connections = result;
|
|
140
|
+
this.toggleForm();
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
//this.alertService.success((isUpdate) ? 'Successfully updated connection.' : 'Successfully created connection.');
|
|
144
|
+
}
|
|
145
|
+
}
|