1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-25 12:15:18 +01:00

[SM-45] Scaffold secrets manager module (#2989)

* Scaffold secrets manager module
This commit is contained in:
Oscar Hinton 2022-07-22 11:16:24 +02:00 committed by GitHub
parent d99acd818b
commit 80ee6d23c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 158 additions and 4 deletions

View File

@ -78,12 +78,12 @@ img.logo {
height: 43px;
margin: 0 auto;
width: 284px;
}
&.logo-themed {
img.logo-themed {
@include themify($themes) {
content: url("../images/logo-" + themed("logoSuffix") + "@2x.png");
}
}
}
.page-content {

View File

@ -1,4 +1,10 @@
/* eslint-disable no-undef, @typescript-eslint/no-var-requires */
const config = require("../../libs/components/tailwind.config.base");
config.content = [
"./src/**/*.{html,ts}",
"../../libs/components/src/**/*.{html,ts}",
"../../bitwarden_license/bit-web/src/**/*.{html,ts}",
];
module.exports = config;

View File

@ -8,6 +8,10 @@ const routes: Routes = [
path: "providers",
loadChildren: () => ProvidersModule,
},
{
path: "sm",
loadChildren: async () => (await import("./sm/sm.module")).SecretsManagerModule,
},
];
@NgModule({

View File

@ -0,0 +1,8 @@
<div class="tw-flex tw-w-full">
<aside class="tw-w-60 tw-bg-background tw-min-h-screen">
<router-outlet name="sidebar"></router-outlet>
</aside>
<main class="tw-flex-1 tw-bg-background-alt tw-min-h-screen tw-px-6 tw-pt-3">
<router-outlet></router-outlet>
</main>
</div>

View File

@ -0,0 +1,11 @@
import { Component, OnInit } from "@angular/core";
@Component({
selector: "sm-layout",
templateUrl: "./layout.component.html",
})
export class LayoutComponent implements OnInit {
ngOnInit() {
document.body.classList.remove("layout_frontend");
}
}

View File

@ -0,0 +1,13 @@
<img alt="Bitwarden" class="logo-themed tw-box-border tw-block tw-w-full tw-py-5 tw-px-3" />
<div class="card mb-4 tw-m-2">
<div class="list-group list-group-flush">
<a routerLink="projects" class="list-group-item" routerLinkActive="active"> Projects </a>
<a routerLink="secrets" class="list-group-item" routerLinkActive="active"> Secrets </a>
<a routerLink="serviceAccounts" class="list-group-item" routerLinkActive="active">
Service Accounts
</a>
<a routerLink="trash" class="list-group-item" routerLinkActive="active"> Trash </a>
<a routerLink="settings" class="list-group-item" routerLinkActive="active"> Settings </a>
</div>
</div>

View File

@ -0,0 +1,7 @@
import { Component } from "@angular/core";
@Component({
selector: "sm-navigation",
templateUrl: "./navigation.component.html",
})
export class NavigationComponent {}

View File

@ -0,0 +1,17 @@
import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
import { SecretsComponent } from "./secrets.component";
const routes: Routes = [
{
path: "",
component: SecretsComponent,
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class SecretsRoutingModule {}

View File

@ -0,0 +1 @@
<h1 class="tw-text-3x tw-font-semibold">Secrets</h1>

View File

@ -0,0 +1,7 @@
import { Component } from "@angular/core";
@Component({
selector: "sm-secrets",
templateUrl: "./secrets.component.html",
})
export class SecretsComponent {}

View File

@ -0,0 +1,12 @@
import { CommonModule } from "@angular/common";
import { NgModule } from "@angular/core";
import { SecretsRoutingModule } from "./secrets-routing.module";
import { SecretsComponent } from "./secrets.component";
@NgModule({
imports: [CommonModule, SecretsRoutingModule],
declarations: [SecretsComponent],
providers: [],
})
export class SecretsModule {}

View File

@ -0,0 +1,36 @@
import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
import { LayoutComponent } from "./layout/layout.component";
import { NavigationComponent } from "./layout/navigation.component";
import { SecretsModule } from "./secrets/secrets.module";
import { SMGuard } from "./sm.guard";
const routes: Routes = [
{
path: "",
component: LayoutComponent,
canActivate: [SMGuard],
children: [
{
path: "",
component: NavigationComponent,
outlet: "sidebar",
},
{
path: "secrets",
loadChildren: () => SecretsModule,
},
{
path: "",
redirectTo: "secrets",
},
],
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class SecretsManagerRoutingModule {}

View File

@ -0,0 +1,13 @@
import { Injectable } from "@angular/core";
import { ActivatedRouteSnapshot, CanActivate } from "@angular/router";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
@Injectable()
export class SMGuard implements CanActivate {
constructor(private platformUtilsService: PlatformUtilsService) {}
async canActivate(route: ActivatedRouteSnapshot) {
return this.platformUtilsService.isDev();
}
}

View File

@ -0,0 +1,19 @@
import { CommonModule } from "@angular/common";
import { NgModule } from "@angular/core";
import { FormsModule } from "@angular/forms";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { OssModule } from "src/app/oss.module";
import { LayoutComponent } from "./layout/layout.component";
import { NavigationComponent } from "./layout/navigation.component";
import { SecretsManagerRoutingModule } from "./sm-routing.module";
import { SMGuard } from "./sm.guard";
@NgModule({
imports: [CommonModule, FormsModule, OssModule, JslibModule, SecretsManagerRoutingModule],
declarations: [LayoutComponent, NavigationComponent],
providers: [SMGuard],
})
export class SecretsManagerModule {}