Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
01f44ee
ORCT-97-fills
Ehevi Jul 25, 2023
81b1a0c
Change share link icon
Ehevi Jul 25, 2023
59d415d
Make copyLinkButton a separate component
Ehevi Jul 25, 2023
cfc5f43
Snackbar
Ehevi Jul 25, 2023
977a334
Flex row gap
Ehevi Jul 25, 2023
6b8c371
Link icon
Ehevi Jul 25, 2023
fd619df
Rename PrimaryModel
Ehevi Jul 25, 2023
747ed91
Use default rows on site parameter
Ehevi Jul 25, 2023
27d69cf
Data access
Ehevi Jul 25, 2023
dd01ca0
indexChip cleanup :broom:
Ehevi Jul 25, 2023
91e2327
Apply eslint rules
Ehevi Jul 25, 2023
635128b
Rename Navigation Model
Ehevi Jul 25, 2023
8ce0b55
Fix
Ehevi Jul 25, 2023
c875101
Fix flags index chips
Ehevi Jul 25, 2023
618b3c4
Test
Ehevi Jul 25, 2023
510b304
Make title model independent
Ehevi Jul 25, 2023
e03a079
Move title to the components catalog
Ehevi Jul 25, 2023
4415e03
Clear filters cleanup
Ehevi Jul 25, 2023
027eadd
Use navigation model
Ehevi Jul 25, 2023
b95d3c7
Address review comments
Ehevi Jul 25, 2023
d68d96e
Address review comments
Ehevi Jul 25, 2023
7cc122c
Apply review comments
Ehevi Jul 25, 2023
d793c65
Address review comments
Ehevi Jul 25, 2023
d7750ba
Mode name
Ehevi Jul 25, 2023
f238231
Address review comments
Ehevi Jul 25, 2023
d692dcc
Fix model mode name
Ehevi Jul 26, 2023
90c6d6f
Fix waiting panel bug :bug:
Ehevi Jul 26, 2023
5a7b6ba
Remove unused files
Ehevi Jul 26, 2023
0c9a07a
IndexChip cleanup :broom:
Ehevi Jul 26, 2023
b3ed409
Address review comments
Ehevi Jul 26, 2023
86768da
Apply eslint rules
Ehevi Jul 26, 2023
32df041
Address review comments
Ehevi Jul 26, 2023
62cb31c
Change noRunNumbers variable name
Ehevi Jul 26, 2023
9cd038a
Address review comments
Ehevi Jul 26, 2023
221cdb8
JS docs
Ehevi Jul 26, 2023
00be7ff
Address review comments
Ehevi Jul 26, 2023
579f67b
Address review comments
Ehevi Jul 26, 2023
66dc725
Address review comments
Ehevi Jul 26, 2023
2b14512
Address review comments
Ehevi Jul 26, 2023
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
12 changes: 10 additions & 2 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,20 @@ _DEF_ML_HOST=alimonitor.cern.ch
_DEF_ML_PROT=https

### bkp
RCT_EP_BK_RUNS_PROT=https
RCT_EP_BK_PROT=https
RCT_EP_BK_HOST=$_DEF_BK_HOST

### bkp runs
RCT_EP_BK_RUNS_PROT=$RCT_EP_BK_PROT
RCT_EP_BK_RUNS_HOST=$_DEF_BK_HOST
RCT_EP_BK_RUNS_PATH=${RCT_EP_BK_RUNS_PATH:-/api/runs?filter[definitions]=PHYSICS}

### bkp lhc fills
RCT_EP_BK_FILLS_PROT=$RCT_EP_BK_PROT
RCT_EP_BK_FILLS_HOST=$_DEF_BK_HOST
RCT_EP_BK_FILLS_PATH=${RCT_EP_BK_FILLS_PATH:-/?page=lhc-fill-details}

### data passes
### ml data passes
RCT_EP_ML_DP_RAW_PROT=$_DEF_ML_PROT
RCT_EP_ML_DP_RAW_HOST=$_DEF_ML_HOST
RCT_EP_ML_DP_RAW_PATH=${RCT_EP_ML_DP_RAW_PATH:-/production/raw.jsp?res_path=json}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@
* granted to it by virtue of its status as an Intergovernmental Organization
* or submit itself to any jurisdiction.
*/
const { ResProvider } = require('../../lib/utils');

