Skip to content

Commit

Permalink
Merge pull request #1008 from rocket-admin/fixes
Browse files Browse the repository at this point in the history
Fixes
  • Loading branch information
lyubov-voloshko authored Feb 2, 2025
2 parents 7140bfb + 6e13c8c commit 95a8c64
Show file tree
Hide file tree
Showing 10 changed files with 107 additions and 343 deletions.
2 changes: 1 addition & 1 deletion frontend/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
</mat-tab-nav-panel>

<div *ngIf="!authBarTheme" class="footer">
<span class="footer__text">&copy; 2024 Rocketadmin</span>
<span class="footer__text">&copy; 2025 Rocketadmin</span>
</div>
</mat-sidenav-content>
</mat-sidenav-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,46 +191,17 @@

.code-snippet-box {
position: relative;
display: flex;
flex-direction: column;
align-items: flex-end;
height: calc(100vh - 200px);
overflow-y: auto;
flex-grow: 1;
}

.action-codeSnippet {
height: 100%;
width: 100%;
}

.action-codeSnippet ::ng-deep .ngs-code-editor {
height: 100%;
}

.lang-select {
position: absolute;
top: 20px;
right: 20px;
width: 156px;
z-index: 5;
}

.lang-select ::ng-deep .mdc-text-field {
background-color: #fff;
}

::ng-deep .CodeMirror-wrap pre.CodeMirror-line,
::ng-deep .CodeMirror-wrap pre.CodeMirror-line-like {
word-wrap: break-word;
white-space: pre-wrap;
word-break: break-word;
border: 1px solid #b0b0b0;
margin-top: 8px;
margin-bottom: 20px;
max-width: 1100px;
padding: 8px 12px;
}

.copy-button {
position: absolute;
right: 184px;
top: 26px;
right: 32px;
top: 32px;
background-color: #fff;
z-index: 5;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,31 +125,59 @@ <h1 class="mat-h1">Rules</h1>
</div>

<span class="mat-body-1"><span class="text_highlighted">then</span> perform action(s)</span>
<div *ngFor="let action of selectedRule.table_actions" class="rule-action">
<mat-form-field appearance="outline">
<mat-label>Actions type</mat-label>
<mat-select name="action-column" [(ngModel)]="action.method">
<mat-option value="EMAIL">Email notification</mat-option>
<mat-option value="SLACK">Slack notification</mat-option>
<mat-option value="URL">URL webhook</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field appearance="outline" *ngIf="action.method === 'URL'" class="rule-action__param">
<mat-label>Action URL</mat-label>
<input matInput [(ngModel)]="action.url" name="action-url" required>
<!-- <mat-error *ngIf="sslCert.errors?.required && (sslCert.invalid && sslCert.touched)">SSL certificate should not be empty.</mat-error> -->
</mat-form-field>
<mat-form-field appearance="outline" *ngIf="action.method === 'SLACK'" class="rule-action__param">
<mat-label>Slack URL</mat-label>
<input matInput [(ngModel)]="action.slack_url" name="action-slack-url" required>
<!-- <mat-error *ngIf="sslCert.errors?.required && (sslCert.invalid && sslCert.touched)">SSL certificate should not be empty.</mat-error> -->
</mat-form-field>
<mat-form-field appearance="outline" *ngIf="action.method === 'EMAIL'" class="rule-action__param">
<mat-label>Emails</mat-label>
<mat-select multiple [(ngModel)]="action.emails" name="notification-emails">
<mat-option *ngFor="let companyMember of companyMembers" [value]="companyMember.email"><span *ngIf="companyMember.name">{{companyMember.name}} | </span> {{companyMember.email}}</mat-option>
</mat-select>
</mat-form-field>
<div *ngFor="let action of selectedRule.table_actions" >
<div class="rule-action">
<mat-form-field appearance="outline">
<mat-label>Actions type</mat-label>
<mat-select name="action-column" [(ngModel)]="action.method">
<mat-option value="EMAIL">Email notification</mat-option>
<mat-option value="SLACK">Slack notification</mat-option>
<mat-option value="URL">URL webhook</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field appearance="outline" *ngIf="action.method === 'URL'" class="rule-action__param">
<mat-label>Action URL</mat-label>
<input matInput [(ngModel)]="action.url" name="action-url" required>
<!-- <mat-error *ngIf="sslCert.errors?.required && (sslCert.invalid && sslCert.touched)">SSL certificate should not be empty.</mat-error> -->
</mat-form-field>
<mat-form-field appearance="outline" *ngIf="action.method === 'SLACK'" class="rule-action__param">
<mat-label>Slack URL</mat-label>
<input matInput [(ngModel)]="action.slack_url" name="action-slack-url" required>
<!-- <mat-error *ngIf="sslCert.errors?.required && (sslCert.invalid && sslCert.touched)">SSL certificate should not be empty.</mat-error> -->
</mat-form-field>
<mat-form-field appearance="outline" *ngIf="action.method === 'EMAIL'" class="rule-action__param">
<mat-label>Emails</mat-label>
<mat-select multiple [(ngModel)]="action.emails" name="notification-emails">
<mat-option *ngFor="let companyMember of companyMembers" [value]="companyMember.email"><span *ngIf="companyMember.name">{{companyMember.name}} | </span> {{companyMember.email}}</mat-option>
</mat-select>
</mat-form-field>
</div>

<div *ngIf="action.method === 'URL'" class="code-snippet-box">
<mat-tab-group mat-stretch-tabs="false" mat-align-tabs="start" animationDuration="0ms">
<mat-tab *ngFor="let lang of codeSnippets | keyvalue"
[label]="lang.value.langName">
<button type="button"
mat-icon-button
class="copy-button"
matTooltip="Copy code"
[cdkCopyToClipboard]="lang.value.snippet"
(cdkCopyToClipboardCopied)="showCopyNotification(codeSnippets[codeLangSelected].langName + 'code snippet was copied to clipboard.')">
<mat-icon>content_copy</mat-icon>
</button>

<ngs-code-editor
theme="vs"
[codeModel]="{
language: lang.value.mode,
uri: 'snippet.' + (lang.value.mode || 'txt'),
value: lang.value.snippet
}"
[options]="codeViewerOptions">
</ngs-code-editor>
</mat-tab>
</mat-tab-group>
</div>
</div>

