Skip to content
Snippets Groups Projects
Commit 357cbb55 authored by Matthias Feyll's avatar Matthias Feyll :cookie: Committed by matthiasf
Browse files

refactor login to component

parent 4f81552d
No related branches found
No related tags found
2 merge requests!1162Draft: Ui integration,!1128UI: Implement yang model view
Showing
with 23 additions and 27 deletions
import { useAuth } from "@provider/auth.provider"; import { useAuth } from "@provider/auth.provider";
import LoginView from "@view/login/login.view";
import { useEffect } from "react"; import { useEffect } from "react";
import { useNavigate, useOutlet } from "react-router-dom"; import { useNavigate, useOutlet } from "react-router-dom";
import LoginView from "../view/login.view";
export const LoginLayout = ({ children }) => { export const LoginLayout = ({ children }) => {
......
...@@ -3,8 +3,8 @@ import { useTranslation } from 'react-i18next' ...@@ -3,8 +3,8 @@ import { useTranslation } from 'react-i18next'
import './login.scss' import './login.scss'
import logo from '@assets/logo.svg' import logo from '@assets/logo.svg'
import useLoginViewModel from '@viewmodel/login.viewmodel'
import React, { useRef } from 'react' import React, { useRef } from 'react'
import useLoginViewModel from '../viewmodel/login.viewmodel'
const LoginView = ({ children }) => { const LoginView = ({ children }) => {
const { t } = useTranslation('common') const { t } = useTranslation('common')
......
import { NetworkElementServiceGetAllFlattenedApiArg, api } from "@api/api"; import { NetworkElementServiceGetAllFlattenedApiArg, api } from "@api/api";
import { setDevices } from "@reducer/device.reducer/device.reducer"; import { setDevices } from "@reducer/device.reducer/device.reducer";
import { setUser } from "@reducer/user.reducer";
import { createAsyncThunk } from "@reduxjs/toolkit"; import { createAsyncThunk } from "@reduxjs/toolkit";
import { setUser } from "@shared/store/user.reducer";
import { RootState } from "src/stores"; import { RootState } from "src/stores";
import { startListening } from "../../stores/middleware/listener.middleware"; import { startListening } from "../../stores/middleware/listener.middleware";
import { FETCH_DEVICE_ACTION } from "./action.routine"; import { FETCH_DEVICE_ACTION } from "./action.routine";
......
@import '../../../style/colors.scss'; @import '/src/shared/style/colors.scss';
thead { thead {
font-size: 0.9em; font-size: 0.9em;
} }
tr:hover > td { tr:hover > td {
background-color: lighten(map-get($theme-colors, primary), 30%) !important; background-color: lighten(map-get($theme-colors, primary), 30%) !important;
} }
tr:nth-child(2n+1) > td { tr:nth-child(2n + 1) > td {
background-color: lighten(map-get($theme-colors, primary) , 38%) background-color: lighten(map-get($theme-colors, primary), 38%);
} }
.c-box { .c-box {
padding: 2em !important; padding: 2em !important;
padding-top: 1em !important; padding-top: 1em !important;
} }
.border-right { .border-right {
$border-padding: 2em; $border-padding: 2em;
...@@ -39,7 +36,7 @@ tr:nth-child(2n+1) > td { ...@@ -39,7 +36,7 @@ tr:nth-child(2n+1) > td {
&:hover { &:hover {
color: lighten(map-get($theme-colors, primary), 10%); color: lighten(map-get($theme-colors, primary), 10%);
} }
&:focus { &:focus {
border: none !important; border: none !important;
color: lighten(map-get($theme-colors, primary), 10%); color: lighten(map-get($theme-colors, primary), 10%);
...@@ -49,4 +46,4 @@ tr:nth-child(2n+1) > td { ...@@ -49,4 +46,4 @@ tr:nth-child(2n+1) > td {
color: map-get($theme-colors, primary); color: map-get($theme-colors, primary);
font-weight: 500; font-weight: 500;
} }
} }
\ No newline at end of file
import { useAppSelector } from "@hooks"; import { useAppSelector } from "@hooks";
import { useDeviceTableViewModel } from "@viewmodel/device.table.viewmodel";
import { MutableRefObject, useCallback } from "react"; import { MutableRefObject, useCallback } from "react";
import { OverlayTrigger, Table, Tooltip } from "react-bootstrap"; import { OverlayTrigger, Table, Tooltip } from "react-bootstrap";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useDeviceTableViewModel } from "../../view_model/device.table.viewmodel";
export const DeviceViewTable = (searchRef: MutableRefObject<HTMLInputElement>) => { export const DeviceViewTable = (searchRef: MutableRefObject<HTMLInputElement>) => {
const { devices, pnds } = useAppSelector(state => state.device); const { devices, pnds } = useAppSelector(state => state.device);
......
import { useDeviceViewModel } from '@viewmodel/device.viewmodel';
import { useRef } from 'react'; import { useRef } from 'react';
import { Button, Col, Container, Form, Nav, NavLink, Row } from 'react-bootstrap'; import { Button, Col, Container, Form, Nav, NavLink, Row } from 'react-bootstrap';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import './device.scss'; import './device.scss';
import { DeviceViewTable } from './device.view.table'; import { DeviceViewTable } from './device.view.table';
import { DeviceViewTabs, DeviceViewTabValues } from './device.view.tabs'; import { DeviceViewTabs, DeviceViewTabValues } from './device.view.tabs';
import { useDeviceViewModel } from '/src/components/view_model/device.viewmodel';
function DeviceView() { function DeviceView() {
const { t } = useTranslation('common'); const { t } = useTranslation('common');
......
@import './style/index.scss'; @import './shared/style/index.scss';
body { body {
margin: 0; margin: 0;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
background-color: map-get($theme-colors, bg-primary) !important;
background-color: map-get($theme-colors, bg-primary) !important;
} }
import { BasicLayout } from "@layout/basic.layout"; import { BasicLayout } from "@layout/basic.layout";
import { LoginLayout } from "@layout/login.layout";
import { ProtectedLayout } from "@layout/protected.layout/protected.layout"; import { ProtectedLayout } from "@layout/protected.layout/protected.layout";
import DeviceView from "@view/device/device.view";
import { createBrowserRouter, createRoutesFromElements, Navigate, Route } from "react-router-dom"; import { createBrowserRouter, createRoutesFromElements, Navigate, Route } from "react-router-dom";
import { LoginLayout } from "./components/login/layouts/login.layout";
import DeviceView from "./components/view/device/device.view";
export const DEVICE_URL = '/device/'; export const DEVICE_URL = '/device/';
export const LOGIN_URL = '/login'; export const LOGIN_URL = '/login';
......
@import "/src/style/colors.scss"; @import '/src/shared/style/colors.scss';
$sidebar-width: 4.5em; $sidebar-width: 4.5em;
...@@ -12,7 +12,7 @@ $sidebar-width: 4.5em; ...@@ -12,7 +12,7 @@ $sidebar-width: 4.5em;
color: map-get($theme-colors, primary); color: map-get($theme-colors, primary);
font-weight: 600; font-weight: 600;
} }
&.active { &.active {
color: map-get($theme-colors, primary); color: map-get($theme-colors, primary);
font-weight: 600; font-weight: 600;
...@@ -26,4 +26,4 @@ $sidebar-width: 4.5em; ...@@ -26,4 +26,4 @@ $sidebar-width: 4.5em;
.main-content { .main-content {
margin-left: $sidebar-width; margin-left: $sidebar-width;
} }
\ No newline at end of file
...@@ -4,8 +4,8 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; ...@@ -4,8 +4,8 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { useAppDispatch, useAppSelector } from '@hooks'; import { useAppDispatch, useAppSelector } from '@hooks';
import { useAuth } from "@provider/auth.provider"; import { useAuth } from "@provider/auth.provider";
import { fetchPnds } from '@reducer/device.reducer/device.reducer'; import { fetchPnds } from '@reducer/device.reducer/device.reducer';
import { fetchUser } from '@reducer/user.reducer';
import { DEVICE_URL, LOGIN_URL } from '@routes'; import { DEVICE_URL, LOGIN_URL } from '@routes';
import { fetchUser } from '@shared/store/user.reducer';
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import { Dropdown } from "react-bootstrap"; import { Dropdown } from "react-bootstrap";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
......
import { AuthServiceLoginApiArg, AuthServiceLoginApiResponse, useAuthServiceLoginMutation } from "@api/api"; import { AuthServiceLoginApiArg, AuthServiceLoginApiResponse, useAuthServiceLoginMutation } from "@api/api";
import { getCookieValue } from "@helper/coookie"; import { getCookieValue } from "@helper/coookie";
import { useAppDispatch, useAppSelector } from "@hooks"; import { useAppDispatch, useAppSelector } from "@hooks";
import { setToken } from "@reducer/user.reducer";
import { DEVICE_URL, LOGIN_URL } from "@routes"; import { DEVICE_URL, LOGIN_URL } from "@routes";
import { jwtDecode } from "jwt-decode"; import { jwtDecode } from "jwt-decode";
import { createContext, useContext, useEffect, useMemo } from "react"; import { createContext, useContext, useEffect, useMemo } from "react";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { setToken } from "../store/user.reducer";
interface AuthProviderType { interface AuthProviderType {
login: (username: string, password: string) => void, login: (username: string, password: string) => void,
......
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment