Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions public/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
"Add Meter Readings to": "Add Meter Readings to",
"Add Shared Properties": "Add Shared Properties",
"Add Shared Tax Lots": "Add Shared Tax Lots",
"Add User": "Add User",
"Add User to Organization": "Add User to Organization",
"Add a Document": "Add a Document",
"Add a label": "Add a label",
"Add another file": "Add another file",
Expand Down Expand Up @@ -336,11 +338,13 @@
"Create Group": "Create Group",
"Create Meter": "Create Meter",
"Create New Sub-Organization": "Create New Sub-Organization",
"Create Organization": "Create Organization",
"Create Profile": "Create Profile",
"Create Project": "Create Project",
"Create Service for System": "Create Service for System",
"Create System": "Create System",
"Create UBID": "Create UBID",
"Create User": "Create User",
"Create Your Account": "Create Your Account",
"Create a Custom Report to get started!": "Create a Custom Report to get started!",
"Create a New Data Set.": "Create a New Data Set.",
Expand Down Expand Up @@ -971,6 +975,7 @@
"No matching instances": "No matching instances",
"No program created": "No program created",
"No program selected": "No program selected",
"No users found in this organization": "No users found in this organization",
"No warnings\/errors": "No warnings\/errors",
"None": "None",
"Not Compliant": "Not Compliant",
Expand Down Expand Up @@ -1001,6 +1006,7 @@
"Or Create New (With User as Head):": "Or Create New (With User as Head):",
"Organization": "Organization",
"Organization Name": "Organization Name",
"Organization Name required": "Organization Name required",
"Organization Name:": "Organization Name:",
"Organization Owner(s)": "Organization Owner(s)",
"Organization Settings": "Organization Settings",
Expand Down Expand Up @@ -1166,6 +1172,7 @@
"Remove Service for System": "Remove Service for System",
"Remove System": "Remove System",
"Remove User": "Remove User",
"Remove User from Organizatio": "Remove User from Organizatio",
"Remove buildings from project": "Remove buildings from project",
"Remove inventory and organizations": "Remove inventory and organizations",
"Removing buildings from project": "Removing buildings from project",
Expand Down Expand Up @@ -1198,6 +1205,7 @@
"Review matches": "Review matches",
"Right Axis": "Right Axis",
"Right Half": "Right Half",
"Role": "Role",
"Role:": "Role:",
"Row 1": "Row 1",
"Row 2": "Row 2",
Expand Down Expand Up @@ -1591,8 +1599,10 @@
"User Last Name:": "User Last Name:",
"User's email address. Used for auth as well.": "User's email address. Used for auth as well.",
"Username": "Username",
"Users": "Users",
"Using your current browser will prevent you from accessing features on our website. Use the links below to download a new browser or upgrade your existing browser.": "Using your current browser will prevent you from accessing features on our website. Use the links below to download a new browser or upgrade your existing browser.",
"Valid": "Valid",
"Valid email required": "Valid email required",
"Version": "Version",
"View Compliance Tracking": "View Compliance Tracking",
"View Project": "View Project",
Expand Down
10 changes: 10 additions & 0 deletions public/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
"Add Meter Readings to": "Agregar lecturas del medidor a",
"Add Shared Properties": "Añadir propiedades compartidas",
"Add Shared Tax Lots": "Añadir lotes fiscales compartidos",
"Add User": "Agregar usuario",
"Add User to Organization": "Agregar usuario a la organización",
"Add a Document": "Añadir un documento",
"Add a label": "Añadir una etiqueta",
"Add another file": "Añadir otro archivo",
Expand Down Expand Up @@ -336,11 +338,13 @@
"Create Group": "Crear grupo",
"Create Meter": "Crear medidor",
"Create New Sub-Organization": "Crear nueva suborganización",
"Create Organization": "Crear organización",
"Create Profile": "Crear perfil",
"Create Project": "Crear proyecto",
"Create Service for System": "Crear servicio para el sistema",
"Create System": "Crear sistema",
"Create UBID": "Crear UBID",
"Create User": "Crear usuario",
"Create Your Account": "Cree su cuenta",
"Create a Custom Report to get started!": "Cree un informe personalizado para empezar",
"Create a New Data Set.": "Crear un nuevo conjunto de datos.",
Expand Down Expand Up @@ -971,6 +975,7 @@
"No matching instances": "No hay instancias coincidentes",
"No program created": "No se ha creado ningún programa",
"No program selected": "Ningún programa seleccionado",
"No users found in this organization": "No se encontraron usuarios en esta organización.",
"No warnings\/errors": "Sin advertencias\/errores",
"None": "Ninguno",
"Not Compliant": "No conforme",
Expand Down Expand Up @@ -1001,6 +1006,7 @@
"Or Create New (With User as Head):": "O Crear Nuevo (Con Usuario como Cabecera):",
"Organization": "Organización",
"Organization Name": "Nombre de la organización",
"Organization Name required": "Se requiere el nombre de la organización.",
"Organization Name:": "Nombre de la organización:",
"Organization Owner(s)": "Organización Propietario(s)",
"Organization Settings": "Configuración de la organización",
Expand Down Expand Up @@ -1166,6 +1172,7 @@
"Remove Service for System": "Quitar servicio del sistema",
"Remove System": "Quitar sistema",
"Remove User": "Eliminar usuario",
"Remove User from Organizatio": "Eliminar usuario de la organización",
"Remove buildings from project": "Retirar edificios del proyecto",
"Remove inventory and organizations": "Eliminar inventario y organizaciones",
"Removing buildings from project": "Retirada de edificios del proyecto",
Expand Down Expand Up @@ -1198,6 +1205,7 @@
"Review matches": "Partidos de revisión",
"Right Axis": "Eje derecho",
"Right Half": "Mitad derecha",
"Role": "Role",
"Role:": "Papel:",
"Row 1": "Fila 1",
"Row 2": "Fila 2",
Expand Down Expand Up @@ -1591,8 +1599,10 @@
"User Last Name:": "Apellido del usuario:",
"User's email address. Used for auth as well.": "Dirección de correo electrónico del usuario. También se utiliza para la autenticación.",
"Username": "Nombre de usuario",
"Users": "Usuarios",
"Using your current browser will prevent you from accessing features on our website. Use the links below to download a new browser or upgrade your existing browser.": "El uso de su navegador actual le impedirá acceder a las funciones de nuestro sitio web. Utilice los enlaces siguientes para descargar un nuevo navegador o actualizar el que ya tiene.",
"Valid": "Válido",
"Valid email required": "Se requiere un correo electrónico válido.",
"Version": "Versión",
"View Compliance Tracking": "Ver el seguimiento del cumplimiento",
"View Project": "Ver proyecto",
Expand Down
10 changes: 10 additions & 0 deletions public/i18n/fr_CA.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
"Add Meter Readings to": "Ajouter des relevés de compteur à",
"Add Shared Properties": "Ajouter des propriétés partagées",
"Add Shared Tax Lots": "Ajouter des lots d'impôt partagés",
"Add User": "Ajouter un utilisateur",
"Add User to Organization": "Ajouter l'utilisateur à l'organisation",
"Add a Document": "Ajouter un document",
"Add a label": "Ajouter une étiquette",
"Add another file": "Ajouter un autre fichier",
Expand Down Expand Up @@ -336,11 +338,13 @@
"Create Group": "Créer un groupe",
"Create Meter": "Créer un compteur",
"Create New Sub-Organization": "Créer nouvelle sous-organisation",
"Create Organization": "Créer une organisation",
"Create Profile": "Créer un profil",
"Create Project": "Créer un projet",
"Create Service for System": "Créer un service pour le système",
"Create System": "Créer un système",
"Create UBID": "Créer un UBID",
"Create User": "Créer un utilisateur",
"Create Your Account": "Créez votre compte",
"Create a Custom Report to get started!": "Créez un rapport personnalisé pour commencer !",
"Create a New Data Set.": "Créer un nouveau jeu de données.",
Expand Down Expand Up @@ -971,6 +975,7 @@
"No matching instances": "Aucune instance correspondante",
"No program created": "Aucun programme créé",
"No program selected": "Aucun programme sélectionné",
"No users found in this organization": "Aucun utilisateur trouvé dans cette organisation",
"No warnings\/errors": "Aucun avertissement\/erreur",
"None": "Aucun",
"Not Compliant": "Non conforme",
Expand Down Expand Up @@ -1001,6 +1006,7 @@
"Or Create New (With User as Head):": "Ou Créer Nouveau (avec l'utilisateur en tant que chef):",
"Organization": "Organisation",
"Organization Name": "Nom de l'organisation",
"Organization Name required": "Nom de l'organisation requis",
"Organization Name:": "Nom de l'organisation:",
"Organization Owner(s)": "Propriétaire(s) de l'organisation",
"Organization Settings": "Paramètres de l'organisation",
Expand Down Expand Up @@ -1166,6 +1172,7 @@
"Remove Service for System": "Supprimer le service pour le système",
"Remove System": "Supprimer le système",
"Remove User": "Supprimer l'utilisateur",
"Remove User from Organizatio": "Supprimer l'utilisateur de l'organisation",
"Remove buildings from project": "Supprimer les bâtiments du projet",
"Remove inventory and organizations": "Supprimer l'inventaire et les organisations",
"Removing buildings from project": "Retrait des bâtiments du projet",
Expand Down Expand Up @@ -1198,6 +1205,7 @@
"Review matches": "Examiner les correspondences",
"Right Axis": "Axe droit",
"Right Half": "Moitié droite",
"Role": "Rôle",
"Role:": "Rôle:",
"Row 1": "Rangée 1",
"Row 2": "Rangée 2",
Expand Down Expand Up @@ -1591,8 +1599,10 @@
"User Last Name:": "Nom de famille de l'utilisateur:",
"User's email address. Used for auth as well.": "Adresse e-mail de l'utilisateur. Utilisé également pour auth.",
"Username": "Nom d'utilisateur",
"Users": "Utilisateurs",
"Using your current browser will prevent you from accessing features on our website. Use the links below to download a new browser or upgrade your existing browser.": "L'utilisation de votre navigateur actuel vous empêchera d'accéder aux fonctionnalités de notre site Web. Utilisez les liens ci-dessous pour télécharger un nouveau navigateur ou mettre à niveau votre navigateur existant.",
"Valid": "Valide",
"Valid email required": "Adresse e-mail valide requise",
"Version": "Version",
"View Compliance Tracking": "Afficher le suivi de la conformité",
"View Project": "Voir le projet",
Expand Down
11 changes: 10 additions & 1 deletion src/@seed/api/column/column.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { catchError, map, ReplaySubject } from 'rxjs'
import type { ProgressResponse } from '@seed/api'
import { ErrorService } from '@seed/services/error/error.service'
import { UserService } from '../user'
import type { Column, ColumnsResponse } from './column.types'
import type { Column, ColumnsResponse, RenameColumnResponse } from './column.types'

