mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-18 05:52:51 +00:00
* return error from changes * project member context, org-policies, state * project type seperation * chore(deps): bump grpc from 1.24.2 to 1.24.3 in /console (#183) Bumps [grpc](https://github.com/grpc/grpc-node) from 1.24.2 to 1.24.3. - [Release notes](https://github.com/grpc/grpc-node/releases) - [Commits](https://github.com/grpc/grpc-node/compare/[email protected]@1.24.3) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump google-proto-files from 1.1.2 to 2.1.0 in /console (#176) Bumps [google-proto-files](https://github.com/googleapis/nodejs-proto-files) from 1.1.2 to 2.1.0. - [Release notes](https://github.com/googleapis/nodejs-proto-files/releases) - [Changelog](https://github.com/googleapis/nodejs-proto-files/blob/master/CHANGELOG.md) - [Commits](https://github.com/googleapis/nodejs-proto-files/compare/v1.1.2...v2.1.0) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump karma-coverage-istanbul-reporter in /console (#169) Bumps [karma-coverage-istanbul-reporter](https://github.com/mattlewis92/karma-coverage-istanbul-reporter) from 3.0.2 to 3.0.3. - [Release notes](https://github.com/mattlewis92/karma-coverage-istanbul-reporter/releases) - [Changelog](https://github.com/mattlewis92/karma-coverage-istanbul-reporter/blob/master/CHANGELOG.md) - [Commits](https://github.com/mattlewis92/karma-coverage-istanbul-reporter/compare/v3.0.2...v3.0.3) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * update packages * update deps * lint * replace assets * add key, creationdate for roles * project grant members Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
95 lines
3.5 KiB
TypeScript
95 lines
3.5 KiB
TypeScript
import { animate, animateChild, query, stagger, style, transition, trigger } from '@angular/animations';
|
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
import { Router } from '@angular/router';
|
|
import { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
|
|
import { GrantedProject, Project, ProjectState } from 'src/app/proto/generated/management_pb';
|
|
import { ProjectService } from 'src/app/services/project.service';
|
|
import { ToastService } from 'src/app/services/toast.service';
|
|
|
|
@Component({
|
|
selector: 'app-project-grid',
|
|
templateUrl: './project-grid.component.html',
|
|
styleUrls: ['./project-grid.component.scss'],
|
|
animations: [
|
|
trigger('list', [
|
|
transition(':enter', [
|
|
query('@animate',
|
|
stagger(100, animateChild()),
|
|
),
|
|
]),
|
|
]),
|
|
trigger('animate', [
|
|
transition(':enter', [
|
|
style({ opacity: 0, transform: 'translateY(-100%)' }),
|
|
animate('100ms', style({ opacity: 1, transform: 'translateY(0)' })),
|
|
]),
|
|
transition(':leave', [
|
|
style({ opacity: 1, transform: 'translateY(0)' }),
|
|
animate('100ms', style({ opacity: 0, transform: 'translateY(100%)' })),
|
|
]),
|
|
]),
|
|
],
|
|
})
|
|
export class ProjectGridComponent {
|
|
@Input() items: Array<GrantedProject.AsObject> = [];
|
|
@Output() newClicked: EventEmitter<boolean> = new EventEmitter();
|
|
@Output() changedView: EventEmitter<boolean> = new EventEmitter();
|
|
@Input() loading: boolean = false;
|
|
|
|
public selection: SelectionModel<GrantedProject.AsObject> = new SelectionModel<GrantedProject.AsObject>(true, []);
|
|
public selectedIndex: number = -1;
|
|
|
|
public showNewProject: boolean = false;
|
|
public ProjectState: any = ProjectState;
|
|
|
|
constructor(private router: Router, private projectService: ProjectService, private toast: ToastService) { }
|
|
|
|
public selectItem(item: GrantedProject.AsObject, event?: any): void {
|
|
if (event && !event.target.classList.contains('mat-icon')) {
|
|
if (item.grantId) {
|
|
this.router.navigate([item.id, '/grant', `${item.grantId}`]);
|
|
} else {
|
|
this.router.navigate(['/projects', item.id]);
|
|
}
|
|
} else if (!event) {
|
|
if (item.grantId) {
|
|
this.router.navigate([item.id, '/grant', `${item.grantId}`]);
|
|
} else {
|
|
this.router.navigate(['/projects', item.id]);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
public addItem(): void {
|
|
this.newClicked.emit(true);
|
|
}
|
|
|
|
public dateFromTimestamp(date: Timestamp.AsObject): any {
|
|
const ts: Date = new Date(date.seconds * 1000 + date.nanos / 1000);
|
|
return ts;
|
|
}
|
|
|
|
public reactivateProjects(selected: Project.AsObject[]): void {
|
|
Promise.all([selected.map(proj => {
|
|
return this.projectService.ReactivateProject(proj.id);
|
|
})]).then(() => {
|
|
this.toast.showInfo('Successful reactivated all projects');
|
|
}).catch(error => {
|
|
this.toast.showError(error.message);
|
|
});
|
|
}
|
|
|
|
public deactivateProjects(selected: Project.AsObject[]): void {
|
|
Promise.all([selected.map(proj => {
|
|
return this.projectService.DeactivateProject(proj.id);
|
|
})]).then(() => {
|
|
this.toast.showInfo('Successful deactivated all projects');
|
|
}).catch(error => {
|
|
this.toast.showError(error.message);
|
|
});
|
|
}
|
|
}
|