<div class="action__actions">
Expand All @@ -164,35 +192,6 @@ <h1 class="mat-h1">Rules</h1>
</button>
</div>
</form>

<!--<div *ngIf="selectedRuleCustomEvent" class="code-snippet-box">
<mat-form-field appearance="outline" class="lang-select">
<mat-label>Language</mat-label>
<mat-select [(ngModel)]="codeLangSelected">
<mat-option *ngFor="let lang of codeSnippets | keyvalue; let key = index; trackBy:trackByFn" [value]="lang.key">{{lang.value.langName}}</mat-option>
</mat-select>
</mat-form-field>
<button type="button"
mat-icon-button
class="copy-button"
matTooltip="Copy mater password"
[cdkCopyToClipboard]="codeSnippets[codeLangSelected].snippet[selectedRuleCustomEvent.type]"
(cdkCopyToClipboardCopied)="showCopyNotification(codeSnippets[codeLangSelected].langName + 'code snippet was copied to clipboard.')">
<mat-icon>content_copy</mat-icon>
</button>
<div class="action-codeSnippet">
<ngs-code-editor
theme="vs"
[codeModel]="{
language: codeSnippets[codeLangSelected].mode,
value: codeSnippets[codeLangSelected].snippet[selectedRuleCustomEvent.type]
}"
[options]="codeViewerOptions">
</ngs-code-editor>
</div>
</div> -->
</div>

</mat-drawer-content>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { AlertActionType, AlertType } from 'src/app/models/alert';
import { Angulartics2, Angulartics2OnModule } from 'angulartics2';
import { Component, OnInit } from '@angular/core';
import { CustomAction, CustomActionMethod, CustomActionType, CustomEvent, EventType, Rule } from 'src/app/models/table';

import { ActionDeleteDialogComponent } from './action-delete-dialog/action-delete-dialog.component';
import { AlertComponent } from '../../ui-components/alert/alert.component';
import { Angulartics2, Angulartics2OnModule } from 'angulartics2';
import { BreadcrumbsComponent } from '../../ui-components/breadcrumbs/breadcrumbs.component';
import { ClipboardModule } from '@angular/cdk/clipboard';
import { CodeEditorModule } from '@ngstack/code-editor';
import { CommonModule } from '@angular/common';
import { CompanyMember } from 'src/app/models/company';
import { CompanyService } from 'src/app/services/company.service';
Expand All @@ -15,6 +17,7 @@ import { FormsModule } from '@angular/forms';
import { HttpErrorResponse } from '@angular/common/http';
import { IconPickerComponent } from '../../ui-components/icon-picker/icon-picker.component';
import { MatButtonModule } from '@angular/material/button';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatDialog } from '@angular/material/dialog';
import { MatDialogModule } from '@angular/material/dialog';
import { MatIconModule } from '@angular/material/icon';
Expand All @@ -23,21 +26,22 @@ import { MatListModule } from '@angular/material/list';
import { MatRadioModule } from '@angular/material/radio';
import { MatSelectModule } from '@angular/material/select';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatTabsModule } from '@angular/material/tabs';
import { MatTooltipModule } from '@angular/material/tooltip';
import { NotificationsService } from 'src/app/services/notifications.service';
import { TablesService } from 'src/app/services/tables.service';
import { Title } from '@angular/platform-browser';
import { UserService } from 'src/app/services/user.service';
import { codeSnippets } from 'src/app/consts/code-snippets';
import { normalizeTableName } from 'src/app/lib/normalize';
import { MatCheckboxModule } from '@angular/material/checkbox';

