From 20f3b50c73d24c6f7449a7e6150722772393148d Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Thu, 5 Nov 2020 22:49:33 +0100 Subject: [PATCH] Adding tooltip --- .../src/main/archiva-web/angular.json | 1 + .../src/main/archiva-web/package-lock.json | 5 +++ .../src/main/archiva-web/package.json | 1 + .../archiva-web/src/app/app-routing.module.ts | 4 +- .../main/archiva-web/src/app/app.module.ts | 2 + .../enable-tooltip.directive.spec.ts | 26 +++++++++++++ .../directives/enable-tooltip.directive.ts | 33 ++++++++++++++++ .../general/sidemenu/sidemenu.component.html | 34 ++++++++--------- .../manage-users/manage-users.component.html | 4 +- .../manage-users-list.component.html | 38 ++++++++++++++++++- .../manage-users-list.component.ts | 16 +++++++- .../main/archiva-web/src/assets/i18n/en.json | 25 ++++++++++++ 12 files changed, 165 insertions(+), 24 deletions(-) create mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/directives/enable-tooltip.directive.spec.ts create mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/directives/enable-tooltip.directive.ts diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/angular.json b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/angular.json index 9ed3ad02b..f9631de49 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/angular.json +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/angular.json @@ -37,6 +37,7 @@ ], "scripts": [ "node_modules/jquery/dist/jquery.js", + "node_modules/popper.js/dist/umd/popper.min.js", "node_modules/bootstrap/dist/js/bootstrap.js", "src/assets/params/js/index.js" ] diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/package-lock.json b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/package-lock.json index d78c09227..5ca161b53 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/package-lock.json +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/package-lock.json @@ -8996,6 +8996,11 @@ "ts-pnp": "^1.1.6" } }, + "popper.js": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1.tgz", + "integrity": "sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ==" + }, "portfinder": { "version": "1.0.28", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz", diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/package.json b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/package.json index c040d42c8..060bd9903 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/package.json +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/package.json @@ -26,6 +26,7 @@ "bootstrap": "^4.5.0", "flag-icon-css": "^3.5.0", "jquery": "^3.5.1", + "popper.js": "^1.16.1", "rxjs": "~6.6.3", "service": "^0.1.4", "tslib": "^2.0.0", diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app-routing.module.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app-routing.module.ts index 1f65d4bfc..9f1249e7b 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app-routing.module.ts +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app-routing.module.ts @@ -46,12 +46,12 @@ const routes: Routes = [ { path: 'users', component: ManageUsersComponent, children: [ {path: 'list', component: ManageUsersListComponent}, - {path: 'add', component: ManageUsersAddComponent} + {path: 'add', component: ManageUsersAddComponent}, + {path: '', redirectTo:'list', pathMatch:'full'} ] }, { path: 'roles', component: ManageRolesComponent }, { path: 'config', component: SecurityConfigurationComponent}, - { path: '', component: ManageUsersComponent } ] }, { path: 'contact', component: ContactComponent }, diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app.module.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app.module.ts index 81f252395..1fe0382d4 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app.module.ts +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app.module.ts @@ -41,6 +41,7 @@ import { ManageRolesComponent } from './modules/user/manage-roles/manage-roles.c import { SecurityConfigurationComponent } from './modules/user/security-configuration/security-configuration.component'; import { ManageUsersListComponent } from './modules/user/users/manage-users-list/manage-users-list.component'; import { ManageUsersAddComponent } from './modules/user/users/manage-users-add/manage-users-add.component'; +import { EnableTooltipDirective } from './directives/enable-tooltip.directive'; @NgModule({ @@ -62,6 +63,7 @@ import { ManageUsersAddComponent } from './modules/user/users/manage-users-add/m SecurityConfigurationComponent, ManageUsersListComponent, ManageUsersAddComponent, + EnableTooltipDirective, ], diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/directives/enable-tooltip.directive.spec.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/directives/enable-tooltip.directive.spec.ts new file mode 100644 index 000000000..916f2767c --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/directives/enable-tooltip.directive.spec.ts @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { EnableTooltipDirective } from './enable-tooltip.directive'; + +describe('EnableTooltipDirective', () => { + it('should create an instance', () => { + const directive = new EnableTooltipDirective(); + expect(directive).toBeTruthy(); + }); +}); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/directives/enable-tooltip.directive.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/directives/enable-tooltip.directive.ts new file mode 100644 index 000000000..099001cc9 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/directives/enable-tooltip.directive.ts @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import {AfterViewChecked, AfterViewInit, Directive, ElementRef, OnInit} from '@angular/core'; + +declare var jQuery:any; +@Directive({ + selector: '[appEnableTooltip]' +}) +export class EnableTooltipDirective implements AfterViewInit { + + + constructor() { } + + ngAfterViewInit(): void { + jQuery('[data-toggle="tooltip"]').tooltip({container: 'body', html: true}); + } +} diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/general/sidemenu/sidemenu.component.html b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/general/sidemenu/sidemenu.component.html index e7ba3775b..c312cfc38 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/general/sidemenu/sidemenu.component.html +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/general/sidemenu/sidemenu.component.html @@ -18,7 +18,7 @@ --> diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/manage-users/manage-users.component.html b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/manage-users/manage-users.component.html index 405ac1096..c61718009 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/manage-users/manage-users.component.html +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/manage-users/manage-users.component.html @@ -19,10 +19,10 @@ diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/users/manage-users-list/manage-users-list.component.html b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/users/manage-users-list/manage-users-list.component.html index d04453d99..2f367636a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/users/manage-users-list/manage-users-list.component.html +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/users/manage-users-list/manage-users-list.component.html @@ -17,4 +17,40 @@ ~ under the License. --> -

