[FEAT] remove angular front

This commit is contained in:
Edouard DUPIN 2024-09-15 15:38:25 +02:00
parent f0b2a859db
commit 75cca15898
166 changed files with 0 additions and 25779 deletions

View File

@ -1,12 +0,0 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# You can see what browsers were selected by your queries by running:
# npx browserslist
> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.

View File

@ -1,13 +0,0 @@
# Editor configuration, see http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false

View File

@ -1,4 +0,0 @@
node_modules/*
build/*
out/*
dist/*

View File

@ -1,225 +0,0 @@
var OFF = 0, WARN = 1, ERROR = 2;
module.exports = {
'env': {
'browser': true,
'es2021': true,
},
'extends': [
'eslint:recommended',
],
'parser': '@typescript-eslint/parser',
'parserOptions': {
'ecmaVersion': 'latest',
'sourceType': 'module',
},
'plugins': [
'@typescript-eslint',
],
"rules": {
// Possible Errors (overrides from recommended set)
"no-extra-parens": ERROR,
"no-unexpected-multiline": ERROR,
// All JSDoc comments must be valid
"valid-jsdoc": [ OFF, {
"requireReturn": false,
"requireReturnDescription": false,
"requireParamDescription": true,
"prefer": {
"return": "returns"
}
}],
// Best Practices
// Allowed a getter without setter, but all setters require getters
"accessor-pairs": [ OFF, {
"getWithoutSet": false,
"setWithoutGet": true
}],
"block-scoped-var": WARN,
"consistent-return": OFF,
"curly": ERROR,
"default-case": WARN,
// the dot goes with the property when doing multiline
"dot-location": [ WARN, "property" ],
"dot-notation": WARN,
"eqeqeq": [ ERROR, "smart" ],
"guard-for-in": WARN,
"no-alert": ERROR,
"no-caller": ERROR,
"no-case-declarations": WARN,
"no-div-regex": WARN,
"no-else-return": WARN,
"no-empty-pattern": WARN,
"no-eq-null": ERROR,
"no-eval": ERROR,
"no-extend-native": ERROR,
"no-extra-bind": WARN,
"no-floating-decimal": WARN,
"no-implicit-coercion": [ WARN, {
"boolean": true,
"number": true,
"string": true
}],
"no-implied-eval": ERROR,
"no-invalid-this": ERROR,
"no-iterator": ERROR,
"no-labels": WARN,
"no-lone-blocks": WARN,
"no-loop-func": ERROR,
"no-magic-numbers": OFF,
"no-multi-spaces": ERROR,
"no-multi-str": WARN,
"no-native-reassign": ERROR,
"no-new-func": ERROR,
"no-new-wrappers": ERROR,
"no-new": ERROR,
"no-octal-escape": ERROR,
"no-param-reassign": ERROR,
"no-process-env": WARN,
"no-proto": ERROR,
"no-redeclare": ERROR,
"no-return-assign": ERROR,
"no-script-url": ERROR,
"no-self-compare": ERROR,
"no-throw-literal": ERROR,
"no-unused-expressions": ERROR,
"no-useless-call": ERROR,
"no-useless-concat": ERROR,
"no-void": WARN,
// Produce warnings when something is commented as TODO or FIXME
"no-warning-comments": [ WARN, {
"terms": [ "TODO", "FIXME" ],
"location": "start"
}],
"no-with": WARN,
"radix": WARN,
"vars-on-top": ERROR,
// Enforces the style of wrapped functions
"wrap-iife": [ ERROR, "outside" ],
"yoda": ERROR,
// Strict Mode - for ES6, never use strict.
"strict": [ ERROR, "never" ],
// Variables
"init-declarations": [ OFF, "always" ],
"no-catch-shadow": WARN,
"no-delete-var": ERROR,
"no-label-var": ERROR,
"no-shadow-restricted-names": ERROR,
"no-shadow": WARN,
// We require all vars to be initialized (see init-declarations)
// If we NEED a var to be initialized to undefined, it needs to be explicit
"no-undef-init": OFF,
"no-undef": ERROR,
"no-undefined": OFF,
"no-unused-vars": OFF,
// Disallow hoisting - let & const don't allow hoisting anyhow
"no-use-before-define": ERROR,
// Node.js and CommonJS
"callback-return": [ WARN, [ "callback", "next" ]],
"global-require": ERROR,
"handle-callback-err": WARN,
"no-mixed-requires": WARN,
"no-new-require": ERROR,
// Use path.concat instead
"no-path-concat": ERROR,
"no-process-exit": ERROR,
"no-restricted-modules": OFF,
"no-sync": WARN,
// ECMAScript 6 support
"arrow-body-style": [ ERROR, "always" ],
"arrow-parens": [ ERROR, "always" ],
"arrow-spacing": [ ERROR, { "before": true, "after": true }],
"constructor-super": ERROR,
"generator-star-spacing": [ ERROR, "before" ],
"no-confusing-arrow": ERROR,
"no-class-assign": ERROR,
"no-const-assign": ERROR,
"no-dupe-class-members": ERROR,
"no-this-before-super": ERROR,
"no-var": WARN,
"object-shorthand": [ WARN, "never" ],
"prefer-arrow-callback": WARN,
"prefer-spread": WARN,
"prefer-template": WARN,
"require-yield": ERROR,
// Stylistic - everything here is a warning because of style.
"array-bracket-spacing": [ WARN, "always" ],
"block-spacing": [ WARN, "always" ],
"brace-style": [ WARN, "1tbs", { "allowSingleLine": false } ],
"camelcase": WARN,
"comma-spacing": [ WARN, { "before": false, "after": true } ],
"comma-style": [ WARN, "last" ],
"computed-property-spacing": [ WARN, "never" ],
"consistent-this": [ WARN, "self" ],
"eol-last": WARN,
"func-names": WARN,
"func-style": [ WARN, "declaration" ],
"id-length": [ WARN, { "min": 2, "max": 32 } ],
"indent": [ WARN, 'tab' ],
"jsx-quotes": [ WARN, "prefer-double" ],
"linebreak-style": [ WARN, "unix" ],
"lines-around-comment": [ OFF, { "beforeBlockComment": true } ],
"max-depth": [ WARN, 8 ],
"max-len": [ WARN, 182 ],
"max-nested-callbacks": [ WARN, 8 ],
"max-params": [ WARN, 10 ],
"new-cap": OFF,
"new-parens": WARN,
"no-array-constructor": WARN,
"no-bitwise": OFF,
"no-continue": OFF,
"no-inline-comments": OFF,
"no-lonely-if": OFF,
"no-mixed-spaces-and-tabs": OFF,
"no-multiple-empty-lines": WARN,
"no-negated-condition": OFF,
"no-nested-ternary": WARN,
"no-new-object": WARN,
"no-plusplus": OFF,
"no-spaced-func": WARN,
"no-ternary": OFF,
"no-trailing-spaces": WARN,
"no-underscore-dangle": WARN,
"no-unneeded-ternary": WARN,
"object-curly-spacing": [ WARN, "always" ],
"one-var": OFF,
"operator-assignment": [ WARN, "never" ],
"operator-linebreak": [ WARN, "after" ],
"padded-blocks": [ WARN, "never" ],
"quote-props": [ WARN, "consistent-as-needed" ],
"quotes": [ WARN, "single" ],
"require-jsdoc": [ OFF, {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": false
}
}],
"semi-spacing": [ WARN, { "before": false, "after": true }],
"semi": [ ERROR, "always" ],
"sort-vars": OFF,
"keyword-spacing": [WARN, {
"overrides": {
"if": { "after": false },
"for": { "after": false },
"while": { "after": false },
"static": { "after": false },
"as": { "after": false }
}
}],
"space-before-blocks": [ WARN, "always" ],
"space-before-function-paren": [ WARN, "never" ],
"space-in-parens": [ WARN, "never" ],
"space-infix-ops": [ WARN, { "int32Hint": true } ],
"space-unary-ops": ERROR,
"spaced-comment": [ WARN, "always" ],
"wrap-regex": WARN,
},
};

3
front/.gitignore vendored
View File

@ -1,3 +0,0 @@
/node_modules/
/.angular/
/.idea/

View File

@ -1,33 +0,0 @@
# base image
FROM node:lts as build
# add `/application/node_modules/.bin` to $PATH
ENV PATH /application/node_modules/.bin:$PATH
ADD package-lock.json /application/
ADD package.json /application/
#ADD browserslist /application/
ADD karma.conf.js /application/
ADD protractor.conf.js /application/
WORKDIR /application/
# install and cache app dependencies
RUN npm install
ADD e2e /application/e2e
ADD tsconfig.json tslint.json angular.json ./
ADD src /application/src
# generate build
RUN ng build --output-path=dist --configuration=production --base-href=/karideo/ --deploy-url=/karideo/
############
### prod ###
############
# base image
FROM httpd:latest
# copy artifact build from the 'build environment'
COPY --from=build /application/dist /usr/local/apache2/htdocs/
COPY httpd/httpd.conf /usr/local/apache2/conf/httpd.conf

View File

@ -1,24 +0,0 @@
# base image
FROM node:latest
ADD src /application/src
ADD e2e /application/e2e
ADD package-lock.json /application/
ADD package.json /application/
ADD angular.json /application/
ADD browserslist /application/
ADD karma.conf.js /application/
ADD protractor.conf.js /application/
ADD tsconfig.json /application/
ADD tslint.json /application/
WORKDIR /application/
# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH
# install and cache app dependencies
RUN npm install
# start app
CMD ["npx", "ng", "serve", "--host", "0.0.0.0"]

View File

@ -1,172 +0,0 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"karusic": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"preserveSymlinks": true,
"polyfills": [
"zone.js"
],
"assets": [
"src/assets",
"src/favicon.ico"
],
"styles": [
"src/styles.less",
"src/generic_page.less",
"src/theme.color.blue.less",
"src/theme.checkbox.less",
"src/theme.modal.less"
],
"scripts": []
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
},
"develop": {
"optimization": false,
"outputHashing": "none",
"namedChunks": true,
"aot": false,
"extractLicenses": true,
"vendorChunk": true,
"buildOptimizer": false,
"sourceMap": {
"scripts": true,
"styles": true,
"hidden": false,
"vendor": true
}
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"buildTarget": "karusic:build"
},
"configurations": {
"production": {
"buildTarget": "karusic:build:production"
},
"develop": {
"buildTarget": "karusic:build:develop"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"buildTarget": "karusic:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": [
"zone.js"
],
"tsConfig": "src/tsconfig.spec.json",
"scripts": [],
"styles": [
"src/styles.less",
"src/generic_page.less",
"src/theme.color.blue.less",
"src/theme.checkbox.less",
"src/theme.modal.less"
],
"assets": [
"src/assets",
"src/favicon.ico"
]
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"fix": true,
"eslintConfig": ".eslintrc.js",
"lintFilePatterns": [
"src/**/*.spec.ts",
"src/**/*.ts"
]
}
},
"TTTTTTlint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"karusic-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "karusic:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"style": "less"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
}

View File

@ -1,11 +0,0 @@
version: '3'
services:
karideo_service:
build: .
restart: always
image: yui.heero/karideo
container_name: karideo
ports:
#- 15081:4200
- 15081:80

View File

@ -1,14 +0,0 @@
import { AppPage } from './app.po';
describe('karusic App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('Welcome to app!');
});
});

View File

@ -1,11 +0,0 @@
import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo() {
return browser.get('/');
}
getParagraphText() {
return element(by.css('app-root h1')).getText();
}
}

View File

@ -1,14 +0,0 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"baseUrl": "./",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}

View File

@ -1,541 +0,0 @@
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/access_log"
# with ServerRoot set to "/usr/local/apache2" will be interpreted by the
# server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log"
# will be interpreted as '/logs/access_log'.
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# Mutex directive, if file-based mutexes are used. If you wish to share the
# same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile.
#
ServerRoot "/usr/local/apache2"
#
# Mutex: Allows you to set the mutex mechanism and mutex file directory
# for individual mutexes, or change the global defaults
#
# Uncomment and change the directory if mutexes are file-based and the default
# mutex file directory is not on a local disk or is not appropriate for some
# other reason.
#
# Mutex default:logs
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
Listen 80
Listen 443
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule mpm_event_module modules/mod_mpm_event.so
#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
#LoadModule mpm_worker_module modules/mod_mpm_worker.so
LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
#LoadModule authn_dbd_module modules/mod_authn_dbd.so
#LoadModule authn_socache_module modules/mod_authn_socache.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
#LoadModule authz_owner_module modules/mod_authz_owner.so
#LoadModule authz_dbd_module modules/mod_authz_dbd.so
LoadModule authz_core_module modules/mod_authz_core.so
#LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
#LoadModule authnz_fcgi_module modules/mod_authnz_fcgi.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_form_module modules/mod_auth_form.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule allowmethods_module modules/mod_allowmethods.so
#LoadModule isapi_module modules/mod_isapi.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule cache_module modules/mod_cache.so
#LoadModule cache_disk_module modules/mod_cache_disk.so
#LoadModule cache_socache_module modules/mod_cache_socache.so
#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
#LoadModule socache_dbm_module modules/mod_socache_dbm.so
#LoadModule socache_memcache_module modules/mod_socache_memcache.so
#LoadModule watchdog_module modules/mod_watchdog.so
#LoadModule macro_module modules/mod_macro.so
#LoadModule dbd_module modules/mod_dbd.so
#LoadModule bucketeer_module modules/mod_bucketeer.so
#LoadModule dumpio_module modules/mod_dumpio.so
#LoadModule echo_module modules/mod_echo.so
#LoadModule example_hooks_module modules/mod_example_hooks.so
#LoadModule case_filter_module modules/mod_case_filter.so
#LoadModule case_filter_in_module modules/mod_case_filter_in.so
#LoadModule example_ipc_module modules/mod_example_ipc.so
#LoadModule buffer_module modules/mod_buffer.so
#LoadModule data_module modules/mod_data.so
#LoadModule ratelimit_module modules/mod_ratelimit.so
LoadModule reqtimeout_module modules/mod_reqtimeout.so
#LoadModule ext_filter_module modules/mod_ext_filter.so
#LoadModule request_module modules/mod_request.so
#LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
#LoadModule reflector_module modules/mod_reflector.so
#LoadModule substitute_module modules/mod_substitute.so
#LoadModule sed_module modules/mod_sed.so
#LoadModule charset_lite_module modules/mod_charset_lite.so
#LoadModule deflate_module modules/mod_deflate.so
LoadModule xml2enc_module modules/mod_xml2enc.so
LoadModule proxy_html_module modules/mod_proxy_html.so
LoadModule mime_module modules/mod_mime.so
#LoadModule ldap_module modules/mod_ldap.so
LoadModule log_config_module modules/mod_log_config.so
#LoadModule log_debug_module modules/mod_log_debug.so
#LoadModule log_forensic_module modules/mod_log_forensic.so
#LoadModule logio_module modules/mod_logio.so
#LoadModule lua_module modules/mod_lua.so
LoadModule env_module modules/mod_env.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
#LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
#LoadModule ident_module modules/mod_ident.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
#LoadModule remoteip_module modules/mod_remoteip.so
LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
#LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
#LoadModule proxy_fdpass_module modules/mod_proxy_fdpass.so
#LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_express_module modules/mod_proxy_express.so
#LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so
#LoadModule session_module modules/mod_session.so
#LoadModule session_cookie_module modules/mod_session_cookie.so
#LoadModule session_crypto_module modules/mod_session_crypto.so
#LoadModule session_dbd_module modules/mod_session_dbd.so
#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
#LoadModule slotmem_plain_module modules/mod_slotmem_plain.so
LoadModule ssl_module modules/mod_ssl.so
#LoadModule optional_hook_export_module modules/mod_optional_hook_export.so
#LoadModule optional_hook_import_module modules/mod_optional_hook_import.so
#LoadModule optional_fn_import_module modules/mod_optional_fn_import.so
#LoadModule optional_fn_export_module modules/mod_optional_fn_export.so
#LoadModule dialup_module modules/mod_dialup.so
#LoadModule http2_module modules/mod_http2.so
#LoadModule proxy_http2_module modules/mod_proxy_http2.so
#LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
#LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
#LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
#LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
LoadModule unixd_module modules/mod_unixd.so
#LoadModule heartbeat_module modules/mod_heartbeat.so
#LoadModule heartmonitor_module modules/mod_heartmonitor.so
#LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule asis_module modules/mod_asis.so
#LoadModule info_module modules/mod_info.so
#LoadModule suexec_module modules/mod_suexec.so
<IfModule !mpm_prefork_module>
#LoadModule cgid_module modules/mod_cgid.so
</IfModule>
<IfModule mpm_prefork_module>
#LoadModule cgi_module modules/mod_cgi.so
</IfModule>
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule dav_lock_module modules/mod_dav_lock.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
#LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
#LoadModule imagemap_module modules/mod_imagemap.so
#LoadModule actions_module modules/mod_actions.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
<IfModule unixd_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User daemon
Group daemon
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin yui.heero@gmail.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride none
Require all denied
</Directory>
# intermediate configuration, tweak to your needs
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
SSLHonorCipherOrder on
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
<VirtualHost *:80>
ServerName my-app
DocumentRoot "/usr/local/apache2/htdocs"
<Directory "/usr/local/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
RewriteEngine on
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Rewrite everything else to index.html to allow HTML5 state links
RewriteRule ^ index.html [L]
</Directory>
</VirtualHost>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ".ht*">
Require all denied
</Files>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog /proc/self/fd/2
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog /proc/self/fd/1 common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock cgisock
</IfModule>
#
# "/usr/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/usr/local/apache2/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
<IfModule headers_module>
#
# Avoid passing HTTP_PROXY environment to CGI's on this or any proxied
# backend servers which have lingering "httpoxy" defects.
# 'Proxy' request header is undefined by the IETF, not listed by IANA
#
RequestHeader unset Proxy early
</IfModule>
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# MaxRanges: Maximum number of Ranges in a request before
# returning the entire resource, or one of the special
# values 'default', 'none' or 'unlimited'.
# Default setting is to accept 200 Ranges.
#MaxRanges unlimited
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall may be used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
# Defaults: EnableMMAP On, EnableSendfile Off
#
#EnableMMAP off
#EnableSendfile on
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Configure mod_proxy_html to understand HTML4/XHTML1
<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

View File

@ -1,31 +0,0 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};

View File

@ -1,49 +0,0 @@
{
"name": "karusic",
"version": "0.0.0",
"license": "MPL-2",
"scripts": {
"all": "npm run build && pnpm run test",
"ng": "ng",
"dev": "ng serve --configuration=develop --watch --port 4203",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"style": "prettier --write .",
"e2e": "ng e2e",
"update_packages": "ncu --upgrade",
"install_dependency": "pnpm install --force",
"link_kar_cw": "pnpm link ../../kar-cw/dist/kar-cw/",
"unlink_kar_cw": "pnpm unlink ../../kar-cw/dist/kar-cw/"
},
"private": true,
"dependencies": {
"@angular/animations": "^18.1.4",
"@angular/cdk": "^18.1.4",
"@angular/common": "^18.1.4",
"@angular/compiler": "^18.1.4",
"@angular/core": "^18.1.4",
"@angular/forms": "^18.1.4",
"@angular/material": "^18.1.4",
"@angular/platform-browser": "^18.1.4",
"@angular/platform-browser-dynamic": "^18.1.4",
"@angular/router": "^18.1.4",
"rxjs": "^7.8.1",
"zone.js": "^0.14.10",
"zod": "^3.23.8",
"@kangaroo-and-rabbit/kar-cw": "^0.4.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "^18.1.4",
"@angular-eslint/builder": "18.3.0",
"@angular-eslint/eslint-plugin": "18.3.0",
"@angular-eslint/eslint-plugin-template": "18.3.0",
"@angular-eslint/schematics": "18.3.0",
"@angular-eslint/template-parser": "18.3.0",
"@angular/cli": "^18.1.4",
"@angular/compiler-cli": "^18.1.4",
"@angular/language-service": "^18.1.4",
"npm-check-updates": "^17.0.6",
"tslib": "^2.6.3"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +0,0 @@
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};

View File

@ -1,43 +0,0 @@
Start the application:
```
npm install
```
upgrade package
```
npm audit fix
```
## npm install -g angular-cli
start the application:
```
npx ng serve --watch
```
plus facilement:
npm install @angular-devkit/build-angular@0.901.9
npm start
Apply linter:
==============
```
npx ng lint
```
build the local image:
docker build -t gitea.atria-soft.org/kangaroo-and-rabbit/karusic:latest .
docker login gitea.atria-soft.org
docker push gitea.atria-soft.org/kangaroo-and-rabbit/karusic:latest

View File

@ -1,184 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file)
*/
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router'; // CLI imports router
import {
HelpScene, HomeScene, AlbumEditScene, AlbumsScene, ArtistEditScene, ArtistScene, SettingsScene,
GenderScene, PlaylistScene, TrackEditScene, TrackScene, UploadScene, ArtistsScene, ArtistAlbumScene, AlbumScene
} from './scene';
import { ForbiddenScene, OnlyUsersGuardHome, HomeOutScene, OnlyUnregisteredGuardHome, SsoScene, OnlyAdminGuard, OnlyUsersGuard, NotFound404Scene } from '@kangaroo-and-rabbit/kar-cw';
// import { HelpComponent } from './help/help.component';
// see https://angular.io/guide/router
const routes: Routes = [
{ path: '', redirectTo: '/home', pathMatch: 'full' },
{ path: 'forbidden', component: ForbiddenScene },
// ------------------------------------
// -- home global interface
// ------------------------------------
{
path: 'home',
component: HomeScene,
canActivate: [OnlyUsersGuardHome], // this route to unregistered path when not logged ==> permit to simplify display
},
{
path: 'unregistered',
component: HomeOutScene,
canActivate: [OnlyUnregisteredGuardHome], // jump to the home when registered
},
// ------------------------------------
// -- SSO Generic interface
// ------------------------------------
{ path: 'sso/:data/:keepConnected/:token', component: SsoScene },
{ path: 'sso/:keepConnected/:token', component: SsoScene },
{ path: 'sso', component: SsoScene },
// ------------------------------------
// -- Generic pages
// ------------------------------------
{ path: 'help/:page', component: HelpScene },
{ path: 'help', component: HelpScene },
// ------------------------------------
// -- upload new data:
// ------------------------------------
{
path: 'upload',
component: UploadScene,
canActivate: [OnlyAdminGuard],
},
// ------------------------------------
// -- gender:
// ------------------------------------
// display all gender
{
path: 'gender',
component: GenderScene,
canActivate: [OnlyUsersGuard],
},
// display all (artist | album | tracks)
{
path: 'gender/:genderId',
component: GenderScene,
canActivate: [OnlyUsersGuard],
},
//{ path: 'gender-edit/:genderId', component: GenderEditScene },
//{ path: 'gender/:genderId', component: GenderScene },
//{ path: 'gender/:genderId/:artistId/:albumId/:trackId', component: GenderScene },
// ------------------------------------
// -- playlist:
// ------------------------------------
{
path: 'playlist',
component: PlaylistScene,
canActivate: [OnlyUsersGuard],
},
{
path: 'playlist/:playlistId',
component: PlaylistScene,
canActivate: [OnlyUsersGuard],
},
//{ path: 'playlist-edit/:playlistId', component: PlaylistEditScene },
// ------------------------------------
// -- Artist:
// ------------------------------------
// display list of all artist
{
path: 'artist',
component: ArtistsScene,
canActivate: [OnlyUsersGuard],
},
// display list af all artist with a specific gender
{
path: 'artist/:artistId',
component: ArtistScene,
canActivate: [OnlyUsersGuard],
},
{
path: 'artist/:artistId/edit',
component: ArtistEditScene,
canActivate: [OnlyAdminGuard],
},
{
path: 'artist/:artistId/:albumId',
component: ArtistAlbumScene,
canActivate: [OnlyUsersGuard],
},
// ------------------------------------
// -- Album:
// ------------------------------------
// display all Album
{
path: 'album',
component: AlbumsScene,
canActivate: [OnlyUsersGuard],
},
{
path: 'album/:albumId/edit',
component: AlbumEditScene,
canActivate: [OnlyAdminGuard],
},
{
path: 'album/:albumId',
component: AlbumScene,
canActivate: [OnlyUsersGuard],
},
// ------------------------------------
// -- Tracks:
// ------------------------------------
{
path: 'track/:trackId/edit',
component: TrackEditScene,
canActivate: [OnlyAdminGuard],
},
{
path: 'track/:genderId/:artistId/:albumId/:trackId',
component: TrackScene,
canActivate: [OnlyUsersGuard],
},
// ------------------------------------
// -- setting:
// ------------------------------------
{
path: 'settings',
component: SettingsScene,
canActivate: [OnlyUsersGuard],
},
{
path: '**',
component: NotFound404Scene,
},
];
@NgModule({
imports: [
RouterModule.forRoot(
routes,
{
//enableTracing: true, // <-- debugging purposes only
},
),
],
exports: [
RouterModule,
]
})
export class AppRoutingModule { }

View File

@ -1,17 +0,0 @@
<!-- Generic global menu -->
<karcw-top-menu [menu]="currentMenu" (callback)="eventOnMenu($event)"/>
<!-- all interfaced pages -->
<div class="main-content">
@if(autoConnectedDone) {
<router-outlet ></router-outlet>
}
@else {
<div class="generic-page">
<div class="fill-all colomn_mutiple">
<b style="color:red;">Auto-connection in progress</b>
<div class="clear"></div>
</div>
</div>
}
</div>
<AppPlayerAudio></AppPlayerAudio>

View File

@ -1,46 +0,0 @@
#create-exercice-button {
position: fixed;
display: block;
right: 0;
bottom: 0;
margin-right: 40px;
margin-bottom: 40px;
z-index: 900;
}
#save-exercice-button {
position: fixed;
display: block;
right: 0;
bottom: 0;
margin-right: 110px;
margin-bottom: 40px;
z-index: 900;
}
.main-content {
position: absolute;
//width: ~"calc(calc(100% / 5 ) * 5)";
width: 100%;
height: ~"calc(100% - 56px)";
top: 56px;
left: 0;
margin: 0;
padding: 0;
display: block;
position: fixed;
overflow-y: auto;
//background-color:#FF0;
/*
.main-reduce {
width: 40%;
height: 100%;
margin: 0;
padding: 0px 10% 0px 10%;
display: block;
overflow-y:scroll;
}
*/
}

View File

@ -1,300 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file)
*/
import { Component, OnInit } from '@angular/core';
import { ArianeService } from './service';
import {
MenuItem,
SSOService,
SessionService,
UserService,
UserRoles222,
EventOnMenu,
MenuPosition,
isNullOrUndefined,
} from '@kangaroo-and-rabbit/kar-cw';
enum MenuEventType {
SSO_LOGIN = "SSO_CALL_LOGIN",
SSO_LOGOUT = "SSO_CALL_LOGOUT",
SSO_SIGNUP = "SSO_CALL_SIGNUP",
SEGMENT = "SEGMENT",
TYPE = "TYPE",
ARTIST = "ARTIST",
ALBUM = "ALBUM",
TRACK = "TRACK",
PLAYLIST = "PLAYLIST",
}
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: [
'./app.component.less',
]
})
export class AppComponent implements OnInit {
title: string = 'Karideo';
autoConnectedDone: boolean = false;
isConnected: boolean = false;
signUpEnable: boolean = true;
currentMenu: MenuItem[] = [];
location: string = "home";
constructor(
private sessionService: SessionService,
private ssoService: SSOService,
private arianeService: ArianeService,
private userService: UserService
) {
}
ngOnInit() {
this.autoConnectedDone = false;
this.isConnected = false;
this.updateMainMenu();
let self = this;
this.sessionService.change.subscribe((isConnected) => {
console.log(`receive event from session ...${isConnected}`);
self.isConnected = isConnected;
self.autoConnectedDone = true;
self.updateMainMenu();
});
this.ssoService.checkSignUpEnable()
.then((value: boolean) => {
console.log(`Get value signUp = ${value}`);
self.signUpEnable = value;
self.updateMainMenu();
}).catch((error: any) => {
console.log(`Can not call the sso to check the sign-up_interface: ${error}`);
});
this.userService.checkAutoConnect().then(() => {
console.log(` ==>>>>> Autoconnect THEN !!!`);
self.autoConnectedDone = true;
}).catch(() => {
console.log(` ==>>>>> Autoconnect CATCH !!!`);
self.autoConnectedDone = true;
}).finally(() => {
console.log(` ==>>>>> Autoconnect FINALLY !!!`);
self.autoConnectedDone = true;
});
this.arianeService.segmentChange.subscribe((_segmentName: string) => {
//console.log(`>>> change typeId=${typeId}`);
self.updateMainMenu();
});
this.arianeService.typeChange.subscribe((_typeId: number) => {
//console.log(`>>> change typeId=${typeId}`);
self.updateMainMenu();
});
this.arianeService.playlistChange.subscribe((_universId: number) => {
//console.log(`>>> change universId=${universId}`);
self.updateMainMenu();
});
this.arianeService.artistChange.subscribe((_artistId: number) => {
//console.log(`>>> change artistId=${artistId}`);
self.updateMainMenu();
});
this.arianeService.albumChange.subscribe((_albumId: number) => {
//console.log(`>>> change albumId=${albumId}`);
self.updateMainMenu();
});
this.arianeService.trackChange.subscribe((_trackId: number) => {
//console.log(`>>> change trackId=${trackId}`);
self.updateMainMenu();
});
}
eventOnMenu(data: EventOnMenu): void {
console.log(`Get event on menu: ${JSON.stringify(data, null, 4)}`);
switch (data.menu.otherData) {
case MenuEventType.SSO_LOGIN:
this.ssoService.requestSignIn();
break;
case MenuEventType.SSO_LOGOUT:
this.ssoService.requestSignOut();
break;
case MenuEventType.SSO_SIGNUP:
this.ssoService.requestSignUp();
break;
case MenuEventType.SEGMENT:
if (this.arianeService.getCurrrentSegment() === "artist") {
this.arianeService.navigateArtist({});
} else if (this.arianeService.getCurrrentSegment() === "gender") {
this.arianeService.navigateGender({});
} else if (this.arianeService.getCurrrentSegment() === "playlist") {
this.arianeService.navigatePlaylist({});
} else if (this.arianeService.getCurrrentSegment() === "track") {
this.arianeService.navigateTrack({});
} else if (this.arianeService.getCurrrentSegment() === "album") {
this.arianeService.navigateAlbum({});
}
break;
case MenuEventType.TYPE:
break;
case MenuEventType.ARTIST:
if (this.arianeService.getCurrrentSegment() === "artist") {
this.arianeService.navigateArtist({ artistId: this.arianeService.getArtistId() });
}
break;
case MenuEventType.ALBUM:
break;
case MenuEventType.TRACK:
break;
case MenuEventType.PLAYLIST:
break;
}
}
updateMainMenu(): void {
console.log("update main menu :");
if (this.isConnected) {
this.currentMenu = [
{
position: MenuPosition.LEFT,
hover: "lkjljlk", //`You are logged as: ${this.sessionService.getLogin()}`,
icon: "menu",
title: "Menu",
subMenu: [
{
position: MenuPosition.LEFT,
hover: "Go to Home page",
icon: "home",
title: "Home",
navigateTo: "home",
}, {
position: MenuPosition.LEFT,
icon: "group_work",
title: this.getSegmentDisplayable(),
otherData: MenuEventType.SEGMENT,
callback: true,
enable: this.getSegmentDisplayable() !== "",
}, {
position: MenuPosition.LEFT,
icon: "piano",
title: this.getSegmentDisplayable(),
otherData: MenuEventType.TYPE,
callback: true,
enable: !isNullOrUndefined(this.arianeService.getTypeId()),
}, {
position: MenuPosition.LEFT,
icon: "person",
title: this.arianeService.getArtistName(),
otherData: MenuEventType.ARTIST,
callback: true,
enable: !isNullOrUndefined(this.arianeService.getArtistId()),
}, {
position: MenuPosition.LEFT,
icon: "album",
title: this.arianeService.getAlbumName(),
otherData: MenuEventType.ALBUM,
callback: true,
enable: !isNullOrUndefined(this.arianeService.getAlbumId()),
}, {
position: MenuPosition.LEFT,
icon: "music_note",
title: this.arianeService.getTrackName(),
otherData: MenuEventType.TRACK,
callback: true,
enable: !isNullOrUndefined(this.arianeService.getTrackId()),
}, {
position: MenuPosition.LEFT,
icon: "queue_music",
title: "true",//this.arianeService.getPlaylistName(),
otherData: MenuEventType.PLAYLIST,
callback: true,
enable: !isNullOrUndefined(this.arianeService.getPlaylistId()),
}
],
}, {
position: MenuPosition.RIGHT,
image: "assets/images/avatar_generic.svg",
title: "",
subMenu: [
{
position: MenuPosition.LEFT,
hover: `You are logged as: <b>${this.sessionService.getLogin()}</b>`,
title: `Sign in as ${this.sessionService.getLogin()}`,
}, {
position: MenuPosition.LEFT,
icon: "add_circle",
title: "Add media",
navigateTo: "upload",
enable: this.sessionService.hasRight(UserRoles222.admin),
}, {
position: MenuPosition.LEFT,
icon: "settings",
title: "Settings",
navigateTo: "settings",
}, {
position: MenuPosition.LEFT,
icon: "help",
title: "Help",
navigateTo: "help",
}, {
position: MenuPosition.LEFT,
hover: "Exit connection",
icon: "exit_to_app",
title: "Sign out",
callback: true,
otherData: MenuEventType.SSO_LOGOUT,
},
],
},
];
} else {
this.currentMenu = [
{
position: MenuPosition.LEFT,
hover: "Go to Home page",
icon: "home",
title: "Home",
navigateTo: "home",
}, {
position: MenuPosition.RIGHT,
hover: "Create a new account",
icon: "add_circle_outline",
title: "Sign-up",
callback: true,
model: this.signUpEnable ? undefined : "disable",
otherData: MenuEventType.SSO_SIGNUP,
}, {
position: MenuPosition.RIGHT,
hover: "Login page",
icon: "account_circle",
title: "Sign-in",
callback: true,
otherData: MenuEventType.SSO_LOGIN,
},
];
}
console.log(" ==> DONE");
}
getSegmentDisplayable(): string {
let segment = this.arianeService.getCurrrentSegment();
if (segment === "artist") {
return "Artists"
}
if (segment === "gender") {
return "Genders"
}
if (segment === "album") {
return "Albums"
}
if (segment === "track") {
return "Tracks"
}
if (segment === "playlist") {
return "Playlist"
}
return "";
}
}

View File

@ -1,98 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file)
*/
import { BrowserModule } from '@angular/platform-browser';
import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { HttpClientModule } from '@angular/common/http';
import { AppRoutingModule } from './app-routing.module';
import { ElementDataImageComponent } from './component/data-image/data-image';
import { ElementTypeComponent } from './component/AppElementHomeType/AppElementHomeType';
import { PopInCreateType } from './popin/create-type/create-type';
import { AppComponent } from './app.component';
import {
HomeScene, HelpScene, GenderScene, PlaylistScene, ArtistScene, AlbumScene, AlbumsScene, TrackScene, SettingsScene,
TrackEditScene, AlbumEditScene, ArtistEditScene, ArtistsScene, ArtistAlbumScene
} from './scene';
import { GenderService, DataService, PlaylistService, ArtistService, AlbumService, TrackService, ArianeService, PlayerService } from './service';
import { UploadScene } from './scene/upload/upload';
import {
AppDescriptionArea,
AppElementAlbum,
AppElementTrack,
ElementPlayerAudioComponent,
} from './component';
import { KarCWModule } from '@kangaroo-and-rabbit/kar-cw';
import { environment } from 'environments/environment';
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { CommonModule } from "@angular/common";
@NgModule({
declarations: [
AppComponent,
ElementDataImageComponent,
ElementTypeComponent,
AppElementTrack,
AppElementAlbum,
ElementPlayerAudioComponent,
AppDescriptionArea,
PopInCreateType,
HomeScene,
HelpScene,
GenderScene,
PlaylistScene,
ArtistAlbumScene,
ArtistsScene,
ArtistScene,
AlbumScene,
AlbumsScene,
TrackScene,
SettingsScene,
TrackEditScene,
AlbumEditScene,
ArtistEditScene,
UploadScene,
],
imports: [
FormsModule,
ReactiveFormsModule,
CommonModule,
BrowserModule,
RouterModule,
AppRoutingModule,
HttpClientModule,
KarCWModule,
],
providers: [
{ provide: 'ENVIRONMENT', useValue: environment },
ArianeService,
PlayerService,
GenderService,
DataService,
PlaylistService,
ArtistService,
AlbumService,
TrackService,
],
exports: [
AppComponent,
ElementTypeComponent,
AppElementAlbum,
AppElementTrack,
PopInCreateType,
],
bootstrap: [
AppComponent
],
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
})
export class AppModule { }

View File

