Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend changes #6235

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 0 additions & 3 deletions apps/backend/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
Expand Down
6 changes: 3 additions & 3 deletions apps/frontend/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ module.exports = {
},
moduleDirectories: ['node_modules', 'src'],
moduleNameMapper: {
'^axios$': 'axios/dist/node/axios.cjs',
'^csv-stringify/sync$': 'csv-stringify/dist/cjs/sync.cjs',
'^d3$': '<rootDir>/tests/util/d3.js',
'^@[/](.+)': '<rootDir>/src/$1',
'^.+\\.(css)$': '<rootDir>/tests/util/cssTransform.js',
'^axios$': 'axios/dist/node/axios.cjs',
'^csv-stringify/sync$': 'csv-stringify/dist/cjs/sync.cjs'
'^.+\\.(css)$': '<rootDir>/tests/util/cssTransform.js'
}
};
1 change: 0 additions & 1 deletion apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"@types/diff": "^5.0.0",
"@types/file-saver": "^2.0.1",
"@types/lodash": "^4.14.161",
"@types/lru-cache": "^7.10.10",
"@types/luxon": "^3.3.1",
"@types/mustache": "^4.1.1",
"@types/node": "^22.0.0",
Expand Down
18 changes: 17 additions & 1 deletion apps/frontend/src/components/global/Snackbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
v-if="show"
id="info-snackbar"
v-model="show"
:color="error ? 'error' : 'success'"
:color="error ? 'error' : warning ? 'warning' : 'success'"
elevation="24"
timeout="10000"
top
>
{{ message }}

<div>
<a :href="'' + href"> {{ hrefText }} </a>
</div>

<template #action="{attrs}">
<v-btn id="hide-snackbar" text v-bind="attrs" @click="show = false">
Close
Expand Down Expand Up @@ -39,6 +43,10 @@ export default class Snackbar extends Vue {
return SnackbarModule.error;
}

get warning(): boolean {
return SnackbarModule.warn;
}

get message(): string {
this.messageContent = SnackbarModule.message;
if (this.error) {
Expand All @@ -55,5 +63,13 @@ export default class Snackbar extends Vue {
}
}
}

get href(): string {
return SnackbarModule.linkUrl;
}

get hrefText(): string {
return SnackbarModule.linkText;
}
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<ActionDialog
v-model="dialogDelete"
type="user"
message="Any ownerless groups left by this user will be transfered to an admin."
message="Any ownerless groups left by this user will be transferred to an admin."
@cancel="closeActionDialog"
@confirm="deleteUserConfirm"
/>
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/mixins/EvaluationMixin.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {GroupsModule} from '@/store/groups';
import {IVuetifyItems} from '@/utilities/helper_util';
import {IGroup} from '@heimdall/interfaces';
import {intersectionBy} from 'lodash';
import {Component, Vue} from 'vue-property-decorator';
import {IVuetifyItems} from '../utilities/helper_util';