@Component({
selector: 'app-db-table-actions',
templateUrl: './db-table-actions.component.html',
styleUrls: ['./db-table-actions.component.css'],
imports: [
CommonModule,
ClipboardModule,
FormsModule,
MatButtonModule,
MatCheckboxModule,
Expand All @@ -49,6 +53,8 @@ import { MatCheckboxModule } from '@angular/material/checkbox';
MatSidenavModule,
MatListModule,
MatRadioModule,
MatTabsModule,
CodeEditorModule,
AlertComponent,
BreadcrumbsComponent,
ContentLoaderComponent,
Expand Down Expand Up @@ -110,10 +116,9 @@ export class DbTableActionsComponent implements OnInit {

async ngOnInit() {
this.connectionID = this._connections.currentConnectionID;
this.signingKey = this._connections.currentConnection.signing_key;
this.tableName = this._tables.currentTableName;
this.normalizedTableName = normalizeTableName(this.tableName);
this.codeSnippets = codeSnippets(this._connections.currentConnection.signing_key);
this._connections.getCurrentConnectionSigningKey().subscribe(signingKey => this.codeSnippets = codeSnippets(signingKey));

try {
this.rulesData = await this.getRules();
Expand All @@ -139,7 +144,6 @@ export class DbTableActionsComponent implements OnInit {
if (arg === 'delete-rule') {
try {
this.rulesData = await this.getRules();
console.log(this.rulesData);
this.rules = this.rulesData.action_rules;
this.selectedRule = this.rules[0];
this.selectedRuleTitle = this.selectedRule.title;
Expand All @@ -153,9 +157,14 @@ export class DbTableActionsComponent implements OnInit {
}

get currentConnection() {
// this.codeSnippets = codeSnippets(this._connections.currentConnection.signing_key);
return this._connections.currentConnection;
}

// get codeSnippets() {
// return codeSnippets(this._connections.currentConnection.signing_key);
// }

getCrumbs(name: string) {
return [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ <h1 mat-dialog-title class="filters-header">
<mat-option value="contains">
contains
</mat-option>
<mat-option value="icontains">
not contains
</mat-option>
<mat-option value="empty">
is empty
</mat-option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { map, startWith, tap } from 'rxjs/operators';

import { AccessLevel } from 'src/app/models/user';
import { ActivatedRoute } from '@angular/router';
import { Angulartics2OnModule } from 'angulartics2';
import { ClipboardModule } from '@angular/cdk/clipboard';
import { CommonModule } from '@angular/common';
import { DbTableExportDialogComponent } from '../db-table-export-dialog/db-table-export-dialog.component';
Expand Down Expand Up @@ -33,7 +34,6 @@ import { RouterModule } from '@angular/router';
import { SelectionModel } from '@angular/cdk/collections';
import { TableStateService } from 'src/app/services/table-state.service';
import { normalizeTableName } from '../../../lib/normalize'
import { Angulartics2OnModule } from 'angulartics2';

interface Column {
title: string,
Expand Down Expand Up @@ -286,6 +286,8 @@ export class DbTableComponent implements OnInit {
return `${displayedName} = ...${filterValue}`
} else if (comparator == 'contains') {
return `${displayedName} = ...${filterValue}...`
} else if (comparator == 'icontains') {
return `${displayedName} != ...${filterValue}...`
} else if (comparator == 'empty') {
return `${displayedName} = ' '`
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
display: flex;
align-items: center;
justify-content: space-between;
color: var(--mat-sidenav-content-text-color);
margin-top: 8px;
}

.icons-list {
Expand All @@ -32,7 +34,7 @@
grid-template-columns: repeat(5, 40px);
grid-gap: 4px;
justify-content: space-between;
margin-top: 12px;
margin-top: 8px;
margin-bottom: 12px;
}

Expand Down
Loading

0 comments on commit 95a8c64

Please sign in to comment.