@ -1,250 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import {
HTTPMimeType,
HTTPRequestModel,
RESTCallbacks,
RESTConfig,
RESTRequestJson,
RESTRequestVoid,
} from "../rest-tools";
import { z as zod } from "zod"
import {
Album,
AlbumWrite,
Long,
UUID,
ZodAlbum,
isAlbum,
} from "../model";
export namespace AlbumResource {
/**
* Add a Track on a specific album
*/
export function addTrack({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
trackId: Long,
id: Long,
},
}): Promise<Album> {
return RESTRequestJson({
restModel: {
endPoint: "/album/{id}/track/{trackId}",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isAlbum);
};
/**
* Get a specific Album with his ID
*/
export function get({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
}): Promise<Album> {
return RESTRequestJson({
restModel: {
endPoint: "/album/{id}",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isAlbum);
};
export const ZodGetsTypeReturn = zod.array(ZodAlbum);
export type GetsTypeReturn = zod.infer<typeof ZodGetsTypeReturn>;
export function isGetsTypeReturn(data: any): data is GetsTypeReturn {
try {
ZodGetsTypeReturn.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodGetsTypeReturn' error=${e}`);
return false;
}
}
/**
* Get all the available Albums
*/
export function gets({
restConfig,
}: {
restConfig: RESTConfig,
}): Promise<GetsTypeReturn> {
return RESTRequestJson({
restModel: {
endPoint: "/album/",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isGetsTypeReturn);
};
/**
* Update a specific album
*/
export function patch({
restConfig,
params,
data,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
data: AlbumWrite,
}): Promise<Album> {
return RESTRequestJson({
restModel: {
endPoint: "/album/{id}",
requestType: HTTPRequestModel.PATCH,
contentType: HTTPMimeType.JSON,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
data,
}, isAlbum);
};
/**
* Add an album (when all the data already exist)
*/
export function post({
restConfig,
data,
}: {
restConfig: RESTConfig,
data: AlbumWrite,
}): Promise<Album> {
return RESTRequestJson({
restModel: {
endPoint: "/album/",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.JSON,
accept: HTTPMimeType.JSON,
},
restConfig,
data,
}, isAlbum);
};
/**
* Remove a specific album
*/
export function remove({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
}): Promise<void> {
return RESTRequestVoid({
restModel: {
endPoint: "/album/{id}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
},
restConfig,
params,
});
};
/**
* Remove a cover on a specific album
*/
export function removeCover({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
coverId: UUID,
id: Long,
},
}): Promise<Album> {
return RESTRequestJson({
restModel: {
endPoint: "/album/{id}/cover/{coverId}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isAlbum);
};
/**
* Remove a Track on a specific album
*/
export function removeTrack({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
trackId: Long,
id: Long,
},
}): Promise<Album> {
return RESTRequestJson({
restModel: {
endPoint: "/album/{id}/track/{trackId}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isAlbum);
};
/**
* Add a cover on a specific album
*/
export function uploadCover({
restConfig,
params,
data,
callbacks,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
data: {
file: File,
},
callbacks?: RESTCallbacks,
}): Promise<Album> {
return RESTRequestJson({
restModel: {
endPoint: "/album/{id}/cover",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
data,
callbacks,
}, isAlbum);
};
}

View File

@ -1,181 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import {
HTTPMimeType,
HTTPRequestModel,
RESTCallbacks,
RESTConfig,
RESTRequestJson,
RESTRequestVoid,
} from "../rest-tools";
import { z as zod } from "zod"
import {
Artist,
ArtistWrite,
Long,
UUID,
ZodArtist,
isArtist,
} from "../model";
export namespace ArtistResource {
export function get({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
}): Promise<Artist> {
return RESTRequestJson({
restModel: {
endPoint: "/artist/{id}",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isArtist);
};
export const ZodGetsTypeReturn = zod.array(ZodArtist);
export type GetsTypeReturn = zod.infer<typeof ZodGetsTypeReturn>;
export function isGetsTypeReturn(data: any): data is GetsTypeReturn {
try {
ZodGetsTypeReturn.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodGetsTypeReturn' error=${e}`);
return false;
}
}
export function gets({
restConfig,
}: {
restConfig: RESTConfig,
}): Promise<GetsTypeReturn> {
return RESTRequestJson({
restModel: {
endPoint: "/artist/",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isGetsTypeReturn);
};
export function patch({
restConfig,
params,
data,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
data: ArtistWrite,
}): Promise<Artist> {
return RESTRequestJson({
restModel: {
endPoint: "/artist/{id}",
requestType: HTTPRequestModel.PATCH,
contentType: HTTPMimeType.JSON,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
data,
}, isArtist);
};
export function post({
restConfig,
data,
}: {
restConfig: RESTConfig,
data: ArtistWrite,
}): Promise<Artist> {
return RESTRequestJson({
restModel: {
endPoint: "/artist/",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.JSON,
accept: HTTPMimeType.JSON,
},
restConfig,
data,
}, isArtist);
};
export function remove({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
}): Promise<void> {
return RESTRequestVoid({
restModel: {
endPoint: "/artist/{id}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
},
restConfig,
params,
});
};
export function removeCover({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
coverId: UUID,
id: Long,
},
}): Promise<Artist> {
return RESTRequestJson({
restModel: {
endPoint: "/artist/{id}/cover/{coverId}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isArtist);
};
export function uploadCover({
restConfig,
params,
data,
callbacks,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
data: {
file: File,
},
callbacks?: RESTCallbacks,
}): Promise<Artist> {
return RESTRequestJson({
restModel: {
endPoint: "/artist/{id}/cover",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
data,
callbacks,
}, isArtist);
};
}

View File

@ -1,128 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import {
HTTPMimeType,
HTTPRequestModel,
RESTConfig,
RESTRequestJson,
RESTRequestVoid,
} from "../rest-tools";
import {
UUID,
} from "../model";
export namespace DataResource {
/**
* Get back some data from the data environment (with a beautiful name (permit download with basic name)
*/
export function retrieveDataFull({
restConfig,
queries,
params,
data,
}: {
restConfig: RESTConfig,
queries: {
Authorization?: string,
},
params: {
name: string,
uuid: UUID,
},
data: string,
}): Promise<object> {
return RESTRequestJson({
restModel: {
endPoint: "/data/{uuid}/{name}",
requestType: HTTPRequestModel.GET,
},
restConfig,
params,
queries,
data,
});
};
/**
* Get back some data from the data environment
*/
export function retrieveDataId({
restConfig,
queries,
params,
data,
}: {
restConfig: RESTConfig,
queries: {
Authorization?: string,
},
params: {
uuid: UUID,
},
data: string,
}): Promise<object> {
return RESTRequestJson({
restModel: {
endPoint: "/data/{uuid}",
requestType: HTTPRequestModel.GET,
},
restConfig,
params,
queries,
data,
});
};
/**
* Get a thumbnail of from the data environment (if resize is possible)
*/
export function retrieveDataThumbnailId({
restConfig,
queries,
params,
data,
}: {
restConfig: RESTConfig,
queries: {
Authorization?: string,
},
params: {
uuid: UUID,
},
data: string,
}): Promise<object> {
return RESTRequestJson({
restModel: {
endPoint: "/data/thumbnail/{uuid}",
requestType: HTTPRequestModel.GET,
},
restConfig,
params,
queries,
data,
});
};
/**
* Insert a new data in the data environment
*/
export function uploadFile({
restConfig,
data,
}: {
restConfig: RESTConfig,
data: {
file: File,
},
}): Promise<void> {
return RESTRequestVoid({
restModel: {
endPoint: "/data//upload/",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
},
restConfig,
data,
});
};
}

View File

@ -1,6 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
export namespace Front {
}

View File

@ -1,181 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import {
HTTPMimeType,
HTTPRequestModel,
RESTCallbacks,
RESTConfig,
RESTRequestJson,
RESTRequestVoid,
} from "../rest-tools";
import { z as zod } from "zod"
import {
Gender,
GenderWrite,
Long,
UUID,
ZodGender,
isGender,
} from "../model";
export namespace GenderResource {
export function get({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
}): Promise<Gender> {
return RESTRequestJson({
restModel: {
endPoint: "/gender/{id}",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isGender);
};
export const ZodGetsTypeReturn = zod.array(ZodGender);
export type GetsTypeReturn = zod.infer<typeof ZodGetsTypeReturn>;
export function isGetsTypeReturn(data: any): data is GetsTypeReturn {
try {
ZodGetsTypeReturn.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodGetsTypeReturn' error=${e}`);
return false;
}
}
export function gets({
restConfig,
}: {
restConfig: RESTConfig,
}): Promise<GetsTypeReturn> {
return RESTRequestJson({
restModel: {
endPoint: "/gender/",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isGetsTypeReturn);
};
export function patch({
restConfig,
params,
data,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
data: GenderWrite,
}): Promise<Gender> {
return RESTRequestJson({
restModel: {
endPoint: "/gender/{id}",
requestType: HTTPRequestModel.PATCH,
contentType: HTTPMimeType.JSON,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
data,
}, isGender);
};
export function post({
restConfig,
data,
}: {
restConfig: RESTConfig,
data: GenderWrite,
}): Promise<Gender> {
return RESTRequestJson({
restModel: {
endPoint: "/gender/",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.JSON,
accept: HTTPMimeType.JSON,
},
restConfig,
data,
}, isGender);
};
export function remove({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
}): Promise<void> {
return RESTRequestVoid({
restModel: {
endPoint: "/gender/{id}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
},
restConfig,
params,
});
};
export function removeCover({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
coverId: UUID,
id: Long,
},
}): Promise<Gender> {
return RESTRequestJson({
restModel: {
endPoint: "/gender/{id}/cover/{coverId}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isGender);
};
export function uploadCover({
restConfig,
params,
data,
callbacks,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
data: {
file: File,
},
callbacks?: RESTCallbacks,
}): Promise<Gender> {
return RESTRequestJson({
restModel: {
endPoint: "/gender/{id}/cover",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
data,
callbacks,
}, isGender);
};
}

View File

@ -1,32 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import {
HTTPMimeType,
HTTPRequestModel,
RESTConfig,
RESTRequestJson,
} from "../rest-tools";
import {
HealthResult,
isHealthResult,
} from "../model";
export namespace HealthCheck {
export function getHealth({
restConfig,
}: {
restConfig: RESTConfig,
}): Promise<HealthResult> {
return RESTRequestJson({
restModel: {
endPoint: "/health_check/",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isHealthResult);
};
}

View File

@ -1,12 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
export * from "./album-resource"
export * from "./artist-resource"
export * from "./data-resource"
export * from "./front"
export * from "./gender-resource"
export * from "./health-check"
export * from "./playlist-resource"
export * from "./track-resource"
export * from "./user-resource"

View File

@ -1,219 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import {
HTTPMimeType,
HTTPRequestModel,
RESTConfig,
RESTRequestJson,
RESTRequestVoid,
} from "../rest-tools";
import { z as zod } from "zod"
import {
Long,
Playlist,
PlaylistWrite,
UUID,
ZodPlaylist,
isPlaylist,
} from "../model";
export namespace PlaylistResource {
export function addTrack({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
trackId: Long,
id: Long,
},
}): Promise<Playlist> {
return RESTRequestJson({
restModel: {
endPoint: "/playlist/{id}/track/{trackId}",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isPlaylist);
};
export function get({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
}): Promise<Playlist> {
return RESTRequestJson({
restModel: {
endPoint: "/playlist/{id}",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isPlaylist);
};
export const ZodGetsTypeReturn = zod.array(ZodPlaylist);
export type GetsTypeReturn = zod.infer<typeof ZodGetsTypeReturn>;
export function isGetsTypeReturn(data: any): data is GetsTypeReturn {
try {
ZodGetsTypeReturn.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodGetsTypeReturn' error=${e}`);
return false;
}
}
export function gets({
restConfig,
}: {
restConfig: RESTConfig,
}): Promise<GetsTypeReturn> {
return RESTRequestJson({
restModel: {
endPoint: "/playlist/",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isGetsTypeReturn);
};
export function patch({
restConfig,
params,
data,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
data: PlaylistWrite,
}): Promise<Playlist> {
return RESTRequestJson({
restModel: {
endPoint: "/playlist/{id}",
requestType: HTTPRequestModel.PATCH,
contentType: HTTPMimeType.JSON,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
data,
}, isPlaylist);
};
export function post({
restConfig,
data,
}: {
restConfig: RESTConfig,
data: PlaylistWrite,
}): Promise<Playlist> {
return RESTRequestJson({
restModel: {
endPoint: "/playlist/",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.JSON,
accept: HTTPMimeType.JSON,
},
restConfig,
data,
}, isPlaylist);
};
export function remove({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
}): Promise<void> {
return RESTRequestVoid({
restModel: {
endPoint: "/playlist/{id}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
},
restConfig,
params,
});
};
export function removeCover({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
coverId: UUID,
id: Long,
},
}): Promise<Playlist> {
return RESTRequestJson({
restModel: {
endPoint: "/playlist/{id}/cover/{coverId}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isPlaylist);
};
export function removeTrack({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
trackId: Long,
id: Long,
},
}): Promise<Playlist> {
return RESTRequestJson({
restModel: {
endPoint: "/playlist/{id}/track/{trackId}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isPlaylist);
};
export function uploadCover({
restConfig,
params,
data,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
data: {
file: File,
},
}): Promise<Playlist> {
return RESTRequestJson({
restModel: {
endPoint: "/playlist/{id}/cover",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
data,
}, isPlaylist);
};
}

View File

@ -1,252 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import {
HTTPMimeType,
HTTPRequestModel,
RESTCallbacks,
RESTConfig,
RESTRequestJson,
RESTRequestVoid,
} from "../rest-tools";
import { z as zod } from "zod"
import {
Long,
Track,
TrackWrite,
UUID,
ZodTrack,
isTrack,
} from "../model";
export namespace TrackResource {
export function addTrack({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
artistId: Long,
id: Long,
},
}): Promise<Track> {
return RESTRequestJson({
restModel: {
endPoint: "/track/{id}/artist/{artistId}",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isTrack);
};
export function get({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
}): Promise<Track> {
return RESTRequestJson({
restModel: {
endPoint: "/track/{id}",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isTrack);
};
export const ZodGetsTypeReturn = zod.array(ZodTrack);
export type GetsTypeReturn = zod.infer<typeof ZodGetsTypeReturn>;
export function isGetsTypeReturn(data: any): data is GetsTypeReturn {
try {
ZodGetsTypeReturn.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodGetsTypeReturn' error=${e}`);
return false;
}
}
export function gets({
restConfig,
}: {
restConfig: RESTConfig,
}): Promise<GetsTypeReturn> {
return RESTRequestJson({
restModel: {
endPoint: "/track/",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isGetsTypeReturn);
};
export function patch({
restConfig,
params,
data,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
data: TrackWrite,
}): Promise<Track> {
return RESTRequestJson({
restModel: {
endPoint: "/track/{id}",
requestType: HTTPRequestModel.PATCH,
contentType: HTTPMimeType.JSON,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
data,
}, isTrack);
};
export function post({
restConfig,
data,
}: {
restConfig: RESTConfig,
data: TrackWrite,
}): Promise<Track> {
return RESTRequestJson({
restModel: {
endPoint: "/track/",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.JSON,
accept: HTTPMimeType.JSON,
},
restConfig,
data,
}, isTrack);
};
export function remove({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
}): Promise<void> {
return RESTRequestVoid({
restModel: {
endPoint: "/track/{id}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
},
restConfig,
params,
});
};
export function removeCover({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
coverId: UUID,
id: Long,
},
}): Promise<Track> {
return RESTRequestJson({
restModel: {
endPoint: "/track/{id}/cover/{coverId}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isTrack);
};
export function removeTrack({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
artistId: Long,
id: Long,
},
}): Promise<Track> {
return RESTRequestJson({
restModel: {
endPoint: "/track/{id}/artist/{trackId}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isTrack);
};
export function uploadCover({
restConfig,
params,
data,
callbacks,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
data: {
file: File,
},
callbacks?: RESTCallbacks,
}): Promise<Track> {
return RESTRequestJson({
restModel: {
endPoint: "/track/{id}/cover",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
data,
callbacks,
}, isTrack);
};
export function uploadTrack({
restConfig,
data,
callbacks,
}: {
restConfig: RESTConfig,
data: {
fileName: string,
file: File,
gender: string,
artist: string,
album: string,
trackId: Long,
title: string,
},
callbacks?: RESTCallbacks,
}): Promise<Track> {
return RESTRequestJson({
restModel: {
endPoint: "/track/upload/",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
accept: HTTPMimeType.JSON,
},
restConfig,
data,
callbacks,
}, isTrack);
};
}

View File

@ -1,90 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import {
HTTPMimeType,
HTTPRequestModel,
RESTConfig,
RESTRequestJson,
} from "../rest-tools";
import { z as zod } from "zod"
import {
Long,
UserKarusic,
UserOut,
ZodUserKarusic,
isUserKarusic,
isUserOut,
} from "../model";
export namespace UserResource {
export function get({
restConfig,
params,
produce,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
produce: HTTPMimeType.JSON,
}): Promise<UserKarusic> {
return RESTRequestJson({
restModel: {
endPoint: "/users/{id}",
requestType: HTTPRequestModel.GET,
accept: produce,
},
restConfig,
params,
}, isUserKarusic);
};
export function getMe({
restConfig,
produce,
}: {
restConfig: RESTConfig,
produce: HTTPMimeType.JSON,
}): Promise<UserOut> {
return RESTRequestJson({
restModel: {
endPoint: "/users/me",
requestType: HTTPRequestModel.GET,
accept: produce,
},
restConfig,
}, isUserOut);
};
export const ZodGetsTypeReturn = zod.array(ZodUserKarusic);
export type GetsTypeReturn = zod.infer<typeof ZodGetsTypeReturn>;
export function isGetsTypeReturn(data: any): data is GetsTypeReturn {
try {
ZodGetsTypeReturn.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodGetsTypeReturn' error=${e}`);
return false;
}
}
export function gets({
restConfig,
produce,
}: {
restConfig: RESTConfig,
produce: HTTPMimeType.JSON,
}): Promise<GetsTypeReturn> {
return RESTRequestJson({
restModel: {
endPoint: "/users/",
requestType: HTTPRequestModel.GET,
accept: produce,
},
restConfig,
}, isGetsTypeReturn);
};
}

View File

@ -1,7 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
export * from "./model";
export * from "./api";
export * from "./rest-tools";

View File

@ -1,53 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodUUID} from "./uuid";
import {ZodLocalDate} from "./local-date";
import {ZodGenericDataSoftDelete, ZodGenericDataSoftDeleteWrite } from "./generic-data-soft-delete";
export const ZodAlbum = ZodGenericDataSoftDelete.extend({
name: zod.string().max(256).optional(),
description: zod.string().optional(),
/**
* List of Id of the specific covers
*/
covers: zod.array(ZodUUID).optional(),
publication: ZodLocalDate.optional(),
});
export type Album = zod.infer<typeof ZodAlbum>;
export function isAlbum(data: any): data is Album {
try {
ZodAlbum.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodAlbum' error=${e}`);
return false;
}
}
export const ZodAlbumWrite = ZodGenericDataSoftDeleteWrite.extend({
name: zod.string().max(256).nullable().optional(),
description: zod.string().nullable().optional(),
/**
* List of Id of the specific covers
*/
covers: zod.array(ZodUUID).nullable().optional(),
publication: ZodLocalDate.nullable().optional(),
});
export type AlbumWrite = zod.infer<typeof ZodAlbumWrite>;
export function isAlbumWrite(data: any): data is AlbumWrite {
try {
ZodAlbumWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodAlbumWrite' error=${e}`);
return false;
}
}

View File

@ -1,59 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodUUID} from "./uuid";
import {ZodLocalDate} from "./local-date";
import {ZodGenericDataSoftDelete, ZodGenericDataSoftDeleteWrite } from "./generic-data-soft-delete";
export const ZodArtist = ZodGenericDataSoftDelete.extend({
name: zod.string().max(256).optional(),
description: zod.string().optional(),
/**
* List of Id of the specific covers
*/
covers: zod.array(ZodUUID).optional(),
firstName: zod.string().max(256).optional(),
surname: zod.string().max(256).optional(),
birth: ZodLocalDate.optional(),
death: ZodLocalDate.optional(),
});
export type Artist = zod.infer<typeof ZodArtist>;
export function isArtist(data: any): data is Artist {
try {
ZodArtist.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodArtist' error=${e}`);
return false;
}
}
export const ZodArtistWrite = ZodGenericDataSoftDeleteWrite.extend({
name: zod.string().max(256).nullable().optional(),
description: zod.string().nullable().optional(),
/**
* List of Id of the specific covers
*/
covers: zod.array(ZodUUID).nullable().optional(),
firstName: zod.string().max(256).nullable().optional(),
surname: zod.string().max(256).nullable().optional(),
birth: ZodLocalDate.nullable().optional(),
death: ZodLocalDate.nullable().optional(),
});
export type ArtistWrite = zod.infer<typeof ZodArtistWrite>;
export function isArtistWrite(data: any): data is ArtistWrite {
try {
ZodArtistWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodArtistWrite' error=${e}`);
return false;
}
}

View File

@ -1,50 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodUUID} from "./uuid";
import {ZodGenericDataSoftDelete, ZodGenericDataSoftDeleteWrite } from "./generic-data-soft-delete";
export const ZodGender = ZodGenericDataSoftDelete.extend({
name: zod.string().max(256).optional(),
description: zod.string().optional(),
/**
* List of Id of the specific covers
*/
covers: zod.array(ZodUUID).optional(),
});
export type Gender = zod.infer<typeof ZodGender>;
export function isGender(data: any): data is Gender {
try {
ZodGender.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodGender' error=${e}`);
return false;
}
}
export const ZodGenderWrite = ZodGenericDataSoftDeleteWrite.extend({
name: zod.string().max(256).nullable().optional(),
description: zod.string().nullable().optional(),
/**
* List of Id of the specific covers
*/
covers: zod.array(ZodUUID).nullable().optional(),
});
export type GenderWrite = zod.infer<typeof ZodGenderWrite>;
export function isGenderWrite(data: any): data is GenderWrite {
try {
ZodGenderWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodGenderWrite' error=${e}`);
return false;
}
}

View File

@ -1,41 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodGenericData, ZodGenericDataWrite } from "./generic-data";
export const ZodGenericDataSoftDelete = ZodGenericData.extend({
/**
* Deleted state
*/
deleted: zod.boolean().readonly().optional(),
});
export type GenericDataSoftDelete = zod.infer<typeof ZodGenericDataSoftDelete>;
export function isGenericDataSoftDelete(data: any): data is GenericDataSoftDelete {
try {
ZodGenericDataSoftDelete.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodGenericDataSoftDelete' error=${e}`);
return false;
}
}
export const ZodGenericDataSoftDeleteWrite = ZodGenericDataWrite.extend({
});
export type GenericDataSoftDeleteWrite = zod.infer<typeof ZodGenericDataSoftDeleteWrite>;
export function isGenericDataSoftDeleteWrite(data: any): data is GenericDataSoftDeleteWrite {
try {
ZodGenericDataSoftDeleteWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodGenericDataSoftDeleteWrite' error=${e}`);
return false;
}
}

View File

@ -1,42 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodLong} from "./long";
import {ZodGenericTiming, ZodGenericTimingWrite } from "./generic-timing";
export const ZodGenericData = ZodGenericTiming.extend({
/**
* Unique Id of the object
*/
id: ZodLong.readonly(),
});
export type GenericData = zod.infer<typeof ZodGenericData>;
export function isGenericData(data: any): data is GenericData {
try {
ZodGenericData.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodGenericData' error=${e}`);
return false;
}
}
export const ZodGenericDataWrite = ZodGenericTimingWrite.extend({
});
export type GenericDataWrite = zod.infer<typeof ZodGenericDataWrite>;
export function isGenericDataWrite(data: any): data is GenericDataWrite {
try {
ZodGenericDataWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodGenericDataWrite' error=${e}`);
return false;
}
}

View File

@ -1,45 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodIsoDate} from "./iso-date";
export const ZodGenericTiming = zod.object({
/**
* Create time of the object
*/
createdAt: ZodIsoDate.readonly().optional(),
/**
* When update the object
*/
updatedAt: ZodIsoDate.readonly().optional(),
});
export type GenericTiming = zod.infer<typeof ZodGenericTiming>;
export function isGenericTiming(data: any): data is GenericTiming {
try {
ZodGenericTiming.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodGenericTiming' error=${e}`);
return false;
}
}
export const ZodGenericTimingWrite = zod.object({
});
export type GenericTimingWrite = zod.infer<typeof ZodGenericTimingWrite>;
export function isGenericTimingWrite(data: any): data is GenericTimingWrite {
try {
ZodGenericTimingWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodGenericTimingWrite' error=${e}`);
return false;
}
}

View File

@ -1,36 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
export const ZodHealthResult = zod.object({
});
export type HealthResult = zod.infer<typeof ZodHealthResult>;
export function isHealthResult(data: any): data is HealthResult {
try {
ZodHealthResult.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodHealthResult' error=${e}`);
return false;
}
}
export const ZodHealthResultWrite = zod.object({
});
export type HealthResultWrite = zod.infer<typeof ZodHealthResultWrite>;
export function isHealthResultWrite(data: any): data is HealthResultWrite {
try {
ZodHealthResultWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodHealthResultWrite' error=${e}`);
return false;
}
}

View File

@ -1,22 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
export * from "./album"
export * from "./artist"
export * from "./gender"
export * from "./generic-data"
export * from "./generic-data-soft-delete"
export * from "./generic-timing"
export * from "./health-result"
export * from "./int"
export * from "./iso-date"
export * from "./local-date"
export * from "./long"
export * from "./playlist"
export * from "./rest-error-response"
export * from "./timestamp"
export * from "./track"
export * from "./user"
export * from "./user-karusic"
export * from "./user-out"
export * from "./uuid"

View File

@ -1,36 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
export const Zodint = zod.object({
});
export type int = zod.infer<typeof Zodint>;
export function isint(data: any): data is int {
try {
Zodint.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='Zodint' error=${e}`);
return false;
}
}
export const ZodintWrite = zod.object({
});
export type intWrite = zod.infer<typeof ZodintWrite>;
export function isintWrite(data: any): data is intWrite {
try {
ZodintWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodintWrite' error=${e}`);
return false;
}
}

View File

@ -1,8 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
export const ZodIsoDate = zod.string().datetime({ precision: 3 });
export type IsoDate = zod.infer<typeof ZodIsoDate>;

View File

@ -1,8 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
export const ZodLocalDate = zod.string().date();
export type LocalDate = zod.infer<typeof ZodLocalDate>;

View File

@ -1,8 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
export const ZodLong = zod.number();
export type Long = zod.infer<typeof ZodLong>;

View File

@ -1,50 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodUUID} from "./uuid";
import {ZodGenericDataSoftDelete, ZodGenericDataSoftDeleteWrite } from "./generic-data-soft-delete";
export const ZodNodeSmall = ZodGenericDataSoftDelete.extend({
name: zod.string().max(256).optional(),
description: zod.string().optional(),
/**
* List of Id of the specific covers
*/
covers: zod.array(ZodUUID),
});
export type NodeSmall = zod.infer<typeof ZodNodeSmall>;
export function isNodeSmall(data: any): data is NodeSmall {
try {
ZodNodeSmall.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodNodeSmall' error=${e}`);
return false;
}
}
export const ZodNodeSmallWrite = ZodGenericDataSoftDeleteWrite.extend({
name: zod.string().max(256).nullable().optional(),
description: zod.string().nullable().optional(),
/**
* List of Id of the specific covers
*/
covers: zod.array(ZodUUID).optional(),
});
export type NodeSmallWrite = zod.infer<typeof ZodNodeSmallWrite>;
export function isNodeSmallWrite(data: any): data is NodeSmallWrite {
try {
ZodNodeSmallWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodNodeSmallWrite' error=${e}`);
return false;
}
}

View File

@ -1,53 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodUUID} from "./uuid";
import {ZodLong} from "./long";
import {ZodGenericDataSoftDelete, ZodGenericDataSoftDeleteWrite } from "./generic-data-soft-delete";
export const ZodPlaylist = ZodGenericDataSoftDelete.extend({
name: zod.string().max(256).optional(),
description: zod.string().optional(),
/**
* List of Id of the specific covers
*/
covers: zod.array(ZodUUID).optional(),
tracks: zod.array(ZodLong),
});
export type Playlist = zod.infer<typeof ZodPlaylist>;
export function isPlaylist(data: any): data is Playlist {
try {
ZodPlaylist.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodPlaylist' error=${e}`);
return false;
}
}
export const ZodPlaylistWrite = ZodGenericDataSoftDeleteWrite.extend({
name: zod.string().max(256).nullable().optional(),
description: zod.string().nullable().optional(),
/**
* List of Id of the specific covers
*/
covers: zod.array(ZodUUID).nullable().optional(),
tracks: zod.array(ZodLong).optional(),
});
export type PlaylistWrite = zod.infer<typeof ZodPlaylistWrite>;
export function isPlaylistWrite(data: any): data is PlaylistWrite {
try {
ZodPlaylistWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodPlaylistWrite' error=${e}`);
return false;
}
}

View File

@ -1,29 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodUUID} from "./uuid";
import {Zodint, ZodintWrite } from "./int";
export const ZodRestErrorResponse = zod.object({
uuid: ZodUUID.optional(),
name: zod.string(),
message: zod.string(),
time: zod.string(),
status: Zodint,
statusMessage: zod.string(),
});
export type RestErrorResponse = zod.infer<typeof ZodRestErrorResponse>;
export function isRestErrorResponse(data: any): data is RestErrorResponse {
try {
ZodRestErrorResponse.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodRestErrorResponse' error=${e}`);
return false;
}
}

View File

@ -1,8 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
export const ZodTimestamp = zod.string().datetime({ precision: 3 });
export type Timestamp = zod.infer<typeof ZodTimestamp>;

View File

@ -1,61 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodUUID} from "./uuid";
import {ZodLong} from "./long";
import {ZodGenericDataSoftDelete, ZodGenericDataSoftDeleteWrite } from "./generic-data-soft-delete";
export const ZodTrack = ZodGenericDataSoftDelete.extend({
name: zod.string().max(256).optional(),
description: zod.string().optional(),
/**
* List of Id of the specific covers
*/
covers: zod.array(ZodUUID).optional(),
genderId: ZodLong.optional(),
albumId: ZodLong.optional(),
track: ZodLong.optional(),
dataId: ZodUUID.optional(),
artists: zod.array(ZodLong),
});
export type Track = zod.infer<typeof ZodTrack>;
export function isTrack(data: any): data is Track {
try {
ZodTrack.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodTrack' error=${e}`);
return false;
}
}
export const ZodTrackWrite = ZodGenericDataSoftDeleteWrite.extend({
name: zod.string().max(256).nullable().optional(),
description: zod.string().nullable().optional(),
/**
* List of Id of the specific covers
*/
covers: zod.array(ZodUUID).nullable().optional(),
genderId: ZodLong.nullable().optional(),
albumId: ZodLong.nullable().optional(),
track: ZodLong.nullable().optional(),
dataId: ZodUUID.nullable().optional(),
artists: zod.array(ZodLong).optional(),
});
export type TrackWrite = zod.infer<typeof ZodTrackWrite>;
export function isTrackWrite(data: any): data is TrackWrite {
try {
ZodTrackWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodTrackWrite' error=${e}`);
return false;
}
}

View File

@ -1,37 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodUser, ZodUserWrite } from "./user";
export const ZodUserKarusic = ZodUser.extend({
});
export type UserKarusic = zod.infer<typeof ZodUserKarusic>;
export function isUserKarusic(data: any): data is UserKarusic {
try {
ZodUserKarusic.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodUserKarusic' error=${e}`);
return false;
}
}
export const ZodUserKarusicWrite = ZodUserWrite.extend({
});
export type UserKarusicWrite = zod.infer<typeof ZodUserKarusicWrite>;
export function isUserKarusicWrite(data: any): data is UserKarusicWrite {
try {
ZodUserKarusicWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodUserKarusicWrite' error=${e}`);
return false;
}
}

View File

@ -1,41 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodLong} from "./long";
export const ZodUserOut = zod.object({
id: ZodLong,
login: zod.string().max(255).optional(),
});
export type UserOut = zod.infer<typeof ZodUserOut>;
export function isUserOut(data: any): data is UserOut {
try {
ZodUserOut.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodUserOut' error=${e}`);
return false;
}
}
export const ZodUserOutWrite = zod.object({
id: ZodLong,
login: zod.string().max(255).nullable().optional(),
});
export type UserOutWrite = zod.infer<typeof ZodUserOutWrite>;
export function isUserOutWrite(data: any): data is UserOutWrite {
try {
ZodUserOutWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodUserOutWrite' error=${e}`);
return false;
}
}

View File

@ -1,57 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodTimestamp} from "./timestamp";
import {ZodUUID} from "./uuid";
import {ZodGenericDataSoftDelete, ZodGenericDataSoftDeleteWrite } from "./generic-data-soft-delete";
export const ZodUser = ZodGenericDataSoftDelete.extend({
login: zod.string().max(128).optional(),
lastConnection: ZodTimestamp.optional(),
admin: zod.boolean(),
blocked: zod.boolean(),
removed: zod.boolean(),
/**
* List of Id of the specific covers
*/
covers: zod.array(ZodUUID).optional(),
});
export type User = zod.infer<typeof ZodUser>;
export function isUser(data: any): data is User {
try {
ZodUser.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodUser' error=${e}`);
return false;
}
}
export const ZodUserWrite = ZodGenericDataSoftDeleteWrite.extend({
login: zod.string().max(128).nullable().optional(),
lastConnection: ZodTimestamp.nullable().optional(),
admin: zod.boolean(),
blocked: zod.boolean(),
removed: zod.boolean(),
/**
* List of Id of the specific covers
*/
covers: zod.array(ZodUUID).nullable().optional(),
});
export type UserWrite = zod.infer<typeof ZodUserWrite>;
export function isUserWrite(data: any): data is UserWrite {
try {
ZodUserWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodUserWrite' error=${e}`);
return false;
}
}

View File

@ -1,8 +0,0 @@
/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
export const ZodUUID = zod.string().uuid();
export type UUID = zod.infer<typeof ZodUUID>;

View File

@ -1,445 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2024, Edouard DUPIN, all right reserved
* @license MPL-2
*/
import { RestErrorResponse, isRestErrorResponse } from "./model";
export enum HTTPRequestModel {
DELETE = "DELETE",
GET = "GET",
PATCH = "PATCH",
POST = "POST",
PUT = "PUT",
}
export enum HTTPMimeType {
ALL = "*/*",
CSV = "text/csv",
IMAGE = "image/*",
IMAGE_JPEG = "image/jpeg",
IMAGE_PNG = "image/png",
JSON = "application/json",
MULTIPART = "multipart/form-data",
OCTET_STREAM = "application/octet-stream",
TEXT_PLAIN = "text/plain",
}
export interface RESTConfig {
// base of the server: http(s)://my.server.org/plop/api/
server: string;
// Token to access of the data.
token?: string;
}
export interface RESTModel {
// base of the local API request: "sheep/{id}".
endPoint: string;
// Type of the request.
requestType?: HTTPRequestModel;
// Input type requested.
accept?: HTTPMimeType;
// Content of the local data.
contentType?: HTTPMimeType;
// Mode of the TOKEN in URL or Header (?token:${tokenInUrl})
tokenInUrl?: boolean;
}
export interface ModelResponseHttp {
status: number;
data: any;
}
function isNullOrUndefined(data: any): data is undefined | null {
return data === undefined || data === null;
}
// generic progression callback
export type ProgressCallback = (count: number, total: number) => void;
export interface RESTAbort {
abort?: () => boolean;
}
// Rest generic callback have a basic model to upload and download advancement.
export interface RESTCallbacks {
progressUpload?: ProgressCallback;
progressDownload?: ProgressCallback;
abortHandle?: RESTAbort;
}
export interface RESTRequestType {
restModel: RESTModel;
restConfig: RESTConfig;
data?: any;
params?: object;
queries?: object;
callbacks?: RESTCallbacks;
}
function replaceAll(input, searchValue, replaceValue) {
return input.split(searchValue).join(replaceValue);
}
function removeTrailingSlashes(input: string): string {
if (isNullOrUndefined(input)) {
return "undefined";
}
return input.replace(/\/+$/, "");
}
function removeLeadingSlashes(input: string): string {
if (isNullOrUndefined(input)) {
return "";
}
return input.replace(/^\/+/, "");
}
export function RESTUrl({
restModel,
restConfig,
params,
queries,
}: RESTRequestType): string {
// Create the URL PATH:
let generateUrl = `${removeTrailingSlashes(
restConfig.server
)}/${removeLeadingSlashes(restModel.endPoint)}`;
if (params !== undefined) {
for (let key of Object.keys(params)) {
generateUrl = replaceAll(generateUrl, `{${key}}`, `${params[key]}`);
}
}
if (
queries === undefined &&
(restConfig.token === undefined || restModel.tokenInUrl !== true)
) {
return generateUrl;
}
const searchParams = new URLSearchParams();
if (queries !== undefined) {
for (let key of Object.keys(queries)) {
const value = queries[key];
if (Array.isArray(value)) {
for (const element of value) {
searchParams.append(`${key}`, `${element}`);
}
} else {
searchParams.append(`${key}`, `${value}`);
}
}
}
if (restConfig.token !== undefined && restModel.tokenInUrl === true) {
searchParams.append("Authorization", `Bearer ${restConfig.token}`);
}
return generateUrl + "?" + searchParams.toString();
}
export function fetchProgress(
generateUrl: string,
{
method,
headers,
body,
}: {
method: HTTPRequestModel;
headers: any;
body: any;
},
{ progressUpload, progressDownload, abortHandle }: RESTCallbacks
): Promise<Response> {
const xhr: {
io?: XMLHttpRequest;
} = {
io: new XMLHttpRequest(),
};
return new Promise((resolve, reject) => {
// Stream the upload progress
if (progressUpload) {
xhr.io?.upload.addEventListener("progress", (dataEvent) => {
if (dataEvent.lengthComputable) {
progressUpload(dataEvent.loaded, dataEvent.total);
}
});
}
// Stream the download progress
if (progressDownload) {
xhr.io?.addEventListener("progress", (dataEvent) => {
if (dataEvent.lengthComputable) {
progressDownload(dataEvent.loaded, dataEvent.total);
}
});
}
if (abortHandle) {
abortHandle.abort = () => {
if (xhr.io) {
console.log(`Request abort on the XMLHttpRequest: ${generateUrl}`);
xhr.io.abort();
return true;
}
console.log(
`Request abort (FAIL) on the XMLHttpRequest: ${generateUrl}`
);
return false;
};
}
// Check if we have an internal Fail:
xhr.io?.addEventListener("error", () => {
xhr.io = undefined;
reject(new TypeError("Failed to fetch"));
});
// Capture the end of the stream
xhr.io?.addEventListener("loadend", () => {
if (xhr.io?.readyState !== XMLHttpRequest.DONE) {
return;
}
if (xhr.io?.status === 0) {
//the stream has been aborted
reject(new TypeError("Fetch has been aborted"));
return;
}
// Stream is ended, transform in a generic response:
const response = new Response(xhr.io.response, {
status: xhr.io.status,
statusText: xhr.io.statusText,
});
const headersArray = replaceAll(
xhr.io.getAllResponseHeaders().trim(),
"\r\n",
"\n"
).split("\n");
headersArray.forEach(function (header) {
const firstColonIndex = header.indexOf(":");
if (firstColonIndex !== -1) {
const key = header.substring(0, firstColonIndex).trim();
const value = header.substring(firstColonIndex + 1).trim();
response.headers.set(key, value);
} else {
response.headers.set(header, "");
}
});
xhr.io = undefined;
resolve(response);
});
xhr.io?.open(method, generateUrl, true);
if (!isNullOrUndefined(headers)) {
for (const [key, value] of Object.entries(headers)) {
xhr.io?.setRequestHeader(key, value as string);
}
}
xhr.io?.send(body);
});
}
export function RESTRequest({
restModel,
restConfig,
data,
params,
queries,
callbacks,
}: RESTRequestType): Promise<ModelResponseHttp> {
// Create the URL PATH:
let generateUrl = RESTUrl({ restModel, restConfig, data, params, queries });
let headers: any = {};
if (restConfig.token !== undefined && restModel.tokenInUrl !== true) {
headers["Authorization"] = `Bearer ${restConfig.token}`;
}
if (restModel.accept !== undefined) {
headers["Accept"] = restModel.accept;
}
if (restModel.requestType !== HTTPRequestModel.GET) {
// if Get we have not a content type, the body is empty
if (restModel.contentType !== HTTPMimeType.MULTIPART) {
// special case of multi-part ==> no content type otherwise the browser does not set the ";bundary=--****"
headers["Content-Type"] = restModel.contentType;
}
}
let body = data;
if (restModel.contentType === HTTPMimeType.JSON) {
body = JSON.stringify(data);
} else if (restModel.contentType === HTTPMimeType.MULTIPART) {
const formData = new FormData();
for (const name in data) {
formData.append(name, data[name]);
}
body = formData;
}
return new Promise((resolve, reject) => {
let action: undefined | Promise<Response> = undefined;
if (
isNullOrUndefined(callbacks) ||
(isNullOrUndefined(callbacks.progressDownload) &&
isNullOrUndefined(callbacks.progressUpload) &&
isNullOrUndefined(callbacks.abortHandle))
) {
// No information needed: call the generic fetch interface
action = fetch(generateUrl, {
method: restModel.requestType,
headers,
body,
});
} else {
// need progression information: call old fetch model (XMLHttpRequest) that permit to keep % upload and % download for HTTP1.x
action = fetchProgress(
generateUrl,
{
method: restModel.requestType ?? HTTPRequestModel.GET,
headers,
body,
},
callbacks
);
}
action
.then((response: Response) => {
if (response.status >= 200 && response.status <= 299) {
const contentType = response.headers.get("Content-Type");
if (
!isNullOrUndefined(restModel.accept) &&
restModel.accept !== contentType
) {
reject({
name: "Model accept type incompatible",
time: Date().toString(),
status: 901,
message: `REST Content type are not compatible: ${restModel.accept} != ${contentType}`,
statusMessage: "Fetch error",
error: "rest-tools.ts Wrong type in the message return type",
} as RestErrorResponse);
} else if (contentType === HTTPMimeType.JSON) {
response
.json()
.then((value: any) => {
resolve({ status: response.status, data: value });
})
.catch((reason: Error) => {
reject({
name: "API serialization error",
time: Date().toString(),
status: 902,
message: `REST parse json fail: ${reason}`,
statusMessage: "Fetch parse error",
error: "rest-tools.ts Wrong message model to parse",
} as RestErrorResponse);
});
} else {
resolve({ status: response.status, data: response.body });
}
} else {
// the answer is not correct not a 2XX
// clone the response to keep the raw data if case of error:
response
.clone()
.json()
.then((value: any) => {
if (isRestErrorResponse(value)) {
reject(value);
} else {
response
.text()
.then((dataError: string) => {
reject({
name: "API serialization error",
time: Date().toString(),
status: 903,
message: `REST parse error json with wrong type fail. ${dataError}`,
statusMessage: "Fetch parse error",
error: "rest-tools.ts Wrong message model to parse",
} as RestErrorResponse);
})
.catch((reason: any) => {
reject({
name: "API serialization error",
time: Date().toString(),
status: response.status,
message: `unmanaged error model: ??? with error: ${reason}`,
statusMessage: "Fetch ERROR parse error",
error: "rest-tools.ts Wrong message model to parse",
} as RestErrorResponse);
});
}
})
.catch((reason: Error) => {
response
.text()
.then((dataError: string) => {
reject({
name: "API serialization error",
time: Date().toString(),
status: response.status,
message: `unmanaged error model: ${dataError} with error: ${reason}`,
statusMessage: "Fetch ERROR TEXT parse error",
error: "rest-tools.ts Wrong message model to parse",
} as RestErrorResponse);
})
.catch((reason: any) => {
reject({
name: "API serialization error",
time: Date().toString(),
status: response.status,
message: `unmanaged error model: ??? with error: ${reason}`,
statusMessage: "Fetch ERROR TEXT FAIL",
error: "rest-tools.ts Wrong message model to parse",
} as RestErrorResponse);
});
});
}
})
.catch((error: Error) => {
if (isRestErrorResponse(error)) {
reject(error);
} else {
reject({
name: "Request fail",
time: Date(),
status: 999,
message: error,
statusMessage: "Fetch catch error",
error: "rest-tools.ts detect an error in the fetch request",
});
}
});
});
}
export function RESTRequestJson<TYPE>(
request: RESTRequestType,
checker?: (data: any) => data is TYPE
): Promise<TYPE> {
return new Promise((resolve, reject) => {
RESTRequest(request)
.then((value: ModelResponseHttp) => {
if (isNullOrUndefined(checker)) {
console.log(`Have no check of MODEL in API: ${RESTUrl(request)}`);
resolve(value.data);
} else if (checker === undefined || checker(value.data)) {
resolve(value.data);
} else {
reject({
name: "Model check fail",
time: Date().toString(),
status: 950,
error: "REST Fail to verify the data",
statusMessage: "API cast ERROR",
message: "api.ts Check type as fail",
} as RestErrorResponse);
}
})
.catch((reason: RestErrorResponse) => {
reject(reason);
});
});
}
export function RESTRequestVoid(request: RESTRequestType): Promise<void> {
return new Promise((resolve, reject) => {
RESTRequest(request)
.then((value: ModelResponseHttp) => {
resolve();
})
.catch((reason: RestErrorResponse) => {
reject(reason);
});
});
}

View File

@ -1,42 +0,0 @@
<div class="fill-title">
<div class="description-area">
@if(title) {
<div class="shadow-text title">
{{title}}
</div>
}
@if(name) {
<div class="shadow-text sub-title-main">
{{name}}
</div>
}
@if(description) {
<div class="description">
{{description}}
</div>
}
<div class="button-area">
<button class="circular-button" (click)="playAll($event)" type="submit">
<i class="material-icons">play_arrow</i>
</button>
<button class="circular-button" (click)="playShuffle($event)" type="submit">
<i class="material-icons">shuffle</i>
</button>
<div style="flex:1;"></div>
</div>
</div>
@if (cover1 && cover1.length > 0) {
<div class="cover-area">
<div class="cover">
<img src="{{cover1[0]}}"/>
</div>
</div>
}
@if (cover2 && cover2.length > 0) {
<div class="cover-area">
<div class="cover">
<img src="{{cover2[0]}}"/>
</div>
</div>
}
</div>

View File

@ -1,31 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file)
*/
import { Component, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'AppDescriptionArea',
templateUrl: './AppDescriptionArea.html',
styleUrls: ['./AppDescriptionArea.less']
})
export class AppDescriptionArea {
@Input() title: string;
@Input() name?: string;
@Input() description?: string;
@Input() cover1?: number[];
@Input() cover2?: number[];
@Output() play = new EventEmitter<void>();
@Output() shuffle = new EventEmitter<void>();
playShuffle(event: any): void {
this.shuffle.emit();
}
playAll(event: any): void {
this.play.emit();
}
}

View File

@ -1,45 +0,0 @@
<div class="imgContainer-small">
@if(covers && covers.length > 0) {
<div>
<img src="{{covers[0]}}"/>
</div>
}
@else {
<div class="noImage"></div>
}
</div>
<div class="season-small">
{{prefixName}} {{numberAlbum}}
</div>
@if(countSubType) {
<div class="description-small">
@if(!count || count == 0) {
No {{countSubType}}
}
@else {
{{count}} {{countSubType}}{{count>1?"s":""}}
}
</div>
}
@if(countSubType2) {
<div class="description-small">
@if(!count2 || count2 == 0) {
No {{countSubType2}}
}
@else {
{{count2}} {{countSubType2}}{{count2>1?"s":""}}
}
</div>
}
@if(subValueData) {
<div class="description-small">
{{subValues}}: {{subValueData}}
</div>
}
@if(!description) {
<div class="description-small">
{{description}}
</div>
}

View File

@ -1,35 +0,0 @@
.imgContainer-small {
text-align: center;
width: 100px;
margin: 4px 15px 4px 10px;
height: 100px;
img {
max-height: 100px;
max-width: 100px;
}
.noImage {
height: 95px;
width: 95px;
//box-shadow: 0px 2px 4px 0 rgba(0, 0, 0, 0.7);
border: solid 2px;
border-color: rgba(0, 0, 0, 0.7);
margin: auto;
}
float: left;
}
.title-small {
height: 50px;
//width: 100%;
font-size: 35px;
display:inline-block;
font-weight: bold;
}
.description-small {
height: 30px;
font-size: 16px;
overflow:hidden;
vertical-align: middle;
}

View File

@ -1,92 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file)
*/
import { Component, OnInit, Input } from '@angular/core';
import { isNullOrUndefined } from '@kangaroo-and-rabbit/kar-cw';
import { Album } from 'app/back-api';
import { AlbumService, DataService } from 'app/service';
@Component({
selector: 'AppElementAlbum',
templateUrl: './AppElementAlbum.html',
styleUrls: ['./AppElementAlbum.less']
})
export class AppElementAlbum implements OnInit {
// input parameters
@Input() element: Album;
@Input() prefix: String;
@Input() countSubTypeCallBack: (arg0: number) => Promise<number>;
@Input() countSubType: String;
@Input() countSubType2CallBack: (arg0: number) => Promise<number>;
@Input() countSubType2: String;
@Input() subValuesCallBack: (arg0: number) => Promise<string[]>;
@Input() subValues: String;
prefixName: string = "";
numberAlbum: string;
count: number;
count2: number;
subValueData: String;
covers: string[];
description: string;
constructor(
private albumService: AlbumService,
private dataService: DataService) {
}
ngOnInit() {
this.prefix = this.prefixName ?? "";
this.count = undefined;
this.count2 = undefined;
//console.log(`element: ${JSON.stringify(this.element, null, 2)}`);
if (isNullOrUndefined(this.element)) {
this.numberAlbum = undefined;
this.covers = undefined;
this.description = undefined;
}
this.numberAlbum = this.element.name;
this.description = this.element.description;
this.covers = this.dataService.getListThumbnailUrl(this.element.covers);
let self = this;
if (!isNullOrUndefined(this.countSubTypeCallBack)) {
this.countSubTypeCallBack(this.element.id)
.then((response) => {
self.count = response;
//console.log(`get values: ${this.element.id} ==> ${self.count}`)
}).catch((response) => {
self.count = undefined;
});
}
if (!isNullOrUndefined(this.countSubType2CallBack)) {
this.countSubType2CallBack(this.element.id)
.then((response) => {
self.count2 = response;
//console.log(`get values: ${this.element.id} ==> ${self.count}`)
}).catch((response) => {
self.count2 = undefined;
});
}
if (!isNullOrUndefined(this.subValuesCallBack)) {
//console.log(`Value call back define ==> call values`)
this.subValuesCallBack(this.element.id)
.then((response: string[]) => {
this.subValueData = "";
for (let kkk = 0; kkk < response.length; kkk++) {
if (kkk != 0) {
this.subValueData += ", ";
}
this.subValueData += response[kkk];
}
//console.log(`get values: ${this.element.id} ==> ${self.subValueData}`)
}).catch((response) => {
self.count2 = undefined;
});
}
}
}

View File

@ -1,22 +0,0 @@
<div>
@if(countTrack) {
<div class="count-base">
<span class="count">{{countTrack}}</span>
</div>
}
<div class="imgContainer-small">
@if(covers && covers.length > 0) {
<div>
<img src="{{covers[0]}}" class="miniature-small"/>
</div>
}
</div>
<div class="title-small">
{{name}}
</div>
@if(description) {
<div class="description-small">
{{description}}
</div>
}
</div>

View File

@ -1,52 +0,0 @@
.count-base {
height: 0px;
width: 100%;
right: 0px;
z-index: 12;
//position:flex;
text-align: right;
.count {
height: 30px;
//width: 30px;
font-size: 17px;
line-height: 30px;
overflow:hidden;
position:relative;
z-index: 12;
right: 2px;
top: 4px;
text-align: right;
padding: 5px 10px;
color: rgba(0, 0, 0, 1.0);
background: rgba(256, 256, 256, 0.3);
border: 1px solid;
border-color: rgba(256, 256, 256, 0.8);
border-radius: 15px;
}
}
.imgContainer-small {
text-align: center;
margin: 15px 0 0 0;
}
img.miniature-small {
width: 80px;
height: 80px;
//border-radius: 50%;
}
.title-small {
height: 60px;
font-size: 24px;
overflow:hidden;
vertical-align: middle;
}
.description-small {
height: 30px;
font-size: 12px;
overflow:hidden;
vertical-align: middle;
}

View File

@ -1,62 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file)
*/
import { Component, OnInit, Input } from '@angular/core';
import { DataService } from 'app/service';
import { isNullOrUndefined } from '@kangaroo-and-rabbit/kar-cw';
export interface HomeInterface {
id: number;
name: string;
description?: string;
covers?: string[];
}
@Component({
selector: 'AppElementHomeType',
templateUrl: './AppElementHomeType.html',
styleUrls: ['./AppElementHomeType.less']
})
export class ElementTypeComponent implements OnInit {
// input parameters
@Input() element: HomeInterface;
@Input() functionVignette: (number) => Promise<Number>;
public name: string = 'rr';
public description: string;
public countTrack: number;
public covers: string[];
constructor(
private dataService: DataService) {
}
ngOnInit() {
if (isNullOrUndefined(this.element)) {
this.name = 'Not a media';
this.description = undefined;
this.countTrack = undefined;
this.covers = undefined;
return;
}
let self = this;
console.log(" ??? Get element ! " + JSON.stringify(this.element));
self.name = this.element.name;
self.description = this.element.description;
self.covers = self.dataService.getListThumbnailUrl(this.element.covers);
if (!isNullOrUndefined(this.functionVignette)) {
this.functionVignette(this.element.id)
.then((response: number) => {
self.countTrack = response;
}).catch(() => {
self.countTrack = 0;
});
}
}
}

View File

@ -1,10 +0,0 @@
<div class="item-list-element">
<div class="season-small">
{{name}}
</div>
@if(track) {
<div class="description-small">
n° {{track}}
</div>
}
</div>

View File

@ -1,47 +0,0 @@
.item-list-element {
font-size: 20px;
padding: 1px;
height: 55px;
width: 80%;
margin: 5px auto 5px auto;
padding: 5px;
overflow: hidden;
line-height: normal;
border: none;
font-family: "Roboto","Helvetica","Arial",sans-serif;
font-weight: 500;
will-change: box-shadow;
outline: none;
cursor: pointer;
background: rgba(256, 256, 256, 0.3);
border-radius: 7px;
.material-icons {
vertical-align: middle;
}
.material-icons {
position: absolute;
top: 50%;
left: 50%;
transform: ~"translate(-12px,-12px)";
line-height: 24px;
width: 24px;
}
}
.title-small {
height: 50px;
//width: 100%;
font-size: 35px;
display:inline-block;
font-weight: bold;
}
.description-small {
height: 30px;
font-size: 16px;
overflow:hidden;
vertical-align: middle;
}

View File

@ -1,44 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file)
*/
import { Component, OnInit, Input } from '@angular/core';
import { isNullOrUndefined } from '@kangaroo-and-rabbit/kar-cw';
import { Track } from 'app/back-api';
import { DataService } from 'app/service';
@Component({
selector: 'AppElementTrack',
templateUrl: './AppElementTrack.html',
styleUrls: ['./AppElementTrack.less']
})
export class AppElementTrack implements OnInit {
// input parameters
@Input() element: Track;
@Input() prefix: String;
prefixName: string = "";
name: string;
track: number;
covers: string[];
description: string;
constructor(
private dataService: DataService) {
}
ngOnInit() {
this.prefix = this.prefixName ?? "";
if (isNullOrUndefined(this.element)) {
this.name = undefined;
this.covers = undefined;
this.description = undefined;
}
this.name = this.element.name;
this.description = this.element.description;
this.track = this.element["track"];
this.covers = this.dataService.getListThumbnailUrl(this.element.covers);
}
}

View File

@ -1,52 +0,0 @@
@if(mediaSource) {
<div>
<audio width="1" height="1" src="{{mediaSource}}"
#mediaPlayer
preload
(play)="changeStateToPlay()"
(pause)="changeStateToPause()"
(timeupdate)="changeTimeupdate($event.currentTime)"
(durationchange)="changeDurationchange($event.duration)"
(loadedmetadata)="changeMetadata()"
autoplay
(ended)="onAudioEnded()"
>
</audio>
<div class="controls">
<div class="controls-inner">
<div class="title text-ellipsis">
<label class="unselectable">{{dataTitle}}</label>
</div>
<div class="text-ellipsis">
<label class="unselectable">{{dataAuthor}} / {{dataAlbum}}</label>
</div>
<div class="timer-slider">
<input type="range" min="0" class="slider"
[value]="currentTime"
[max]="duration"
(input)="seek($event.target)">
</div>
<div class="flex-row">
<label class="unselectable">{{currentTimeDisplay}}</label>
<label class="unselectable flex-row-last">{{durationDisplay}}</label>
</div>
<div class="control">
@if(!isPlaying) {
<button (click)="onPlay()"><i class="material-icons">play_arrow</i></button>
}
@else {
<button (click)="onPause()"><i class="material-icons">pause</i></button>
}
<button (click)="onStop()"><i class="material-icons">stop</i></button>
<div style="margin:auto"></div>
<button [disabled]="havePrevious" (click)="onBefore()"><i class="material-icons">navigate_before</i></button>
<button (click)="onRewind()"><i class="material-icons">fast_rewind</i></button>
<button (click)="onForward()"><i class="material-icons">fast_forward</i></button>
<button [disabled]="haveNext" (click)="onNext()"><i class="material-icons">navigate_next</i></button>
<div style="margin:auto"></div>
<button (click)="onPlayMode()"><i class="material-icons">{{playMode}}</i></button>
</div>
</div>
</div>
</div>
}

View File

@ -1,113 +0,0 @@
.controls {
//visibility: hidden;
opacity: 0.85;
width: 96%;
//height: 150px;
border-radius: 10px;
position: absolute;
bottom: 20px;
left: 2%;
//margin-left: -200px;
background-color: black;
box-shadow: 3px 3px 5px black;
transition: 1s all;
display: flex;
font-size: 40px;
min-width: 380px;
.controls-inner {
position: relative;
width: 100%;
height: 100%;
min-width: 350px;
font-family: monospace;
color: white;
margin: 10px 15px 1px 15px;
font-size: 20px;
}
.material-icons {
color: #FFF;
font-size: 40px;
}
button {
border: none;
background: none;
}
button:disabled,
button[disabled] {
.material-icons {
color: rgb(46, 46, 46);
}
}
.slider {
position: relative;
//-webkit-appearance: none;
width: 100%;
height: 10px;
top: 5px;
border-radius: 5px;
background: #d3d3d3;
outline: none;
opacity: 0.7;
-webkit-transition: .2s;
transition: opacity .2s;
flex: 5;
}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
border-radius: 50%;
background: #4CAF50;
cursor: pointer;
}
.slider::-moz-range-thumb {
width: 25px;
height: 25px;
border-radius: 50%;
background: #4CAF50;
cursor: pointer;
}
.text-ellipsis {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.title {
font-size: 24px;
font-weight: bold;
}
.timer-slider {
width: 100%;
margin: 4px 0px 4px 0px;
font-size: 20px;
padding-bottom: 10px;
}
.control {
width: 100%;
font-size: 30px;
font-weight: bold;
display: flex;
justify-content: center;
}
}
button:before {
font-family: HeydingsControlsRegular;
font-size: 30px;
position: relative;
color: #FFF;
}

View File

@ -1,359 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file)
*/
import { Component, OnInit, ViewChild, ElementRef, Inject } from '@angular/core';
import { DataService, PlayerService, TrackService, AlbumService, ArtistService } from 'app/service';
import { PlaylistCurrent } from 'app/service/player';
import { Title } from '@angular/platform-browser';
import { Album, Artist, Track } from 'app/back-api';
import { isArray, isNullOrUndefined, Environment } from '@kangaroo-and-rabbit/kar-cw';
export enum PlayMode {
PLAY_ONE = "check",
PLAY_ALL = "trending_flat",
PLAY_ONE_LOOP = "repeat_one",
PLAY_ALL_LOOP = "repeat",
};
// note: all the input is managed with the player service ...
@Component({
selector: 'AppPlayerAudio',
templateUrl: './AppPlayerAudio.html',
styleUrls: ['./AppPlayerAudio.less']
})
export class ElementPlayerAudioComponent implements OnInit {
mediaPlayer: HTMLAudioElement;
duration: number;
durationDisplay: string;
@ViewChild('mediaPlayer')
set mainVideoEl(el: ElementRef) {
if (el !== null && el !== undefined) {
this.mediaPlayer = el.nativeElement;
}
}
public mediaSource: string = undefined;
public name: string = 'rr';
public description: string;
public countTrack: number;
public covers: string[];
public volume_value: number = 100;
public volume_displayMenu: boolean = false;
dataTitle: string;
dataAlbum: string;
dataAuthor: string;
playStream: boolean;
isPlaying: boolean;
currentTime: any;
currentTimeDisplay: string;
havePrevious: boolean = false;
haveNext: boolean = false;
playMode: PlayMode = PlayMode.PLAY_ALL;
onPlayMode() {
if (this.playMode === PlayMode.PLAY_ONE) {
this.playMode = PlayMode.PLAY_ALL;
} else if (this.playMode === PlayMode.PLAY_ALL) {
this.playMode = PlayMode.PLAY_ONE_LOOP;
} else if (this.playMode === PlayMode.PLAY_ONE_LOOP) {
this.playMode = PlayMode.PLAY_ALL_LOOP;
} else {
this.playMode = PlayMode.PLAY_ONE;
}
}
constructor(
@Inject('ENVIRONMENT') private environment: Environment,
private playerService: PlayerService,
private trackService: TrackService,
private dataService: DataService,
private albumService: AlbumService,
private artistService: ArtistService,
private titleService: Title) {
// nothing to do...
}
private currentLMedia: Track;
private localIdStreaming: number;
private localListStreaming: number[] = [];
ngOnInit() {
/*
export interface PlaylistCurrent {
playTrackList: number[];
trackLocalId?: number;
}
*/
let self = this;
this.playerService.playChange.subscribe((newProperty: PlaylistCurrent) => {
self.localIdStreaming = newProperty.trackLocalId;
self.localListStreaming = newProperty.playTrackList;
self.updateMediaStreamed();
});
}
updateMediaStreamed() {
if (isNullOrUndefined(this.localIdStreaming)) {
this.mediaSource = undefined;
return;
}
let self = this;
this.havePrevious = this.localIdStreaming <= 0;
this.haveNext = this.localIdStreaming >= this.localListStreaming.length - 1;
this.trackService.get(this.localListStreaming[this.localIdStreaming])
.then((response: Track) => {
console.log(`get response of video : ${JSON.stringify(response, null, 2)}`);
self.currentLMedia = response;
self.dataTitle = response.name;
if (!isNullOrUndefined(response.albumId)) {
this.albumService.get(response.albumId)
.then((response2: Album) => {
self.dataAlbum = response2.name;
self.updateTitle();
})
.catch(() => { });
}
if (!isNullOrUndefined(response.artists) && isArray(response.artists) && response.artists.length > 0) {
this.artistService.get(response.artists[0])
.then((response2: Artist) => {
self.dataAuthor = response2.name;
})
.catch(() => { });
}
if (isNullOrUndefined(self.currentLMedia)) {
console.log("Can not retrieve the media ...")
return;
}
if (isNullOrUndefined(self.currentLMedia.dataId)) {
console.log("Can not retrieve the media ... null or undefined data ID")
return;
}
self.mediaSource = self.dataService.getUrl(self.currentLMedia.dataId, "unknownMediaName.webm");
}).catch((error) => {
console.error(`error not unmanaged in audio player ... 111 ${error}`);
})
}
updateTitle() {
let title = this.dataTitle;
if (!isNullOrUndefined(this.dataAlbum)) {
title = `${this.dataAlbum} - ${title}`;
}
if (!isNullOrUndefined(this.dataAuthor)) {
title = `${title} (${this.dataAuthor})`;
}
this.titleService.setTitle(`${this.environment.applName} > ${title}`)
}
changeMetadata() {
console.log('list of the stream:');
}
myPeriodicCheckFunction() {
console.log('check ... ');
}
onRequirePlay() {
this.playStream = true;
}
onRequireStop() {
this.playStream = false;
}
onAudioEnded() {
if (this.playMode === PlayMode.PLAY_ONE) {
this.playStream = false;
} else if (this.playMode === PlayMode.PLAY_ALL) {
this.onNext();
} else if (this.playMode === PlayMode.PLAY_ONE_LOOP) {
this.mediaPlayer.currentTime = 0;
this.onPlay();
} else {
if (this.localIdStreaming == this.localListStreaming.length - 1) {
this.localIdStreaming = 0;
this.updateMediaStreamed();
if (this.localListStreaming.length == 1) {
this.mediaPlayer.currentTime = 0;
this.onPlay();
}
} else {
this.onNext();
}
}
}
changeStateToPlay() {
this.isPlaying = true;
}
changeStateToPause() {
this.isPlaying = false;
}
convertInDisplayTime(time: number): string {
let temporaryValue = parseInt(`${time}`, 10);
let hours = parseInt(`${temporaryValue / 3600}`, 10);
temporaryValue = temporaryValue - hours * 3600;
let minutes = parseInt(`${temporaryValue / 60}`, 10);
let seconds = temporaryValue - minutes * 60;
let out = '';
if (hours !== 0) {
out = `${out}${hours}:`;
}
if (minutes >= 10) {
out = `${out}${minutes}:`;
} else {
out = `${out}0${minutes}:`;
}
if (seconds >= 10) {
out = out + seconds;
} else {
out = `${out}0${seconds}`;
}
return out;
}
changeTimeupdate(currentTime: any) {
// console.log("time change ");
// console.log(" ==> " + this.audioPlayer.currentTime);
this.currentTime = this.mediaPlayer.currentTime;
this.currentTimeDisplay = this.convertInDisplayTime(this.currentTime);
// console.log(" ==> " + this.currentTimeDisplay);
}
changeDurationchange(duration: any) {
console.log('duration change ');
console.log(` ==> ${this.mediaPlayer.duration}`);
this.duration = this.mediaPlayer.duration;
this.durationDisplay = this.convertInDisplayTime(this.duration);
}
onPlay() {
console.log('play');
if (isNullOrUndefined(this.mediaPlayer)) {
console.log(`error element: ${this.mediaPlayer}`);
return;
}
this.lockPlayerEnable();
this.mediaPlayer.play();
}
onPause() {
console.log('pause');
if (isNullOrUndefined(this.mediaPlayer)) {
console.log(`error element: ${this.mediaPlayer}`);
return;
}
this.unlockPlayerEnable();
this.mediaPlayer.pause();
}
onPauseToggle() {
console.log('pause toggle ...');
if (this.isPlaying === true) {
this.onPause();
} else {
this.onPlay();
}
}
onStop() {
console.log('stop');
if (this.mediaPlayer.paused && this.mediaPlayer.currentTime == 0) {
this.mediaSource = null;
return;
}
if (isNullOrUndefined(this.mediaPlayer)) {
console.log(`error element: ${this.mediaPlayer}`);
return;
}
this.unlockPlayerEnable();
this.mediaPlayer.pause();
this.mediaPlayer.currentTime = 0;
}
onBefore() {
console.log('before');
if (this.localIdStreaming <= 0) {
console.error("have no previous !!!");
return;
}
this.localIdStreaming--;
this.updateMediaStreamed();
this.playerService.previous();
}
onNext() {
console.log('next');
if (this.localIdStreaming >= this.localListStreaming.length - 1) {
console.error("have no next !!!");
return;
}
this.localIdStreaming++;
this.updateMediaStreamed();
this.playerService.next();
}
seek(newValue: any) {
console.log(`seek ${newValue.value}`);
if (isNullOrUndefined(this.mediaPlayer)) {
console.log(`error element: ${this.mediaPlayer}`);
return;
}
this.mediaPlayer.currentTime = newValue.value;
}
onRewind() {
console.log('rewind');
if (isNullOrUndefined(this.mediaPlayer)) {
console.log(`error element: ${this.mediaPlayer}`);
return;
}
this.mediaPlayer.currentTime = this.currentTime - 10;
}
onForward() {
console.log('forward');
if (isNullOrUndefined(this.mediaPlayer)) {
console.log(`error element: ${this.mediaPlayer}`);
return;
}
this.mediaPlayer.currentTime = this.currentTime + 10;
}
onMore() {
console.log('more');
if (isNullOrUndefined(this.mediaPlayer)) {
console.log(`error element: ${this.mediaPlayer}`);
return;
}
}
// these element is to permit to not stop music when screen is off !!
wakeLock = null;
unlockPlayerEnable() {
const temporaryValue = this.wakeLock;
this.wakeLock = null;
if (!isNullOrUndefined(temporaryValue)) {
console.log(`plopppp ${temporaryValue}`);
temporaryValue.release();
}
try {
const tmp = navigator as any;
this.wakeLock = tmp.wakeLock.request('screen');
} catch (err) {
// The Wake Lock request has failed - usually system related, such as battery.
console.log(`Can not lock screen element: ${err.name}, ${err.message}`);
}
}
async lockPlayerEnable() {
if ('wakeLock' in navigator) {
try {
let tmp = navigator as any;
this.wakeLock = await tmp.wakeLock.request('screen');
} catch (err) {
// The Wake Lock request has failed - usually system related, such as battery.
console.log(`Can not lock screen element: ${err.name}, ${err.message}`);
}
}
}
}

View File

@ -1,2 +0,0 @@
<!--<canvas width="200" height="250" style="border:1px solid #d3d3d3;" id="imageCanvas" #imageCanvas></canvas>-->
<img src="{{cover}}"/>

View File

@ -1,5 +0,0 @@
img {
max-height: 250px;
max-width: 200px;
}

View File

@ -1,58 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file)
*/
import { Component, OnInit, Input } from '@angular/core';
//import { ModelResponseHttp } from '@app/service/http-wrapper';
import { DataService } from 'app/service/data';
@Component({
selector: 'data-image',
templateUrl: './data-image.html',
styleUrls: ['./data-image.less']
})
export class ElementDataImageComponent implements OnInit {
// input parameters
@Input() id: string = "0";
cover: string = '';
/*
imageCanvas:any;
@ViewChild('imageCanvas')
set mainDivEl(el: ElementRef) {
if(el !== null && el !== undefined) {
this.imageCanvas = el.nativeElement;
}
}
*/
constructor(private dataService: DataService) {
}
ngOnInit() {
this.cover = this.dataService.getThumbnailUrl(this.id);
/*
let canvas = this.imageCanvas.nativeElement;
let ctx = canvas.getContext("2d");
console.log(`Request thumbnail for ---> ${this.id}`);
this.dataService.getImageThumbnail(this.id)
.then((result:ModelResponseHttp) => {
console.log(`plop ---> ${result.status}`);
const response = result.data as Response;
response.blob().then((value:Blob) => {
let img = new Image();
img.onload = function() {
//ctx.drawImage(img, 0, 0)
}
let imageUrl = URL.createObjectURL(value);
console.log(`get new image url blob: ${imageUrl}`);
//img.src = imageUrl;
})
}).catch(()=>{
console.log("plop ---> ");
});
//img.src = "../../assets/aCRF-PRV111_CLN-001 v1.4-images/aCRF-PRV111_CLN-001 v1.4-blank_0.jpg";
//ctx.drawImage(img, 10, 10, 250, 250);
*/
}
}

View File

@ -1,14 +0,0 @@
import { AppDescriptionArea } from "./AppDescriptionArea/AppDescriptionArea";
import { ElementPlayerAudioComponent } from "./AppPlayerAudio/AppPlayerAudio";
import { AppElementAlbum } from "./AppElementAlbum/AppElementAlbum";
import { AppElementTrack } from "./AppElementTrack/AppElementTrack";
export {
AppDescriptionArea,
AppElementAlbum,
ElementPlayerAudioComponent,
AppElementTrack,
};

View File

@ -1,22 +0,0 @@
<div>
<app-popin id="popin-create-type"
popSize="medium"
popTitle="Create a new 'TYPE'"
closeTopRight="true"
closeTitle="Cancel"
validateTitle="Create"
(callback)="eventPopUp($event[0])">
<p class="expand">
<label class="unselectable">Name: </label><br/>
<input type="text"
placeholder="Name of the Type"
[value]="name"
(input)="onName($event.target.value)"
/>
</p>
<p class="expand">
<label class="unselectable">Description: </label><br/>
<textarea (input)="onDescription($event.target.value)" placeholder="Description of the Type" rows=6>{{description}}</textarea>
</p>
</app-popin>
</div>

View File

@ -1,12 +0,0 @@
.expand {
width: 100%;
input {
width: 100%;
};
textarea {
width: 100%;
};
}

View File

@ -1,51 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file)
*/
import { Component, OnInit } from '@angular/core';
import { PopInService } from '@kangaroo-and-rabbit/kar-cw';
@Component({
selector: 'create-type',
templateUrl: './create-type.html',
styleUrls: ['./create-type.less']
})
export class PopInCreateType implements OnInit {
name: string = '';
description: string = '';
constructor(private popInService: PopInService) {
}
OnDestroy() {
}
ngOnInit() {
}
eventPopUp(event: string): void {
console.log(`GET event: ${event}`);
this.popInService.close('popin-create-type');
}
updateNeedSend(): void {
}
onName(value: any): void {
if (value.length === 0) {
this.name = '';
} else {
this.name = value;
}
this.updateNeedSend();
}
onDescription(value: any): void {
if (value.length === 0) {
this.description = '';
} else {
this.description = value;
}
this.updateNeedSend();
}
}

View File

@ -1,168 +0,0 @@
<div class="main-reduce edit-page">
<div class="title">
Edit album
</div>
@if(itemIsRemoved) {
<div class="fill-all">
<div class="message-big">
<br/><br/><br/>
The album has been removed
<br/><br/><br/>
</div>
</div>
}
@else if (itemIsNotFound) {
<div class="fill-all">
<div class="message-big">
<br/><br/><br/>
The album does not exist
<br/><br/><br/>
</div>
</div>
}
@else if (itemIsLoading) {
<div class="fill-all">
<div class="message-big">
<br/><br/><br/>
Loading ...<br/>
Please wait.
<br/><br/><br/>
</div>
</div>
}
@else {
<div class="fill-all">
<div class="request_raw">
<div class="label">
name:
</div>
<div class="input">
<input type="text"
placeholder="Name of the album"
[value]="nameAlbum"
(input)="onName($event.target.value)"
/>
</div>
</div>
<!--
<div class="request_raw">
<div class="label">
<i class="material-icons">date_range</i> Date:
</div>
<div class="input">
<input type="number"
pattern="[0-9]{0-4}"
placeholder="2112"
[value]="data.time"
(input)="onDate($event.target)"/>
</div>
</div>
-->
<div class="request_raw">
<div class="label">
Description:
</div>
<div class="input">
<input type="text"
placeholder="Description of the Media"
[value]="description"
(input)="onDescription($event.target.value)"/>
</div>
</div>
<div class="send_value">
<button class="button fill-x color-button-validate color-shadow-black" (click)="sendValues()" type="submit"><i class="material-icons">save_alt</i> Save</button>
</div>
<div class="clear"></div>
</div>
<!-- ------------------------- Cover section --------------------------------- -->
<div class="title">
Covers
</div>
<div class="fill-all">
<div class="hide-element">
<input type="file"
#fileInput
(change)="onChangeCover($event.target)"
placeholder="Select a cover file"
accept=".png,.jpg,.jpeg,.webp"/>
</div>
<div class="request_raw">
<div class="input">
@for (element of coversDisplay; track element.id;) {
<div class="cover">
<div class="cover-image">
<img src="{{element.url}}"/>
</div>
<div class="cover-button">
<button (click)="removeCover(element.id)">
<i class="material-icons button-remove">highlight_off</i>
</button>
</div>
</div>
}
<div class="cover">
<div class="cover-no-image">
</div>
<div class="cover-button">
<button (click)="fileInput.click()">
<i class="material-icons button-add">add_circle_outline</i>
</button>
</div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
<!-- ------------------------- ADMIN section --------------------------------- -->
<div class="title">
Administration
</div>
<div class="fill-all">
<div class="request_raw">
<div class="label">
<i class="material-icons">data_usage</i> ID:
</div>
<div class="input">
{{idAlbum}}
</div>
</div>
<div class="clear"></div>
<div class="request_raw">
<div class="label">
Tracks:
</div>
<div class="input">
{{trackCount}}
</div>
</div>
<div class="clear"></div>
<div class="request_raw">
<div class="label">
<i class="material-icons">delete_forever</i> Trash:
</div>
@if(trackCount == '0') {
<div class="input">
<button class="button color-button-cancel color-shadow-black" (click)="removeItem()" type="submit">
<i class="material-icons">delete</i> Remove album
</button>
</div>
}
@else {
<div class="input">
<i class="material-icons">new_releases</i> Can not remove album, track depending on it
</div>
}
</div>
<div class="clear"></div>
</div>
}
</div>
<upload-progress [mediaTitle]="upload.labelMediaTitle"
[mediaUploaded]="upload.mediaSendSize"
[mediaSize]="upload.mediaSize"
[result]="upload.result"
[error]="upload.error"></upload-progress>
<delete-confirm
[comment]="confirmDeleteComment"
[imageUrl]=confirmDeleteImageUrl
(callback)="deleteConfirmed()"></delete-confirm>

View File

@ -1,221 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file)
*/
import { Component, OnInit } from '@angular/core';
import { UploadProgress, PopInService } from '@kangaroo-and-rabbit/kar-cw';
import { Album } from 'app/back-api';
import { AlbumService, ArianeService, DataService, TrackService } from 'app/service';
export interface ElementList {
value: number;
label: string;
}
@Component({
selector: 'SceneAlbumEdit',
templateUrl: './SceneAlbumEdit.html',
styleUrls: ['./SceneAlbumEdit.less']
})
export class AlbumEditScene implements OnInit {
idAlbum: number = -1;
itemIsRemoved: boolean = false;
itemIsNotFound: boolean = false;
itemIsLoading: boolean = true;
error: string = '';
nameAlbum: string;
description: string = '';
coverFile: File;
uploadFileValue: string = '';
selectedFiles: FileList;
trackCount: string = null;
coversDisplay: Array<any> = [];
// section tha define the upload value to display in the pop-in of upload
public upload: UploadProgress = new UploadProgress();
// --------------- confirm section ------------------
public confirmDeleteComment: string = null;
public confirmDeleteImageUrl: string = null;
private deleteCoverId: string = null;
private deleteItemId: number = null;
deleteConfirmed() {
if (this.deleteCoverId !== null) {
this.removeCoverAfterConfirm(this.deleteCoverId);
this.cleanConfirm();
}
if (this.deleteItemId !== null) {
this.removeItemAfterConfirm(this.deleteItemId);
this.cleanConfirm();
}
}
cleanConfirm() {
this.confirmDeleteComment = null;
this.confirmDeleteImageUrl = null;
this.deleteCoverId = null;
this.deleteItemId = null;
}
constructor(
private albumService: AlbumService,
private trackService: TrackService,
private arianeService: ArianeService,
private popInService: PopInService,
private dataService: DataService) {
}
ngOnInit() {
this.idAlbum = this.arianeService.getAlbumId();
let self = this;
this.albumService.get(this.idAlbum)
.then((response: Album) => {
console.log(`get response of album : ${JSON.stringify(response, null, 2)}`);
self.nameAlbum = response.name;
self.description = response.description;
self.updateCoverList(response.covers);
self.itemIsLoading = false;
}).catch((response) => {
self.error = 'Can not get the data';
self.nameAlbum = null;
self.description = '';
self.coversDisplay = [];
self.itemIsNotFound = true;
self.itemIsLoading = false;
});
this.trackService.getTracksWithAlbumId(this.idAlbum)
.then((response: any) => {
self.trackCount = response.length;
}).catch((response: any) => {
self.trackCount = '---';
});
}
updateCoverList(covers: any) {
this.coversDisplay = [];
if (covers !== undefined && covers !== null) {
for (let iii = 0; iii < covers.length; iii++) {
this.coversDisplay.push({
id: covers[iii],
url: this.dataService.getThumbnailUrl(covers[iii])
});
}
} else {
this.coversDisplay = [];
}
}
onName(value: any): void {
this.nameAlbum = value;
}
onDescription(value: any): void {
this.description = value;
}
sendValues(): void {
console.log('send new values....');
let data = {
name: this.nameAlbum,
description: this.description
};
if (this.description === undefined) {
data.description = null;
}
this.albumService.patch(this.idAlbum, data);
}
// At the drag drop area
// (drop)="onDropFile($event)"
onDropFile(event: DragEvent) {
event.preventDefault();
// this.uploadFile(event.dataTransfer.files[0]);
}
// At the drag drop area
// (dragover)="onDragOverFile($event)"
onDragOverFile(event) {
event.stopPropagation();
event.preventDefault();
}
// At the file input element
// (change)="selectFile($event)"
onChangeCover(value: any): void {
this.selectedFiles = value.files;
this.coverFile = this.selectedFiles[0];
console.log(`select file ${this.coverFile.name}`);
this.uploadCover(this.coverFile);
}
uploadCover(file: File) {
if (file === undefined) {
console.log('No file selected!');
return;
}
let self = this;
// clean upload labels
this.upload.clear();
// display the upload pop-in
this.popInService.open('popin-upload-progress');
this.albumService.uploadCover(this.idAlbum, file, (count, total) => {
self.upload.mediaSendSize = count;
self.upload.mediaSize = total;
})
.then((response: any) => {
self.upload.result = 'Cover added done';
// we retrive the whiole media ==> update data ...
self.updateCoverList(response.covers);
}).catch((response: any) => {
// self.error = "Can not get the data";
console.log('Can not add the cover in the track...');
});
}
removeCover(id: string) {
this.cleanConfirm();
this.confirmDeleteComment = `Delete the cover ID: ${id}`;
this.confirmDeleteImageUrl = this.dataService.getThumbnailUrl(id);
this.deleteCoverId = id;
this.popInService.open('popin-delete-confirm');
}
removeCoverAfterConfirm(id: string) {
console.log(`Request remove cover: ${id}`);
let self = this;
this.albumService.deleteCover(this.idAlbum, id)
.then((response: any) => {
self.upload.result = 'Cover remove done';
// we retrive the whiole media ==> update data ...
self.updateCoverList(response.covers);
}).catch((response: any) => {
// self.error = "Can not get the data";
console.log('Can not remove the cover of the track...');
});
}
removeItem() {
console.log('Request remove Media...');
this.cleanConfirm();
this.confirmDeleteComment = `Delete the Album: ${this.idAlbum}`;
this.deleteItemId = this.idAlbum;
this.popInService.open('popin-delete-confirm');
}
removeItemAfterConfirm(id: number) {
let self = this;
this.albumService.delete(id)
.then((response3) => {
// self.dataOri = tmpp;
// self.updateNeedSend();
self.itemIsRemoved = true;
}).catch((response3) => {
// self.updateNeedSend();
});
}
}

View File

@ -1,26 +0,0 @@
<div class="generic-page">
<AppDescriptionArea
[title]="name"
[name]="albumName"
[description]="albumDescription"
[cover1]="artistCovers"
[cover2]="albumCovers"
(play)="playAll()"
(shuffle)="playShuffle()"/>
@if (tracks) {
<div class="fill-content colomn_single">
<div class="clear"></div>
<div class="title">Track{{tracks.length > 1?"s":""}}:</div>
@for (data of tracks; track data.id;) {
<AppElementTrack
[element]="data"
(click)="onSelectTrack($event, data.id)"
(auxclick)="onSelectTrack($event, data.id)"/>
} @empty {
Aucune piste accessible.
}
</div>
}
<div class="clear-end"></div>
</div>

View File

@ -1,130 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file)
*/
import { Component, OnInit } from '@angular/core';
import { Album, Track } from 'app/back-api';
import { arrayUnique } from '@kangaroo-and-rabbit/kar-cw';
import { ArtistService, DataService, ArianeService, AlbumService, TrackService, PlayerService } from 'app/service';
@Component({
selector: 'SceneAlbum',
templateUrl: './SceneAlbum.html',
})
export class AlbumScene implements OnInit {
public artistIds: number[] = [];
public idAlbum: number = -1;
public name: string = '???';
public description: string = undefined;
public artistCovers: Array<string> = undefined;
public albumName: string = '';
public albumDescription: string = undefined;
public albumCovers: string[] = undefined;
public tracksIds: number[] = undefined;
public tracks: Track[] = undefined;
constructor(
private artistService: ArtistService,
private albumService: AlbumService,
private trackService: TrackService,
private arianeService: ArianeService,
private playerService: PlayerService,
private dataService: DataService) {
}
ngOnInit() {
//this.artistIds = [this.arianeService.getArtistId()];
this.idAlbum = this.arianeService.getAlbumId();
let self = this;
this.albumService.get(this.idAlbum)
.then((response) => {
self.albumName = response.name;
self.albumDescription = response.description;
self.albumCovers = this.dataService.getListUrl(response.covers);
}).catch((error) => {
self.albumDescription = undefined;
self.albumName = '???';
self.albumCovers = undefined;
// no check just ==> an error occurred on album
});
console.log(`all the tracks for a specific album: ${self.idAlbum}`);
this.trackService.getTracksWithAlbumId(self.idAlbum)
.then((response2: Track[]) => {
self.tracks = response2;
console.log(`get tracks : ${JSON.stringify(self.tracks, null, 2)}`);
self.artistIds = []
self.tracks.forEach(element => {
self.artistIds = [...self.artistIds, ...element.artists];
});
self.artistIds = arrayUnique(self.artistIds);
if (self.artistIds.length === 0) {
console.error("No artist found !!!");
return;
} else if (self.artistIds.length > 1) {
console.error("More than 1 artist ==> not managed");
}
/*
// TODO: display more than 1 ...
self.artistService.get(self.artistIds[0])
.then((response) => {
self.name = response.name;
self.description = response.description;
self.artistCovers = self.dataService.getListUrl(response.covers);
}).catch((error) => {
self.description = undefined;
self.name = '???';
self.artistCovers = undefined;
});
*/
//console.log(`>>>>BBB get tracks : ${JSON.stringify(response2, null, 2)}`);
}).catch((response) => {
//console.log(`>>>>BBB plop`);
self.tracks = undefined;
});
}
onSelectTrack(event: any, idSelected: number): void {
if (event.ctrlKey === false) {
//this.arianeService.navigateTrack({trackId: idSelected, newWindows:event.which === 2} );
// TODO: add on global player ...
//this.playerService.play(idSelected);
let elements: number[] = [];
let valuePlayed: number = undefined;
for (let iii = 0; iii < this.tracks.length; iii++) {
elements.push(this.tracks[iii].id);
//console.log(`plop: ${this.tracks[iii].id} == ${idSelected} ==> ${this.tracks[iii].name}`);
if (this.tracks[iii].id == idSelected) {
//console.log(` ==> find`);
valuePlayed = iii;
}
}
this.playerService.playInList(valuePlayed, elements);
} else {
this.arianeService.navigateTrackEdit({ id: idSelected, newWindows: event.which === 2 });
}
}
playAll(): void {
let elements: number[] = [];
for (let iii = 0; iii < this.tracks.length; iii++) {
elements.push(this.tracks[iii].id);
}
this.playerService.clear();
this.playerService.setNewPlaylist(elements);
}
playShuffle(): void {
let elements: number[] = [];
for (let iii = 0; iii < this.tracks.length; iii++) {
elements.push(this.tracks[iii].id);
}
this.playerService.clear();
this.playerService.setNewPlaylistShuffle(elements);
}
}

View File

@ -1,40 +0,0 @@
<div class="generic-page">
<AppDescriptionArea
[title]="name"
[description]="description"
[cover1]="covers"
(play)="playAll()"
(shuffle)="playShuffle()"/>
@if(albums) {
<div class="fill-content colomn_single">
<div class="clear"></div>
<div class="title">Album{{albums.length > 1?"s":""}}: <app-entry placeholder="Search..." (changeValue)="onSearch($event)"></app-entry></div>
@for (data of albums; track data.id;) {
<div class="item-list"
(click)="onSelectAlbum($event, data.id)"
(auxclick)="onSelectAlbum($event, data.id)"
>
<AppElementAlbum
[element]="data"
countSubType="Track"
[countSubTypeCallBack]="countTrack"
subValues="Artist"
[subValuesCallBack]="getArtistsString"/>
</div>
}
</div>
}
@if(tracks) {
<div class="fill-content colomn_mutiple">
<div class="clear"></div>
<div class="title">Track{{tracks.length > 1?"s":""}}:</div>
@for (data of tracks; track data.id;) {
<div class="item item-video" (click)="onSelectTrack($event, data.id)" (auxclick)="onSelectTrack($event, data.id)">
<AppElementTrack
[element]="data"/>
</div>
}
</div>
}
<div class="clear-end"></div>
</div>

View File

@ -1,142 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file)
*/
import { Component, OnInit } from '@angular/core';
import { DataTools } from '@kangaroo-and-rabbit/kar-cw';
import { Album, Artist, Track } from 'app/back-api';
import { ArtistService, DataService, ArianeService, AlbumService, PlayerService, TrackService } from 'app/service';
@Component({
selector: 'SceneAlbums',
templateUrl: './SceneAlbums.html'
})
export class AlbumsScene implements OnInit {
public name: string = '';
public description: string = undefined;
public covers: string[] = undefined;
public albums: Album[] = undefined;
public albumsSave: Album[] = undefined;
public tracks: any[] = undefined;
public countSubElement: number = undefined;
countTrack: (id: number) => Promise<Number>;
getArtistsString: (id: number) => Promise<String[]>;
constructor(
private albumService: AlbumService,
private artistService: ArtistService,
private arianeService: ArianeService,
private trackService: TrackService,
private playerService: PlayerService,
private dataService: DataService) {
}
countTrackCallback(albumId: number): Promise<Number> {
return this.trackService.countTracksWithAlbumId(albumId);
}
getArtistsStringCallback(albumId: number): Promise<String[]> {
//console.log(`request all artist for album: {albumId}`)
let self = this;
return new Promise((resolve, reject) => {
self.trackService.getTracksWithAlbumId(albumId)
.then((response: Track[]) => {
const listArtists = DataTools.extractLimitOneList(response, "artists");
self.artistService.getAll(listArtists)
.then((listArtists: Artist[]) => {
resolve(DataTools.extractLimitOne(listArtists, "name"));
}).catch((error) => {
resolve([">> ERROR 1 <<"]);
})
}).catch((error) => {
resolve([">> ERROR 2 <<"]);
});
});
}
ngOnInit() {
const self = this;
this.getArtistsString = (id: number) => { return self.getArtistsStringCallback(id); };
this.countTrack = (id: number) => { return self.countTrackCallback(id); };
self.name = "All Albums";
self.description = "View all albums (no specific artist)";
//console.log(`get parameter id: ${ this.idArtist}`);
this.albumService.getOrder()
.then((response: Album[]) => {
//console.log(`>>>> get album : ${JSON.stringify(response)}`)
self.albums = response;
self.albumsSave = [...response];
}).catch((response) => {
self.albums = undefined;
});
// TODO later: get all orfans tracks ...
/*
this.artistService.getTrack(this.idArtist)
.then((response: NodeData[]) => {
//console.log(`>>>> get track : ${JSON.stringify(response)}`)
self.tracks = response;
}).catch((response) => {
self.tracks = undefined;
});
*/
}
onSearch(value: string) {
console.log(`Search value: ${value}`);
this.albums = this.albumsSave.filter(element => {
return element.name.toLowerCase().includes(value.toLowerCase());;
})
}
onSelectAlbum(event: any, idSelected: number): void {
if (event.ctrlKey) {
this.arianeService.navigateAlbumEdit({ id: idSelected, newWindows: event.which === 2 });
} else {
this.arianeService.navigateAlbum({ albumId: idSelected, newWindows: event.which === 2 });
}
}
onSelectTrack(event: any, idSelected: number): void {
if (event.ctrlKey) {
this.arianeService.navigateTrackEdit({ id: idSelected, newWindows: event.which === 2 });
} else {
this.arianeService.navigateTrack({ trackId: idSelected, newWindows: event.which === 2 });
}
}
playAll(): void {
this.playerService.clear();
let self = this;
this.trackService.gets()
.then((response: Track[]) => {
let ids = [];
response.forEach(element => {
ids.push(element.id);
});
self.playerService.setNewPlaylist(ids);
})
.catch(() => {
console.log(`error to get list o ftrack ...`)
});
}
playShuffle(): void {
this.playerService.clear();
let self = this;
this.trackService.gets()
.then((response: Track[]) => {
let ids = [];
response.forEach(element => {
ids.push(element.id);
});
self.playerService.setNewPlaylistShuffle(ids);
})
.catch(() => {
console.log(`error to get list o ftrack ...`)
});
}
}

View File

@ -1,165 +0,0 @@
<div class="main-reduce edit-page">
<div class="title">
Edit artist
</div>
@if(itemIsRemoved) {
<div class="fill-all">
<div class="message-big">
<br/><br/><br/>
The artist has been removed
<br/><br/><br/>
</div>
</div>
}
@else if (itemIsNotFound) {
<div class="fill-all">
<div class="message-big">
<br/><br/><br/>
The artist does not exist
<br/><br/><br/>
</div>
</div>
}
@else if (itemIsLoading) {
<div class="fill-all">
<div class="message-big">
<br/><br/><br/>
Loading ...<br/>
Please wait.
<br/><br/><br/>
</div>
</div>
}
@else {
<div class="fill-all">
<div class="request_raw">
<div class="label">
Name:
</div>
<div class="input">
<input type="text"
placeholder="Name of the Artist"
[value]="name"
(input)="onName($event.target.value)"
/>
</div>
</div>
<div class="request_raw">
<div class="label">
Description:
</div>
<div class="input">
<input type="text"
placeholder="Description of the Media"
[value]="description"
(input)="onDescription($event.target.value)"/>
</div>
</div>
<div class="clear"></div>
<div class="send_value">
<button class="button fill-x color-button-validate color-shadow-black" (click)="sendValues()" type="submit"><i class="material-icons">save_alt</i> Save</button>
</div>
<div class="clear"></div>
</div>
<!-- ------------------------- Cover section --------------------------------- -->
<div class="title">
Covers
</div>
<div class="fill-all">
<div class="hide-element">
<input type="file"
#fileInput
(change)="onChangeCover($event.target)"
placeholder="Select a cover file"
accept=".png,.jpg,.jpeg,.webp"/>
</div>
<div class="request_raw">
<div class="input">
@for (element of coversDisplay; track element.id;) {
<div class="cover">
<div class="cover-image">
<img src="{{element.url}}"/>
</div>
<div class="cover-button">
<button (click)="removeCover(element.id)">
<i class="material-icons button-remove">highlight_off</i>
</button>
</div>
</div>
}
<div class="cover">
<div class="cover-no-image">
</div>
<div class="cover-button">
<button (click)="fileInput.click()">
<i class="material-icons button-add">add_circle_outline</i>
</button>
</div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
<!-- ------------------------- ADMIN section --------------------------------- -->
<div class="title">
Administration
</div>
<div class="fill-all">
<div class="request_raw">
<div class="label">
<i class="material-icons">data_usage</i> ID:
</div>
<div class="input">
{{idArtist}}
</div>
</div>
<div class="clear"></div>
<div class="request_raw">
<div class="label">
Albums:
</div>
<div class="input">
{{albumsCount}}
</div>
</div>
<div class="clear"></div>
<div class="request_raw">
<div class="label">
Tracks:
</div>
<div class="input">
{{trackCount}}
</div>
</div>
<div class="clear"></div>
<div class="request_raw">
<div class="label">
<i class="material-icons">delete_forever</i> Trash:
</div>
@if(trackCount == '0' && albumsCount == '0') {
<div class="input">
<button class="button color-button-cancel color-shadow-black" (click)="removeItem()" type="submit">
<i class="material-icons">delete</i> Remove Artist
</button>
</div>
}
@else {
<div class="input">
<i class="material-icons">new_releases</i> Can not remove album or track depending on it
</div>
}
</div>
<div class="clear"></div>
</div>
}
</div>
<upload-progress [mediaTitle]="upload.labelMediaTitle"
[mediaUploaded]="upload.mediaSendSize"
[mediaSize]="upload.mediaSize"
[result]="upload.result"
[error]="upload.error"></upload-progress>
<delete-confirm
[comment]="confirmDeleteComment"
[imageUrl]=confirmDeleteImageUrl
(callback)="deleteConfirmed()"></delete-confirm>

View File

@ -1,232 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file)
*/
import { Component, OnInit } from '@angular/core';
import { PopInService, UploadProgress } from '@kangaroo-and-rabbit/kar-cw';
import { Artist, Track } from 'app/back-api';
import { ArtistService, DataService, GenderService, ArianeService, TrackService } from 'app/service';
export class ElementList {
constructor(
public value: number,
public label: string) {
}
}
@Component({
selector: 'app-artist-edit',
templateUrl: './artist-edit.html',
styleUrls: ['./artist-edit.less']
})
export class ArtistEditScene implements OnInit {
idArtist: number = -1;
itemIsRemoved: boolean = false;
itemIsNotFound: boolean = false;
itemIsLoading: boolean = true;
error: string = '';
name: string = '';
description: string = '';
coverFile: File;
uploadFileValue: string = '';
selectedFiles: FileList;
albumsCount: string = null;
trackCount: string = null;
coversDisplay: Array<any> = [];
// section tha define the upload value to display in the pop-in of upload
public upload: UploadProgress = new UploadProgress();
// --------------- confirm section ------------------
public confirmDeleteComment: string = null;
public confirmDeleteImageUrl: string = null;
private deleteCoverId: string = null;
private deleteItemId: number = null;
deleteConfirmed() {
if (this.deleteCoverId !== null) {
this.removeCoverAfterConfirm(this.deleteCoverId);
this.cleanConfirm();
}
if (this.deleteItemId !== null) {
this.removeItemAfterConfirm(this.deleteItemId);
this.cleanConfirm();
}
}
cleanConfirm() {
this.confirmDeleteComment = null;
this.confirmDeleteImageUrl = null;
this.deleteCoverId = null;
this.deleteItemId = null;
}
constructor(private dataService: DataService,
private genderService: GenderService,
private artistService: ArtistService,
private trackService: TrackService,
private arianeService: ArianeService,
private popInService: PopInService) {
}
ngOnInit() {
this.idArtist = this.arianeService.getArtistId();
let self = this;
this.artistService.get(this.idArtist)
.then((response: Artist) => {
// console.log("get response of track : " + JSON.stringify(response, null, 2));
self.name = response.name;
self.description = response.description;
self.updateCoverList(response.covers);
// console.log("covers_list : " + JSON.stringify(self.covers_display, null, 2));
self.itemIsLoading = false;
}).catch((response) => {
self.error = 'Can not get the data';
self.name = '';
self.description = '';
self.coversDisplay = [];
self.itemIsNotFound = true;
self.itemIsLoading = false;
});
console.log(`get parameter id: ${this.idArtist}`);
this.trackService.getAlbumIdsOfAnArtist(this.idArtist)
.then((response: number[]) => {
self.albumsCount = "" + response.length;
}).catch((response) => {
self.albumsCount = '---';
});
this.trackService.getTracksOfAnArtist(this.idArtist)
.then((response: Track[]) => {
self.trackCount = "" + response.length;
}).catch((response) => {
self.trackCount = '---';
});
}
updateCoverList(covers: any) {
this.coversDisplay = [];
if (covers !== undefined && covers !== null) {
for (let iii = 0; iii < covers.length; iii++) {
this.coversDisplay.push({
id: covers[iii],
url: this.dataService.getThumbnailUrl(covers[iii])
});
}
} else {
this.coversDisplay = [];
}
}
onName(value: any): void {
this.name = value;
}
onDescription(value: any): void {
this.description = value;
}
sendValues(): void {
console.log('send new values....');
let data = {
name: this.name,
description: this.description
};
if (this.description === undefined) {
data.description = null;
}
this.artistService.patch(this.idArtist, data);
}
// At the drag drop area
// (drop)="onDropFile($event)"
onDropFile(event: DragEvent) {
event.preventDefault();
// this.uploadFile(_event.dataTransfer.files[0]);
}
// At the drag drop area
// (dragover)="onDragOverFile($event)"
onDragOverFile(event) {
event.stopPropagation();
event.preventDefault();
}
// At the file input element
// (change)="selectFile($event)"
onChangeCover(value: any): void {
this.selectedFiles = value.files;
this.coverFile = this.selectedFiles[0];
console.log(`select file ${this.coverFile.name}`);
this.uploadCover(this.coverFile);
}
uploadCover(file: File) {
if (file === undefined) {
console.log('No file selected!');
return;
}
let self = this;
// clean upload labels
this.upload.clear();
// display the upload pop-in
this.popInService.open('popin-upload-progress');
this.artistService.uploadCover(this.idArtist, file, (count, total) => {
self.upload.mediaSendSize = count;
self.upload.mediaSize = total;
})
.then((response: any) => {
self.upload.result = 'Cover added done';
// we retrive the whiole media ==> update data ...
self.updateCoverList(response.covers);
}).catch((response: any) => {
// self.error = "Can not get the data";
console.log('Can not add the cover in the track...');
});
}
removeCover(id: string) {
this.cleanConfirm();
this.confirmDeleteComment = `Delete the cover ID: ${id}`;
this.confirmDeleteImageUrl = this.dataService.getThumbnailUrl(id);
this.deleteCoverId = id;
this.popInService.open('popin-delete-confirm');
}
removeCoverAfterConfirm(id: string) {
console.log(`Request remove cover: ${id}`);
let self = this;
this.artistService.deleteCover(this.idArtist, id)
.then((response: any) => {
self.upload.result = 'Cover remove done';
// we retrive the whiole media ==> update data ...
self.updateCoverList(response.covers);
}).catch((response: any) => {
// self.error = "Can not get the data";
console.log('Can not remove the cover of the track...');
});
}
removeItem() {
console.log('Request remove Media...');
this.cleanConfirm();
this.confirmDeleteComment = `Delete the Artist: ${this.idArtist}`;
this.deleteItemId = this.idArtist;
this.popInService.open('popin-delete-confirm');
}
removeItemAfterConfirm(_id: number) {
let self = this;
this.artistService.delete(_id)
.then((response3) => {
// self.data_ori = tmpp;
// self.updateNeedSend();
self.itemIsRemoved = true;
}).catch((response3) => {
// self.updateNeedSend();
});
}
}

View File

@ -1,25 +0,0 @@
<div class="generic-page">
<AppDescriptionArea
[title]="name"
[name]="albumName"
[description]="albumDescription"
[cover1]="artistCovers"
[cover2]="albumCovers"
(play)="playAll()"
(shuffle)="playShuffle()"/>
@if(tracks) {
<div class="fill-content colomn_single">
<div class="clear"></div>
<div class="title">Track{{tracks.length > 1?"s":""}}:</div>
@for (data of tracks; track data.id;) {
<AppElementTrack
[element]="data"
(click)="onSelectTrack($event, data.id)"
(auxclick)="onSelectTrack($event, data.id)"></AppElementTrack>
} @empty {
Aucune piste accessible.
}
</div>
}
<div class="clear-end"></div>
</div>

View File

@ -1,116 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file)
*/
import { Component, OnInit } from '@angular/core';
import { Track } from 'app/back-api';
import { ArtistService, DataService, ArianeService, AlbumService, TrackService, PlayerService } from 'app/service';
@Component({
selector: 'app-artist-album',
templateUrl: './artist-album.html'
})
export class ArtistAlbumScene implements OnInit {
public idArtist = -1;
public idAlbum = -1;
public name: string = '';
public description: string = undefined;
public artistCovers: Array<string> = undefined;
public albumName: string = '';
public albumDescription: string = undefined;
public albumCovers: string[] = undefined;
public tracksIds: number[] = undefined;
public tracks: Track[] = undefined;
constructor(
private artistService: ArtistService,
private albumService: AlbumService,
private trackService: TrackService,
private arianeService: ArianeService,
private playerService: PlayerService,
private dataService: DataService) {
}
ngOnInit() {
this.idArtist = this.arianeService.getArtistId();
this.idAlbum = this.arianeService.getAlbumId();
let self = this;
this.artistService.get(this.idArtist)
.then((response) => {
self.name = response.name;
self.description = response.description;
self.artistCovers = this.dataService.getListUrl(response.covers);
}).catch((response) => {
self.description = undefined;
self.name = '???';
self.artistCovers = undefined;
// no check just ==> an error occured on album
});
this.albumService.get(this.idAlbum)
.then((response) => {
self.albumName = response.name;
self.albumDescription = response.description;
self.albumCovers = this.dataService.getListUrl(response.covers);
}).catch((response) => {
self.albumDescription = undefined;
self.albumName = '???';
self.albumCovers = undefined;
// no check just ==> an error occured on album
});
//console.log("all the tracks: " + self.tracksIds);
this.trackService.getTracksWithAlbumId(self.idAlbum)
.then((response2: Track[]) => {
self.tracks = response2;
//console.log(`>>>>BBB get tracks : ${JSON.stringify(response2, null, 2)}`);
}).catch((response) => {
//console.log(`>>>>BBB plop`);
self.tracks = undefined;
});
}
onSelectTrack(event: any, idSelected: number): void {
if (event.ctrlKey === false) {
//this.arianeService.navigateTrack({trackId: idSelected, newWindows:event.which === 2} );
// TODO: add on global player ...
//this.playerService.play(idSelected);
let elements: number[] = [];
let valuePlayed: number = undefined;
for (let iii = 0; iii < this.tracks.length; iii++) {
elements.push(this.tracks[iii].id);
//console.log(`plop: ${this.tracks[iii].id} == ${idSelected} ==> ${this.tracks[iii].name}`);
if (this.tracks[iii].id == idSelected) {
//console.log(` ==> find`);
valuePlayed = iii;
}
}
this.playerService.playInList(valuePlayed, elements);
} else {
this.arianeService.navigateTrackEdit({ id: idSelected, newWindows: event.which === 2 });
}
}
playAll(): void {
let elements: number[] = [];
for (let iii = 0; iii < this.tracks.length; iii++) {
elements.push(this.tracks[iii].id);
}
this.playerService.clear();
this.playerService.setNewPlaylist(elements);
}
playShuffle(): void {
let elements: number[] = [];
for (let iii = 0; iii < this.tracks.length; iii++) {
elements.push(this.tracks[iii].id);
}
this.playerService.clear();
this.playerService.setNewPlaylistShuffle(elements);
}
}

View File

@ -1,37 +0,0 @@
<div class="generic-page">
<AppDescriptionArea
[title]="name"
[description]="description"
[cover1]="covers"
(play)="playAll()"
(shuffle)="playShuffle()"/>
@if(albums) {
<div class="fill-content colomn_single">
<div class="clear"></div>
<div class="title">Album{{albums.length > 1?"s":""}}:</div>
@for (data of albums; track data.id;) {
<div class="item-list" (click)="onSelectAlbum($event, data.id)" (auxclick)="onSelectAlbum($event, data.id)">
<AppElementAlbum
[element]="data"
countSubType="Track"
[countSubTypeCallBack]="countTrack"
/>
</div>
}
</div>
}
@if(tracks) {
<div class="fill-content colomn_mutiple">
<div class="clear"></div>
<div class="title">Track{{tracks.length > 1?"s":""}}:</div>
@for (data of tracks; track data.id;) {
<div class="item item-video" (click)="onSelectTrack($event, data.id)" (auxclick)="onSelectTrack($event, data.id)">
<AppElementTrack
[element]="data"
/>
</div>
}
</div>
}
<div class="clear-end"></div>
</div>

View File

@ -1,131 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file)
*/
import { Component, OnInit } from '@angular/core';
import { Album, Track } from 'app/back-api';
import { ArtistService, DataService, ArianeService, AlbumService, PlayerService, TrackService } from 'app/service';
@Component({
selector: 'app-artist',
templateUrl: './artist.html'
})
export class ArtistScene implements OnInit {
public idArtist = -1;
public name: string = '';
public description: string = undefined;
public covers: string[] = undefined;
public albums: Album[] = undefined;
public tracks: Track[] = undefined;
public countSubElement: number = undefined;
countTrack: (id: number) => Promise<Number>;
constructor(
private albumService: AlbumService,
private artistService: ArtistService,
private playerService: PlayerService,
private trackService: TrackService,
private arianeService: ArianeService,
private dataService: DataService) {
}
countTrackCallback(albumId: number): Promise<Number> {
return this.trackService.countTracksWithAlbumId(albumId);
}
ngOnInit() {
this.countTrack = (id: number) => { return self.countTrackCallback(id); };
// this.idPlaylist = parseInt(this.route.snapshot.paramMap.get('universId'));
// this.idType = parseInt(this.route.snapshot.paramMap.get('typeId'));
this.idArtist = this.arianeService.getArtistId();
let self = this;
this.artistService.get(this.idArtist)
.then((response) => {
self.name = response.name;
self.description = response.description;
self.covers = this.dataService.getListUrl(response.covers);
}).catch((response) => {
self.name = '???';
self.description = undefined;
self.covers = undefined;
});
//console.log(`get parameter id: ${ this.idArtist}`);
this.trackService.getAlbumIdsOfAnArtist(this.idArtist)
.then((albumIds: number[]) => {
this.albumService.getAll(albumIds)
.then((response: Album[]) => {
//console.log(`>>>> get album : ${JSON.stringify(response)}`)
self.albums = response;
}).catch((response) => {
self.albums = undefined;
});
}).catch((response) => {
self.albums = undefined;
});
// TODO later: get all orfan tracks ...
/*
this.artistService.getTrack(this.idArtist)
.then((response: NodeData[]) => {
//console.log(`>>>> get track : ${JSON.stringify(response)}`)
self.tracks = response;
}).catch((response) => {
self.tracks = undefined;
});
*/
}
onSelectAlbum(event: any, idSelected: number): void {
if (event.ctrlKey) {
this.arianeService.navigateAlbumEdit({ id: idSelected, newWindows: event.which === 2 });
} else {
this.arianeService.navigateArtist({ artistId: this.idArtist, albumId: idSelected, newWindows: event.which === 2 });
}
}
onSelectTrack(event: any, idSelected: number): void {
if (event.ctrlKey === false) {
this.arianeService.navigateTrack({ trackId: idSelected, newWindows: event.which === 2 });
} else {
this.arianeService.navigateTrackEdit({ id: idSelected, newWindows: event.which === 2 });
}
}
getAllTracksIds(): Promise<number[]> {
let elements: number[] = [];
for (let iii = 0; iii < this.albums.length; iii++) {
elements.push(this.albums[iii].id);
}
return this.trackService.getTracksIdsForAlbums(elements);
}
playAll(): void {
this.playerService.clear();
let self = this;
this.getAllTracksIds()
.then((response: number[]) => {
self.playerService.setNewPlaylist(response);
})
.catch(() => {
console.log(`error to get list o ftrack ...`)
});
}
playShuffle(): void {
this.playerService.clear();
let self = this;
this.getAllTracksIds()
.then((response: number[]) => {
self.playerService.setNewPlaylistShuffle(response);
})
.catch(() => {
console.log(`error to get list o ftrack ...`)
});
}
}

View File

@ -1,26 +0,0 @@
<div class="generic-page">
<AppDescriptionArea
[title]="name"
[description]="description"
[cover1]="covers"
(play)="playAll()"
(shuffle)="playShuffle()"/>
@if(artists) {
<div class="fill-content colomn_single">
<div class="clear"></div>
<div class="title">Artist{{artists.length > 1?"s":""}}: <app-entry placeholder="Search..." (changeValue)="onSearch($event)"></app-entry></div>
@for (data of artists; track data.id;) {
<div class="item-list" (click)="onSelectArtist($event, data.id)" (auxclick)="onSelectArtist($event, data.id)">
<AppElementAlbum
[element]="data"
countSubType="Album"
[countSubTypeCallBack]="countAlbum"
countSubType2="Track"
[countSubType2CallBack]="countTrack"
/>
</div>
}
</div>
}
<div class="clear-end"></div>
</div>

View File

@ -1,101 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file)
*/
import { Component, OnInit } from '@angular/core';
import { Artist, Track } from 'app/back-api';
import { ArtistService, ArianeService, TrackService, PlayerService } from 'app/service';
@Component({
selector: 'app-artists',
templateUrl: './artists.html',
})
export class ArtistsScene implements OnInit {
cover: string = '';
covers: Array<string> = [];
name: string = "Artists";
description: string = "All available artists";
artists: Artist[];
artistsSave: Artist[];
countTrack: (id: number) => Promise<Number>;
countAlbum: (id: number) => Promise<Number>;
constructor(
private artistService: ArtistService,
private trackService: TrackService,
private playerService: PlayerService,
private arianeService: ArianeService) {
}
ngOnInit() {
let self = this;
this.countTrack = (id: number) => { return self.countTrackCallback(id); };
this.countAlbum = (id: number) => { return self.countAlbumCallback(id); };
this.artistService.getOrder()
.then((response: Artist[]) => {
self.artists = response;
self.artistsSave = [...response];
//console.log("get artists: " + JSON.stringify(self.artists));
}).catch((response) => {
self.artists = undefined;
});
}
onSearch(value: string) {
console.log(`Search value: ${value}`);
this.artists = this.artistsSave.filter(element => {
return element.name.toLowerCase().includes(value.toLowerCase());;
})
}
onSelectArtist(event: any, idSelected: number): void {
if (event.ctrlKey) {
this.arianeService.navigateArtistEdit({ id: idSelected, newWindows: event.which === 2 });
} else {
this.arianeService.navigateArtist({ artistId: idSelected, newWindows: event.which === 2 });
}
}
countTrackCallback(artistId: number): Promise<Number> {
return this.trackService.countTracksOfAnArtist(artistId);
}
countAlbumCallback(artistId: number): Promise<Number> {
return this.trackService.countAlbumOfAnArtist(artistId);
}
playAll(): void {
this.playerService.clear();
let self = this;
this.trackService.gets()
.then((response: Track[]) => {
let ids = [];
response.forEach(element => {
ids.push(element.id);
});
self.playerService.setNewPlaylist(ids);
})
.catch(() => {
console.log(`error to get list o ftrack ...`)
});
}
playShuffle(): void {
this.playerService.clear();
let self = this;
this.trackService.gets()
.then((response: Track[]) => {
let ids = [];
response.forEach(element => {
ids.push(element.id);
});
self.playerService.setNewPlaylistShuffle(ids);
})
.catch(() => {
console.log(`error to get list o track ...`)
});
}
}

View File

@ -1,3 +0,0 @@
<p>
error-viewer works!
</p>

View File

@ -1,20 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file)
*/
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-error-viewer',
templateUrl: './error-viewer.html',
styleUrls: ['./error-viewer.less']
})
export class ErrorViewerScene implements OnInit {
constructor() { }
ngOnInit() {
}
}

View File

@ -1,38 +0,0 @@
<div class="generic-page">
<div class="fill-title colomn_mutiple">
<div class="cover-area">
@if (cover != null) {
<div class="cover">
<img src="{{cover}}"/>
</div>
}
</div>
<div [className]="cover != null ? 'description-area description-area-cover' : 'description-area description-area-no-cover'">
<div class="title">
{{name}}
</div>
@if(description) {
<div class="description">
{{description}}
</div>
}
</div>
</div>
<div class="fill-content colomn_mutiple">
<div class="clear"></div>
@for (data of artists; track data.id;) {
<div class="item" (click)="onSelectArtist($event, data.id)" (auxclick)="onSelectArtist($event, data.id)">
<!--<app-element-artist [element]="data"/>-->
</div>
}
</div>
<div class="fill-content colomn_mutiple">
<div class="clear"></div>
@for (data of tracks; track data.id;) {
<div class="item item-track" (click)="onSelectTrack($event, data.id)" (auxclick)="onSelectTrack($event, data.id)">
<AppElementTrack [element]="data"/>
</div>
}
</div>
<div class="clear"></div>
</div>

View File

@ -1,98 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file)
*/
import { Component, OnInit } from '@angular/core';
import { GenderService, DataService, ArianeService, TrackService } from 'app/service';
@Component({
selector: 'app-gender',
templateUrl: './gender.html',
styleUrls: ['./gender.less']
})
export class GenderScene implements OnInit {
genderId = -1;
name: string = '';
description: string = '';
cover: string = null;
covers: string[] = [];
artistsError = '';
artists = [];
tracksError = '';
tracks = [];
constructor(
private genderService: GenderService,
private trackService: TrackService,
private arianeService: ArianeService,
private dataService: DataService) {
//NOTHING TO DO ...
}
ngOnInit() {
this.genderId = this.arianeService.getTypeId();
let self = this;
console.log(`get gender global id: ${this.genderId}`);
this.genderService.get(this.genderId)
.then((response) => {
self.name = response.name;
self.description = response.description;
console.log(` ==> get answer gender detail: ${JSON.stringify(response)}`);
if (response.covers === undefined || response.covers === null || response.covers.length === 0) {
self.cover = null;
self.covers = [];
} else {
self.cover = self.dataService.getUrl(response.covers[0]);
for (let iii = 0; iii < response.covers.length; iii++) {
self.covers.push(self.dataService.getUrl(response.covers[iii]));
}
}
}).catch((response) => {
self.name = '???';
self.description = '';
self.covers = [];
self.cover = null;
});
/*
TODO ???
this.trackService.getSubArtist(this.genderId)
.then((response) => {
console.log(` ==> get answer sub-artist: ${JSON.stringify(response)}`);
self.artistsError = '';
self.artists = response;
}).catch((response) => {
console.log(` ==> get answer sub-artist (ERROR): ${JSON.stringify(response)}`);
self.artistsError = 'Wrong e-mail/login or password';
self.artists = [];
});
*/
this.trackService.getTracksForGender(this.genderId)
.then((response) => {
console.log(` ==> get answer sub-track: ${JSON.stringify(response)}`);
self.tracksError = '';
self.tracks = response;
}).catch((response) => {
console.log(` ==> get answer sub-track (ERROR): ${JSON.stringify(response)}`);
self.tracksError = 'Wrong e-mail/login or password';
self.tracks = [];
});
}
onSelectArtist(event: any, idSelected: number): void {
if (event.ctrlKey === false) {
this.arianeService.navigateArtist({ artistId: idSelected, newWindows: event.which === 2 });
} else {
this.arianeService.navigateArtistEdit({ id: idSelected, newWindows: event.which === 2 });
}
}
onSelectTrack(event: any, idSelected: number): void {
if (event.ctrlKey === false) {
this.arianeService.navigateTrack({ trackId: idSelected, newWindows: event.which === 2 });
} else {
this.arianeService.navigateTrackEdit({ id: idSelected, newWindows: event.which === 2 });
}
}
}

Some files were not shown because too many files have changed in this diff Show More