[DEV] update to basic work

This commit is contained in:
Edouard DUPIN 2024-04-06 13:08:12 +02:00
parent e4246750c7
commit 4ff2b247b4
6 changed files with 57 additions and 31 deletions

View File

@ -2,7 +2,6 @@
"$schema": "./node_modules/@angular/cli/lib/config/schema.json", "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1, "version": 1,
"newProjectRoot": "projects", "newProjectRoot": "projects",
"defaultProject": "karusic",
"projects": { "projects": {
"karusic": { "karusic": {
"root": "", "root": "",
@ -53,33 +52,38 @@
"develop": { "develop": {
"optimization": false, "optimization": false,
"outputHashing": "none", "outputHashing": "none",
"sourceMap": true,
"namedChunks": true, "namedChunks": true,
"aot": false, "aot": false,
"extractLicenses": true, "extractLicenses": true,
"vendorChunk": true, "vendorChunk": true,
"buildOptimizer": false "buildOptimizer": false,
"sourceMap": {
"scripts": true,
"styles": true,
"hidden": false,
"vendor": true
}
} }
} }
}, },
"serve": { "serve": {
"builder": "@angular-devkit/build-angular:dev-server", "builder": "@angular-devkit/build-angular:dev-server",
"options": { "options": {
"browserTarget": "karusic:build" "buildTarget": "karusic:build"
}, },
"configurations": { "configurations": {
"production": { "production": {
"browserTarget": "karusic:build:production" "buildTarget": "karusic:build:production"
}, },
"develop": { "develop": {
"browserTarget": "karusic:build:develop" "buildTarget": "karusic:build:develop"
} }
} }
}, },
"extract-i18n": { "extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n", "builder": "@angular-devkit/build-angular:extract-i18n",
"options": { "options": {
"browserTarget": "karusic:build" "buildTarget": "karusic:build"
} }
}, },
"test": { "test": {

View File

@ -13,6 +13,7 @@
"e2e": "ng e2e", "e2e": "ng e2e",
"update_packages": "ncu --upgrade", "update_packages": "ncu --upgrade",
"install_dependency": "pnpm install --force", "install_dependency": "pnpm install --force",
"link_kar_cw": "pnpm link ../../kar-cw/dist/kar-cw/",
"publish": "pnpm publish --no-git-checks" "publish": "pnpm publish --no-git-checks"
}, },
"private": true, "private": true,

View File