@Component({})
export default class EvaluationMixin extends Vue {
Expand Down
11 changes: 5 additions & 6 deletions apps/frontend/src/store/data_filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,15 @@ export class FilteredData extends VuexModule {

@Mutation
SELECT_EVALUATIONS(files: FileID[]): void {
this.selectedEvaluationIds = [
...new Set([...files, ...this.selectedEvaluationIds])
];
this.selectedEvaluationIds = _.uniq([
...files,
...this.selectedEvaluationIds
]);
}

@Mutation
SELECT_PROFILES(files: FileID[]): void {
this.selectedProfileIds = [
...new Set([...files, ...this.selectedProfileIds])
];
this.selectedProfileIds = _.uniq([...files, ...this.selectedProfileIds]);
}

@Mutation
Expand Down
48 changes: 46 additions & 2 deletions apps/frontend/src/store/snackbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ import {
} from 'vuex-module-decorators';

export interface ISnackbarState {
linkUrl: string;
linkText: string;
message: string;
error: boolean;
warn: boolean;
show: boolean;
}

Expand All @@ -21,23 +24,49 @@ export interface ISnackbarState {
name: 'SnackbarModule'
})
export class Snackbar extends VuexModule {
linkUrl = '';
linkText = '';
message = '';
error = false;
warn = false;
show = false;

@Action
notify(message: string) {
notify(message: string, linkUrl?: string, linkText?: string) {
this.context.commit('SET_VISIBILITY', false);
this.context.commit('SET_ERROR', false);
this.context.commit('SET_WARN', false);
this.context.commit('SET_MESSAGE', message);
if (linkUrl) {
this.context.commit('SET_LINK_URL', linkUrl);
this.context.commit('SET_LINK_TEXT', linkText);
}
this.context.commit('SET_VISIBILITY', true);
}

@Action
warning(message: string, linkUrl?: string, linkText?: string) {
this.context.commit('SET_VISIBILITY', false);
this.context.commit('SET_ERROR', false);
this.context.commit('SET_WARN', true);
this.context.commit('SET_MESSAGE', message);
if (linkUrl) {
this.context.commit('SET_LINK_URL', linkUrl);
this.context.commit('SET_LINK_TEXT', linkText);
}
this.context.commit('SET_VISIBILITY', true);
}

@Action
failure(message: string) {
failure(message: string, linkUrl?: string, linkText?: string) {
this.context.commit('SET_VISIBILITY', false);
this.context.commit('SET_ERROR', true);
this.context.commit('SET_WARN', false);
this.context.commit('SET_MESSAGE', message);
if (linkUrl) {
this.context.commit('SET_LINK_URL', linkUrl);
this.context.commit('SET_LINK_TEXT', linkText);
}
this.context.commit('SET_VISIBILITY', true);
}

Expand Down Expand Up @@ -74,11 +103,26 @@ export class Snackbar extends VuexModule {
this.error = error;
}

@Mutation
SET_WARN(warn: boolean) {
this.warn = warn;
}

@Mutation
SET_MESSAGE(message: string) {
this.message = message;
}

@Mutation
SET_LINK_URL(linkUrl: string) {
this.linkUrl = linkUrl;
}

@Mutation
SET_LINK_TEXT(linkText: string) {
this.linkText = linkText;
}

@Mutation
SET_VISIBILITY(visibility: boolean) {
this.show = visibility;
Expand Down
6 changes: 6 additions & 0 deletions apps/frontend/src/types/vuex.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare module 'vuex' {
export * from 'vuex/types/helpers.d.ts';
export * from 'vuex/types/index.d.ts';
export * from 'vuex/types/logger.d.ts';
export * from 'vuex/types/vue.d.ts';
}
6 changes: 4 additions & 2 deletions apps/frontend/src/views/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@
v-if="anyAuthProvidersAvailable"
id="select-tab-standard-login"
href="#login-standard"
>Heimdall Login (Local Authorization)</v-tab
>
Heimdall Login (Local Authentication)
</v-tab>
<v-tab
v-if="ldapenabled"
id="select-tab-ldap-login"
href="#login-ldap"
>Organization Login (LDAP Authorization)</v-tab
>
Organization Login (LDAP Authentication)
</v-tab>

<v-tab-item value="login-standard">
<LocalLogin />
Expand Down
7 changes: 1 addition & 6 deletions apps/frontend/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"resolveJsonModule": true,
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"esModuleInterop": true,
"sourceMap": true,
"allowSyntheticDefaultImports": true,
"baseUrl": "./",
"types": ["jest", "chai", "vuetify", "node"],
"types": ["jest", "chai", "vue", "vuetify", "node"],
"paths": {
"@/*": ["src/*"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {FromHdfBaseConverter, ILookupPathFH} from './reverse-base-converter';

// Base converter used to support conversions from HDF to Any Format
export class FromAnyBaseConverter extends FromHdfBaseConverter {
data: any;
declare data: any;

constructor(data: any, collapseResults = false) {
super(data, collapseResults);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export class FromHDFControlToSplunkControlMapper extends FromAnyBaseConverter {
}

export class FromHDFToSplunkMapper extends FromAnyBaseConverter {
mappings?: MappedTransform<SplunkData, ILookupPathFH>;
declare mappings?: MappedTransform<SplunkData, ILookupPathFH>;
contextualizedEvaluation?: ContextualizedEvaluation;
axiosInstance: AxiosInstance;

Expand Down
13 changes: 7 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"downlevelIteration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"sourceMap": true,
"target": "ES2019",
"esModuleInterop": true,
"experimentalDecorators": true,
"importHelpers": true,
"module": "node16",
"moduleResolution": "node16",
"noImplicitAny": true,
"removeComments": true,
"resolveJsonModule": true,
"sourceMap": true,
"useUnknownInCatchVariables": false
},
"include": [
Expand Down
17 changes: 5 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4639,13 +4639,6 @@
resolved "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a"
integrity sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==

"@types/lru-cache@^7.10.10":
version "7.10.10"
resolved "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-7.10.10.tgz#3fa937c35ff4b3f6753d5737915c9bf8e693a713"
integrity sha512-nEpVRPWW9EBmx2SCfNn3ClYxPL7IktPX12HhIoSc/H5mMjdeW3+YsXIpseLQ2xF35+OcpwKQbEUw5VtqE4PDNA==
dependencies:
lru-cache "*"

"@types/luxon@^3.3.1":
version "3.4.2"
resolved "https://registry.npmjs.org/@types/luxon/-/luxon-3.4.2.tgz#e4fc7214a420173cea47739c33cdf10874694db7"
Expand Down Expand Up @@ -14284,16 +14277,16 @@ lowercase-keys@^1.0.0:
resolved "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f"
integrity sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==

lru-cache@*, lru-cache@^10.0.1, lru-cache@^10.1.0, lru-cache@^10.2.0, lru-cache@^10.2.2, "lru-cache@^9.1.1 || ^10.0.0":
version "10.3.0"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.3.0.tgz#4a4aaf10c84658ab70f79a85a9a3f1e1fb11196b"
integrity sha512-CQl19J/g+Hbjbv4Y3mFNNXFEL/5t/KCg8POCuUqd4rMKjGG+j1ybER83hxV58zL+dFI1PTkt3GNFSHRt+d8qEQ==

"[email protected] - 7.13.1":
version "7.13.1"
resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-7.13.1.tgz#267a81fbd0881327c46a81c5922606a2cfe336c4"
integrity sha512-CHqbAq7NFlW3RSnoWXLJBxCWaZVBrfa9UEHId2M3AW8iEBurbqduNexEUCGc3SHc6iCYXNJCDi903LajSVAEPQ==

lru-cache@^10.0.1, lru-cache@^10.1.0, lru-cache@^10.2.0, lru-cache@^10.2.2, "lru-cache@^9.1.1 || ^10.0.0":
version "10.3.0"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.3.0.tgz#4a4aaf10c84658ab70f79a85a9a3f1e1fb11196b"
integrity sha512-CQl19J/g+Hbjbv4Y3mFNNXFEL/5t/KCg8POCuUqd4rMKjGG+j1ybER83hxV58zL+dFI1PTkt3GNFSHRt+d8qEQ==

lru-cache@^4.0.1, lru-cache@^4.1.2:
version "4.1.5"
resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd"
Expand Down
Loading