@Injectable({ providedIn: 'root' })
export class ColumnService {
Expand Down Expand Up @@ -86,4 +86,13 @@ export class ColumnService {
}),
)
}

renameColumn(orgId: number, columnId: number, newColumnName: string, overwrite: boolean): Observable<RenameColumnResponse> {
const url = `/api/v3/columns/${columnId}/rename/`
return this._httpClient.post<RenameColumnResponse>(url, { organization_id: orgId, new_column_name: newColumnName, overwrite }).pipe(
catchError((error: HttpErrorResponse) => {
return this._errorService.handleError(error, 'Error renaming column')
}),
)
}
}
5 changes: 5 additions & 0 deletions src/@seed/api/column/column.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ export type ColumnsResponse = {
columns: Column[];
}

export type RenameColumnResponse = {
success: boolean;
message: string;
}

export type GenericColumn = {
[key: string]: unknown;
display_name: string;
Expand Down
53 changes: 52 additions & 1 deletion src/@seed/api/organization/organization.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ import type {
AccessLevelsByDepth,
AccessLevelTree,
AccessLevelTreeResponse,
AddUserToOrgResponse,
AdminOrganization,
AdminOrganizationsResponse,
BriefOrganization,
CanDeleteInstanceResponse,
CreateAccessLevelInstanceRequest,
CreateOrganizationResponse,
EditAccessLevelInstanceRequest,
EditAccessLevelInstanceResponse,
FilterByViewsResponse,
Expand Down Expand Up @@ -312,13 +316,60 @@ export class OrganizationService {
switchMap((org: Organization) => this._inventoryService.getView(org.org_id, viewId, type).pipe(map((view) => ({ org, view })))),
map(({ org, view }: { org: Organization; view: ViewResponse }) => {
const displayFieldKey = type === 'taxlots' ? org.taxlot_display_field : org.property_display_field
const displayField = view.state[displayFieldKey] as string
// Check top-level state first, then extra_data (for extra data columns like "Nick Name")
const displayField = (view.state[displayFieldKey] ?? view.state.extra_data?.[displayFieldKey]) as string
const defaultName = type === 'taxlots' ? `Tax Lot ${view.taxlot.id}` : `Property ${view.property.id}`
return displayField || defaultName
}),
)
}

getAllOrganizations(): Observable<AdminOrganization[]> {
const url = '/api/v3/organizations/'
return this._httpClient.get<AdminOrganizationsResponse>(url).pipe(
map(({ organizations }) => organizations.toSorted((a, b) => naturalSort(a.name, b.name))),
catchError((error: HttpErrorResponse) => {
return this._errorService.handleError(error, 'Error fetching all organizations')
}),
)
}

createOrganization(userId: number, organizationName: string): Observable<CreateOrganizationResponse> {
const url = '/api/v3/organizations/'
return this._httpClient.post<CreateOrganizationResponse>(url, { user_id: userId, organization_name: organizationName }).pipe(
catchError((error: HttpErrorResponse) => {
return this._errorService.handleError(error, 'Error creating organization')
}),
)
}

deleteOrganization(orgId: number): Observable<unknown> {
const url = `/api/v3/organizations/${orgId}/`
return this._httpClient.delete(url).pipe(
catchError((error: HttpErrorResponse) => {
return this._errorService.handleError(error, 'Error deleting organization')
}),
)
}

deleteOrganizationInventory(orgId: number): Observable<ProgressResponse> {
const url = `/api/v3/organizations/${orgId}/inventory/`
return this._httpClient.delete<ProgressResponse>(url).pipe(
catchError((error: HttpErrorResponse) => {
return this._errorService.handleError(error, 'Error deleting organization inventory')
}),
)
}

addUserToOrganization(orgId: number, userId: number): Observable<AddUserToOrgResponse> {
const url = `/api/v3/organizations/${orgId}/users/${userId}/add/`
return this._httpClient.put<AddUserToOrgResponse>(url, {}).pipe(
catchError((error: HttpErrorResponse) => {
return this._errorService.handleError(error, 'Error adding user to organization')
}),
)
}

private _sortAccessLevelInstances(tree: AccessLevelInstance[]): AccessLevelInstance[] {
return tree
.map((instance) => ({
Expand Down
23 changes: 23 additions & 0 deletions src/@seed/api/organization/organization.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,26 @@ export type FilterByViewsResponse = {
access_level_instance_ids: number[];
status: string;
}

export type AdminOrganization = {
id: number;
name: string;
created: string;
number_of_users: number;
user_count?: number;
property_count?: number;
taxlot_count?: number;
}

export type AdminOrganizationsResponse = {
organizations: AdminOrganization[];
}

export type CreateOrganizationResponse = {
status: string;
organization: AdminOrganization;
}

export type AddUserToOrgResponse = {
status: string;
}
13 changes: 13 additions & 0 deletions src/@seed/api/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type {
SetDefaultOrganizationResponse,
UserAuth,
UserAuthResponse,
UserBrief,
UserUpdateRequest,
} from '@seed/api'
import { ErrorService } from '@seed/services'
Expand Down Expand Up @@ -166,6 +167,18 @@ export class UserService {
)
}

/**
* Get all users (superuser endpoint)
*/
getAllUsers(): Observable<UserBrief[]> {
return this._httpClient.get<{ users: UserBrief[] }>('/api/v3/users/').pipe(
map((response) => response.users),
catchError((error: HttpErrorResponse) => {
return this._errorService.handleError(error, 'Error fetching all users')
}),
)
}

// applies defaults to an org users settings
checkUserSettings(userSettings: OrganizationUserSettings) {
userSettings ??= {}
Expand Down
5 changes: 5 additions & 0 deletions src/@seed/api/user/user.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ export type CurrentUser = {
settings: OrganizationUserSettings;
}

export type UserBrief = {
user_id: number;
email: string;
}

export type UserUpdateRequest = {
first_name: string;
last_name: string;
Expand Down
2 changes: 1 addition & 1 deletion src/@seed/components/page/page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<div class="flex">
<h2 class="truncate text-3xl font-bold capitalize leading-7 tracking-tight sm:leading-10 md:text-4xl">
@if (config.titleIcon) {
<mat-icon class="text-primary-900 icon-size-6" [svgIcon]="config.titleIcon"></mat-icon>
<mat-icon class="text-primary-900 icon-size-6 dark:text-primary-300" [svgIcon]="config.titleIcon"></mat-icon>
}
{{ t(config.title) }}
@if (config.subTitle) {
Expand Down
6 changes: 6 additions & 0 deletions src/app/modules/datasets/dataset/dataset.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
subTitle: datasetName$ | async,
titleIcon: 'fa-solid:sitemap',
breadcrumbs: ['Dataset', 'Detail'],
action: addDataFile,
actionIcon: 'fa-solid:plus',
actionText: 'Data File',
action2: addMeterData,
action2Icon: 'fa-solid:plus',
action2Text: 'Meter Data',
}"
>
<div class="h-full-page-tabs p-5" id="content">
Expand Down
Loading
Loading