repo_name
string
dataset
string
owner
string
lang
string
func_name
string
code
string
docstring
string
url
string
sha
string
biome-vscode
github_2023
biomejs
typescript
promptVersionToDownload
const promptVersionToDownload = async () => { debug("Prompting user to select Biome version to download"); // Get the list of versions const compileItems = async (): Promise<QuickPickItem[]> => { const downloadedVersion = (await getDownloadedVersion())?.version; // Get the list of available versions const av...
/** * Prompts the user to select which versions of the Biome CLI to download * * This function will display a QuickPick dialog to the user, allowing them to * select which versions of the Biome CLI they would like to download. Versions * that have already been downloaded will be pre-selected. */
https://github.com/biomejs/biome-vscode/blob/c146d1bf9bdcec376706114d76abdb11d7e9005e/src/downloader.ts#L121-L148
c146d1bf9bdcec376706114d76abdb11d7e9005e
biome-vscode
github_2023
biomejs
typescript
compileItems
const compileItems = async (): Promise<QuickPickItem[]> => { const downloadedVersion = (await getDownloadedVersion())?.version; // Get the list of available versions const availableVersions = await getAllVersions(false); return availableVersions.map((version, index) => { return { label: version, de...
// Get the list of versions
https://github.com/biomejs/biome-vscode/blob/c146d1bf9bdcec376706114d76abdb11d7e9005e/src/downloader.ts#L125-L142
c146d1bf9bdcec376706114d76abdb11d7e9005e
biome-vscode
github_2023
biomejs
typescript
registerUserFacingCommands
const registerUserFacingCommands = () => { state.context.subscriptions.push( commands.registerCommand("biome.start", startCommand), commands.registerCommand("biome.stop", stopCommand), commands.registerCommand("biome.restart", restartCommand), commands.registerCommand("biome.download", downloadCommand), comm...
/** * Registers the extension's user-facing commands. */
https://github.com/biomejs/biome-vscode/blob/c146d1bf9bdcec376706114d76abdb11d7e9005e/src/extension.ts#L48-L58
c146d1bf9bdcec376706114d76abdb11d7e9005e
biome-vscode
github_2023
biomejs
typescript
listenForConfigurationChanges
const listenForConfigurationChanges = () => { const debouncedConfigurationChangeHandler = debounce( (event: ConfigurationChangeEvent) => { if (event.affectsConfiguration("biome")) { info("Configuration change detected."); if (!["restarting", "stopping"].includes(state.state)) { restart(); } } ...
/** * Listens for configuration changes * * This function sets up a listener for configuration changes in the `biome` * namespace. When a configuration change is detected, the extension is * restarted to reflect the new configuration. */
https://github.com/biomejs/biome-vscode/blob/c146d1bf9bdcec376706114d76abdb11d7e9005e/src/extension.ts#L67-L84
c146d1bf9bdcec376706114d76abdb11d7e9005e
biome-vscode
github_2023
biomejs
typescript
listenForActiveTextEditorChange
const listenForActiveTextEditorChange = () => { state.context.subscriptions.push( window.onDidChangeActiveTextEditor((editor) => { updateActiveProject(editor); }), ); info("Started listening for active text editor changes"); updateActiveProject(window.activeTextEditor); };
/** * Listens for changes to the active text editor * * This function listens for changes to the active text editor and updates the * active project accordingly. This change is then reflected throughout the * extension automatically. Notably, this triggers the status bar to update * with the active project. */
https://github.com/biomejs/biome-vscode/blob/c146d1bf9bdcec376706114d76abdb11d7e9005e/src/extension.ts#L94-L104
c146d1bf9bdcec376706114d76abdb11d7e9005e
biome-vscode
github_2023
biomejs
typescript
listenForLockfilesChanges
const listenForLockfilesChanges = () => { const watcher = workspace.createFileSystemWatcher( "**/{package-lock.json,yarn.lock,bun.lockb,bun.lock,pnpm-lock.yaml}", ); watcher.onDidChange((event) => { info(`Lockfile ${event.fsPath} changed.`); restart(); }); watcher.onDidCreate((event) => { info(`Lockfile ...
/** * Listens for changes to lockfiles in the workspace * * We use this watcher to detect changes to lockfiles and restart the extension * when they occur. We currently rely on this strategy to detect if Biome has been * installed or updated in the workspace until VS Code provides a better way to * detect this. ...
https://github.com/biomejs/biome-vscode/blob/c146d1bf9bdcec376706114d76abdb11d7e9005e/src/extension.ts#L114-L137
c146d1bf9bdcec376706114d76abdb11d7e9005e
biome-vscode
github_2023
biomejs
typescript
doStart
const doStart = async () => { try { await createProjectSessions(); await createGlobalSessionWhenNecessary(); } catch (e) { error("Failed to start Biome extension"); state.state = "error"; } };
/** * Runs the startup logic */
https://github.com/biomejs/biome-vscode/blob/c146d1bf9bdcec376706114d76abdb11d7e9005e/src/lifecycle.ts#L47-L55
c146d1bf9bdcec376706114d76abdb11d7e9005e
biome-vscode
github_2023
biomejs
typescript
doStop
const doStop = async () => { // If we end up here following a configuration change, we need to wait // for the notification to be processed before we can stop the LSP session, // otherwise we will get an error. This is a workaround for a race condition // that occurs when the configuration change notification is se...
/** * Runs the shutdown logic */
https://github.com/biomejs/biome-vscode/blob/c146d1bf9bdcec376706114d76abdb11d7e9005e/src/lifecycle.ts#L60-L77
c146d1bf9bdcec376706114d76abdb11d7e9005e
biome-vscode
github_2023
biomejs
typescript
createProject
const createProject = async ({ folder, path, configFile, }: { folder?: WorkspaceFolder; path: Uri; configFile?: Uri; }): Promise<Project | undefined> => { return { folder: folder, path: path, configFile: configFile, }; };
/** * Creates a new Biome project * * This function creates a new Biome project and automatically resolves the * path to the Biome binary in the context of the project. * * @param folder The parent workspace folder of the project * @param path The URI of the project directory, relative to the workspace folder *...
https://github.com/biomejs/biome-vscode/blob/c146d1bf9bdcec376706114d76abdb11d7e9005e/src/project.ts#L50-L64
c146d1bf9bdcec376706114d76abdb11d7e9005e
biome-vscode
github_2023
biomejs
typescript
createWorkspaceFolderProjects
const createWorkspaceFolderProjects = async (folder: WorkspaceFolder) => { // If Biome is disabled in the workspace folder, we skip project creation // entirely for that workspace folder. if (!isEnabled(folder)) { return []; } // Retrieve the project definitions in the workspace folder's configuration // or fa...
/** * Detects projects in the given workspace folder * * This function will detect projects in the given workspace folder by looking * for project definitions in the workspace folder's configuration. If no project * definitions are found, it will create a single project at the root of the * workspace folder. * ...
https://github.com/biomejs/biome-vscode/blob/c146d1bf9bdcec376706114d76abdb11d7e9005e/src/project.ts#L144-L236
c146d1bf9bdcec376706114d76abdb11d7e9005e
biome-vscode
github_2023
biomejs
typescript
copyBinaryToTemporaryLocation
const copyBinaryToTemporaryLocation = async ( bin: Uri, ): Promise<Uri | undefined> => { // Retrieve the the version of the binary // We call biome with --version which outputs the version in the format // of "Version: 1.0.0" const version = spawnSync(bin.fsPath, ["--version"]) .stdout.toString() .split(":")[1...
/** * Copies the binary to a temporary location if necessary * * This function will copy the binary to a temporary location if it is not already * present in the global storage directory. It will then return the location of * the copied binary. * * This approach allows the user to update the original binary that...
https://github.com/biomejs/biome-vscode/blob/c146d1bf9bdcec376706114d76abdb11d7e9005e/src/session.ts#L91-L147
c146d1bf9bdcec376706114d76abdb11d7e9005e
biome-vscode
github_2023
biomejs
typescript
createLanguageClient
const createLanguageClient = (bin: Uri, project?: Project) => { let args = ["lsp-proxy"]; if (project?.configFile) { args = [...args, "--config-path", project.configFile.fsPath]; } const serverOptions: ServerOptions = { command: bin.fsPath, transport: TransportKind.stdio, options: { ...(project?.path &&...
/** * Creates a new Biome LSP client */
https://github.com/biomejs/biome-vscode/blob/c146d1bf9bdcec376706114d76abdb11d7e9005e/src/session.ts#L221-L289
c146d1bf9bdcec376706114d76abdb11d7e9005e
biome-vscode
github_2023
biomejs
typescript
createLspLogger
const createLspLogger = (project?: Project): LogOutputChannel => { // If the project is missing, we're creating a logger for the global LSP // session. In this case, we don't have a workspace folder to display in the // logger name, so we just use the display name of the extension. if (!project?.folder) { return ...
/** * Creates a new Biome LSP logger */
https://github.com/biomejs/biome-vscode/blob/c146d1bf9bdcec376706114d76abdb11d7e9005e/src/session.ts#L294-L318
c146d1bf9bdcec376706114d76abdb11d7e9005e
biome-vscode
github_2023
biomejs
typescript
createLspTraceLogger
const createLspTraceLogger = (project?: Project): LogOutputChannel => { // If the project is missing, we're creating a logger for the global LSP // session. In this case, we don't have a workspace folder to display in the // logger name, so we just use the display name of the extension. if (!project?.folder) { re...
/** * Creates a new Biome LSP logger */
https://github.com/biomejs/biome-vscode/blob/c146d1bf9bdcec376706114d76abdb11d7e9005e/src/session.ts#L323-L350
c146d1bf9bdcec376706114d76abdb11d7e9005e
biome-vscode
github_2023
biomejs
typescript
createDocumentSelector
const createDocumentSelector = (project?: Project): DocumentFilter[] => { if (project) { return supportedLanguageIdentifiers.map((language) => ({ language, scheme: "file", pattern: Uri.joinPath(project.path, "**", "*").fsPath.replaceAll( "\\", "/", ), })); } return supportedLanguageIdentifie...
/** * Creates a new document selector * * This function will create a document selector scoped to the given project, * which will only match files within the project's root directory. If no * project is specified, the document selector will match files that have * not yet been saved to disk (untitled). */
https://github.com/biomejs/biome-vscode/blob/c146d1bf9bdcec376706114d76abdb11d7e9005e/src/session.ts#L360-L378
c146d1bf9bdcec376706114d76abdb11d7e9005e
UTMStack
github_2023
utmstack
typescript
AdTreeComponent.select
select(item: ActiveDirectoryTreeType) { // (item.type === 'USER' || item.type === 'GROUP' || item.type === 'GROUP') && if (item.children.length === 0) { this.itemView = item.id; this.selected.emit(item.objectSid); this.treeObjectBehavior.changeUser(item); } }
/** * Check tree object if user or group to trigger behavior; * @param item Receive select node in tree */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/active-directory/shared/components/active-directory-tree/active-directory-tree.component.ts#L170-L177
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
AdTreeComponent.deployAll
deployAll(item: TreeItem) { this.deployed.push(item.id); for (const it of item.children) { const index = this.deployed.findIndex(value => value === it.id); if (index === -1) { this.deployed.push(it.id); } if (it.children.length > 0) { this.deployAll(it); } } }
// deploy all children in tree when search
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/active-directory/shared/components/active-directory-tree/active-directory-tree.component.ts#L232-L243
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
AdViewComponent.addToTracking
addToTracking() { const modalAddTracking = this.modalService.open(AdTrackerCreateComponent, {centered: true}); modalAddTracking.componentInstance.targetTracking = [{ name: this.adInfo.cn, id: this.adInfo.objectSid, type: resolveType(this.adInfo.objectClass), isAdmin: this.adInfo.adminCou...
/*getInfo() { const req = { 'objectSid.equals': this.object, page: 1, size: 50 }; this.activeDirectoryService.query(req).subscribe(object => { if (object.body) { this.adInfo = object.body[0]; } }); }*/
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/active-directory/view/active-directory-view/active-directory-view.component.ts#L86-L95
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
SourcesService.findAllSources
findAllSources(): Observable<HttpResponse<ISource[]>> { return this.http.get<ISource[]>(`${this.resourceUrl}`, {observe: 'response'}); }
/** * Get all alert sources */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/admin/sources/sources.service.ts#L20-L22
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
UtmHealthService.addHealthObject
private addHealthObject(result, isLeaf, healthObject, name): any { const healthData: any = { name }; const details = {}; let hasDetails = false; for (const key in healthObject) { if (healthObject.hasOwnProperty(key)) { const value = healthObject[key]; if (key === 'statu...
/* private methods */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/app-management/health-checks/health-checks.service.ts#L50-L82
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
IntLdapGroupsComponent.saveConfig
saveConfig() { // this.saving = true; // console.log(this.integrationConfig); // this.utmIntConfigManageService.saveConfig(this.integrationConfig, JSON.stringify(this.group.value)).subscribe(saved => { // if (saved) { // this.toastService.showSuccessBottom('Configuration saved successfully'); ...
// }
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/app-module/conf/int-ldap-groups/int-ldap-groups.component.ts#L79-L91
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
GuideSalesforceComponent.generateDockerCommand
generateDockerCommand(): string { const formData = this.salesforceForm.value; return ` mkdir -p /utmstack/sforceds && docker run --restart=always --name sforceds ` + `-e "clientID=${formData.clientID}" ` + `-e "clientSecret=<secret>${formData.clientSecret}</secret>" ` + ...
// --log-opt max-file=3 -d utmstack.azurecr.io/sforceds:v9
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/app-module/guides/guide-salesforce/guide-salesforce.component.ts#L47-L60
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
AssetsViewComponent.ngOnInit
ngOnInit() { this.setInitialWidth(); this.getAssets(); this.starInterval(); this.accountService.identity().then(account => { this.reasonRun = { command: '', reason: '', originId: account.login, originType: IncidentOriginTypeEnum.USER_EXECUTION }; }); }
// Init get asset on time filter component trigger
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/assets-discover/assets-view/assets-view.component.ts#L93-L106
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
CollectorsViewComponent.ngOnInit
ngOnInit() { this.setInitialWidth(); this.getCollectors(); this.starInterval(); this.accountService.identity().then(account => { this.reasonRun = { command: '', reason: '', originId: account.login, originType: IncidentOriginTypeEnum.USER_EXECUTION }; }); ...
// Init get asset on time filter component trigger
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/assets-discover/collectors-view/collectors-view.component.ts#L90-L103
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
UtmNetScanService.create
create(asset: any): Observable<HttpResponse<NetScanType>> { return this.http.post<NetScanType>(this.resourceUrl + '/saveOrUpdateCustomAsset', asset, {observe: 'response'}); }
// POST /api/utm-network-scans/saveOrUpdateCustomAsset
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/assets-discover/shared/services/utm-net-scan.service.ts#L31-L33
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
PaginationConfig.constructor
constructor(private config: NgbPaginationConfig) { config.boundaryLinks = true; config.maxSize = 5; config.pageSize = ITEMS_PER_PAGE; config.size = 'sm'; }
// tslint:disable-next-line: no-unused-variable
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/blocks/config/uib-pagination.config.ts#L9-L14
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
ManageHttpInterceptor.filterRequest
filterRequest(route: string): boolean { return BYPASS_ROUTES.findIndex(value => route.includes(value)) !== -1; }
/** * Determine if cancel request or not on page request * @param route Current route */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/blocks/interceptor/managehttp.interceptor.ts#L29-L31
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
HttpCancelService.cancelPendingRequests
public cancelPendingRequests() { this.pendingHTTPRequests$.next(); }
// Cancel Pending HTTP calls
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/blocks/service/httpcancel.service.ts#L13-L15
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
ComplianceResultViewComponent.getTemplate
getTemplate() { if (this.reportId) { this.cpReportsService.find(this.reportId).subscribe(response => { this.report = response.body; if (this.report.dashboardId) { this.loadVisualizations(this.report.dashboardId); } }); } }
/** * Return template */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/compliance/compliance-result-view/compliance-result-view.component.ts#L139-L148
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
UtmReportInfoViewComponent.deleteSection
deleteSection(index: number) { this.complianceReports.splice(index, 1); this.complianceReportsChange.emit(this.complianceReports); }
// }
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/compliance/shared/components/utm-report-info-view/utm-report-info-view.component.ts#L40-L43
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
CpReportsService.queryByStandard
queryByStandard(req?: any): Observable<HttpResponse<ComplianceReportType[]>> { const options = createRequestOption(req); return this.http.get<ComplianceReportType[]>(this.resourceUrl + '/get-by-filters', { params: options, observe: 'response' }); }
// GET /api/compliance/report-config/get-by-report
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/compliance/shared/services/cp-reports.service.ts#L60-L66
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
CpStandardSectionService.queryWithReports
queryWithReports(req?: any): Observable<HttpResponse<ComplianceStandardSectionType[]>> { const options = createRequestOption(req); return this.http.get<ComplianceStandardSectionType[]>(this.resourceUrl + '/sections-with-reports', { params: options, observe: 'response' }); }
// GET /api/compliance/standard-section/sections-with-reports
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/compliance/shared/services/cp-standard-section.service.ts#L45-L51
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
ComplianceExportComponent.getTemplate
getTemplate() { this.cpReportsService.find(this.reportId).subscribe(response => { this.report = response.body; if (this.report.dashboardId) { this.loadVisualizations(this.report.dashboardId); } }); }
/** * Return template */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/dashboard/compliance-export/compliance-export.component.ts#L143-L150
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
DashboardOverviewComponent.exportToPdf
exportToPdf() { this.spinner.show('buildPrintPDF').then(() => { const params = this.filterTime ? `?filterTime=${encodeURIComponent(JSON.stringify(this.filterTime))}` : ''; const url = `/dashboard/overview${params}`; this.exportPdfService.getPdf(url, 'Dashboard_Overview', 'PDF_TYPE...
/*exportToPdf() { this.pdfExport = true; // captureScreen('utmDashboardAlert').then((finish) => { // this.pdfExport = false; // }); setTimeout(() => { window.print(); }, 1000); } */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/dashboard/dashboard-overview/dashboard-overview.component.ts#L213-L232
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
DashboardOverviewComponent.synchronizeFields
synchronizeFields() { this.accountService.identity(true).then(value => { if (value) { this.indexPatternService.queryWithFields({page: 0, size: 2000, 'isActive.equals': true}) .pipe( map(response => response.body)) .subscribe((values: UtmIndexPatternFields[]) => ...
/** * Sync field in local storage from index service */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/dashboard/dashboard-overview/dashboard-overview.component.ts#L240-L255
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
ReportExportComponent.getTemplate
getTemplate() { this.reportsService.find(this.reportId).subscribe(response => { this.report = response.body; if (this.report.dashboardId) { this.loadVisualizations(this.report.dashboardId); } }); }
/** * Return template */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/dashboard/report-export/report-export.component.ts#L103-L110
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
SaveAlertReportComponent.constructor
constructor(public activeModal: NgbActiveModal, // private accountService: AccountService, private reportService: AlertReportService, private utmToastService: UtmToastService, private elasticDataExportService: ElasticDataExportService, ) { }
// private user: User;
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/data-management/alert-management/alert-reports/shared/components/save-report/save-report.component.ts#L33-L39
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
SaveAlertReportComponent.applyLimit
applyLimit(limit) { this.limit = limit; }
// }
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/data-management/alert-management/alert-reports/shared/components/save-report/save-report.component.ts#L69-L71
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
AlertViewComponent.resolveDataType
resolveDataType(): Promise<EventDataTypeEnum> { return new Promise<EventDataTypeEnum>(resolve => { const indexOfIsIncident = this.filters.findIndex(value => value.field === ALERT_INCIDENT_FLAG_FIELD && value.operator === ElasticOperatorsEnum.IS); const indexOfIsAlert = this.filters.findIndex(val...
/** * Return EventDataTypeEnum based on filters * Check if exist any incident field with operator IS, if exist return INCIDENT * Check if exist any isAlert field with operator IS, if exist return ALERT * else return EVENT */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/data-management/alert-management/alert-view/alert-view.component.ts#L240-L254
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
AlertViewComponent.resolveFieldByDataTypeEnum
resolveFieldByDataTypeEnum(type: EventDataTypeEnum) { switch (type) { case EventDataTypeEnum.ALERT: return EVENT_IS_ALERT; case EventDataTypeEnum.EVENT: return null; case EventDataTypeEnum.INCIDENT: return ALERT_INCIDENT_FLAG_FIELD; } }
/** * Resolve field based on EventDataTypeEnum * @param type EventDataTypeEnum */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/data-management/alert-management/alert-view/alert-view.component.ts#L260-L270
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
AlertViewComponent.setDefaultParams
setDefaultParams() { const indexTime = this.filters.findIndex(value => value.field === ALERT_TIMESTAMP_FIELD); if (indexTime !== -1) { this.defaultTime = new ElasticFilterDefaultTime(this.filters[indexTime].value[0], this.filters[indexTime].value[1]); } else { this.defaultTime = new ElasticFilte...
/** * After merge filter set default values to params new values */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/data-management/alert-management/alert-view/alert-view.component.ts#L275-L286
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
AlertViewComponent.getCurrentStatus
getCurrentStatus(): number { return getCurrentAlertStatus(this.filters); }
/** * Return current status value from filter */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/data-management/alert-management/alert-view/alert-view.component.ts#L291-L293
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
AlertRulesService.query
query(query: any): Observable<HttpResponse<AlertRuleType[]>> { const options = createRequestOption(query); return this.http.get<AlertRuleType[]>(this.resourceUrl , {params: options, observe: 'response'}); }
/** * Find alert-rules by filters */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/data-management/alert-management/shared/services/alert-rules.service.ts#L22-L25
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
AlertRulesService.delete
delete(id: number): Observable<HttpResponse<any>> { return this.http.delete(`${this.resourceUrl}/${id}`, {observe: 'response'}); }
/** * Delete a rule */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/data-management/alert-management/shared/services/alert-rules.service.ts#L30-L32
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
BucketAggregationComponent.changeFieldTextToKeyword
changeFieldTextToKeyword($event, index: number) { if ($event.type === ElasticDataTypesEnum.TEXT) { this.buckets.at(index).get('field').setValue($event.name + '.keyword'); } }
// }
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/graphic-builder/chart-builder/chart-property-builder/bucket-aggregation/bucket-aggregation.component.ts#L203-L207
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
BucketAggregationComponent.buildBucketObject
private buildBucketObject(): MetricBucketsType { const arr: MetricBucketsType[] = this.buckets.value ? this.buckets.value : []; if (arr.length > 1) { for (let i = 0; i < arr.length; i++) { if (arr[i + 1] !== undefined) { arr[i].subBucket = arr[i + 1]; } } } return a...
/** * Build object bucket hierarchical */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/graphic-builder/chart-builder/chart-property-builder/bucket-aggregation/bucket-aggregation.component.ts#L234-L244
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
GoalPropertiesOptionComponent.ngOnInit
ngOnInit() { this.initFormGoalOption(); this.metricDataBehavior.$metricDeletedId.subscribe(id => { const indexOption = this.options.controls.findIndex(value => value.get('goalId').value === id); if (indexOption > -1) { this.deleteOption(indexOption); } }); this.metricD...
// }
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/graphic-builder/chart-builder/chart-property-builder/charts/goal-properties-option/goal-properties-option.component.ts#L49-L75
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
ListColumnsComponent.buildBucketObject
private buildBucketObject(): MetricBucketsType { const arr: MetricBucketsType[] = this.columns.value ? this.columns.value : []; if (arr.length > 1) { for (let i = 0; i < arr.length; i++) { if (arr[i + 1] !== undefined) { arr[i].subBucket = arr[i + 1]; } } } return a...
/** * Build object bucket hierarchical */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/graphic-builder/chart-builder/chart-property-builder/list-columns/list-columns.component.ts#L135-L145
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
DashboardCreateComponent.getVisualizationToAdd
getVisualizationToAdd(id: number): Promise<boolean> { return new Promise<boolean>(resolve => { this.visualizationService.find(id).subscribe(response => { // call method to select visualization to avoid conflict and code repetition this.onVisSelected([response.body], true); }); reso...
/** * After get callback from created visualization need to add to current layout dasboard * @param id Visualization ID */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/graphic-builder/dashboard-builder/dashboard-create/dashboard-create.component.ts#L144-L152
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
DashboardCreateComponent.orderLayout
orderLayout() { let gr = this.gridsterItems.toArray(); gr = gr.sort((a, b) => { return a.item.y - b.item.y || a.item.x - b.item.x; }); return gr; }
/** * sort array by y and x position */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/graphic-builder/dashboard-builder/dashboard-create/dashboard-create.component.ts#L200-L206
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
DashboardCreateComponent.onVisSelected
onVisSelected($event: VisualizationType[], override?: boolean) { console.log('EVENT:', $event); for (const vis of $event) { const indexVis = this.layout.findIndex(value => value.visualization.id === vis.id); vis.chartConfig = (typeof vis.chartConfig === 'string' && vis.chartType !== ChartTypeEnum.TE...
/** * Add visualization to dashboard layout * @param $event Visualization array * @param override Attribute to determine if override visualization in layout */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/graphic-builder/dashboard-builder/dashboard-create/dashboard-create.component.ts#L216-L233
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
DashboardCreateComponent.deleteVisualization
deleteVisualization(item: { grid: GridsterItem; visualization: VisualizationType }) { if (this.dashboardId) { const index = this.visDashboard.findIndex(value => Number(value.idDashboard) === Number(this.dashboardId) && Number(value.idVisualization) === Number(item.visualization.id)); const visDa...
/** * If editing add id to tempDelete array for delete after save dashboard * @param item Item grid to delete */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/graphic-builder/dashboard-builder/dashboard-create/dashboard-create.component.ts#L281-L291
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
DashboardSaveComponent.getMenuEdit
getMenuEdit() { const query = new QueryType(); query.add('dashboardId', this.dashboard.id, Operator.equals); this.menuService.query(query).subscribe(menus => { if (menus.body.length > 0) { this.idMenu = menus.body[0].id; this.authority = menus.body[0].authorities; this.subMenuN...
/** * Set menu var if dashboard is already in navigation abr */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/graphic-builder/dashboard-builder/dashboard-save/dashboard-save.component.ts#L121-L137
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
DashboardSaveComponent.creatingVisualizationsRecords
creatingVisualizationsRecords(dashboard: UtmDashboardType): Promise<string> { return new Promise<string>((resolve, reject) => { // for (const item of this.grid) { const promises = []; for (let j = 0; j < this.grid.length; j++) { const item = this.grid[j]; const query = { ...
/** * Check in database that relations do not exist to create new one * @param dashboard Dashboard to save */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/graphic-builder/dashboard-builder/dashboard-save/dashboard-save.component.ts#L172-L204
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
ChartViewComponent.forceSingle
forceSingle(): boolean { return (this.visualization.chartType === ChartTypeEnum.BAR_CHART || this.visualization.chartType === ChartTypeEnum.BAR_HORIZONTAL_CHART) && this.data[0].series.length === 1 && (this.visualization.aggregationType.bucket !== null && this.visualization.aggregationType.bucket....
/** * This method return if click navigation behavior will treated as single one */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/graphic-builder/shared/components/viewer/chart-view/chart-view.component.ts#L104-L109
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
ChartViewComponent.onChartChange
onChartChange() { if (typeof this.visualization.chartConfig === 'string') { this.visualization.chartConfig = JSON.parse(this.visualization.chartConfig); } this.echartOption = deleteNullValues(this.chartFactory.createChart( this.chart, this.data, this.visualization, this.exportF...
/** * Build echart object */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/graphic-builder/shared/components/viewer/chart-view/chart-view.component.ts#L132-L143
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
MapViewComponent.onChartChange
onChartChange() { // set center this.mapOption = this.visualization.chartConfig.leaflet; const centerLat = (this.data && this.data.length > 0) ? this.data[0].value[0] : this.mapOption.center[0]; const centerLng = (this.data && this.data.length > 0) ? this.data[0].value[1] : this.mapOption.center[1]; ...
/** * Build echart object */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/graphic-builder/shared/components/viewer/map-view/map-view.component.ts#L145-L210
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
TableViewComponent.processVisNameToCsvName
processVisNameToCsvName(): string { let str = this.visualization.name; str = str.replace(/\W+(?!$)/g, '-').toLowerCase(); str = str.replace(/\W$/, '').toLowerCase(); return str; }
/** * Return clean name for csv based on visualization name */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/graphic-builder/shared/components/viewer/table-view/table-view.component.ts#L340-L345
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
TableViewComponent.processToCsv
processToCsv(): Promise<Array<any[]>> { return new Promise<Array<any[]>>(resolve => { const dataExport: Array<any[]> = []; // First extract columns to set the first element of exported array to csv, this // way get csv headers this.addColumnsToCsv().then(csvHeader => { dataExport.pus...
/** * Process current data to csv */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/graphic-builder/shared/components/viewer/table-view/table-view.component.ts#L350-L366
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
TableViewComponent.addRowsToCsv
addRowsToCsv(): Promise<any[]> { return new Promise<any[]>(resolve => { const rows: any[] = []; this.data.rows.forEach((rowsData) => { this.convertRowTableTypeToStringArray(rowsData).then(data => { rows.push(data); }); }); resolve(rows); }); }
/** * Process row to convert to acceptable data to export to csv */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/graphic-builder/shared/components/viewer/table-view/table-view.component.ts#L371-L381
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
TableViewComponent.convertRowTableTypeToStringArray
convertRowTableTypeToStringArray(rowsData: { value: any, metric: boolean }[]): Promise<string[]> { return new Promise<string[]>(resolve => { const dataArr: string[] = []; rowsData.forEach(row => { this.addQuoteToData(row.value).then(value => { dataArr.push(value); }); });...
/** * Extract data value for each row * @param rowsData Row object of TableBuilderResponseType row property */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/graphic-builder/shared/components/viewer/table-view/table-view.component.ts#L387-L397
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
TableViewComponent.addColumnsToCsv
addColumnsToCsv(): Promise<string[]> { return new Promise<string[]>(resolve => { const columns: string[] = []; this.data.columns.forEach((col) => { const columnName = col.split('->')[1]; columns.push((columnName === '' || columnName === null || columnName === undefined) ? '\"\"' : column...
/** * Extract table header and covert to acceptable format to export */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/graphic-builder/shared/components/viewer/table-view/table-view.component.ts#L413-L422
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
RunVisualizationService.run
run(visualization: VisualizationType, request: any = {}): Observable<any> { const req = createRequestOption(request); return new Observable<any>(subscriber => { if (typeof visualization.chartConfig !== 'string') { visualization.chartConfig = JSON.stringify(visualization.chartConfig); } ...
/** * Method return observable of visualization run response * @param visualization Visualization to run * @param request optional pagination */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/graphic-builder/shared/services/run-visualization.service.ts#L20-L41
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
UtmChartClickActionService.onClickNavigate
onClickNavigate(visualization: VisualizationType, chartClickAction: EchartClickAction, forceSingle?: boolean) { if (visualization.chartAction.active) { const queryParams = this.chartClickFactory.createParams(visualization, chartClickAction, forceSingle); this.spinner.show('loadingSpinner'); this.r...
/** * @param visualization Visualization * @param chartClickAction EchartClickAction * Manage click route navigation on chart click * @param forceSingle Force to single on charts with multiple buckets, used by single bar chart navigation */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/graphic-builder/shared/services/utm-chart-click-action.service.ts#L25-L36
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
LogAnalyzerTabsComponent.ngOnInit
ngOnInit(): void { this.activatedRoute.queryParams .pipe(takeUntil(this.destroy$)) .subscribe(params => { this.queryId = params.queryId; const isRefresh = params.refreshRoute || null; if (this.queryId) { this.logAnalyzerQueryService.find(this.queryId).subscribe(vis => {...
/*ngOnInit() { this.activatedRoute.queryParams.subscribe(params => { this.queryId = params.queryId; const tabName = params.active || null; if (this.queryId) { this.logAnalyzerQueryService.find(this.queryId).subscribe(vis => { this.query = vis.body; this.addNewTab(this.q...
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/log-analyzer/explorer/log-analyzer-tabs/log-analyzer-tabs.component.ts#L52-L91
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
LogAnalyzerViewComponent.resolveParams
resolveParams(): Promise<any> { return new Promise<any>(resolve => { let origin: any = DataNatureTypeEnum.ALERT; // If query params exist if (this.queryParams) { origin = this.dataNature; // get filters from url and add to current filter parseQueryParamsToFilter(this.queryP...
/** * Resolve params and data nature depending on action */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/log-analyzer/explorer/log-analyzer-view/log-analyzer-view.component.ts#L157-L202
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
LogAnalyzerViewComponent.setFilterSearchOnNatureChange
setFilterSearchOnNatureChange() { const indexFieldIn = this.filters.findIndex(value => value.operator === ElasticOperatorsEnum.IS_IN_FIELD); if (indexFieldIn !== -1) { this.filters[indexFieldIn].field = this.resolvePrefix(); } }
/** * Set prefix is data nature change */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/log-analyzer/explorer/log-analyzer-view/log-analyzer-view.component.ts#L353-L358
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
TabService.addTab
public addTab(tab: TabType): void { this.deactivateAllTabs(); const newTab: TabType = { ...tab, id: this.tabs.length + 1, active: true, }; this.tabs.push(newTab); this.emitTabs(); }
/** * Add a new tab and make it active. * @param tab The tab to add. */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/log-analyzer/shared/services/tab.service.ts#L17-L26
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
TabService.removeTab
public removeTab(index: number): void { this.tabs.splice(index, 1); if (this.tabs.length > 0) { this.tabs[this.tabs.length - 1].active = true; } this.emitTabs(); }
/** * Remove a tab by index. Activates the last tab if any remain. * @param index The index of the tab to remove. */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/log-analyzer/shared/services/tab.service.ts#L32-L38
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
TabService.setActiveTab
public setActiveTab(tabId: number): void { this.deactivateAllTabs(); const tab = this.tabs.find(t => t.id === tabId); if (tab) { tab.active = true; } this.emitTabs(); }
/** * Set a specific tab as active by its ID. * @param tabId The ID of the tab to activate. */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/log-analyzer/shared/services/tab.service.ts#L44-L51
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
TabService.updateActiveTab
public updateActiveTab(query: LogAnalyzerQueryType): void { const activeTab = this.getActiveTab(); if (activeTab) { activeTab.title = query.name; this.emitTabs(); } }
/** * Update the active tab with new data. * @param query The query containing updated data. */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/log-analyzer/shared/services/tab.service.ts#L57-L63
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
TabService.closeAllTabs
public closeAllTabs(): void { this.tabs = []; this.emitTabs(); }
/** * Close all tabs. */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/log-analyzer/shared/services/tab.service.ts#L68-L71
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
TabService.getActiveTab
public getActiveTab(): TabType | undefined { return this.tabs.find(t => t.active); }
/** * Get the currently active tab. * @returns The active tab, or undefined if no tab is active. */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/log-analyzer/shared/services/tab.service.ts#L77-L79
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
TabService.deleteActiveTab
public deleteActiveTab(): void { const activeIndex = this.tabs.findIndex(t => t.active); if (activeIndex !== -1) { this.tabs.splice(activeIndex, 1); if (this.tabs.length > 0) { this.tabs[this.tabs.length - 1].active = true; } this.emitTabs(); } }
/** * Delete the currently active tab. */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/log-analyzer/shared/services/tab.service.ts#L84-L93
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
TabService.getTabCount
public getTabCount(): number { return this.tabs.length; }
/** * Get the total number of tabs. * @returns The number of tabs. */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/log-analyzer/shared/services/tab.service.ts#L99-L101
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
TabService.deactivateAllTabs
private deactivateAllTabs(): void { this.tabs.forEach(t => (t.active = false)); }
/** * Deactivate all tabs. */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/log-analyzer/shared/services/tab.service.ts#L106-L108
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
TabService.emitTabs
private emitTabs(): void { this.tabSubject.next(this.tabs); }
/** * Emit the latest state of the tabs. */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/log-analyzer/shared/services/tab.service.ts#L113-L115
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
ReportTemplateResultComponent.getTemplate
getTemplate() { this.reportsService.find(this.reportId).subscribe(response => { this.report = response.body; if (this.report.dashboardId) { this.loadVisualizations(this.report.dashboardId); } }); }
/** * Return template */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/report/report-template-result/report-template-result.component.ts#L74-L81
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
SectionReportService.constructor
constructor(private http: HttpClient) { }
// GET /api/GET /api/utm-reportSectionnologies
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/report/shared/service/section-report.service.ts#L15-L16
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
AssetsDashboardComponent.getHostsByModificationTime
getHostsByModificationTime() { this.loadingLineOption = true; this.assetDashboardService.hostsByModificationTime().subscribe(value => { this.loadingLineOption = false; this.multilineOption = this.multilineSeverityDef.buildChartHostsByModificationTime(value.body); }); }
// multiline chart
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/scanner/assets-discovery/assets-dashboard/assets-dashboard.component.ts#L83-L89
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
AssetsDashboardComponent.getHostsBySeverityClass
getHostsBySeverityClass() { this.loadingPieOption = true; this.assetDashboardService.hostsBySeverityClass().subscribe(value => { this.loadingPieOption = false; if (value.body !== null) { this.pieOption = this.pieSeverityClassDef.buildChartBySeverityClass(value.body[0]); } }); }
// severity chart
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/scanner/assets-discovery/assets-dashboard/assets-dashboard.component.ts#L92-L100
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
AssetsDashboardComponent.getMostVulnerableHost
getMostVulnerableHost(assets: AssetModel[]) { this.loadingBarHostVulnerabilitiesOption = true; this.assetDashboardService.mostVulnerableHost().subscribe(value => { this.barHostVulnerabilitiesOption = this.barHostDef.buildCharMostVulnerableHost(value.body[0], assets); this.loadingBarHostVulnerabiliti...
// end severity chart
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/scanner/assets-discovery/assets-dashboard/assets-dashboard.component.ts#L108-L114
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
AssetsHostDetailComponent.onError
private onError(error) { // this.alertService.error(error.error, error.message, null); }
// }
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/scanner/assets-discovery/assets-host-detail/assets-host-detail.component.ts#L186-L188
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
BarHostDef.buildCharOperatingSystemsByVulnerabilityScore
public buildCharOperatingSystemsByVulnerabilityScore(chart: OpenvasOptionModel, assets: AssetModel[]) { let barSo: any = {}; this.processMostVulnerableSo(chart, assets).subscribe(barOption => { barSo = { color: UTM_COLOR_THEME, tooltip: { trigger: 'axis', backgroundColo...
// SO build option
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/scanner/assets-discovery/shared/chart/bar-host.def.ts#L77-L138
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
PortRangeListComponent.savePortList
savePortList() { this.portListService.update(this.formPortList.value).subscribe(portCreated => { this.portEdited.emit('success'); this.activeModal.dismiss(); this.utmToastService.showSuccessBottom('Port edited successfully'); }, error1 => { this.utmToastService.showError('Error editing p...
// };
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/scanner/scanner-config/port/port-range/port-range-list/port-range-list.component.ts#L105-L114
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
TargetListComponent.resolveSshCredential
resolveSshCredential(target: TargetModel) { let credential = ''; if (target.sshCredential.name !== null) { credential += target.sshCredential.name; if (target.sshCredential.port !== null) { credential += ' on port ' + target.sshCredential.port; } } else { credential = ''; ...
// }
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/scanner/scanner-config/target/target-list/target-list.component.ts#L148-L159
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
TaskElementViewResolverService.resolveTrendClass
resolveTrendClass(trend: TaskTrendEnum): string { if (trend === TaskTrendEnum.UP || trend === TaskTrendEnum.MORE) { return 'badge-danger'; } else if (trend === TaskTrendEnum.LESS || trend === TaskTrendEnum.DOWN) { return 'badge-success'; } else { return 'badge-primary'; } }
// up|down|more|less|same
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/scanner/scanner-config/task/shared/services/task-element-view-resolver.service.ts#L54-L62
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
UtmAlertErrorService.constructor
constructor(private translateService: TranslateService, public alertService: UtmToastService ) { /* tslint:enable */ // this.cleanHttpErrorListener = eventManager.subscribe('inverdiamond.httpError', response => { // const httpErrorResponse = response.content; // console.log(response)...
/* tslint:disable */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/shared/alert/utm-alert-error.service.ts#L11-L33
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
TagCloud.randomIndex
randomIndex(min, max) { return Math.floor(Math.random() * (max - min + 1) + min); }
// ].join(',') + ')'
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/shared/chart/factories/echart-factory/charts/tag-cloud.ts#L64-L66
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
HeaderMenuNavigationComponent.showAdMenu
showAdMenu(menu: Menu) { return !menu.url.includes('active-directory') && menu.menuActive; }
/** * Determine if show AD or not based on service * @param menu MenuNavType */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/shared/components/layout/header/header-menu-navigation/header-menu-navigation.component.ts#L56-L58
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
ElasticFilterTimeComponent.applyRange
applyRange() { if (this.isValidDate()) { this.dateTo = this.extractDate(this.rangeTimeTo, this.timeTo); this.dateFrom = this.extractDate(this.rangeTimeFrom, this.timeFrom); if (this.isEmitter) { this.timeFilterBehavior.$time.next({ from: this.extractDate(this.rangeTimeFrom, this....
/*isValidDate() { if (this.rangeTimeFrom && this.rangeTimeTo) { const from = Number(new Date(this.extractDate(this.rangeTimeFrom, this.timeFrom)).getTime()); const to = Number(new Date(this.extractDate(this.rangeTimeTo, this.timeTo)).getTime()); return to - from >= 0; } else { return fal...
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/shared/components/utm/filters/elastic-filter-time/elastic-filter-time.component.ts#L191-L206
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
ElasticFilterTimeComponent.onTimeFromChange
onTimeFromChange() { this.updateMaxDates('from'); // Update maxDates when timeFrom changes }
// Function called every time the 'timeFrom' date is changed
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/shared/components/utm/filters/elastic-filter-time/elastic-filter-time.component.ts#L229-L231
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
ElasticFilterTimeComponent.onTimeToChange
onTimeToChange() { this.updateMaxDates('to'); // Update maxDates when timeTo changes }
// Function called every time the 'timeTo' date is changed
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/shared/components/utm/filters/elastic-filter-time/elastic-filter-time.component.ts#L234-L236
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
ElasticFilterTimeComponent.updateMaxDates
updateMaxDates(type: 'from' | 'to') { if (this.rangeTimeFrom && type === 'from') { const maxDateTo = new Date(this.rangeTimeFrom.year, this.rangeTimeFrom.month - 1, this.rangeTimeFrom.day); maxDateTo.setDate(maxDateTo.getDate() + 30); // Set maxDateTo to 30 days after timeFrom this.maxDateTo = { ...
// Update the maxDate values based on selected 'timeFrom' and 'timeTo' dates
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/shared/components/utm/filters/elastic-filter-time/elastic-filter-time.component.ts#L239-L259
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
ElasticFilterAddComponent.setFilterEdit
setFilterEdit() { this.formFilter.patchValue(this.filter); this.getOperators(); this.isMultipleSelectValue(); if (this.applySelectFilter()) { if (this.field.type === ElasticDataTypesEnum.DATE || (this.field.type === ElasticDataTypesEnum.TEXT && !this.field.name.includes('.keyword'))) { ...
/** * Edit Filter */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/shared/components/utm/filters/utm-elastic-filter/elastic-filter-add/elastic-filter-add.component.ts#L100-L116
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
ElasticFilterAddComponent.selectOperator
selectOperator($event) { if (this.formFilter.get('operator').value === this.operatorEnum.IS_ONE_OF || this.formFilter.get('operator').value === this.operatorEnum.IS_NOT_ONE_OF) { this.addValidatorToValue(); // Only get values of field that are atomic(keyword, number) if (this.field.type === ...
/** * On operator clicked, determine if cant get field values or not * @param $event Operator */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/shared/components/utm/filters/utm-elastic-filter/elastic-filter-add/elastic-filter-add.component.ts#L131-L145
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
ElasticFilterAddComponent.addValidatorToValue
addValidatorToValue() { this.formFilter.get('value').setValidators(Validators.required); this.formFilter.get('value').updateValueAndValidity(); this.formFilter.updateValueAndValidity(); }
/** * Add validator to input */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/shared/components/utm/filters/utm-elastic-filter/elastic-filter-add/elastic-filter-add.component.ts#L150-L154
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
ElasticFilterAddComponent.cancelValidatorToValue
cancelValidatorToValue() { this.formFilter.get('value').setValidators(null); this.formFilter.get('value').updateValueAndValidity(); this.formFilter.updateValueAndValidity(); }
/** * Clear validator to input */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/shared/components/utm/filters/utm-elastic-filter/elastic-filter-add/elastic-filter-add.component.ts#L159-L163
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
ElasticFilterAddComponent.extractFieldDataType
extractFieldDataType(): string { const field = this.formFilter.get('field').value; const index = this.fields.findIndex(value => value.name === field); return this.fields[index].type; }
/** * Return field data type */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/shared/components/utm/filters/utm-elastic-filter/elastic-filter-add/elastic-filter-add.component.ts#L187-L191
e00c7c4742b5ce01932668d00f6a87bb5307505d
UTMStack
github_2023
utmstack
typescript
ElasticFilterAddComponent.changeField
changeField($event) { // this.formFilter.get('field').setValue($event.name); this.formFilter.get('value').setValue(null); this.formFilter.get('operator').setValue(null); this.getOperators(); this.isMultipleSelectValue(); }
/** * When change field, refresh operator based on field data type, refresh multiple bar * @param $event Field */
https://github.com/utmstack/UTMStack/blob/e00c7c4742b5ce01932668d00f6a87bb5307505d/frontend/src/app/shared/components/utm/filters/utm-elastic-filter/elastic-filter-add/elastic-filter-add.component.ts#L201-L207
e00c7c4742b5ce01932668d00f6a87bb5307505d