/**
* This object defines metadata required to proceed posting data
* currently at which columns there will not be input and what is target table in backend side
*/
const postingDataConfig = {
flags: {
excludedFields: ['id'],
targetTable: 'flags',
const lhcFills = {
url: ResProvider.getServiceEndpoint('BK_FILLS'),
params: {
fillNumber: 'fillNumber',
},
};

export default postingDataConfig;
const bookkeeping = {
lhcFills: lhcFills,
};

module.exports = { bookkeeping };
19 changes: 19 additions & 0 deletions app/config/outerServices/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* @license
* Copyright 2019-2020 CERN and copyright holders of ALICE O2.
* See http://alice-o2.web.cern.ch/copyright for details of the copyright holders.
* All rights not expressly granted are reserved.
*
* This software is distributed under the terms of the GNU General Public
* License v3 (GPL Version 3), copied verbatim in the file "COPYING".
*
* In applying this license CERN does not waive the privileges and immunities
* granted to it by virtue of its status as an Intergovernmental Organization
* or submit itself to any jurisdiction.
*/

const { bookkeeping } = require('./bookkeeping.js');

module.exports = {
bookkeeping,
};
2 changes: 2 additions & 0 deletions app/config/public.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
*/

const { roles, detectors, pageNames, filterTypes, filterInputTypes, fieldNames, quality } = require('./rct-data');
const { bookkeeping } = require('./outerServices');

module.exports = { // Properties that will be provided to frontend in the public folder
outerServices: { bookkeeping },
filterTypes: filterTypes,
filterInputTypes: filterInputTypes,

Expand Down
2 changes: 1 addition & 1 deletion app/lib/utils/ResProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class ResProvider {
}

static getServiceEndpoint(serviceAbbr) {
// BK-RUNS, ML-DP, ML-MC
// BK_RUNS, BK_FILLS, ML_DP, ML_MC
const varsDef = {};
varsDef[`RCT_EP_${serviceAbbr}_PROT`] = 'prot';
varsDef[`RCT_EP_${serviceAbbr}_HOST`] = 'host';
Expand Down
14 changes: 7 additions & 7 deletions app/public/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/

import { Observable, sessionService, QueryRouter, Loader } from '/js/src/index.js';
import PrimaryModel from './model/PrimaryModel.js';
import DataAccessModel from './model/DataAccessModel.js';
import ServiceUnavailableModel from './model/ServiceUnavailableModel.js';
import { RCT } from './config.js';
import Flags from './views/flags/Flags.js';
Expand Down Expand Up @@ -57,9 +57,9 @@ export default class Model extends Observable {
const { status, result, ok } = await this.postLoginPasses(username);
this._tokenExpirationHandler(status);
if (ok) {
this.setPrimary();
this.setDataAccessSubmodel();
} else if (/5\d\d/.test(status)) {
this.setServiceUnavailable(result);
this.setServiceUnavailableModel(result);
}
}

Expand Down Expand Up @@ -88,7 +88,7 @@ export default class Model extends Observable {
return [roles.dict.Guest];
}

setServiceUnavailable(result) {
setServiceUnavailableModel(result) {
const messageShowTimeout = 200;
const modeName = 'serviceUnavailable';
if (!this.submodels[modeName]) {
Expand All @@ -108,10 +108,10 @@ export default class Model extends Observable {
}, messageShowTimeout);
}

setPrimary() {
const modeName = 'primary';
setDataAccessSubmodel() {
const modeName = 'dataAccess';
localStorage.token = sessionService.session.token;
this.submodels[modeName] = new PrimaryModel(this);
this.submodels[modeName] = new DataAccessModel(this);
this.submodels[modeName].bubbleTo(this);
this.mode = modeName;
this.notify();
Expand Down
51 changes: 51 additions & 0 deletions app/public/components/buttons/copyLinkButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* @license
* Copyright 2019-2020 CERN and copyright holders of ALICE O2.
* See http://alice-o2.web.cern.ch/copyright for details of the copyright holders.
* All rights not expressly granted are reserved.
*
* This software is distributed under the terms of the GNU General Public
* License v3 (GPL Version 3), copied verbatim in the file "COPYING".
*
* In applying this license CERN does not waive the privileges and immunities
* granted to it by virtue of its status as an Intergovernmental Organization
* or submit itself to any jurisdiction.
*/

import { h } from '/js/src/index.js';
import snackBar from '../snackBars/snackBar.js';

/**
* @param {string} url - url that will be returned to the user
* @returns a button that once clicked will add the url to the user's clipboard
*/

export default function copyLinkButton(url) {
const snackBarId = `${url}-copied`;
const thisButtonId = `${url}-copy-link-button`;
const thisButtonContentId = `${thisButtonId}-content`;

return h('button.btn.btn-secondary.icon-only-button', {
id: thisButtonId,
onclick: () => {
navigator.clipboard.writeText(url)
.then(() => {
const snackbar = document.getElementById(snackBarId);
const thisButton = document.getElementById(thisButtonId);
const thisButtonContent = document.getElementById(thisButtonContentId);
snackbar.style.display = 'flex';

document.addEventListener('click', (event) => {
if (thisButton != event.target && thisButtonContent != event.target) {
snackbar.style.display = 'none';
}
});
})
.catch((e) => {
snackBar(e, snackBarId);
});
},
}, h('.link-20-primary.abs-center', {
id: thisButtonContentId,
}), snackBar(h('.flex-row.items-center.gap-0-5', h('.done-10-primary'), 'Copied!'), snackBarId));
}
29 changes: 16 additions & 13 deletions app/public/components/chips/indexChip.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,32 @@

import { h } from '/js/src/index.js';
import { RCT } from '../../config.js';
const { dataReqParams, pageNames } = RCT;
const { pageNames } = RCT;

export default function indexChip(model, index) {
/**
* @param {Observable} model - provides a set of functions
* @param {string} pageName - name of the page
* @param {string} index - index of the item on page
* @returns - button that navigates user to the related (page, index) view
*/

export default function indexChip(model, pageName, index) {
const dataPointer = model.getCurrentDataPointer();
const { page } = dataPointer;
const data = model.fetchedData[dataPointer.page][dataPointer.index].payload;
const { fields } = data;
const firstField = fields.find((f) => f !== undefined && f.name);
const targetUrl = `/?page=${page}&index=${index}&${dataReqParams.rowsOnSite}=50&${dataReqParams.site}=1&sorting=-${firstField.name}`;
const currentPage = dataPointer.page;

return page !== pageNames.periods && model.fetchedData[page][index]
return currentPage !== pageNames.periods && model.fetchedData[currentPage][index] && currentPage === pageName
? h('.chip.flex-wrap.justify-between.items-center', {
id: `chip-${page}-${index}`,
class: dataPointer.index === index && dataPointer.page === page ? 'primary' : '',
id: `chip-${currentPage}-${index}`,
class: dataPointer.index === index ? 'primary' : '',
},
h('button.btn.transparent', { onclick: () => {
model.router.go(targetUrl);
model.navigation.go(currentPage, index);
} }, index),
h('button.btn.icon-only-button.transparent', {
onclick: () => {
model.removeSubPage(page, index);
model.removeSubPage(currentPage, index);
model.notify();
},
}, dataPointer.index === index && dataPointer.page === page ? h('.close-20-off-white') : h('.close-20-primary')))
}, dataPointer.index === index ? h('.close-20-off-white') : h('.close-20-primary')))
: '';
}
11 changes: 7 additions & 4 deletions app/public/components/flags/flagBreadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@

import { h } from '/js/src/index.js';
import flagsIndexChip from './flagsIndexChip.js';
import title from '../../views/userView/data/table/title.js';
import title from '../table/title.js';
import { extractPeriodName } from '../../utils/dataProcessing/dataProcessingUtils.js';
import { RCT } from '../../config.js';
const { pageNames } = RCT;

export default function flagBreadCrumbs(model, dataPass, run, detector) {
return [
title(model),
title(pageNames.flags),
h('.forward-20'),
h('h3.ph-15.text-primary', dataPass),
flagsIndexChip(model.navigation, pageNames.dataPasses, extractPeriodName(dataPass), dataPass),
h('.forward-20'),
flagsIndexChip(model, 'run', run),
flagsIndexChip(model.navigation, pageNames.runsPerDataPass, dataPass, run),
h('.forward-20'),
h('h3.ph-15.text-primary', detector),
];
Expand Down
7 changes: 2 additions & 5 deletions app/public/components/flags/flagsIndexChip.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@

import { h } from '/js/src/index.js';

export default function flagsIndexChip(model, targetPage, label) {
export default function flagsIndexChip(navigation, targetPage, targetIndex, label) {
return h('.chip', {
id: `chip-${targetPage}-${label}`,
},
h('button.btn.transparent', { onclick: () => {
// TODO once url scheme is confirmed
// eslint-disable-next-line max-len
// Model.router.go(`/?page=${targetPage}&index=${index}&${dataReqParams.rowsOnSite}=50&${dataReqParams.site}=1&sorting=-${firstField.name}`);
history.back();
navigation.go(targetPage, targetIndex);
} }, label));
}
26 changes: 26 additions & 0 deletions app/public/components/snackBars/snackBar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* @license
* Copyright 2019-2020 CERN and copyright holders of ALICE O2.
* See http://alice-o2.web.cern.ch/copyright for details of the copyright holders.
* All rights not expressly granted are reserved.
*
* This software is distributed under the terms of the GNU General Public
* License v3 (GPL Version 3), copied verbatim in the file "COPYING".
*
* In applying this license CERN does not waive the privileges and immunities
* granted to it by virtue of its status as an Intergovernmental Organization
* or submit itself to any jurisdiction.
*/

import { h } from '/js/src/index.js';

export default function snackBar(message, id = null) {
const snackBarId = id ? id : `snackbar-${message}`;
return h('button.snackbar', {
id: snackBarId,
onclick: () => {
const snackbar = document.getElementById(snackBarId);
snackbar.style.display = 'none';
},
}, message);
}
2 changes: 1 addition & 1 deletion app/public/components/table/pager.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function pager(model, data, pagerOnly = true) {
const currentSite = Number(Object.fromEntries(data.url.searchParams.entries())[site]);

const pageButton = (targetSite) => {
const url = replaceUrlParams(data.url, [[site, targetSite]]);
const url = replaceUrlParams(data.url, { [RCT.dataReqParams.site]: targetSite });
return viewButton(
model,
targetSite,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
*/

import { h } from '/js/src/index.js';
import { RCT } from '../../../../config.js';
import { RCT } from '../../config.js';
const { pageNames } = RCT;

export default function title(model) {
const { page } = model.getCurrentDataPointer();

export default function title(page) {
const pageTitle = () => {
switch (page) {
case pageNames.periods: return 'Periods';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import { Observable, Loader } from '/js/src/index.js';
import FetchedDataManager from './data/FetchedDataManager.js';
import { defaultIndex, defaultIndexString } from '../utils/defaults.js';
import Navigation from './navigation/NavModel.js';
import Navigation from './navigation/Navigation.js';

export default class PrimaryModel extends Observable {
export default class DataAccessModel extends Observable {
constructor(parent) {
super();
this.parent = parent;
Expand Down
12 changes: 6 additions & 6 deletions app/public/model/data/FetchedDataManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ import { RemoteData, Loader } from '/js/src/index.js';
import FetchedData from './FetchedData.js';
import { replaceUrlParams } from '../../utils/url/urlUtils.js';
import { RCT } from '../../../config.js';
const { dataReqParams } = RCT;
const { pageNames } = RCT;
const { dataReqParams, defaultDataReqParams, pageNames } = RCT;

/**
* Object of this class provide organization of many FetchedData objects,
Expand All @@ -31,7 +30,7 @@ export default class FetchedDataManager {
this.router = router;
this.loader = new Loader();

this.rowsOnSite = 50;
this.rowsOnSite = defaultDataReqParams.rowsOnSite;

for (const n in pageNames) {
if (Object.prototype.hasOwnProperty.call(pageNames, n)) {
Expand Down Expand Up @@ -122,20 +121,21 @@ export default class FetchedDataManager {

changePage(pageNumber) {
const url = this.router.getUrl();
const newUrl = replaceUrlParams(url, [[dataReqParams.site, pageNumber]]);
const newUrl = replaceUrlParams(url, { [dataReqParams.site]: pageNumber });
this.router.go(newUrl);
}

changeSorting(sorting) {
const url = this.router.getUrl();
const { field, order } = sorting;
const newUrl = replaceUrlParams(url, [['sorting', `${order == -1 ? '-' : ''}${field}`]]);
const newUrl = replaceUrlParams(url, { sorting: `${order == -1 ? '-' : ''}${field}` });
this.router.go(newUrl);
}

changeRowsOnSite(rowsOnSite) {
const url = this.router.getUrl();
const newUrl = replaceUrlParams(url, [[dataReqParams.rowsOnSite, rowsOnSite]]);
this.rowsOnSite = rowsOnSite;
const newUrl = replaceUrlParams(url, { [dataReqParams.rowsOnSite]: this.rowsOnSite });
this.router.go(newUrl);
}

Expand Down
Loading