@ -21,7 +21,7 @@ import { ForbiddenScene, OnlyUsersGuardHome, HomeOutScene, OnlyUnregisteredGuard
const routes: Routes = [ const routes: Routes = [
{ path: '', redirectTo: '/home', pathMatch: 'full' }, { path: '', redirectTo: '/home', pathMatch: 'full' },
{ path: 'forbidden', component: ForbiddenScene }, //{ path: 'forbidden', component: ForbiddenScene },
// ------------------------------------ // ------------------------------------
// -- home global interface // -- home global interface
@ -29,8 +29,9 @@ const routes: Routes = [
{ {
path: 'home', path: 'home',
component: HomeScene, component: HomeScene,
canActivate: [OnlyUsersGuardHome], // this route to unregistered path when not logged ==> permit to simplify display //canActivate: [OnlyUsersGuardHome], // this route to unregistered path when not logged ==> permit to simplify display
}, },
/*
{ {
path: 'unregistered', path: 'unregistered',
component: HomeOutScene, component: HomeOutScene,
@ -165,7 +166,7 @@ const routes: Routes = [
path: '**', path: '**',
component: NotFound404Scene, component: NotFound404Scene,
}, },
*/
]; ];
@NgModule({ @NgModule({

View File

@ -1,6 +1,7 @@
<!-- Generig global menu --> <!-- Generic global menu -->
<app-top-menu [menu]="currentMenu" (callback)="eventOnMenu($event)"></app-top-menu> <karcw-top-menu [menu]="currentMenu" (callback)="eventOnMenu($event)"/>
<!-- all interfaced pages --> <!-- all interfaced pages -->
<!--
<div class="main-content"> <div class="main-content">
@if(autoConnectedDone) { @if(autoConnectedDone) {
<router-outlet ></router-outlet> <router-outlet ></router-outlet>
@ -15,3 +16,4 @@
} }
</div> </div>
<app-element-player-audio></app-element-player-audio> <app-element-player-audio></app-element-player-audio>
-->

View File

@ -6,7 +6,16 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ArianeService } from './service'; import { ArianeService } from './service';
import { MenuItem, SSOService, SessionService, UserService, UserRoles222, EventOnMenu, MenuPosition, isNullOrUndefined } from '@kangaroo-and-rabbit/kar-cw'; import {
MenuItem,
SSOService,
SessionService,
UserService,
UserRoles222,
EventOnMenu,
MenuPosition,
isNullOrUndefined,
} from '@kangaroo-and-rabbit/kar-cw';
enum MenuEventType { enum MenuEventType {
SSO_LOGIN = "SSO_CALL_LOGIN", SSO_LOGIN = "SSO_CALL_LOGIN",
@ -36,10 +45,11 @@ export class AppComponent implements OnInit {
location: string = "home"; location: string = "home";
constructor( constructor(
private userService: UserService, /*private userService: UserService,
private sessionService: SessionService, private sessionService: SessionService,
private ssoService: SSOService, private ssoService: SSOService,
private arianeService: ArianeService) { private arianeService: ArianeService
*/) {
} }
@ -48,6 +58,7 @@ export class AppComponent implements OnInit {
this.isConnected = false; this.isConnected = false;
this.updateMainMenu(); this.updateMainMenu();
let self = this; let self = this;
/*
this.sessionService.change.subscribe((isConnected) => { this.sessionService.change.subscribe((isConnected) => {
console.log(`receive event from session ...${isConnected}`); console.log(`receive event from session ...${isConnected}`);
self.isConnected = isConnected; self.isConnected = isConnected;
@ -98,11 +109,13 @@ export class AppComponent implements OnInit {
//console.log(`>>> change trackId=${trackId}`); //console.log(`>>> change trackId=${trackId}`);
self.updateMainMenu(); self.updateMainMenu();
}); });
*/
} }
eventOnMenu(data: EventOnMenu): void { eventOnMenu(data: EventOnMenu): void {
//console.log(`plopppppppppp ${JSON.stringify(this.route.snapshot.url)}`); //console.log(`plopppppppppp ${JSON.stringify(this.route.snapshot.url)}`);
//console.log(`Get event on menu: ${JSON.stringify(data, null, 4)}`); //console.log(`Get event on menu: ${JSON.stringify(data, null, 4)}`);
/*
switch (data.menu.otherData) { switch (data.menu.otherData) {
case MenuEventType.SSO_LOGIN: case MenuEventType.SSO_LOGIN:
this.ssoService.requestSignIn(); this.ssoService.requestSignIn();
@ -141,15 +154,17 @@ export class AppComponent implements OnInit {
case MenuEventType.PLAYLIST: case MenuEventType.PLAYLIST:
break; break;
} }
*/
} }
updateMainMenu(): void { updateMainMenu(): void {
console.log("update main menu :"); console.log("update main menu :");
if (this.isConnected) { if (this.isConnected) {
this.currentMenu = [ this.currentMenu = [
{ {
position: MenuPosition.LEFT, position: MenuPosition.LEFT,
hover: `You are logged as: ${this.sessionService.getLogin()}`, hover: "lkjljlk", //`You are logged as: ${this.sessionService.getLogin()}`,
icon: "menu", icon: "menu",
title: "Menu", title: "Menu",
subMenu: [ subMenu: [
@ -172,35 +187,35 @@ export class AppComponent implements OnInit {
title: this.getSegmentDisplayable(), title: this.getSegmentDisplayable(),
otherData: MenuEventType.TYPE, otherData: MenuEventType.TYPE,
callback: true, callback: true,
enable: !isNullOrUndefined(this.arianeService.getTypeId()), enable: true//!isNullOrUndefined(this.arianeService.getTypeId()),
}, { }, {
position: MenuPosition.LEFT, position: MenuPosition.LEFT,
icon: "person", icon: "person",
title: this.arianeService.getArtistName(), title: "true", //this.arianeService.getArtistName(),
otherData: MenuEventType.ARTIST, otherData: MenuEventType.ARTIST,
callback: true, callback: true,
enable: !isNullOrUndefined(this.arianeService.getArtistId()), enable: true// !isNullOrUndefined(this.arianeService.getArtistId()),
}, { }, {
position: MenuPosition.LEFT, position: MenuPosition.LEFT,
icon: "album", icon: "album",
title: this.arianeService.getAlbumName(), title: "true", //this.arianeService.getAlbumName(),
otherData: MenuEventType.ALBUM, otherData: MenuEventType.ALBUM,
callback: true, callback: true,
enable: !isNullOrUndefined(this.arianeService.getAlbumId()), enable: true// !isNullOrUndefined(this.arianeService.getAlbumId()),
}, { }, {
position: MenuPosition.LEFT, position: MenuPosition.LEFT,
icon: "music_note", icon: "music_note",
title: this.arianeService.getTrackName(), title: "true", //this.arianeService.getTrackName(),
otherData: MenuEventType.TRACK, otherData: MenuEventType.TRACK,
callback: true, callback: true,
enable: !isNullOrUndefined(this.arianeService.getTrackId()), enable: true// !isNullOrUndefined(this.arianeService.getTrackId()),
}, { }, {
position: MenuPosition.LEFT, position: MenuPosition.LEFT,
icon: "queue_music", icon: "queue_music",
title: this.arianeService.getPlaylistName(), title: "true",//this.arianeService.getPlaylistName(),
otherData: MenuEventType.PLAYLIST, otherData: MenuEventType.PLAYLIST,
callback: true, callback: true,
enable: !isNullOrUndefined(this.arianeService.getPlaylistId()), enable: true// !isNullOrUndefined(this.arianeService.getPlaylistId()),
} }
], ],
}, { }, {
@ -210,14 +225,14 @@ export class AppComponent implements OnInit {
subMenu: [ subMenu: [
{ {
position: MenuPosition.LEFT, position: MenuPosition.LEFT,
hover: `You are logged as: <b>${this.sessionService.getLogin()}</b>`, hover: "true", //`You are logged as: <b>${this.sessionService.getLogin()}</b>`,
title: `Sign in as ${this.sessionService.getLogin()}`, title: "true", //`Sign in as ${this.sessionService.getLogin()}`,
}, { }, {
position: MenuPosition.LEFT, position: MenuPosition.LEFT,
icon: "add_circle", icon: "add_circle",
title: "Add media", title: "Add media",
navigateTo: "upload", navigateTo: "upload",
enable: this.sessionService.hasRight(UserRoles222.admin), enable: true, //this.sessionService.hasRight(UserRoles222.admin),
}, { }, {
position: MenuPosition.LEFT, position: MenuPosition.LEFT,
icon: "settings", icon: "settings",
@ -269,6 +284,7 @@ export class AppComponent implements OnInit {
} }
getSegmentDisplayable(): string { getSegmentDisplayable(): string {
/*
let segment = this.arianeService.getCurrrentSegment(); let segment = this.arianeService.getCurrrentSegment();
if (segment === "artist") { if (segment === "artist") {
return "Artists" return "Artists"
@ -285,6 +301,7 @@ export class AppComponent implements OnInit {
if (segment === "playlist") { if (segment === "playlist") {
return "Playlistq" return "Playlistq"
} }
*/
return ""; return "";
} }
} }

View File

@ -23,7 +23,7 @@ import {
import { GenderService, DataService, PlaylistService, ArtistService, AlbumService, TrackService, ArianeService, PlayerService } from './service'; import { GenderService, DataService, PlaylistService, ArtistService, AlbumService, TrackService, ArianeService, PlayerService } from './service';
import { UploadScene } from './scene/upload/upload'; import { UploadScene } from './scene/upload/upload';
import { ElementSeriesComponent, ElementTrackComponent, ElementSeasonComponent, ElementVideoComponent, ElementPlayerAudioComponent, DescriptionAreaComponent } from './component'; import { ElementSeriesComponent, ElementTrackComponent, ElementSeasonComponent, ElementVideoComponent, ElementPlayerAudioComponent, DescriptionAreaComponent } from './component';
import { ALL_COMPONENTS, ALL_SCENES, ALL_SERVICES, ALL_GUARDS, KarCWModule, UserService } from '@kangaroo-and-rabbit/kar-cw'; import { ALL_COMPONENTS, ALL_SCENES, ALL_SERVICES, ALL_GUARDS, KarCWModule, UserService, TopMenuComponent } from '@kangaroo-and-rabbit/kar-cw';
import { KarusicEnvironmentService, environment } from 'environments/environment'; import { KarusicEnvironmentService, environment } from 'environments/environment';
import { FormsModule, ReactiveFormsModule } from "@angular/forms"; import { FormsModule, ReactiveFormsModule } from "@angular/forms";
@ -61,7 +61,6 @@ import { CommonModule } from "@angular/common";
//...ALL_SCENES, //...ALL_SCENES,
], ],
imports: [ imports: [
KarCWModule,
FormsModule, FormsModule,
ReactiveFormsModule, ReactiveFormsModule,
CommonModule, CommonModule,
@ -70,9 +69,10 @@ import { CommonModule } from "@angular/common";
RouterModule, RouterModule,
AppRoutingModule, AppRoutingModule,
HttpClientModule, HttpClientModule,
KarCWModule,
], ],
providers: [ providers: [
KarusicEnvironmentService, /*KarusicEnvironmentService,
{ provide: 'ENVIRONMENT', useValue: KarusicEnvironmentService }, { provide: 'ENVIRONMENT', useValue: KarusicEnvironmentService },
//...ALL_SERVICES, //...ALL_SERVICES,
//...ALL_GUARDS, //...ALL_GUARDS,
@ -84,6 +84,7 @@ import { CommonModule } from "@angular/common";
AlbumService, AlbumService,
TrackService, TrackService,
ArianeService, ArianeService,
*/
], ],
exports: [ exports: [
//...ALL_COMPONENTS, //...ALL_COMPONENTS,