]> source.dussan.org Git - archiva.git/commitdiff
Adding user edit component
authorMartin Stockhammer <martin_s@apache.org>
Wed, 11 Nov 2020 20:01:58 +0000 (21:01 +0100)
committerMartin Stockhammer <martin_s@apache.org>
Wed, 11 Nov 2020 20:01:58 +0000 (21:01 +0100)
archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app-routing.module.ts
archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app.module.ts
archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/users/manage-users-edit/manage-users-edit.component.html [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/users/manage-users-edit/manage-users-edit.component.scss [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/users/manage-users-edit/manage-users-edit.component.spec.ts [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/users/manage-users-edit/manage-users-edit.component.ts [new file with mode: 0644]

index 9f1249e7be6f5e87a80defde789202d9b0bb400e..eed0365a71124b5eedde51b57b7ef6550c36356a 100644 (file)
@@ -32,6 +32,7 @@ import {ManageRolesComponent} from "./modules/user/manage-roles/manage-roles.com
 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 {ManageUsersEditComponent} from "./modules/user/users/manage-users-edit/manage-users-edit.component";
 
 const routes: Routes = [
   { path: '', component: HomeComponent,
@@ -47,6 +48,7 @@ const routes: Routes = [
         children: [
           {path: 'list', component: ManageUsersListComponent},
           {path: 'add', component: ManageUsersAddComponent},
+          {path: 'edit/:userid', component: ManageUsersEditComponent},
           {path: '', redirectTo:'list', pathMatch:'full'}
         ]
       },
index f3ddcc7f98c1ee4937d6b2b31537d508aea23c2b..6b7d2c4bb963fa08ea8cd8e9b6e06cd7db36cd0c 100644 (file)
@@ -45,6 +45,7 @@ import { NgbPaginationModule, NgbTooltipModule} from "@ng-bootstrap/ng-bootstrap
 import { PaginatedEntitiesComponent } from './modules/general/paginated-entities/paginated-entities.component';
 import { SortedTableHeaderComponent } from './modules/general/sorted-table-header/sorted-table-header.component';
 import { SortedTableHeaderRowComponent } from './modules/general/sorted-table-header-row/sorted-table-header-row.component';
+import { ManageUsersEditComponent } from './modules/user/users/manage-users-edit/manage-users-edit.component';
 
 
 @NgModule({
@@ -69,6 +70,7 @@ import { SortedTableHeaderRowComponent } from './modules/general/sorted-table-he
     PaginatedEntitiesComponent,
     SortedTableHeaderComponent,
     SortedTableHeaderRowComponent,
+    ManageUsersEditComponent,
   ],
   imports: [
     BrowserModule,
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/users/manage-users-edit/manage-users-edit.component.html b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/users/manage-users-edit/manage-users-edit.component.html
new file mode 100644 (file)
index 0000000..c70355a
--- /dev/null
@@ -0,0 +1,83 @@
+<!--
+  ~ 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.
+  -->
+
+<form class="mt-3 mb-3" [formGroup]="userForm" (ngSubmit)="onSubmit()">
+    <div class="form-group col-md-8">
+        <label for="user_id">{{'users.attributes.user_id' |translate}}</label>
+        <input type="text" class="form-control" formControlName="user_id" id="user_id"
+               [ngClass]="valid('user_id')"
+               placeholder="{{'users.input.user_id'|translate}}">
+        <small>{{'users.input.small.user_id'|translate:{'minSize':this.minUserIdSize} }}</small>
+    </div>
+    <div class="form-group col-md-8">
+        <label for="full_name">{{'users.attributes.full_name' |translate}}</label>
+        <input type="text" class="form-control" formControlName="full_name" id="full_name"
+               [ngClass]="valid('full_name')"
+               placeholder="{{'users.input.full_name'|translate}}">
+        <small>{{'users.input.small.full_name'|translate}}</small>
+    </div>
+    <div class="form-group col-md-8">
+        <label for="email">{{'users.attributes.email' |translate}}</label>
+        <input type="text" class="form-control" formControlName="email" id="email"
+               [ngClass]="valid('email')"
+               placeholder="{{'users.input.email'|translate}}">
+    </div>
+    <div class="form-group col-md-8">
+        <label for="password">{{'users.attributes.password' |translate}}</label>
+        <input type="password" class="form-control" formControlName="password" id="password"
+               [ngClass]="valid('password')"
+               placeholder="{{'users.input.password'|translate}}">
+    </div>
+    <div class="form-group col-md-8">
+        <label for="confirm_password">{{'users.attributes.confirm_password' |translate}}</label>
+        <input type="password" class="form-control" formControlName="confirm_password" id="confirm_password"
+               [ngClass]="valid('confirm_password')"
+               placeholder="{{'users.input.confirm_password'|translate}}">
+    </div>
+    <div class="form-group col-md-8">
+        <div class="form-check">
+            <input class="form-check-input" type="checkbox" value="" formControlName="locked" id="locked">
+            <label class="form-check-label" for="locked">
+                {{'users.attributes.locked'|translate}}
+            </label>
+        </div>
+        <div class="form-check">
+            <input class="form-check-input" type="checkbox" value="" formControlName="password_change_required"
+                   id="password_change_required" checked>
+            <label class="form-check-label" for="password_change_required">
+                {{'users.attributes.password_change_required'|translate}}
+            </label>
+        </div>
+    </div>
+    <div class="form-group col-md-8">
+        <button class="btn btn-primary" type="submit"
+                [disabled]="!userForm.valid">{{'users.add.submit'|translate}}</button>
+    </div>
+    <div *ngIf="success" class="alert alert-success" role="alert">
+        User <a [routerLink]="['user','users','edit',userid]">{{userid}}</a> was added to the list.
+    </div>
+    <div *ngIf="error" class="alert alert-danger" role="alert" >
+        <h4 class="alert-heading">Errors</h4>
+        <ng-container *ngFor="let message of errorResult?.error_messages; first as isFirst" >
+            <hr *ngIf="!isFirst">
+            <p>{{message.message}}</p>
+        </ng-container>
+    </div>
+
+
+</form>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/users/manage-users-edit/manage-users-edit.component.scss b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/users/manage-users-edit/manage-users-edit.component.scss
new file mode 100644 (file)
index 0000000..343c3b1
--- /dev/null
@@ -0,0 +1,18 @@
+/*!
+ * 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.
+ */
+
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/users/manage-users-edit/manage-users-edit.component.spec.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/users/manage-users-edit/manage-users-edit.component.spec.ts
new file mode 100644 (file)
index 0000000..f21a49f
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * 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 { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ManageUsersEditComponent } from './manage-users-edit.component';
+
+describe('ManageUsersEditComponent', () => {
+  let component: ManageUsersEditComponent;
+  let fixture: ComponentFixture<ManageUsersEditComponent>;
+
+  beforeEach(async () => {
+    await TestBed.configureTestingModule({
+      declarations: [ ManageUsersEditComponent ]
+    })
+    .compileComponents();
+  });
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(ManageUsersEditComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/users/manage-users-edit/manage-users-edit.component.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/user/users/manage-users-edit/manage-users-edit.component.ts
new file mode 100644 (file)
index 0000000..5d55089
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * 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 { Component, OnInit } from '@angular/core';
+import { ActivatedRoute } from '@angular/router';
+
+@Component({
+  selector: 'app-manage-users-edit',
+  templateUrl: './manage-users-edit.component.html',
+  styleUrls: ['./manage-users-edit.component.scss']
+})
+export class ManageUsersEditComponent implements OnInit {
+
+  userid;
+
+  constructor(private route: ActivatedRoute) {
+    this.route.params.subscribe(params => this.userid=params.userid);
+  }
+
+  ngOnInit(): void {
+  }
+
+}