manage-users-list works!

+
+
+
+ + +
+
+ +
+
+ + +
+ + + + + + + + + + + + + + + + + +
{{'users.list.table.head.id' | translate}}{{'users.list.table.head.user_id' | translate}}{{'users.list.table.head.fullName' | translate}}{{'users.list.table.head.email' | translate}} + + {{'users.list.table.head.lastLogin' | translate}}{{'users.list.table.head.created' | translate}}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/users/manage-users-list/manage-users-list.component.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/users/manage-users-list/manage-users-list.component.ts index 43f922dbd..22625a7b1 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/users/manage-users-list/manage-users-list.component.ts +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/users/manage-users-list/manage-users-list.component.ts @@ -17,7 +17,10 @@ * under the License. */ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, Input } from '@angular/core'; +import {TranslateService} from "@ngx-translate/core"; +import {AppComponent} from "../../../../app.component"; +import {UserService} from "../../../../services/user.service"; @Component({ selector: 'app-manage-users-list', @@ -25,10 +28,19 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./manage-users-list.component.scss'] }) export class ManageUsersListComponent implements OnInit { + @Input() heads: any; - constructor() { } + constructor(private translator: TranslateService, private userService : UserService) { } ngOnInit(): void { + this.heads={}; + // We need to wait for the translator initialization and use the init key as step in. + this.translator.get('init').subscribe( () => { + // Only table headings for small columns that use icons + for (let suffix of ['validated', 'locked', 'pwchange']) { + this.heads[suffix] = this.translator.instant('users.list.table.head.' + suffix); + } + }); } } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/assets/i18n/en.json b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/assets/i18n/en.json index 16ebb2d62..d43bd2a92 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/assets/i18n/en.json +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/assets/i18n/en.json @@ -1,4 +1,5 @@ { + "init": "Initalize", "login": { "title": "Login to Archiva", "password": "Password", @@ -47,5 +48,29 @@ }, "api" : { "rb.auth.invalid_credentials": "Invalid credentials given" + }, + "users": { + "list": { + "head": "List Users", + "table":{ + "head": { + "id": "ID", + "user_id": "User Identifier", + "email": "Email", + "fullName": "Name", + "validated": "User Validated", + "locked": "User Locked", + "pwchange": "Password Change Required", + "lastLogin": "Last Login", + "created": "Created" + } + } + }, + "add": { + "head": "Add User" + } + }, + "search": { + "button": "Search" } } \ No newline at end of file