[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",
"version": 1,
"newProjectRoot": "projects",
"defaultProject": "karusic",
"projects": {
"karusic": {
"root": "",
@ -53,33 +52,38 @@
"develop": {
"optimization": false,
"outputHashing": "none",
"sourceMap": true,
"namedChunks": true,
"aot": false,
"extractLicenses": true,
"vendorChunk": true,
"buildOptimizer": false
"buildOptimizer": false,
"sourceMap": {
"scripts": true,
"styles": true,
"hidden": false,
"vendor": true
}
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "karusic:build"
"buildTarget": "karusic:build"
},
"configurations": {
"production": {
"browserTarget": "karusic:build:production"
"buildTarget": "karusic:build:production"
},
"develop": {
"browserTarget": "karusic:build:develop"
"buildTarget": "karusic:build:develop"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "karusic:build"
"buildTarget": "karusic:build"
}
},
"test": {

View File

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

View File

@ -21,7 +21,7 @@ import { ForbiddenScene, OnlyUsersGuardHome, HomeOutScene, OnlyUnregisteredGuard
const routes: Routes = [
{ path: '', redirectTo: '/home', pathMatch: 'full' },
{ path: 'forbidden', component: ForbiddenScene },
//{ path: 'forbidden', component: ForbiddenScene },
// ------------------------------------
// -- home global interface
@ -29,8 +29,9 @@ const routes: Routes = [
{
path: 'home',
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',
component: HomeOutScene,
@ -165,7 +166,7 @@ const routes: Routes = [
path: '**',
component: NotFound404Scene,
},
*/
];
@NgModule({

View File

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

View File

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

View File

@ -23,7 +23,7 @@ import {
import { GenderService, DataService, PlaylistService, ArtistService, AlbumService, TrackService, ArianeService, PlayerService } from './service';
import { UploadScene } from './scene/upload/upload';
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 { FormsModule, ReactiveFormsModule } from "@angular/forms";
@ -61,7 +61,6 @@ import { CommonModule } from "@angular/common";
//...ALL_SCENES,
],
imports: [
KarCWModule,
FormsModule,
ReactiveFormsModule,
CommonModule,
@ -70,9 +69,10 @@ import { CommonModule } from "@angular/common";
RouterModule,
AppRoutingModule,
HttpClientModule,
KarCWModule,
],
providers: [
KarusicEnvironmentService,
/*KarusicEnvironmentService,
{ provide: 'ENVIRONMENT', useValue: KarusicEnvironmentService },
//...ALL_SERVICES,
//...ALL_GUARDS,
@ -84,6 +84,7 @@ import { CommonModule } from "@angular/common";
AlbumService,
TrackService,
ArianeService,
*/
],
exports: [
//...ALL_COMPONENTS,