Compare commits

..

1 Commits

Author SHA1 Message Date
180491cdd2 fix: potential fixes 2024-03-11 15:12:02 +01:00
270 changed files with 8619 additions and 9556 deletions

View File

@@ -0,0 +1,9 @@
---
"@openstapps/node-builder": patch
"@openstapps/database": patch
"@openstapps/node-base": patch
"@openstapps/backend": patch
"@openstapps/app": patch
---
pin alpine version to 3.18 and add healthchecks

1
.envrc
View File

@@ -1 +0,0 @@
use flake

1
.gitignore vendored
View File

@@ -24,7 +24,6 @@ report-junit.xml
# NixOS flake # NixOS flake
result result
hsperfdata_root hsperfdata_root
.direnv/
# Directory for instrumented libs generated by jscoverage/JSCover # Directory for instrumented libs generated by jscoverage/JSCover
lib-cov lib-cov

View File

@@ -2,7 +2,7 @@
/** @type {import('syncpack').RcFile} */ /** @type {import('syncpack').RcFile} */
const config = { const config = {
semverGroups: [{range: ''}], semverRange: '',
source: ['package.json', '**/package.json'], source: ['package.json', '**/package.json'],
indent: ' ', indent: ' ',
sortFirst: [ sortFirst: [
@@ -49,7 +49,7 @@ const config = {
{ {
label: 'Packages should use workspace version', label: 'Packages should use workspace version',
dependencies: ['@openstapps/**'], dependencies: ['@openstapps/**'],
dependencyTypes: ['prod', 'dev', 'peer'], dependencyTypes: ['prod', 'dev'],
packages: ['**'], packages: ['**'],
pinVersion: 'workspace:*', pinVersion: 'workspace:*',
}, },

View File

@@ -1,3 +0,0 @@
nodejs 18.19.1
pnpm 8.15.4
python 3.11.5

View File

@@ -1,20 +1,5 @@
# @openstapps/backend # @openstapps/backend
## 3.2.0
### Minor Changes
- 912ae422: Add the ability to filter by existence of a field
### Patch Changes
- 689ac68b: pin alpine version to 3.18 and add healthchecks
- e8d72683: Backend unit tests break every year
- Updated dependencies [912ae422]
- @openstapps/core@4.0.0
- @openstapps/core-tools@3.0.0
- @openstapps/logger@3.0.0
## 3.1.2 ## 3.1.2
### Patch Changes ### Patch Changes

View File

@@ -1,3 +1,5 @@
// @ts-check
/** /**
* This is the database configuration for the technical university of berlin * This is the database configuration for the technical university of berlin
* *

View File

@@ -1,3 +1,4 @@
// @ts-check
import {SCSettingInputType, SCThingOriginType, SCThingType} from '@openstapps/core'; import {SCSettingInputType, SCThingOriginType, SCThingType} from '@openstapps/core';
/** @type {import('@openstapps/core').SCLanguageSetting} */ /** @type {import('@openstapps/core').SCLanguageSetting} */

View File

@@ -1,3 +1,4 @@
// @ts-check
/** @type {import('@openstapps/core').SCAppConfigurationMenuCategory[]} */ /** @type {import('@openstapps/core').SCAppConfigurationMenuCategory[]} */
const menus = [ const menus = [
{ {

View File

@@ -1,3 +1,4 @@
// @ts-check
import {SCSettingInputType, SCThingOriginType, SCThingType} from '@openstapps/core'; import {SCSettingInputType, SCThingOriginType, SCThingType} from '@openstapps/core';
/** @type {import('@openstapps/core').SCUserGroupSetting} */ /** @type {import('@openstapps/core').SCUserGroupSetting} */

View File

@@ -1,3 +1,4 @@
// @ts-check
import {SCThingType} from '@openstapps/core'; import {SCThingType} from '@openstapps/core';
/** @type {import('@openstapps/core').SCBackendAggregationConfiguration[]} */ /** @type {import('@openstapps/core').SCBackendAggregationConfiguration[]} */

View File

@@ -1,3 +1,4 @@
// @ts-check
import { import {
month, month,
sommerRange, sommerRange,

View File

@@ -1,3 +1,4 @@
// @ts-check
import {SCThingType} from '@openstapps/core'; import {SCThingType} from '@openstapps/core';
import aggregations from './aggregations.js'; import aggregations from './aggregations.js';
import boostings from './boostings.js'; import boostings from './boostings.js';
@@ -16,7 +17,7 @@ export const backend = {
hiddenTypes: [SCThingType.DateSeries, SCThingType.Diff, SCThingType.Floor], hiddenTypes: [SCThingType.DateSeries, SCThingType.Diff, SCThingType.Floor],
mappingIgnoredTags: ['minlength', 'pattern', 'see', 'tjs-format'], mappingIgnoredTags: ['minlength', 'pattern', 'see', 'tjs-format'],
maxMultiSearchRouteQueries: 5, maxMultiSearchRouteQueries: 5,
maxRequestBodySize: 2e6, maxRequestBodySize: 2 * 10 ** 6,
name: 'Goethe-Universität Frankfurt am Main', name: 'Goethe-Universität Frankfurt am Main',
namespace: '909a8cbc-8520-456c-b474-ef1525f14209', namespace: '909a8cbc-8520-456c-b474-ef1525f14209',
sortableFields: [ sortableFields: [

View File

@@ -1,3 +1,4 @@
// @ts-check
import app from './app/index.js'; import app from './app/index.js';
import {backend, internal} from './backend/index.js'; import {backend, internal} from './backend/index.js';

View File

@@ -1,3 +1,5 @@
// @ts-check
/** /**
* This is the default configuration for elasticsearch (a database) * This is the default configuration for elasticsearch (a database)
* *

View File

@@ -1,3 +1,4 @@
// @ts-check
import {readFile} from 'fs/promises'; import {readFile} from 'fs/promises';
import {SCAboutPageContentType} from '@openstapps/core'; import {SCAboutPageContentType} from '@openstapps/core';

View File

@@ -1,3 +1,4 @@
// @ts-check
/** /**
* Generates a range of numbers that represent consecutive calendar months * Generates a range of numbers that represent consecutive calendar months
* *

View File

@@ -1,3 +1,4 @@
// @ts-check
import {readFile, readdir} from 'fs/promises'; import {readFile, readdir} from 'fs/promises';
import url from 'url'; import url from 'url';
import path from 'path'; import path from 'path';

View File

@@ -1,3 +1,4 @@
// @ts-check
import {SCAboutPageContentType} from '@openstapps/core'; import {SCAboutPageContentType} from '@openstapps/core';
import {markdown} from '../../default/tools/markdown.js'; import {markdown} from '../../default/tools/markdown.js';

View File

@@ -1,3 +1,4 @@
// @ts-check
import {SCAboutPageContentType} from '@openstapps/core'; import {SCAboutPageContentType} from '@openstapps/core';
/** @type {import('@openstapps/core').SCAboutPage} */ /** @type {import('@openstapps/core').SCAboutPage} */

View File

@@ -1,3 +1,4 @@
// @ts-check
import about from './about.js'; import about from './about.js';
import imprint from './imprint.js'; import imprint from './imprint.js';
import privacy from './privacy.js'; import privacy from './privacy.js';

View File

@@ -1,3 +1,4 @@
// @ts-check
import {markdown} from '../../default/tools/markdown.js'; import {markdown} from '../../default/tools/markdown.js';
/** @type {import('@openstapps/core').SCAboutPage} */ /** @type {import('@openstapps/core').SCAboutPage} */

View File

@@ -1,3 +1,4 @@
// @ts-check
import aboutPages from './about-pages/index.js'; import aboutPages from './about-pages/index.js';
import defaultApp from '../default/app/index.js'; import defaultApp from '../default/app/index.js';
import {backend as defaultBackend, internal as defaultInternal} from '../default/backend/index.js'; import {backend as defaultBackend, internal as defaultInternal} from '../default/backend/index.js';

View File

@@ -1,3 +1,4 @@
// @ts-check
import {versions} from '../../default/tools/version.js'; import {versions} from '../../default/tools/version.js';
/** @type {import('@openstapps/core').SCAppVersionInfo[]} */ /** @type {import('@openstapps/core').SCAppVersionInfo[]} */

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/backend", "name": "@openstapps/backend",
"description": "A reference implementation for a StApps backend", "description": "A reference implementation for a StApps backend",
"version": "3.2.0", "version": "3.1.2",
"private": true, "private": true,
"type": "module", "type": "module",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
@@ -40,7 +40,7 @@
"start:debug": "cross-env STAPPS_LOG_LEVEL=31 NODE_CONFIG_ENV=elasticsearch ALLOW_NO_TRANSPORT=true node app.js", "start:debug": "cross-env STAPPS_LOG_LEVEL=31 NODE_CONFIG_ENV=elasticsearch ALLOW_NO_TRANSPORT=true node app.js",
"test": "pnpm run test:unit", "test": "pnpm run test:unit",
"test:integration": "sh integration-test.sh", "test:integration": "sh integration-test.sh",
"test:unit": "cross-env NODE_CONFIG_ENV=elasticsearch ALLOW_NO_TRANSPORT=true STAPPS_LOG_LEVEL=0 mocha --exit" "test:unit": "cross-env NODE_CONFIG_ENV=elasticsearch ALLOW_NO_TRANSPORT=true STAPPS_LOG_LEVEL=0 c8 mocha"
}, },
"dependencies": { "dependencies": {
"@elastic/elasticsearch": "8.4.0", "@elastic/elasticsearch": "8.4.0",
@@ -64,7 +64,7 @@
"express-prom-bundle": "6.6.0", "express-prom-bundle": "6.6.0",
"express-promise-router": "4.1.1", "express-promise-router": "4.1.1",
"got": "12.6.0", "got": "12.6.0",
"moment": "2.30.1", "moment": "2.29.4",
"morgan": "1.10.0", "morgan": "1.10.0",
"nock": "13.3.1", "nock": "13.3.1",
"node-cache": "5.1.2", "node-cache": "5.1.2",
@@ -98,9 +98,9 @@
"sinon": "15.0.4", "sinon": "15.0.4",
"sinon-express-mock": "2.2.1", "sinon-express-mock": "2.2.1",
"supertest": "6.3.3", "supertest": "6.3.3",
"ts-node": "10.9.2", "ts-node": "10.9.1",
"tsup": "6.7.0", "tsup": "6.7.0",
"typescript": "5.4.2" "typescript": "5.1.6"
}, },
"tsup": { "tsup": {
"entry": [ "entry": [

View File

@@ -16,7 +16,7 @@
*/ */
import {Logger, SMTP} from '@openstapps/logger'; import {Logger, SMTP} from '@openstapps/logger';
import {MailOptions} from 'nodemailer/lib/sendmail-transport'; import {MailOptions} from 'nodemailer/lib/sendmail-transport';
import Queue from 'promise-queue';
/** /**
* A queue that can send mails in serial * A queue that can send mails in serial
*/ */
@@ -32,80 +32,45 @@ export class MailQueue {
static readonly VERIFICATION_TIMEOUT = 5000; static readonly VERIFICATION_TIMEOUT = 5000;
/** /**
* A queue that saves mails, before the transport is ready. When * A promise that resolves when the last mail was sent
* the transport gets ready this mails are getting pushed in to
* the normal queue.
*/ */
dryQueue: MailOptions[]; last?: Promise<string>;
/**
* A queue that saves mails, that are being sent in series
*/
queue: Queue;
/**
* A counter for the number of verifications that failed
*/
verificationCounter: number;
/** /**
* Creates a mail queue * Creates a mail queue
* @param transport Transport which is used for sending mails * @param transport Transport which is used for sending mails
*/ */
constructor(private readonly transport: SMTP) { constructor(private readonly transport: SMTP) {}
this.queue = new Queue(1);
// this queue saves all request when the transport is not ready yet
this.dryQueue = [];
this.verificationCounter = 0;
// if the transport can be verified it should check if it was done...
this.checkForVerification();
}
/** /**
* Adds a mail into the queue so it gets send when the queue is ready * Wait for the transport to be verified
* @param mail Information required for sending a mail
*/ */
private async addToQueue(mail: MailOptions) { private async waitForVerification() {
return this.queue.add<string>(() => this.transport.sendMail(mail)); for (let i = 0; i < MailQueue.MAX_VERIFICATION_ATTEMPTS; i++) {
} if (this.transport.isVerified()) {
Logger.ok('Transport for mail queue was verified. We can send mails now');
/** return;
* Verify the given transport
*/
private checkForVerification() {
if (this.verificationCounter >= MailQueue.MAX_VERIFICATION_ATTEMPTS) {
throw new Error('Failed to initialize the SMTP transport for the mail queue');
}
if (this.transport.isVerified()) {
Logger.ok('Transport for mail queue was verified. We can send mails now');
// if the transport finally was verified send all our mails from the dry queue
for (const mail of this.dryQueue) {
void this.addToQueue(mail);
} }
} else { await new Promise(resolve => setTimeout(resolve, MailQueue.VERIFICATION_TIMEOUT));
this.verificationCounter++; Logger.warn('Transport not verified yet. Trying to send mails here...');
setTimeout(() => {
Logger.warn('Transport not verified yet. Trying to send mails here...');
this.checkForVerification();
}, MailQueue.VERIFICATION_TIMEOUT);
} }
throw new Error('Failed to initialize the SMTP transport for the mail queue');
} }
/** /**
* Push a mail into the queue so it gets send when the queue is ready * Push a mail into the queue so it gets send when the queue is ready
* @param mail Information required for sending a mail * @param mail Information required for sending a mail
*/ */
public async push(mail: MailOptions) { public async push(mail: MailOptions): Promise<string> {
if (this.transport.isVerified()) { const previousQueue = this.last ?? this.waitForVerification();
await this.addToQueue(mail); this.last = previousQueue.then(() =>
} else { Promise.race([
// the transport has verification, but is not verified yet this.transport.sendMail(mail),
// push to a dry queue which gets pushed to the real queue when the transport is verified new Promise<string>((_, reject) =>
this.dryQueue.push(mail); setTimeout(() => reject(new Error('Timeout')), MailQueue.VERIFICATION_TIMEOUT),
} ),
]),
);
return this.last;
} }
} }

View File

@@ -21,31 +21,16 @@ import {QueryDslSpecificQueryContainer} from '../../types/util.js';
*/ */
export function buildValueFilter( export function buildValueFilter(
filter: SCSearchValueFilter, filter: SCSearchValueFilter,
): ): QueryDslSpecificQueryContainer<'term'> | QueryDslSpecificQueryContainer<'terms'> {
| QueryDslSpecificQueryContainer<'exists'> return Array.isArray(filter.arguments.value)
| QueryDslSpecificQueryContainer<'term'> ? {
| QueryDslSpecificQueryContainer<'terms'> { terms: {
switch (typeof filter.arguments.value) { [`${filter.arguments.field}.raw`]: filter.arguments.value,
case 'undefined': {
return {
exists: {
field: filter.arguments.field,
}, },
}; }
} : {
case 'string': {
return {
term: { term: {
[`${filter.arguments.field}.raw`]: filter.arguments.value, [`${filter.arguments.field}.raw`]: filter.arguments.value,
}, },
}; };
}
case 'object': {
return {
terms: {
[`${filter.arguments.field}.raw`]: filter.arguments.value,
},
};
}
}
} }

View File

@@ -44,7 +44,7 @@ describe('MailQueue', async function () {
clock.tick(MailQueue.VERIFICATION_TIMEOUT * (MailQueue.MAX_VERIFICATION_ATTEMPTS + 1)); clock.tick(MailQueue.VERIFICATION_TIMEOUT * (MailQueue.MAX_VERIFICATION_ATTEMPTS + 1));
}; };
expect(() => test()).to.throw(); expect(test).to.throw();
expect(loggerStub.callCount).to.be.equal(MailQueue.MAX_VERIFICATION_ATTEMPTS); expect(loggerStub.callCount).to.be.equal(MailQueue.MAX_VERIFICATION_ATTEMPTS);
}); });

View File

@@ -14,7 +14,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { import {
SCBook,
SCBulkAddRoute, SCBulkAddRoute,
SCBulkDoneRoute, SCBulkDoneRoute,
SCBulkRequest, SCBulkRequest,
@@ -24,30 +23,29 @@ import {
import {expect} from 'chai'; import {expect} from 'chai';
import {bulk, DEFAULT_TEST_TIMEOUT} from '../common.js'; import {bulk, DEFAULT_TEST_TIMEOUT} from '../common.js';
import {testApp} from '../tests-setup.js'; import {testApp} from '../tests-setup.js';
import {readFile} from 'fs/promises';
import {v4} from 'uuid'; import {v4} from 'uuid';
import bookFile from '@openstapps/core/test/resources/indexable/Book.2.json' assert {type: 'json'};
const book = bookFile.instance as SCBook; const book = JSON.parse(
await readFile('node_modules/@openstapps/core/test/resources/indexable/Book.2.json', 'utf8'),
).instance;
describe('Bulk routes', async function () { describe('Bulk routes', async function () {
// increase timeout for the suite // increase timeout for the suite
this.timeout(DEFAULT_TEST_TIMEOUT); this.timeout(DEFAULT_TEST_TIMEOUT);
let request: SCBulkRequest; const request: SCBulkRequest = {
let bulkRoute: SCBulkRoute; expiration: bulk.expiration,
let bulkAddRoute: SCBulkAddRoute; source: bulk.source,
let bulkDoneRoute: SCBulkDoneRoute; type: bulk.type,
};
const bulkRoute = new SCBulkRoute();
const bulkAddRoute = new SCBulkAddRoute();
const bulkDoneRoute = new SCBulkDoneRoute();
before(function () { // afterEach(async function() {
request = { // TODO: Delete saved bulks
expiration: bulk.expiration, // });
source: bulk.source,
type: bulk.type,
};
bulkRoute = new SCBulkRoute();
bulkAddRoute = new SCBulkAddRoute();
bulkDoneRoute = new SCBulkDoneRoute();
});
it('should create bulk', async function () { it('should create bulk', async function () {
const {status, body, error} = await testApp const {status, body, error} = await testApp

View File

@@ -21,12 +21,7 @@ import {expect} from 'chai';
describe('Index route', async function () { describe('Index route', async function () {
// increase timeout for the suite // increase timeout for the suite
this.timeout(DEFAULT_TEST_TIMEOUT); this.timeout(DEFAULT_TEST_TIMEOUT);
const indexRoute = new SCIndexRoute();
let indexRoute: SCIndexRoute;
before(function () {
indexRoute = new SCIndexRoute();
});
it('should respond with both app and backend configuration', async function () { it('should respond with both app and backend configuration', async function () {
const request: SCIndexRequest = {}; const request: SCIndexRequest = {};

View File

@@ -30,11 +30,15 @@ import chaiAsPromised from 'chai-as-promised';
import {DEFAULT_TEST_TIMEOUT} from '../common.js'; import {DEFAULT_TEST_TIMEOUT} from '../common.js';
import {testApp} from '../tests-setup.js'; import {testApp} from '../tests-setup.js';
import {backendConfig} from '../../src/config.js'; import {backendConfig} from '../../src/config.js';
import registerRequest from '@openstapps/core/test/resources/PluginRegisterRequest.1.json' assert {type: 'json'}; import {readFile} from 'fs/promises';
// for using promises in expectations (to.eventually.be...) // for using promises in expectations (to.eventually.be...)
use(chaiAsPromised); use(chaiAsPromised);
const registerRequest = JSON.parse(
await readFile('node_modules/@openstapps/core/test/resources/PluginRegisterRequest.1.json', 'utf8'),
);
// cast it because of "TS2322: Type 'string' is not assignable to type '"add"'" // cast it because of "TS2322: Type 'string' is not assignable to type '"add"'"
export const registerAddRequest: SCPluginAdd = registerRequest.instance as SCPluginAdd; export const registerAddRequest: SCPluginAdd = registerRequest.instance as SCPluginAdd;

View File

@@ -47,8 +47,8 @@ describe('Create route', async function () {
const statusCodeSuccess = 222; const statusCodeSuccess = 222;
const bodySuccess = {foo: true}; const bodySuccess = {foo: true};
const sandbox = sinon.createSandbox(); const sandbox = sinon.createSandbox();
let validationError: SCValidationErrorResponse; const validationError = new SCValidationErrorResponse([]);
let internalServerError: SCInternalServerErrorResponse; const internalServerError = new SCInternalServerErrorResponse();
beforeEach(function () { beforeEach(function () {
app = express(); app = express();
@@ -64,9 +64,6 @@ describe('Create route', async function () {
handler = (_request, _app) => { handler = (_request, _app) => {
return Promise.resolve(bodySuccess); return Promise.resolve(bodySuccess);
}; };
validationError = new SCValidationErrorResponse([]);
internalServerError = new SCInternalServerErrorResponse();
}); });
afterEach(function () { afterEach(function () {

View File

@@ -29,19 +29,11 @@ import {backendConfig} from '../../src/config.js';
describe('Search route', async function () { describe('Search route', async function () {
// increase timeout for the suite // increase timeout for the suite
this.timeout(DEFAULT_TEST_TIMEOUT); this.timeout(DEFAULT_TEST_TIMEOUT);
let searchRoute: SCSearchRoute; const searchRoute = new SCSearchRoute();
let multiSearchRoute: SCMultiSearchRoute; const multiSearchRoute = new SCMultiSearchRoute();
let syntaxError: SCSyntaxErrorResponse; const syntaxError = new SCSyntaxErrorResponse('Foo Message');
let methodNotAllowedError: SCMethodNotAllowedErrorResponse; const methodNotAllowedError = new SCMethodNotAllowedErrorResponse();
let tooManyRequestsError: SCTooManyRequestsErrorResponse; const tooManyRequestsError = new SCTooManyRequestsErrorResponse();
before(function () {
searchRoute = new SCSearchRoute();
multiSearchRoute = new SCMultiSearchRoute();
syntaxError = new SCSyntaxErrorResponse('Foo Message');
methodNotAllowedError = new SCMethodNotAllowedErrorResponse();
tooManyRequestsError = new SCTooManyRequestsErrorResponse();
});
it('should reject GET, PUT with a valid search query', async function () { it('should reject GET, PUT with a valid search query', async function () {
// const expectedParams = JSON.parse(JSON.stringify(defaultParams)); // const expectedParams = JSON.parse(JSON.stringify(defaultParams));

View File

@@ -13,25 +13,23 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCBook, SCThingUpdateRoute} from '@openstapps/core'; import {SCThingUpdateRoute} from '@openstapps/core';
import chaiAsPromised from 'chai-as-promised'; import chaiAsPromised from 'chai-as-promised';
import {bulkStorageMock, DEFAULT_TEST_TIMEOUT} from '../common.js'; import {bulkStorageMock, DEFAULT_TEST_TIMEOUT} from '../common.js';
import {expect, use} from 'chai'; import {expect, use} from 'chai';
import {testApp} from '../tests-setup.js'; import {testApp} from '../tests-setup.js';
import bookFile from '@openstapps/core/test/resources/indexable/Book.1.json' assert {type: 'json'}; import {readFile} from 'fs/promises';
use(chaiAsPromised); use(chaiAsPromised);
const book = bookFile.instance as SCBook; const book = JSON.parse(
await readFile('node_modules/@openstapps/core/test/resources/indexable/Book.1.json', 'utf8'),
).instance;
describe('Thing update route', async function () { describe('Thing update route', async function () {
// increase timeout for the suite // increase timeout for the suite
this.timeout(DEFAULT_TEST_TIMEOUT); this.timeout(DEFAULT_TEST_TIMEOUT);
let thingUpdateRoute: SCThingUpdateRoute; const thingUpdateRoute = new SCThingUpdateRoute();
before(function () {
thingUpdateRoute = new SCThingUpdateRoute();
});
it('should update a thing', async function () { it('should update a thing', async function () {
const thingUpdateRouteurlPath = thingUpdateRoute.urlPath const thingUpdateRouteurlPath = thingUpdateRoute.urlPath

View File

@@ -49,11 +49,8 @@ import {
} from '../../../src/storage/elasticsearch/util/index.js'; } from '../../../src/storage/elasticsearch/util/index.js';
import cron from 'node-cron'; import cron from 'node-cron';
import {query} from './query.js'; import {query} from './query.js';
import messageFile from '@openstapps/core/test/resources/indexable/Message.1.json' assert {type: 'json'}; import message from '@openstapps/core/test/resources/indexable/Message.1.json' assert {type: 'json'};
import bookFile from '@openstapps/core/test/resources/indexable/Book.1.json' assert {type: 'json'}; import book from '@openstapps/core/test/resources/indexable/Book.1.json' assert {type: 'json'};
const message = messageFile.instance as SCMessage;
const book = bookFile.instance as SCBook;
use(chaiAsPromised); use(chaiAsPromised);
@@ -70,16 +67,7 @@ describe('Elasticsearch', function () {
const sandbox = sinon.createSandbox(); const sandbox = sinon.createSandbox();
before(function () { before(function () {
// eslint-disable-next-line no-console
sandbox.stub(fs, 'readFileSync').returns('{}'); sandbox.stub(fs, 'readFileSync').returns('{}');
sandbox.stub(backendConfig.internal.boostings.default[0], 'fields').value({
'academicTerms.acronym': {
'SS 2023': 1.05,
'WS 2023/24': 1.1,
'SoSe 2023': 1.05,
'WiSe 2023/24': 1.1,
},
});
}); });
after(function () { after(function () {
sandbox.restore(); sandbox.restore();
@@ -273,7 +261,7 @@ describe('Elasticsearch', function () {
return expect(es.init()).to.be.rejected; return expect(es.init()).to.be.rejected;
}); });
it('should setup the monitoring if there is monitoring is set and mail queue is defined', function () { it('should setup the monitoring if there is monitoring is set and mail queue is defined', async function () {
const config: SCConfigFile = { const config: SCConfigFile = {
...backendConfig, ...backendConfig,
internal: { internal: {
@@ -295,7 +283,7 @@ describe('Elasticsearch', function () {
const cronSetupStub = sandbox.stub(cron, 'schedule'); const cronSetupStub = sandbox.stub(cron, 'schedule');
const es = new Elasticsearch(config, new MailQueue(getTransport(false) as unknown as SMTP)); const es = new Elasticsearch(config, new MailQueue(getTransport(false) as unknown as SMTP));
es.init(); await es.init();
expect(cronSetupStub.called).to.be.true; expect(cronSetupStub.called).to.be.true;
}); });
@@ -449,7 +437,7 @@ describe('Elasticsearch', function () {
_id: '', _id: '',
_index: '', _index: '',
_score: 0, _score: 0,
_source: message, _source: message.instance as SCMessage,
}; };
sandbox.stub(es.client, 'search').resolves(searchResponse(foundObject)); sandbox.stub(es.client, 'search').resolves(searchResponse(foundObject));
@@ -479,7 +467,7 @@ describe('Elasticsearch', function () {
const object: SearchHit<SCMessage> = { const object: SearchHit<SCMessage> = {
_id: '', _id: '',
_index: oldIndex, _index: oldIndex,
_source: message, _source: message.instance as SCMessage,
}; };
sandbox.stub(es.client, 'search').resolves(searchResponse<SCMessage>(object)); sandbox.stub(es.client, 'search').resolves(searchResponse<SCMessage>(object));
sandbox.stub(es, 'prepareBulkWrite').resolves(index); sandbox.stub(es, 'prepareBulkWrite').resolves(index);
@@ -493,7 +481,7 @@ describe('Elasticsearch', function () {
sandbox.stub(es.client, 'create').resolves({result: 'not_found'} as CreateResponse); sandbox.stub(es.client, 'create').resolves({result: 'not_found'} as CreateResponse);
await es.init(); await es.init();
return expect(es.post(message, bulk)).to.rejectedWith('creation'); return expect(es.post(message.instance as SCMessage, bulk)).to.rejectedWith('creation');
}); });
it('should create a new object', async function () { it('should create a new object', async function () {
@@ -506,11 +494,11 @@ describe('Elasticsearch', function () {
}); });
await es.init(); await es.init();
await es.post(message, bulk); await es.post(message.instance as SCMessage, bulk);
expect(createStub.called).to.be.true; expect(createStub.called).to.be.true;
expect(caughtParameter.document).to.be.eql({ expect(caughtParameter.document).to.be.eql({
...message, ...message.instance,
creation_date: caughtParameter.document.creation_date, creation_date: caughtParameter.document.creation_date,
}); });
}); });
@@ -531,7 +519,7 @@ describe('Elasticsearch', function () {
_id: '', _id: '',
_index: getIndex(), _index: getIndex(),
_score: 0, _score: 0,
_source: message, _source: message.instance as SCMessage,
}; };
sandbox.stub(es.client, 'search').resolves(searchResponse()); sandbox.stub(es.client, 'search').resolves(searchResponse());
@@ -545,7 +533,7 @@ describe('Elasticsearch', function () {
_id: '', _id: '',
_index: getIndex(), _index: getIndex(),
_score: 0, _score: 0,
_source: message, _source: message.instance as SCMessage,
}; };
sandbox.stub(es.client, 'search').resolves(searchResponse(object)); sandbox.stub(es.client, 'search').resolves(searchResponse(object));
// @ts-expect-error unused // @ts-expect-error unused
@@ -568,13 +556,13 @@ describe('Elasticsearch', function () {
_id: '123', _id: '123',
_index: getIndex(), _index: getIndex(),
_score: 0, _score: 0,
_source: message, _source: message.instance as SCMessage,
}; };
const objectBook: SearchHit<SCBook> = { const objectBook: SearchHit<SCBook> = {
_id: '321', _id: '321',
_index: getIndex(), _index: getIndex(),
_score: 0, _score: 0,
_source: book, _source: book.instance as SCBook,
}; };
const fakeEsAggregations = { const fakeEsAggregations = {
'@all': { '@all': {

View File

@@ -2,7 +2,9 @@
"extends": "@openstapps/tsconfig", "extends": "@openstapps/tsconfig",
"compilerOptions": { "compilerOptions": {
"resolveJsonModule": true, "resolveJsonModule": true,
"useUnknownInCatchVariables": false "useUnknownInCatchVariables": false,
"allowJs": true,
"checkJs": true
}, },
"exclude": ["lib", "app.js"] "exclude": ["app.js", "lib/"]
} }

View File

@@ -1,11 +1,5 @@
# @openstapps/database # @openstapps/database
## 3.2.0
### Patch Changes
- 689ac68b: pin alpine version to 3.18 and add healthchecks
## 3.0.0 ## 3.0.0
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@openstapps/database", "name": "@openstapps/database",
"version": "3.2.0", "version": "3.0.0",
"private": true, "private": true,
"files": [ "files": [
"config", "config",

View File

@@ -1,2 +1,2 @@
nginx & nginx &
node ./lib/cli.js node ./app.js

View File

@@ -14,9 +14,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
// ESM is not supported, and cts is not detected, so we use type-checked cjs instead.
/** @type {import('../src/common').ConfigFile} */ /** @type {import('../src/common').ConfigFile} */
module.exports = { const configFile = {
activeVersions: ['1\\.0\\.\\d+', '2\\.0\\.\\d+'], activeVersions: ['1\\.0\\.\\d+', '2\\.0\\.\\d+'],
hiddenRoutes: ['/bulk'], hiddenRoutes: ['/bulk'],
logFormat: 'default', logFormat: 'default',
@@ -31,3 +30,5 @@ module.exports = {
dhparam: '/etc/nginx/certs/dhparam.pem', dhparam: '/etc/nginx/certs/dhparam.pem',
}, },
}; };
export default configFile;

View File

@@ -46,12 +46,11 @@
"@types/dockerode": "3.3.17", "@types/dockerode": "3.3.17",
"@types/node": "18.15.3", "@types/node": "18.15.3",
"@types/sha1": "1.1.3", "@types/sha1": "1.1.3",
"config": "3.3.9",
"dockerode": "3.3.5", "dockerode": "3.3.5",
"is-cidr": "4.0.2", "is-cidr": "4.0.2",
"mustache": "4.2.0", "mustache": "4.2.0",
"semver": "7.6.0", "semver": "7.5.4",
"typescript": "5.4.2" "typescript": "5.1.6"
}, },
"devDependencies": { "devDependencies": {
"@openstapps/api-cli": "workspace:*", "@openstapps/api-cli": "workspace:*",
@@ -59,13 +58,12 @@
"@openstapps/prettier-config": "workspace:*", "@openstapps/prettier-config": "workspace:*",
"@openstapps/tsconfig": "workspace:*", "@openstapps/tsconfig": "workspace:*",
"@types/chai": "4.3.5", "@types/chai": "4.3.5",
"@types/config": "3.3.0",
"@types/dockerode": "3.3.17", "@types/dockerode": "3.3.17",
"@types/mocha": "10.0.1", "@types/mocha": "10.0.1",
"@types/mustache": "4.2.2", "@types/mustache": "4.2.2",
"@types/node": "18.15.3", "@types/node": "18.15.3",
"@types/proxyquire": "1.3.28", "@types/proxyquire": "1.3.28",
"@types/semver": "7.5.8", "@types/semver": "7.5.6",
"@types/sha1": "1.1.3", "@types/sha1": "1.1.3",
"@types/sinon": "10.0.14", "@types/sinon": "10.0.14",
"@types/sinon-chai": "3.2.9", "@types/sinon-chai": "3.2.9",
@@ -75,7 +73,7 @@
"mocha-junit-reporter": "2.2.0", "mocha-junit-reporter": "2.2.0",
"sinon": "15.0.4", "sinon": "15.0.4",
"sinon-chai": "3.7.0", "sinon-chai": "3.7.0",
"ts-node": "10.9.2", "ts-node": "10.9.1",
"tsup": "6.7.0" "tsup": "6.7.0"
}, },
"tsup": { "tsup": {

View File

@@ -14,7 +14,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {Logger, SMTP} from '@openstapps/logger'; import {Logger, SMTP} from '@openstapps/logger';
import config from 'config';
import {existsSync} from 'fs'; import {existsSync} from 'fs';
// set transport on logger // set transport on logger
@@ -163,7 +162,7 @@ ssl_stapling_verify on;`;
/** /**
* Config file * Config file
*/ */
export const configFile: ConfigFile = config.util.toObject(); export const configFile: ConfigFile = await import('../config/default.js').then(it => it.default);
/** /**
* Check if path is a specific file type * Check if path is a specific file type

View File

@@ -1,4 +1,4 @@
{ {
"extends": "@openstapps/tsconfig", "extends": "@openstapps/tsconfig",
"exclude": ["config", "lib", "app.js"] "exclude": ["./config/", "./lib/"]
} }

View File

@@ -1,3 +1,4 @@
// @ts-check
const fs = require("fs"); const fs = require("fs");
const path = require("node:path"); const path = require("node:path");
const child_process = require("child_process"); const child_process = require("child_process");

View File

@@ -1,3 +1,4 @@
// @ts-check
"use strict" "use strict"
const rule = require('./copyright-header-rule') const rule = require('./copyright-header-rule')

View File

@@ -1,3 +1,5 @@
// @ts-check
/** @type {import('eslint').Linter.Config} */ /** @type {import('eslint').Linter.Config} */
const config = { const config = {
root: true, root: true,

View File

@@ -18,15 +18,16 @@
"devDependencies": { "devDependencies": {
"@openstapps/tsconfig": "workspace:*", "@openstapps/tsconfig": "workspace:*",
"@types/node": "18.15.3", "@types/node": "18.15.3",
"eslint": "8.57.0", "eslint": "8.43.0",
"typescript": "5.4.2" "typescript": "5.1.6"
}, },
"peerDependencies": { "peerDependencies": {
"@typescript-eslint/eslint-plugin": "7.2.0", "@typescript-eslint/eslint-plugin": "5.60.1",
"@typescript-eslint/parser": "7.2.0", "@typescript-eslint/parser": "5.60.1",
"eslint": "8.57.0", "eslint": "8.43.0",
"eslint-config-prettier": "9.1.0", "eslint-config-prettier": "8.8.0",
"eslint-plugin-jsdoc": "48.2.1", "eslint-plugin-jsdoc": "46.4.2",
"eslint-plugin-unicorn": "51.0.1" "eslint-plugin-prettier": "4.2.1",
"eslint-plugin-unicorn": "47.0.0"
} }
} }

View File

@@ -1,11 +1,5 @@
# @openstapps/prettier-config # @openstapps/prettier-config
## 3.2.0
### Patch Changes
- dbb55850: Update Prettier to 3.1.1
## 3.0.0 ## 3.0.0
### Major Changes ### Major Changes
@@ -36,7 +30,7 @@
```js ```js
#!/usr/bin/env node #!/usr/bin/env node
import "./lib/app.js"; import './lib/app.js';
``` ```
- 64caebaf: Migrate to ESM - 64caebaf: Migrate to ESM
@@ -75,14 +69,11 @@
- 64caebaf: Migrated changelogs to changeset format - 64caebaf: Migrated changelogs to changeset format
```js ```js
import fs from "fs"; import fs from 'fs';
const path = "packages/logger/CHANGELOG.md"; const path = 'packages/logger/CHANGELOG.md';
fs.writeFileSync( fs.writeFileSync(path, fs.readFileSync(path, 'utf8').replace(/^#+\s+\[/gm, '## ['));
path,
fs.readFileSync(path, "utf8").replace(/^#+\s+\[/gm, "## ["),
);
``` ```
- 98546a97: Migrate away from @openstapps/configuration - 98546a97: Migrate away from @openstapps/configuration
@@ -124,7 +115,7 @@
```js ```js
#!/usr/bin/env node #!/usr/bin/env node
import "./lib/app.js"; import './lib/app.js';
``` ```
- 64caebaf: Migrate to ESM - 64caebaf: Migrate to ESM
@@ -163,14 +154,11 @@
- 64caebaf: Migrated changelogs to changeset format - 64caebaf: Migrated changelogs to changeset format
```js ```js
import fs from "fs"; import fs from 'fs';
const path = "packages/logger/CHANGELOG.md"; const path = 'packages/logger/CHANGELOG.md';
fs.writeFileSync( fs.writeFileSync(path, fs.readFileSync(path, 'utf8').replace(/^#+\s+\[/gm, '## ['));
path,
fs.readFileSync(path, "utf8").replace(/^#+\s+\[/gm, "## ["),
);
``` ```
- 98546a97: Migrate away from @openstapps/configuration - 98546a97: Migrate away from @openstapps/configuration

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/prettier-config", "name": "@openstapps/prettier-config",
"description": "StApps Prettier Config", "description": "StApps Prettier Config",
"version": "3.2.0", "version": "3.0.0",
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/prettier-config.git", "repository": "git@gitlab.com:openstapps/prettier-config.git",
@@ -19,9 +19,9 @@
"test": "prettier --config index.js --check \"test/*.js\"" "test": "prettier --config index.js --check \"test/*.js\""
}, },
"devDependencies": { "devDependencies": {
"prettier": "3.1.1" "prettier": "3.1.0"
}, },
"peerDependencies": { "peerDependencies": {
"prettier": "3.1.1" "prettier": "3.1.0"
} }
} }

View File

@@ -43,8 +43,8 @@
"@openstapps/logger": "workspace:*", "@openstapps/logger": "workspace:*",
"@slack/web-api": "6.8.1", "@slack/web-api": "6.8.1",
"commander": "10.0.0", "commander": "10.0.0",
"date-fns": "3.6.0", "date-fns": "2.30.0",
"glob": "10.3.10", "glob": "10.2.7",
"mustache": "4.2.0" "mustache": "4.2.0"
}, },
"devDependencies": { "devDependencies": {
@@ -53,7 +53,7 @@
"@openstapps/tsconfig": "workspace:*", "@openstapps/tsconfig": "workspace:*",
"@types/chai": "4.3.5", "@types/chai": "4.3.5",
"@types/chai-as-promised": "7.1.5", "@types/chai-as-promised": "7.1.5",
"@types/glob": "8.1.0", "@types/glob": "8.0.1",
"@types/mocha": "10.0.1", "@types/mocha": "10.0.1",
"@types/mustache": "4.2.2", "@types/mustache": "4.2.2",
"@types/node": "18.15.3", "@types/node": "18.15.3",
@@ -63,9 +63,9 @@
"chai-as-promised": "7.1.1", "chai-as-promised": "7.1.1",
"mocha": "10.2.0", "mocha": "10.2.0",
"mocha-junit-reporter": "2.2.0", "mocha-junit-reporter": "2.2.0",
"ts-node": "10.9.2", "ts-node": "10.9.1",
"tsup": "6.7.0", "tsup": "6.7.0",
"typescript": "5.4.2" "typescript": "5.1.6"
}, },
"tsup": { "tsup": {
"entry": [ "entry": [

View File

@@ -1,4 +1,3 @@
{ {
"extends": "@openstapps/tsconfig", "extends": "@openstapps/tsconfig"
"exclude": ["lib", "app.js"]
} }

View File

@@ -14,7 +14,6 @@
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"isolatedModules": true, "isolatedModules": true,
"allowJs": true, "allowJs": true,
"checkJs": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"noImplicitAny": true, "noImplicitAny": true,

View File

@@ -1,14 +1,5 @@
# @openstapps/minimal-connector # @openstapps/minimal-connector
## 3.2.0
### Patch Changes
- Updated dependencies [912ae422]
- @openstapps/core@4.0.0
- @openstapps/api@4.0.0
- @openstapps/logger@3.0.0
## 3.1.1 ## 3.1.1
### Patch Changes ### Patch Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/minimal-connector", "name": "@openstapps/minimal-connector",
"description": "This is a minimal connector which serves as an example", "description": "This is a minimal connector which serves as an example",
"version": "3.2.0", "version": "3.1.1",
"private": true, "private": true,
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
@@ -53,9 +53,9 @@
"mocha": "10.2.0", "mocha": "10.2.0",
"mocha-junit-reporter": "2.2.0", "mocha-junit-reporter": "2.2.0",
"nock": "13.3.1", "nock": "13.3.1",
"ts-node": "10.9.2", "ts-node": "10.9.1",
"tsup": "6.7.0", "tsup": "6.7.0",
"typescript": "5.4.2" "typescript": "5.1.6"
}, },
"tsup": { "tsup": {
"entry": [ "entry": [

View File

@@ -1,4 +1,3 @@
{ {
"extends": "@openstapps/tsconfig", "extends": "@openstapps/tsconfig"
"exclude": ["lib", "app.js"]
} }

View File

@@ -1,62 +1,44 @@
version: '3.7' version: '3.7'
x-development-variables: &development-variables
NODE_ENV: "development"
ALLOW_NO_TRANSPORT: "true"
services: services:
database: database:
image: registry.gitlab.com/openstapps/openstapps/database:3.0.0 image: registry.gitlab.com/openstapps/openstapps/database:2.0.0
# If you need persistence for debugging purposes uncomment the following lines volumes:
#volumes: - ./database:/usr/share/elasticsearch/data
# - ./database:/usr/share/elasticsearch/data
expose: expose:
- 9200 - "9200"
ports:
- 127.0.0.1:9200:9200
environment:
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms2g -Xmx2g"
- discovery.type=single-node
ulimits:
memlock:
soft: -1
hard: -1
restart: unless-stopped restart: unless-stopped
backend: backend:
image: registry.gitlab.com/openstapps/openstapps/backend:3.1.0 image: registry.gitlab.com/openstapps/openstapps/backend:3.0.0-next.0
environment: environment:
<<: *development-variables
ES_ADDR: "http://database:9200" ES_ADDR: "http://database:9200"
NODE_CONFIG_ENV: "elasticsearch" NODE_CONFIG_ENV: "elasticsearch"
NODE_APP_INSTANCE: "f-u" ALLOW_NO_TRANSPORT: "true"
PROMETHEUS_MIDDLEWARE: "false"
expose: expose:
- 3000 - 3000
ports: ports:
- 127.0.0.1:3000:3000 - 3000:3000
links:
- "database"
labels: labels:
- stapps.version=4.1.0 - stapps.version=1.0.0
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
- database - database
api:
image: registry.gitlab.com/openstapps/openstapps/api:3.0.0-next.0
links: links:
- database - "backend"
# api: minimal-connector:
# image: registry.gitlab.com/openstapps/openstapps/api:3.0.0 image: registry.gitlab.com/openstapps/minimal-connector:core-0.23
# links: container_name: minimal-connector-0.23
# - backend command: ["http://backend:3000", "minimal-connector", "f-u"]
# minimal-connector: app:
# image: registry.gitlab.com/openstapps/minimal-connector:core-0.23 image: registry.gitlab.com/openstapps/app/executable:core-0.23
# container_name: minimal-connector-0.23 expose:
# command: ["http://backend:3000", "minimal-connector", "f-u"] - 8100
ports:
# app: - 8100:8100
# image: registry.gitlab.com/openstapps/app/executable:core-0.23
# expose:
# - 8100
# ports:
# - 8100:8100

View File

@@ -1,16 +1,5 @@
# @openstapps/minimal-plugin # @openstapps/minimal-plugin
## 3.2.0
### Patch Changes
- Updated dependencies [912ae422]
- @openstapps/core@4.0.0
- @openstapps/api@4.0.0
- @openstapps/api-plugin@4.0.0
- @openstapps/core-tools@3.0.0
- @openstapps/logger@3.0.0
## 3.1.1 ## 3.1.1
### Patch Changes ### Patch Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/minimal-plugin", "name": "@openstapps/minimal-plugin",
"description": "Minimal Plugin", "description": "Minimal Plugin",
"version": "3.2.0", "version": "3.1.1",
"private": true, "private": true,
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
@@ -35,7 +35,7 @@
"@openstapps/logger": "workspace:*", "@openstapps/logger": "workspace:*",
"commander": "10.0.0", "commander": "10.0.0",
"express": "4.18.2", "express": "4.18.2",
"ts-node": "10.9.2" "ts-node": "10.9.1"
}, },
"devDependencies": { "devDependencies": {
"@openstapps/eslint-config": "workspace:*", "@openstapps/eslint-config": "workspace:*",
@@ -44,7 +44,7 @@
"@types/express": "4.17.17", "@types/express": "4.17.17",
"@types/node": "18.15.3", "@types/node": "18.15.3",
"tsup": "6.7.0", "tsup": "6.7.0",
"typescript": "5.4.2" "typescript": "5.1.6"
}, },
"tsup": { "tsup": {
"entry": [ "entry": [

View File

@@ -1,4 +1,3 @@
{ {
"extends": "@openstapps/tsconfig", "extends": "@openstapps/tsconfig"
"exclude": ["lib", "app.js"]
} }

34
flake.lock generated
View File

@@ -1,23 +1,5 @@
{ {
"nodes": { "nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1701626906, "lastModified": 1701626906,
@@ -36,24 +18,8 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

142
flake.nix
View File

@@ -1,75 +1,77 @@
{ {
description = "A Nix-flake-based development environment for OpenStApps"; description = "A Nix-flake-based development environment for OpenStApps";
inputs = { inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; outputs = { self, nixpkgs }:
flake-utils.url = "github:numtide/flake-utils"; let
}; buildToolsVersion = "30.0.3";
outputs = { overlays = [
self, (final: prev: rec {
nixpkgs, nodejs = prev.nodejs-18_x;
flake-utils, pnpm = prev.nodePackages.pnpm;
}: let chrome = prev.google-chrome;
aapt2buildToolsVersion = "33.0.2"; firefox = prev.firefox;
in webkit = prev.epiphany; # Safari-ish browser
flake-utils.lib.eachDefaultSystem (system: let android = prev.androidenv.composeAndroidPackages {
pkgs = import nixpkgs { buildToolsVersions = [ "${buildToolsVersion}" ];
inherit system; platformVersions = [ "33" ];
overlays = [ };
(final: prev: rec { cypress = prev.cypress.overrideAttrs(cyPrev: rec {
fontMin = prev.python311.withPackages (ps: with ps; [brotli fonttools] ++ (with fonttools.optional-dependencies; [woff])); version = "13.2.0";
android = prev.androidenv.composeAndroidPackages { src = prev.fetchzip {
buildToolsVersions = ["30.0.3" aapt2buildToolsVersion]; url = "https://cdn.cypress.io/desktop/${version}/linux-x64/cypress.zip";
platformVersions = ["33"]; hash = "sha256-9o0nprGcJhudS1LNm+T7Vf0Dwd1RBauYKI+w1FBQ3ZM=";
}; };
cypress = prev.cypress.overrideAttrs (cyPrev: rec { });
version = "13.2.0"; })
src = prev.fetchzip { ];
url = "https://cdn.cypress.io/desktop/${version}/linux-x64/cypress.zip"; # TODO: aarch64-linux, x68_64-darwin, aarch64-darwin
hash = "sha256-9o0nprGcJhudS1LNm+T7Vf0Dwd1RBauYKI+w1FBQ3ZM="; supportedSystems = [ "x86_64-linux" ];
}; forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
}); pkgs = import nixpkgs {
}) inherit overlays system;
]; config = {
config = { allowUnfree = true;
allowUnfree = true; android_sdk.accept_license = true;
android_sdk.accept_license = true; };
}; };
}; });
androidFhs = pkgs.buildFHSUserEnv { in
name = "android-env"; {
targetPkgs = pkgs: with pkgs; []; devShells = forEachSupportedSystem ({ pkgs }:
runScript = "bash"; let
profile = '' python = (pkgs.python311.withPackages(ps: with ps; [ brotli fonttools ] ++ (with fonttools.optional-dependencies; [ ufo lxml unicode woff ])));
export ALLOW_NINJA_ENV=true in
export USE_CCACHE=1 {
export LD_LIBRARY_PATH=/usr/lib:/usr/lib32 default = (pkgs.buildFHSUserEnv {
''; name = "StApps Dev";
}; targetPkgs = pkgs: with pkgs; [
in { nodejs
devShell = pkgs.mkShell rec { pnpm
nativeBuildInputs = [androidFhs]; python
buildInputs = with pkgs; [ docker
nodejs-18_x # tools
nodePackages.pnpm curl
# tools jq
curl # browsers
jq firefox
fontMin chrome
# browsers webkit
firefox cypress
google-chrome # android
epiphany # Safari-ish browser jdk17
cypress android.androidsdk
# android musl
jdk17 ];
android.androidsdk runScript = "bash";
musl profile = ''
]; export CYPRESS_INSTALL_BINARY=0
ANDROID_JAVA_HOME = "${pkgs.jdk.home}"; export CYPRESS_RUN_BINARY=${pkgs.cypress}/bin/Cypress
ANDROID_SDK_ROOT = "${pkgs.android.androidsdk}/libexec/android-sdk"; export ANDROID_SDK_ROOT=${pkgs.android.androidsdk}/libexec/android-sdk
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${ANDROID_SDK_ROOT}/build-tools/${aapt2buildToolsVersion}/aapt2"; export ANDROID_JAVA_HOME=${pkgs.jdk.home}
CYPRESS_INSTALL_BINARY = "0"; export DOCKER_HOST=unix:///run/user/1000/docker.sock
CYPRESS_RUN_BINARY = "${pkgs.cypress}/bin/Cypress"; { dockerd-rootless & } 2>/dev/null
}; '';
}); }).env;
});
};
} }

View File

@@ -5,4 +5,10 @@
# You can see what browsers were selected by your queries by running: # You can see what browsers were selected by your queries by running:
# npx browserslist # npx browserslist
> 0.5% in DE and last 2 major versions and supports es6 and not dead > 0.5%
last 2 versions
Firefox ESR
not dead
not kaios 2.5
not op_mini all
not IE 9-11

View File

@@ -1,15 +1,5 @@
# @openstapps/app # @openstapps/app
## 3.2.0
### Patch Changes
- 689ac68b: pin alpine version to 3.18 and add healthchecks
- Updated dependencies [912ae422]
- @openstapps/core@4.0.0
- @openstapps/api@4.0.0
- @openstapps/collection-utils@3.0.0
## 3.1.2 ## 3.1.2
### Patch Changes ### Patch Changes

View File

@@ -97,20 +97,20 @@
"serve": { "serve": {
"builder": "@angular-devkit/build-angular:dev-server", "builder": "@angular-devkit/build-angular:dev-server",
"options": { "options": {
"buildTarget": "app:build" "browserTarget": "app:build"
}, },
"configurations": { "configurations": {
"production": { "production": {
"buildTarget": "app:build:production" "browserTarget": "app:build:production"
}, },
"development": { "development": {
"buildTarget": "app:build:development" "browserTarget": "app:build:development"
}, },
"ci": { "ci": {
"buildTarget": "app:build" "browserTarget": "app:build"
}, },
"fake": { "fake": {
"buildTarget": "app:build:fake" "browserTarget": "app:build:fake"
} }
}, },
"defaultConfiguration": "development" "defaultConfiguration": "development"

View File

@@ -173,7 +173,7 @@ describe('dashboard', async function () {
cy.visit('/overview'); cy.visit('/overview');
cy.get('ion-searchbar').click({scrollBehavior: 'center'}); cy.get('ion-searchbar').click({scrollBehavior: 'center'});
cy.url().should('include', '/search'); cy.url().should('eq', Cypress.config().baseUrl + '/search');
cy.get('ion-searchbar').should('not.have.value'); cy.get('ion-searchbar').should('not.have.value');
cy.get('ion-searchbar input.searchbar-input').should('have.focus'); cy.get('ion-searchbar input.searchbar-input').should('have.focus');

View File

@@ -1,3 +1,4 @@
// @ts-check
/* /*
* Copyright (C) 2022 StApps * Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
@@ -12,9 +13,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import type {IconConfig} from './scripts/icon-config'; /** @type {import('./scripts/icon-config').IconConfig} */
const config = {
const config: IconConfig = {
inputPath: 'node_modules/material-symbols/material-symbols-rounded.woff2', inputPath: 'node_modules/material-symbols/material-symbols-rounded.woff2',
outputPath: 'src/assets/icons.min.woff2', outputPath: 'src/assets/icons.min.woff2',
htmlGlob: 'src/**/*.html', htmlGlob: 'src/**/*.html',

View File

@@ -25,7 +25,7 @@ def capacitor_pods
pod 'CapacitorPreferences', :path => '../../../../node_modules/.pnpm/@capacitor+preferences@5.0.6_@capacitor+core@5.5.0/node_modules/@capacitor/preferences' pod 'CapacitorPreferences', :path => '../../../../node_modules/.pnpm/@capacitor+preferences@5.0.6_@capacitor+core@5.5.0/node_modules/@capacitor/preferences'
pod 'CapacitorShare', :path => '../../../../node_modules/.pnpm/@capacitor+share@5.0.6_@capacitor+core@5.5.0/node_modules/@capacitor/share' pod 'CapacitorShare', :path => '../../../../node_modules/.pnpm/@capacitor+share@5.0.6_@capacitor+core@5.5.0/node_modules/@capacitor/share'
pod 'CapacitorSplashScreen', :path => '../../../../node_modules/.pnpm/@capacitor+splash-screen@5.0.6_@capacitor+core@5.5.0/node_modules/@capacitor/splash-screen' pod 'CapacitorSplashScreen', :path => '../../../../node_modules/.pnpm/@capacitor+splash-screen@5.0.6_@capacitor+core@5.5.0/node_modules/@capacitor/splash-screen'
pod 'TransistorsoftCapacitorBackgroundFetch', :path => '../../../../node_modules/.pnpm/@transistorsoft+capacitor-background-fetch@5.1.1_@capacitor+core@5.5.0/node_modules/@transistorsoft/capacitor-background-fetch' pod 'TransistorsoftCapacitorBackgroundFetch', :path => '../../../../node_modules/.pnpm/@transistorsoft+capacitor-background-fetch@1.0.2_@capacitor+core@5.5.0/node_modules/@transistorsoft/capacitor-background-fetch'
pod 'CapacitorSecureStoragePlugin', :path => '../../../../node_modules/.pnpm/capacitor-secure-storage-plugin@0.9.0_@capacitor+core@5.5.0/node_modules/capacitor-secure-storage-plugin' pod 'CapacitorSecureStoragePlugin', :path => '../../../../node_modules/.pnpm/capacitor-secure-storage-plugin@0.9.0_@capacitor+core@5.5.0/node_modules/capacitor-secure-storage-plugin'
pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins' pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins'
end end

View File

@@ -36,7 +36,7 @@ PODS:
- CordovaPlugins (5.5.0): - CordovaPlugins (5.5.0):
- CapacitorCordova - CapacitorCordova
- SwiftKeychainWrapper (4.0.1) - SwiftKeychainWrapper (4.0.1)
- TransistorsoftCapacitorBackgroundFetch (5.1.1): - TransistorsoftCapacitorBackgroundFetch (1.0.2):
- Capacitor - Capacitor
DEPENDENCIES: DEPENDENCIES:
@@ -58,7 +58,7 @@ DEPENDENCIES:
- "CapacitorShare (from `../../../../node_modules/.pnpm/@capacitor+share@5.0.6_@capacitor+core@5.5.0/node_modules/@capacitor/share`)" - "CapacitorShare (from `../../../../node_modules/.pnpm/@capacitor+share@5.0.6_@capacitor+core@5.5.0/node_modules/@capacitor/share`)"
- "CapacitorSplashScreen (from `../../../../node_modules/.pnpm/@capacitor+splash-screen@5.0.6_@capacitor+core@5.5.0/node_modules/@capacitor/splash-screen`)" - "CapacitorSplashScreen (from `../../../../node_modules/.pnpm/@capacitor+splash-screen@5.0.6_@capacitor+core@5.5.0/node_modules/@capacitor/splash-screen`)"
- CordovaPlugins (from `../capacitor-cordova-ios-plugins`) - CordovaPlugins (from `../capacitor-cordova-ios-plugins`)
- "TransistorsoftCapacitorBackgroundFetch (from `../../../../node_modules/.pnpm/@transistorsoft+capacitor-background-fetch@5.1.1_@capacitor+core@5.5.0/node_modules/@transistorsoft/capacitor-background-fetch`)" - "TransistorsoftCapacitorBackgroundFetch (from `../../../../node_modules/.pnpm/@transistorsoft+capacitor-background-fetch@1.0.2_@capacitor+core@5.5.0/node_modules/@transistorsoft/capacitor-background-fetch`)"
SPEC REPOS: SPEC REPOS:
trunk: trunk:
@@ -102,7 +102,7 @@ EXTERNAL SOURCES:
CordovaPlugins: CordovaPlugins:
:path: "../capacitor-cordova-ios-plugins" :path: "../capacitor-cordova-ios-plugins"
TransistorsoftCapacitorBackgroundFetch: TransistorsoftCapacitorBackgroundFetch:
:path: "../../../../node_modules/.pnpm/@transistorsoft+capacitor-background-fetch@5.1.1_@capacitor+core@5.5.0/node_modules/@transistorsoft/capacitor-background-fetch" :path: "../../../../node_modules/.pnpm/@transistorsoft+capacitor-background-fetch@1.0.2_@capacitor+core@5.5.0/node_modules/@transistorsoft/capacitor-background-fetch"
SPEC CHECKSUMS: SPEC CHECKSUMS:
Capacitor: 57890b363df14d5d2d5d8461aa23e886cb34da2a Capacitor: 57890b363df14d5d2d5d8461aa23e886cb34da2a
@@ -124,8 +124,8 @@ SPEC CHECKSUMS:
CapacitorSplashScreen: 5fa2ab5e46cf5cc530cf16a51c80c7a986579ccd CapacitorSplashScreen: 5fa2ab5e46cf5cc530cf16a51c80c7a986579ccd
CordovaPlugins: de5669381702d76ed5b1d442177a6a5fc3252a9d CordovaPlugins: de5669381702d76ed5b1d442177a6a5fc3252a9d
SwiftKeychainWrapper: 807ba1d63c33a7d0613288512399cd1eda1e470c SwiftKeychainWrapper: 807ba1d63c33a7d0613288512399cd1eda1e470c
TransistorsoftCapacitorBackgroundFetch: ce4b3e01b898cef516e68485d2160a078016ee97 TransistorsoftCapacitorBackgroundFetch: 74ca62dae7ec78639eaf3d0d1e24c595ada213dd
PODFILE CHECKSUM: 229278f2c257e8ab555325c7115b2e187e8e628d PODFILE CHECKSUM: 073b899f90bacc5049101cb9c562a168757d554e
COCOAPODS: 1.13.0 COCOAPODS: 1.13.0

View File

@@ -1,3 +1,4 @@
// @ts-check
/* /*
* Copyright (C) 2022 StApps * Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/app", "name": "@openstapps/app",
"description": "The generic app tailored to fulfill needs of German universities, written using Ionic Framework.", "description": "The generic app tailored to fulfill needs of German universities, written using Ionic Framework.",
"version": "3.2.0", "version": "3.1.2",
"private": true, "private": true,
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>", "author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
@@ -21,7 +21,7 @@
"build:prod": "ng build --configuration=production", "build:prod": "ng build --configuration=production",
"build:stats": "ng build --configuration=production --stats-json", "build:stats": "ng build --configuration=production --stats-json",
"changelog": "conventional-changelog -p angular -i src/assets/about/CHANGELOG.md -s -r 0", "changelog": "conventional-changelog -p angular -i src/assets/about/CHANGELOG.md -s -r 0",
"check-icons": "ts-node scripts/check-icon-correctness.ts", "check-icons": "node scripts/check-icon-correctness.mjs",
"chromium:no-cors": "chromium --disable-web-security --user-data-dir=\".browser-data/chromium\"", "chromium:no-cors": "chromium --disable-web-security --user-data-dir=\".browser-data/chromium\"",
"chromium:virtual-host": "chromium --host-resolver-rules=\"MAP mobile.app.uni-frankfurt.de:* localhost:8100\" --ignore-certificate-errors", "chromium:virtual-host": "chromium --host-resolver-rules=\"MAP mobile.app.uni-frankfurt.de:* localhost:8100\" --ignore-certificate-errors",
"cypress:open": "cypress open", "cypress:open": "cypress open",
@@ -38,7 +38,7 @@
"licenses": "license-checker --json > src/assets/about/licenses.json && ts-node ./scripts/accumulate-licenses.ts && git add src/assets/about/licenses.json", "licenses": "license-checker --json > src/assets/about/licenses.json && ts-node ./scripts/accumulate-licenses.ts && git add src/assets/about/licenses.json",
"lint": "ng lint && stylelint \"**/*.scss\"", "lint": "ng lint && stylelint \"**/*.scss\"",
"lint:fix": "eslint --fix -c .eslintrc.json --ignore-path .eslintignore --ext .ts,.html src/ && stylelint --fix \"**/*.scss\"", "lint:fix": "eslint --fix -c .eslintrc.json --ignore-path .eslintignore --ext .ts,.html src/ && stylelint --fix \"**/*.scss\"",
"minify-icons": "ts-node-esm scripts/minify-icon-font.ts", "minify-icons": "node scripts/minify-icon-font.mjs",
"postinstall": "jetify && echo \"skipping jetify in production mode\"", "postinstall": "jetify && echo \"skipping jetify in production mode\"",
"preview": "http-server www --p 8101 -o", "preview": "http-server www --p 8101 -o",
"push": "git push && git push origin \"v$npm_package_version\"", "push": "git push && git push origin \"v$npm_package_version\"",
@@ -52,34 +52,34 @@
"test:integration": "sh integration-test.sh" "test:integration": "sh integration-test.sh"
}, },
"dependencies": { "dependencies": {
"@angular/animations": "17.3.0", "@angular/animations": "16.1.4",
"@angular/cdk": "17.3.0", "@angular/cdk": "16.1.4",
"@angular/common": "17.3.0", "@angular/common": "16.1.4",
"@angular/core": "17.3.0", "@angular/core": "16.1.4",
"@angular/forms": "17.3.0", "@angular/forms": "16.1.4",
"@angular/platform-browser": "17.3.0", "@angular/platform-browser": "16.1.4",
"@angular/router": "17.3.0", "@angular/router": "16.1.4",
"@asymmetrik/ngx-leaflet": "17.0.0", "@asymmetrik/ngx-leaflet": "16.0.1",
"@asymmetrik/ngx-leaflet-markercluster": "17.0.0", "@asymmetrik/ngx-leaflet-markercluster": "16.0.0",
"@awesome-cordova-plugins/calendar": "6.6.0", "@awesome-cordova-plugins/calendar": "5.45.0",
"@awesome-cordova-plugins/core": "6.6.0", "@awesome-cordova-plugins/core": "5.45.0",
"@capacitor/app": "5.0.7", "@capacitor/app": "5.0.6",
"@capacitor/browser": "5.2.0", "@capacitor/browser": "5.1.0",
"@capacitor/clipboard": "5.0.7", "@capacitor/clipboard": "5.0.6",
"@capacitor/core": "5.7.3", "@capacitor/core": "5.5.0",
"@capacitor/device": "5.0.7", "@capacitor/device": "5.0.6",
"@capacitor/dialog": "5.0.7", "@capacitor/dialog": "5.0.6",
"@capacitor/filesystem": "5.2.1", "@capacitor/filesystem": "5.1.4",
"@capacitor/geolocation": "5.0.7", "@capacitor/geolocation": "5.0.6",
"@capacitor/haptics": "5.0.7", "@capacitor/haptics": "5.0.6",
"@capacitor/keyboard": "5.0.8", "@capacitor/keyboard": "5.0.6",
"@capacitor/local-notifications": "5.0.7", "@capacitor/local-notifications": "5.0.6",
"@capacitor/network": "5.0.7", "@capacitor/network": "5.0.6",
"@capacitor/preferences": "5.0.7", "@capacitor/preferences": "5.0.6",
"@capacitor/share": "5.0.7", "@capacitor/share": "5.0.6",
"@capacitor/splash-screen": "5.0.7", "@capacitor/splash-screen": "5.0.6",
"@ionic-native/core": "5.36.0", "@ionic-native/core": "5.36.0",
"@ionic/angular": "7.8.0", "@ionic/angular": "7.1.3",
"@ionic/storage-angular": "4.0.0", "@ionic/storage-angular": "4.0.0",
"@ngx-translate/core": "15.0.0", "@ngx-translate/core": "15.0.0",
"@ngx-translate/http-loader": "8.0.0", "@ngx-translate/http-loader": "8.0.0",
@@ -87,104 +87,104 @@
"@openstapps/api": "workspace:*", "@openstapps/api": "workspace:*",
"@openstapps/collection-utils": "workspace:*", "@openstapps/collection-utils": "workspace:*",
"@openstapps/core": "workspace:*", "@openstapps/core": "workspace:*",
"@transistorsoft/capacitor-background-fetch": "5.2.0", "@transistorsoft/capacitor-background-fetch": "5.1.1",
"@types/dom-view-transitions": "1.0.4", "@types/dom-view-transitions": "1.0.1",
"capacitor-secure-storage-plugin": "0.9.0", "capacitor-secure-storage-plugin": "0.9.0",
"cordova-plugin-calendar": "5.1.6", "cordova-plugin-calendar": "5.1.6",
"date-fns": "3.6.0", "date-fns": "2.30.0",
"deepmerge": "4.3.1", "deepmerge": "4.3.1",
"form-data": "4.0.0", "form-data": "4.0.0",
"geojson": "0.5.0", "geojson": "0.5.0",
"ionic-appauth": "0.9.0", "ionic-appauth": "0.9.0",
"jsonpath-plus": "6.0.1", "jsonpath-plus": "6.0.1",
"leaflet": "1.9.4", "leaflet": "1.9.3",
"leaflet.markercluster": "1.5.3", "leaflet.markercluster": "1.5.3",
"material-symbols": "0.17.0", "material-symbols": "0.10.0",
"moment": "2.30.1", "moment": "2.29.4",
"ngx-date-fns": "11.0.0", "ngx-date-fns": "10.0.1",
"ngx-logger": "5.0.12", "ngx-logger": "5.0.12",
"ngx-markdown": "17.1.1", "ngx-markdown": "16.0.0",
"ngx-moment": "6.0.2", "ngx-moment": "6.0.2",
"opening_hours": "3.8.0", "opening_hours": "3.8.0",
"rxjs": "7.8.1", "rxjs": "7.8.1",
"semver": "7.6.0", "semver": "7.5.4",
"swiper": "8.4.5", "swiper": "8.4.5",
"tslib": "2.6.2", "tslib": "2.4.1",
"zone.js": "0.14.4" "zone.js": "0.13.1"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/architect": "0.1703.0", "@angular-devkit/architect": "0.1601.4",
"@angular-devkit/build-angular": "17.3.0", "@angular-devkit/build-angular": "16.1.4",
"@angular-devkit/core": "17.3.0", "@angular-devkit/core": "16.1.4",
"@angular-devkit/schematics": "17.3.0", "@angular-devkit/schematics": "16.1.4",
"@angular-eslint/builder": "17.3.0", "@angular-eslint/builder": "16.1.0",
"@angular-eslint/eslint-plugin": "17.3.0", "@angular-eslint/eslint-plugin": "16.1.0",
"@angular-eslint/eslint-plugin-template": "17.3.0", "@angular-eslint/eslint-plugin-template": "16.1.0",
"@angular-eslint/schematics": "17.3.0", "@angular-eslint/schematics": "16.1.0",
"@angular-eslint/template-parser": "17.3.0", "@angular-eslint/template-parser": "16.1.0",
"@angular/cli": "17.3.0", "@angular/cli": "16.1.4",
"@angular/compiler": "17.3.0", "@angular/compiler": "16.1.4",
"@angular/compiler-cli": "17.3.0", "@angular/compiler-cli": "16.1.4",
"@angular/language-server": "17.3.0", "@angular/language-service": "16.1.4",
"@angular/language-service": "17.3.0", "@angular/platform-browser-dynamic": "16.1.4",
"@angular/platform-browser-dynamic": "17.3.0", "@capacitor/android": "5.5.0",
"@capacitor/android": "5.7.3", "@capacitor/assets": "3.0.1",
"@capacitor/assets": "3.0.4", "@capacitor/cli": "5.5.0",
"@capacitor/cli": "5.7.3", "@capacitor/ios": "5.5.0",
"@capacitor/ios": "5.7.3", "@compodoc/compodoc": "1.1.19",
"@compodoc/compodoc": "1.1.23", "@cypress/schematic": "1.7.0",
"@cypress/schematic": "2.5.1", "@ionic/angular-toolkit": "10.0.0",
"@ionic/angular-toolkit": "11.0.1", "@ionic/cli": "7.1.1",
"@ionic/cli": "7.2.0",
"@openstapps/prettier-config": "workspace:*", "@openstapps/prettier-config": "workspace:*",
"@openstapps/tsconfig": "workspace:*", "@openstapps/tsconfig": "workspace:*",
"@types/fontkit": "2.0.7", "@types/fontkit": "1.8.0",
"@types/geojson": "1.0.6", "@types/geojson": "1.0.6",
"@types/glob": "8.1.0", "@types/glob": "8.0.1",
"@types/jasmine": "5.1.4", "@types/jasmine": "4.3.1",
"@types/jasminewd2": "2.0.13", "@types/jasminewd2": "2.0.10",
"@types/jsonpath": "0.2.0", "@types/jsonpath": "0.2.0",
"@types/karma": "6.3.8", "@types/karma": "6.3.4",
"@types/karma-coverage": "2.0.3", "@types/karma-coverage": "2.0.1",
"@types/karma-jasmine": "4.0.5", "@types/karma-jasmine": "4.0.2",
"@types/leaflet": "1.9.8", "@types/leaflet": "1.9.0",
"@types/leaflet.markercluster": "1.5.4", "@types/leaflet.markercluster": "1.5.1",
"@types/node": "18.15.3", "@types/node": "18.15.3",
"@types/semver": "7.5.8", "@types/semver": "7.5.6",
"@typescript-eslint/eslint-plugin": "7.2.0", "@typescript-eslint/eslint-plugin": "5.60.1",
"@typescript-eslint/parser": "7.2.0", "@typescript-eslint/parser": "5.60.1",
"cordova-res": "0.15.4", "cordova-res": "0.15.4",
"cypress": "13.7.0", "cypress": "13.2.0",
"eslint": "8.57.0", "eslint": "8.43.0",
"eslint-plugin-jsdoc": "48.2.1", "eslint-plugin-jsdoc": "46.4.2",
"eslint-plugin-prettier": "5.1.3", "eslint-plugin-prettier": "4.2.1",
"eslint-plugin-unicorn": "51.0.1", "eslint-plugin-unicorn": "47.0.0",
"fast-deep-equal": "3.1.3", "fast-deep-equal": "3.1.3",
"fontkit": "2.0.2", "fontkit": "2.0.2",
"glob": "10.3.10", "glob": "10.2.7",
"http-server": "14.1.1", "http-server": "14.1.1",
"is-docker": "2.2.1", "is-docker": "2.2.1",
"jasmine-core": "5.1.2", "jasmine-core": "5.0.1",
"jasmine-spec-reporter": "7.0.0", "jasmine-spec-reporter": "7.0.0",
"jetifier": "2.0.0", "jetifier": "2.0.0",
"junit-report-merger": "6.0.3", "junit-report-merger": "6.0.2",
"karma": "6.4.3", "karma": "6.4.2",
"karma-chrome-launcher": "3.2.0", "karma-chrome-launcher": "3.2.0",
"karma-coverage": "2.2.1", "karma-coverage": "2.2.1",
"karma-jasmine": "5.1.0", "karma-jasmine": "5.1.0",
"karma-junit-reporter": "2.0.1", "karma-junit-reporter": "2.0.1",
"karma-mocha-reporter": "2.2.5", "karma-mocha-reporter": "2.2.5",
"license-checker": "25.0.1", "license-checker": "25.0.1",
"stylelint": "16.2.1", "stylelint": "15.10.1",
"stylelint-config-clean-order": "5.4.1", "stylelint-config-clean-order": "5.0.1",
"stylelint-config-prettier-scss": "1.0.0", "stylelint-config-prettier-scss": "1.0.0",
"stylelint-config-recommended-scss": "14.0.0", "stylelint-config-recommended-scss": "12.0.0",
"stylelint-config-standard-scss": "13.0.0", "stylelint-config-standard-scss": "10.0.0",
"surge": "0.23.1", "surge": "0.23.1",
"ts-node": "10.9.2", "ts-node": "10.9.1",
"typescript": "5.4.2", "typescript": "5.1.6",
"webpack-bundle-analyzer": "4.10.1" "webpack-bundle-analyzer": "4.7.0"
}, },
"prettier": "@openstapps/prettier-config",
"cordova": { "cordova": {
"plugins": {}, "plugins": {},
"platforms": [ "platforms": [

View File

@@ -1,4 +1,3 @@
// @ts-check
/* /*
* Copyright (C) 2022 StApps * Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
@@ -26,6 +25,7 @@ const config = {
}, },
}, },
], ],
ignorePath: ['.prettierignore', '../../.gitignore'],
}; };
export default config; export default config;

View File

@@ -1,3 +1,4 @@
// @ts-check
/* /*
* Copyright (C) 2022 StApps * Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
@@ -13,13 +14,14 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import fs from 'fs'; import fs from 'fs';
import {omit} from '../src/app/_helpers/collections/omit'; import {omit, pickBy} from '@openstapps/collection-utils';
import {pickBy} from '../src/app/_helpers/collections/pick';
/** /**
* accumulate and transform licenses based on two license files * accumulate and transform licenses based on two license files
* @param {string} path
* @param {string} additionalLicensesPath
*/ */
function accumulateFile(path: string, additionalLicensesPath: string) { function accumulateFile(path, additionalLicensesPath) {
const packageJson = JSON.parse(fs.readFileSync('./package.json').toString()); const packageJson = JSON.parse(fs.readFileSync('./package.json').toString());
const dependencies = packageJson.dependencies; const dependencies = packageJson.dependencies;
@@ -28,10 +30,9 @@ function accumulateFile(path: string, additionalLicensesPath: string) {
fs.writeFileSync( fs.writeFileSync(
path, path,
JSON.stringify( JSON.stringify(
// eslint-disable-next-line @typescript-eslint/no-explicit-any Object.entries({
Object.entries<any>({ ...pickBy(JSON.parse(fs.readFileSync(path).toString()), (_, key) => {
...pickBy(JSON.parse(fs.readFileSync(path).toString()), (_, key: string) => { const parts = /** @type {string} */ (key).split('@');
const parts = key.split('@');
return dependencies[parts.slice(0, -1).join('@')] === parts[parts.length - 1]; return dependencies[parts.slice(0, -1).join('@')] === parts[parts.length - 1];
}), }),

View File

@@ -1,3 +1,4 @@
// @ts-check
/* /*
* Copyright (C) 2022 StApps * Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
@@ -12,18 +13,18 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import fontkit, {Font} from 'fontkit'; import {openSync} from 'fontkit';
import config from '../icons.config'; import config from '../icons.config.mjs';
import {existsSync} from 'fs'; import {existsSync} from 'fs';
import {getUsedIconsHtml, getUsedIconsTS} from './gather-used-icons'; import {getUsedIconsHtml, getUsedIconsTS} from './gather-used-icons.mjs';
const commandName = '"npm run minify-icons"'; const commandName = '"npm run minify-icons"';
const originalFont = fontkit.openSync(config.inputPath); const originalFont = openSync(config.inputPath);
if (!existsSync(config.outputPath)) { if (!existsSync(config.outputPath)) {
console.error(`Minified font not found. Run ${commandName} first.`); console.error(`Minified font not found. Run ${commandName} first.`);
process.exit(-1); process.exit(-1);
} }
const modifiedFont = fontkit.openSync(config.outputPath); const modifiedFont = openSync(config.outputPath);
let success = true; let success = true;
@@ -48,9 +49,9 @@ async function checkAll() {
} }
/** /**
* * @param {Record<string, string[]>} icons
*/ */
function check(icons: Record<string, string[]>) { function check(icons) {
for (const [purpose, iconSet] of Object.entries(icons)) { for (const [purpose, iconSet] of Object.entries(icons)) {
for (const icon of iconSet) { for (const icon of iconSet) {
if (!hasIcon(originalFont, icon)) { if (!hasIcon(originalFont, icon)) {
@@ -65,8 +66,9 @@ function check(icons: Record<string, string[]>) {
} }
/** /**
* * @param {import('fontkit').Font} font
* @param {string} icon
*/ */
function hasIcon(font: Font, icon: string) { function hasIcon(font, icon) {
return font.layout(icon).glyphs.some(it => it.isLigature); return font.layout(icon).glyphs.some(it => it.isLigature);
} }

View File

@@ -1,3 +1,4 @@
// @ts-check
/* /*
* Copyright (C) 2022 StApps * Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
@@ -14,31 +15,33 @@
*/ */
import {glob} from 'glob'; import {glob} from 'glob';
import {readFileSync} from 'fs'; import {readFileSync} from 'fs';
import {matchPropertyContent, matchTagProperties} from '../src/app/util/ion-icon/icon-match'; import {matchPropertyContent, matchTagProperties} from '../src/app/util/ion-icon/icon-match.mjs';
/** /**
* * @returns {Promise<Record<string, string[]>>}
*/ */
export async function getUsedIconsHtml(pattern = 'src/**/*.html'): Promise<Record<string, string[]>> { export async function getUsedIconsHtml(pattern = 'src/**/*.html') {
return Object.fromEntries( return Object.fromEntries(
(await glob(pattern)) (await glob(pattern))
.map(file => [ .map(file => [
file, file,
(readFileSync(file, 'utf8') /** @type {string[]} */ (
.match(matchTagProperties('ion-icon')) readFileSync(file, 'utf8')
?.flatMap(match => { .match(matchTagProperties('ion-icon'))
return match.match(matchPropertyContent(['name', 'md', 'ios'])); ?.flatMap(match => {
}) return match.match(matchPropertyContent(['name', 'md', 'ios']));
.filter(it => !!it) as string[]) || [], })
.filter(it => !!it)
) || [],
]) ])
.filter(([, values]) => values.length > 0), .filter(([, values]) => values.length > 0),
); );
} }
/** /**
* * @returns {Promise<Record<string, string[]>>}
*/ */
export async function getUsedIconsTS(pattern = 'src/**/*.ts'): Promise<Record<string, string[]>> { export async function getUsedIconsTS(pattern = 'src/**/*.ts') {
return Object.fromEntries( return Object.fromEntries(
(await glob(pattern)) (await glob(pattern))
.map(file => [file, readFileSync(file, 'utf8').match(/(?<=Icon`)[\w-]+(?=`)/g) || []]) .map(file => [file, readFileSync(file, 'utf8').match(/(?<=Icon`)[\w-]+(?=`)/g) || []])

View File

@@ -1,3 +1,4 @@
// @ts-check
/* /*
* Copyright (C) 2022 StApps * Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
@@ -12,18 +13,17 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {openSync} from 'fontkit';
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import fontkit from 'fontkit';
import {exec} from 'child_process'; import {exec} from 'child_process';
import config from '../icons.config'; import config from '../icons.config.mjs';
import {statSync} from 'fs'; import {statSync} from 'fs';
import {getUsedIconsHtml, getUsedIconsTS} from './gather-used-icons'; import {getUsedIconsHtml, getUsedIconsTS} from './gather-used-icons.mjs';
/** /**
* * @param {string[] | string} command
* @returns {Promise<string>}
*/ */
async function run(command: string[] | string): Promise<string> { async function run(command) {
const fullCommand = Array.isArray(command) ? command.join(' ') : command; const fullCommand = Array.isArray(command) ? command.join(' ') : command;
console.log(`>> ${fullCommand}`); console.log(`>> ${fullCommand}`);
@@ -44,7 +44,8 @@ async function run(command: string[] | string): Promise<string> {
* *
*/ */
async function minifyIconFont() { async function minifyIconFont() {
const icons = new Set<string>(); /** @type {Set<string>} */
const icons = new Set();
for (const iconSet of [ for (const iconSet of [
...Object.values(config.additionalIcons || []), ...Object.values(config.additionalIcons || []),
@@ -57,9 +58,10 @@ async function minifyIconFont() {
} }
console.log('Icons used:', [...icons.values()].sort()); console.log('Icons used:', [...icons.values()].sort());
const font = fontkit.openSync(config.inputPath); const font = openSync(config.inputPath);
const glyphs: string[] = ['5f-7a', '30-39']; /** @type {string[]} */
const glyphs = ['5f-7a', '30-39'];
for (const icon of icons) { for (const icon of icons) {
const iconGlyphs = font.layout(icon).glyphs; const iconGlyphs = font.layout(icon).glyphs;
if (iconGlyphs.length === 0) { if (iconGlyphs.length === 0) {
@@ -70,7 +72,7 @@ async function minifyIconFont() {
const codePoints = iconGlyphs const codePoints = iconGlyphs
.flatMap(it => font.stringsForGlyph(it.id)) .flatMap(it => font.stringsForGlyph(it.id))
.flatMap(it => [...it]) .flatMap(it => [...it])
.map(it => it.codePointAt(0)!.toString(16)); .map(it => it.codePointAt(0).toString(16));
if (codePoints.length === 0) { if (codePoints.length === 0) {
if (config.codePoints?.[icon]) { if (config.codePoints?.[icon]) {
@@ -114,8 +116,10 @@ minifyIconFont();
/** /**
* Bytes to respective units * Bytes to respective units
* @param {number} value
* @returns {string}
*/ */
function toByteUnit(value: number): string { function toByteUnit(value) {
if (value < 1024) { if (value < 1024) {
return `${value}B`; return `${value}B`;
} else if (value < 1024 * 1024) { } else if (value < 1024 * 1024) {

View File

@@ -1,7 +0,0 @@
{
"extends": "@openstapps/tsconfig",
"compilerOptions": {
"module": "CommonJS",
"moduleResolution": "Node"
}
}

View File

@@ -21,7 +21,7 @@ import {
SCThingOriginType, SCThingOriginType,
SCThingType, SCThingType,
} from '@openstapps/core'; } from '@openstapps/core';
import {CORE_VERSION} from '@openstapps/core'; import packageInfo from '@openstapps/core/package.json';
import {Polygon} from 'geojson'; import {Polygon} from 'geojson';
// provides sample aggregations to be used in tests or backendless development // provides sample aggregations to be used in tests or backendless development
@@ -195,7 +195,7 @@ export const sampleIndexResponse: SCIndexResponse = {
}, },
auth: {}, auth: {},
backend: { backend: {
SCVersion: CORE_VERSION, SCVersion: packageInfo.version,
externalRequestTimeout: 5000, externalRequestTimeout: 5000,
hiddenTypes: [SCThingType.DateSeries, SCThingType.Diff, SCThingType.Floor], hiddenTypes: [SCThingType.DateSeries, SCThingType.Diff, SCThingType.Floor],
mappingIgnoredTags: [], mappingIgnoredTags: [],

View File

@@ -14,7 +14,7 @@
*/ */
import {AnimationBuilder, AnimationController} from '@ionic/angular'; import {AnimationBuilder, AnimationController} from '@ionic/angular';
import {AnimationOptions} from '@ionic/angular/common/providers/nav-controller'; import {AnimationOptions} from '@ionic/angular/providers/nav-controller';
import {iosDuration, iosEasing, mdDuration, mdEasing} from './easings'; import {iosDuration, iosEasing, mdDuration, mdEasing} from './easings';
/** /**

View File

@@ -1,17 +1,17 @@
<!-- <!--
~ Copyright (C) 2023 StApps ~ Copyright (C) 2023 StApps
~ This program is free software: you can redistribute it and/or modify it ~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free ~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3. ~ Software Foundation, version 3.
~ ~
~ This program is distributed in the hope that it will be useful, but WITHOUT ~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details. ~ more details.
~ ~
~ You should have received a copy of the GNU General Public License along with ~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>. ~ this program. If not, see <https://www.gnu.org/licenses/>.
--> -->
<ion-header> <ion-header>
<ion-toolbar color="primary" mode="ios"> <ion-toolbar color="primary" mode="ios">
@@ -24,24 +24,28 @@
</ion-header> </ion-header>
<ion-content parallax> <ion-content parallax>
<div class="licenses-content"> <div class="licenses-content">
@for (license of licenses; track license) { <ion-card
<ion-card [href]="license.url || license.repository" rel="external" target="_blank"> *ngFor="let license of licenses"
<ion-card-header> [href]="license.url || license.repository"
<ion-card-title> rel="external"
{{ license.name }} target="_blank"
<ion-icon [size]="16" [weight]="300" class="supertext-icon" name="open_in_browser"></ion-icon> >
</ion-card-title> <ion-card-header>
@if (license.authors || license.publisher) { <ion-card-title>
<ion-card-subtitle> {{ license.authors || license.publisher }} </ion-card-subtitle> {{ license.name }}
} <ion-icon [size]="16" [weight]="300" class="supertext-icon" name="open_in_browser"></ion-icon>
</ion-card-header> </ion-card-title>
<ion-card-content>
<ion-chip (click)="$event.preventDefault(); viewLicense(license)"> <ion-card-subtitle *ngIf="license.authors || license.publisher">
<ion-icon name="copyright"></ion-icon> {{ license.authors || license.publisher }}
<ion-label>{{ license.licenses }} License</ion-label> </ion-card-subtitle>
</ion-chip> </ion-card-header>
</ion-card-content> <ion-card-content>
</ion-card> <ion-chip (click)="$event.preventDefault(); viewLicense(license)">
} <ion-icon name="copyright"></ion-icon>
<ion-label>{{ license.licenses }} License</ion-label>
</ion-chip>
</ion-card-content>
</ion-card>
</div> </div>
</ion-content> </ion-content>

View File

@@ -1,56 +1,41 @@
<!-- <!--
~ Copyright (C) 2023 StApps ~ Copyright (C) 2023 StApps
~ This program is free software: you can redistribute it and/or modify it ~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free ~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3. ~ Software Foundation, version 3.
~ ~
~ This program is distributed in the hope that it will be useful, but WITHOUT ~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details. ~ more details.
~ ~
~ You should have received a copy of the GNU General Public License along with ~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>. ~ this program. If not, see <https://www.gnu.org/licenses/>.
--> -->
@if (content.type === 'markdown') { <markdown *ngIf="content.type === 'markdown'" [data]="'value' | translateSimple : content"></markdown>
<markdown [data]="'value' | translateSimple: content"></markdown> <div *ngIf="content.type ==='section'">
} <ion-card *ngIf="content.card; else noCard">
@if (content.type === 'section') { <ion-card-header>
<div> <ion-card-title>{{ 'title' | translateSimple : content }}</ion-card-title>
@if (content.card) { </ion-card-header>
<ion-card> <ion-card-content>
<ion-card-header>
<ion-card-title>{{ 'title' | translateSimple: content }}</ion-card-title>
</ion-card-header>
<ion-card-content>
<about-page-content [content]="content.content"></about-page-content>
</ion-card-content>
</ion-card>
} @else {
<h2>{{ 'title' | translateSimple: content }}</h2>
<about-page-content [content]="content.content"></about-page-content> <about-page-content [content]="content.content"></about-page-content>
} </ion-card-content>
</div> </ion-card>
} <ng-template #noCard>
@if (content.type === 'table') { <h2>{{ 'title' | translateSimple : content }}</h2>
<ion-grid> <about-page-content [content]="content.content"></about-page-content>
@for (row of content.rows; track row) { </ng-template>
<ion-row> </div>
@for (col of row; track col) { <ion-grid *ngIf="content.type === 'table'">
<ion-col> <ion-row *ngFor="let row of content.rows">
<about-page-content [content]="col"></about-page-content> <ion-col *ngFor="let col of row">
</ion-col> <about-page-content [content]="col"></about-page-content>
} </ion-col>
</ion-row> </ion-row>
} </ion-grid>
</ion-grid> <ion-item *ngIf="content.type === 'router link'" [routerLink]="content.link">
} <ion-icon *ngIf="content.icon" [name]="content.icon" slot="start"></ion-icon>
@if (content.type === 'router link') { <ion-label>{{ 'title' | translateSimple : content }}</ion-label>
<ion-item [routerLink]="content.link"> </ion-item>
@if (content.icon) {
<ion-icon [name]="content.icon" slot="start"></ion-icon>
}
<ion-label>{{ 'title' | translateSimple: content }}</ion-label>
</ion-item>
}

View File

@@ -1,37 +1,32 @@
<!-- <!--
~ Copyright (C) 2023 StApps ~ Copyright (C) 2023 StApps
~ This program is free software: you can redistribute it and/or modify it ~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free ~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3. ~ Software Foundation, version 3.
~ ~
~ This program is distributed in the hope that it will be useful, but WITHOUT ~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details. ~ more details.
~ ~
~ You should have received a copy of the GNU General Public License along with ~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>. ~ this program. If not, see <https://www.gnu.org/licenses/>.
--> -->
<ion-header> <ion-header>
<ion-toolbar color="primary" mode="ios"> <ion-toolbar color="primary" mode="ios">
<ion-buttons slot="start"> <ion-buttons slot="start">
<ion-back-button></ion-back-button> <ion-back-button></ion-back-button>
</ion-buttons> </ion-buttons>
@if (content) { <ion-title *ngIf="content; else titleLoading">{{ 'title' | translateSimple : content }}</ion-title>
<ion-title>{{ 'title' | translateSimple: content }}</ion-title> <ng-template #titleLoading>
} @else {
<ion-title><ion-skeleton-text animated="true"></ion-skeleton-text></ion-title> <ion-title><ion-skeleton-text animated="true"></ion-skeleton-text></ion-title>
} </ng-template>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
@if (content) { <ion-content parallax *ngIf="content">
<ion-content parallax> <ion-text>{{ 'about.VERSION_INFO' | translate: {name, version, stappsVersion} }}</ion-text>
<ion-text>{{ 'about.VERSION_INFO' | translate: {name, version, stappsVersion} }}</ion-text> <div class="page-content">
<div class="page-content"> <about-page-content *ngFor="let element of content.content" [content]="element"></about-page-content>
@for (element of content.content; track element) { </div>
<about-page-content [content]="element"></about-page-content> </ion-content>
}
</div>
</ion-content>
}

View File

@@ -5,6 +5,7 @@ import {ThingTranslateModule} from '../../translation/thing-translate.module';
import {IonicModule, ModalController} from '@ionic/angular'; import {IonicModule, ModalController} from '@ionic/angular';
import {TranslateModule} from '@ngx-translate/core'; import {TranslateModule} from '@ngx-translate/core';
import {UtilModule} from '../../util/util.module'; import {UtilModule} from '../../util/util.module';
import {CommonModule} from '@angular/common';
@Component({ @Component({
selector: 'stapps-release-notes', selector: 'stapps-release-notes',
@@ -12,7 +13,7 @@ import {UtilModule} from '../../util/util.module';
styleUrls: ['release-notes.scss'], styleUrls: ['release-notes.scss'],
standalone: true, standalone: true,
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
imports: [UtilModule, MarkdownModule, ThingTranslateModule, IonicModule, TranslateModule], imports: [UtilModule, MarkdownModule, ThingTranslateModule, IonicModule, TranslateModule, CommonModule],
}) })
export class ReleaseNotesComponent { export class ReleaseNotesComponent {
@Input() versionInfos: SCAppVersionInfo[]; @Input() versionInfos: SCAppVersionInfo[];

View File

@@ -1,20 +1,18 @@
<ion-header> <ion-header>
<ion-toolbar> <ion-toolbar>
<ion-title <ion-title><span class="ion-text-wrap">{{'releaseNotes.TITLE_UPDATED' | translate}}</span></ion-title>
><span class="ion-text-wrap">{{ 'releaseNotes.TITLE_UPDATED' | translate }}</span></ion-title
>
<ion-buttons slot="end"> <ion-buttons slot="end">
<ion-button [strong]="true" (click)="modalController.dismiss()">{{ <ion-button [strong]="true" (click)="modalController.dismiss()"
'modal.DISMISS_NEUTRAL' | translate >{{'modal.DISMISS_NEUTRAL' | translate}}</ion-button
}}</ion-button> >
</ion-buttons> </ion-buttons>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content parallax> <ion-content parallax>
@for (versionInfo of versionInfos; track versionInfo) { <ng-container *ngFor="let versionInfo of versionInfos">
<markdown <markdown
class="content-card ion-padding" class="content-card ion-padding"
[data]="'releaseNotes' | translateSimple: versionInfo" [data]="'releaseNotes' | translateSimple: versionInfo"
></markdown> ></markdown>
} </ng-container>
</ion-content> </ion-content>

View File

@@ -36,7 +36,7 @@
class="ion-text-wrap" class="ion-text-wrap"
*ngIf="assessments[key].courseOfStudy | async as course; else defaultLabel" *ngIf="assessments[key].courseOfStudy | async as course; else defaultLabel"
> >
{{ 'name' | thingTranslate: course }} ({{ 'academicDegree' | thingTranslate: course }}) {{ 'name' | thingTranslate : course }} ({{ 'academicDegree' | thingTranslate : course }})
</ion-label> </ion-label>
</div> </div>
<ng-template #defaultLabel> <ng-template #defaultLabel>

View File

@@ -14,12 +14,8 @@
--> -->
<ion-label [color]="passed ? undefined : 'danger'" <ion-label [color]="passed ? undefined : 'danger'"
>{{ >{{ (_item.grade | isNumeric) ? (_item.grade | numberLocalized :
(_item.grade | isNumeric) 'minimumFractionDigits:1,maximumFractionDigits:1') : '' }} {{ 'status' | thingTranslate : _item | titlecase
? (_item.grade | numberLocalized: 'minimumFractionDigits:1,maximumFractionDigits:1') }}, {{ 'attempt' | propertyNameTranslate : _item }} {{ _item.attempt }}
: ''
}}
{{ 'status' | thingTranslate: _item | titlecase }}, {{ 'attempt' | propertyNameTranslate: _item }}
{{ _item.attempt }}
</ion-label> </ion-label>
<ion-note> {{ _item.ects }} {{ 'ects' | propertyNameTranslate: _item }}</ion-note> <ion-note> {{ _item.ects }} {{ 'ects' | propertyNameTranslate : _item }}</ion-note>

View File

@@ -1,28 +1,24 @@
<!-- <!--
~ Copyright (C) 2022 StApps ~ Copyright (C) 2022 StApps
~ This program is free software: you can redistribute it and/or modify it ~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free ~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3. ~ Software Foundation, version 3.
~ ~
~ This program is distributed in the hope that it will be useful, but WITHOUT ~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details. ~ more details.
~ ~
~ You should have received a copy of the GNU General Public License along with ~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>. ~ this program. If not, see <https://www.gnu.org/licenses/>.
--> -->
<ion-card> <ion-card>
<ion-card-content> <ion-card-content>
@if (item.courseOfStudy; as courseOfStudy) { <ion-note *ngIf="item.courseOfStudy as courseOfStudy">
<ion-note> {{ $any('courseOfStudy' | propertyNameTranslate : item) | titlecase }}: {{ 'name' | thingTranslate :
{{ $any('courseOfStudy' | propertyNameTranslate: item) | titlecase }}: $any(courseOfStudy) }} ({{ 'academicDegree' | thingTranslate : $any(courseOfStudy) }})
{{ 'name' | thingTranslate: $any(courseOfStudy) }} ({{ </ion-note>
'academicDegree' | thingTranslate: $any(courseOfStudy)
}})
</ion-note>
}
</ion-card-content> </ion-card-content>
</ion-card> </ion-card>
<ion-list class="container"> <ion-list class="container">

View File

@@ -14,6 +14,6 @@
--> -->
<div class="container"> <div class="container">
<h2 class="name">{{ 'name' | thingTranslate: item }} {{ item.date ? (item.date | amDateFormat) : '' }}</h2> <h2 class="name">{{ 'name' | thingTranslate : item }} {{ item.date ? (item.date | amDateFormat) : '' }}</h2>
<assessment-base-info [item]="item"></assessment-base-info> <assessment-base-info [item]="item"></assessment-base-info>
</div> </div>

View File

@@ -1,17 +1,17 @@
<!-- <!--
~ Copyright (C) 2022 StApps ~ Copyright (C) 2022 StApps
~ This program is free software: you can redistribute it and/or modify it ~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free ~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3. ~ Software Foundation, version 3.
~ ~
~ This program is distributed in the hope that it will be useful, but WITHOUT ~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details. ~ more details.
~ ~
~ You should have received a copy of the GNU General Public License along with ~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>. ~ this program. If not, see <https://www.gnu.org/licenses/>.
--> -->
<div> <div>
<ion-card-header> <ion-card-header>
<ion-card-title>{{ 'schedule.toCalendar.reviewModal.TITLE' | translate }}</ion-card-title> <ion-card-title>{{ 'schedule.toCalendar.reviewModal.TITLE' | translate }}</ion-card-title>
@@ -22,46 +22,34 @@
<ion-card-content> <ion-card-content>
<ion-list lines="none"> <ion-list lines="none">
@for (event of iCalEvents; track event) { <ion-item-group *ngFor="let event of iCalEvents">
<ion-item-group> <ion-item-divider>
<ion-item-divider> <ion-label>{{ event.title }}</ion-label>
<ion-label>{{ event.title }}</ion-label> <ion-note slot="start" *ngIf="event.events.length > 1">
@if (event.events.length > 1) { <ion-icon name="insert_page_break"></ion-icon>
<ion-note slot="start"> </ion-note>
<ion-icon name="insert_page_break"></ion-icon> </ion-item-divider>
</ion-note> <ion-item *ngFor="let iCalEvent of event.events">
} <ion-label>
</ion-item-divider> <s *ngIf="iCalEvent.cancelled; else date"
@for (iCalEvent of event.events; track iCalEvent) { ><ng-container [ngTemplateOutlet]="date"></ng-container>
<ion-item> </s>
<ion-label> <ng-template #date> {{ moment(iCalEvent.start) | amDateFormat : 'll, HH:mm' }} </ng-template>
@if (iCalEvent.cancelled) { </ion-label>
<s><ng-container [ngTemplateOutlet]="date"></ng-container> </s> <ion-note *ngIf="iCalEvent.rrule">
} @else { {{ iCalEvent.rrule.interval }} {{ iCalEvent.rrule.freq | sentencecase }}
{{ moment(iCalEvent.start) | amDateFormat: 'll, HH:mm' }} </ion-note>
} <ion-icon *ngIf="iCalEvent.rrule" name="event_repeat"></ion-icon>
<ng-template #date> {{ moment(iCalEvent.start) | amDateFormat: 'll, HH:mm' }} </ng-template> </ion-item>
</ion-label> </ion-item-group>
@if (iCalEvent.rrule) {
<ion-note>
{{ iCalEvent.rrule.interval }} {{ iCalEvent.rrule.freq | sentencecase }}
</ion-note>
}
@if (iCalEvent.rrule) {
<ion-icon name="event_repeat"></ion-icon>
}
</ion-item>
}
</ion-item-group>
}
</ion-list> </ion-list>
</ion-card-content> </ion-card-content>
<div class="horizontal-flex"> <div class="horizontal-flex">
<ion-item lines="none"> <ion-item lines="none">
<ion-checkbox [(ngModel)]="includeCancelled">{{ <ion-checkbox [(ngModel)]="includeCancelled"
'schedule.toCalendar.reviewModal.INCLUDE_CANCELLED' | translate >{{ 'schedule.toCalendar.reviewModal.INCLUDE_CANCELLED' | translate }}</ion-checkbox
}}</ion-checkbox> >
</ion-item> </ion-item>
</div> </div>
<div class="horizontal-flex"> <div class="horizontal-flex">
@@ -69,16 +57,15 @@
{{ 'share' | translate }} {{ 'share' | translate }}
<ion-icon slot="end" md="share" ios="ios_share"></ion-icon> <ion-icon slot="end" md="share" ios="ios_share"></ion-icon>
</ion-button> </ion-button>
@if (isWeb) { <ion-button fill="outline" (click)="download()" *ngIf="isWeb; else exportButton">
<ion-button fill="outline" (click)="download()"> {{ 'schedule.toCalendar.reviewModal.DOWNLOAD' | translate }}
{{ 'schedule.toCalendar.reviewModal.DOWNLOAD' | translate }} <ion-icon slot="end" name="download"></ion-icon>
<ion-icon slot="end" name="download"></ion-icon> </ion-button>
</ion-button> <ng-template #exportButton>
} @else {
<ion-button fill="outline" (click)="toCalendar()"> <ion-button fill="outline" (click)="toCalendar()">
{{ 'schedule.toCalendar.reviewModal.EXPORT' | translate }} {{ 'schedule.toCalendar.reviewModal.EXPORT' | translate }}
<ion-icon slot="end" name="event_upcoming"></ion-icon> <ion-icon slot="end" name="event_upcoming"></ion-icon>
</ion-button> </ion-button>
} </ng-template>
</div> </div>
</div> </div>

View File

@@ -1,17 +1,17 @@
<!-- <!--
~ Copyright (C) 2022 StApps ~ Copyright (C) 2022 StApps
~ This program is free software: you can redistribute it and/or modify it ~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free ~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3. ~ Software Foundation, version 3.
~ ~
~ This program is distributed in the hope that it will be useful, but WITHOUT ~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details. ~ more details.
~ ~
~ You should have received a copy of the GNU General Public License along with ~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>. ~ this program. If not, see <https://www.gnu.org/licenses/>.
--> -->
<ion-header> <ion-header>
<ion-toolbar color="primary" mode="ios"> <ion-toolbar color="primary" mode="ios">
@@ -23,45 +23,33 @@
</ion-toolbar> </ion-toolbar>
<ion-toolbar color="primary" mode="md"> <ion-toolbar color="primary" mode="md">
<ion-segment (ionChange)="segmentChanged($event)" [value]="selectedSemesterUID" mode="md"> <ion-segment (ionChange)="segmentChanged($event)" [value]="selectedSemesterUID" mode="md">
@for (semester of availableSemesters; track semester) { <ion-segment-button *ngFor="let semester of availableSemesters" [value]="semester.uid">
<ion-segment-button [value]="semester.uid"> <ion-label>{{ semester.acronym }}</ion-label>
<ion-label>{{ semester.acronym }}</ion-label> </ion-segment-button>
</ion-segment-button>
}
</ion-segment> </ion-segment>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content> <ion-content>
@if (catalogs && catalogs.length > 0) { <ion-list *ngIf="catalogs && catalogs.length > 0">
<ion-list> <ion-item *ngFor="let catalog of catalogs" button="true" lines="inset" (click)="notifySelect(catalog)">
@for (catalog of catalogs; track catalog) { <ion-label>
<ion-item button="true" lines="inset" (click)="notifySelect(catalog)"> <h2>{{ catalog.name }}</h2>
</ion-label>
</ion-item>
</ion-list>
<ion-list *ngIf="!catalogs">
<stapps-skeleton-list-item *ngFor="let skeleton of [].constructor(10)"> </stapps-skeleton-list-item>
</ion-list>
<ion-grid *ngIf="catalogs && catalogs.length === 0">
<ion-row>
<ion-col>
<div class="ion-text-center margin-top">
<ion-label> <ion-label>
<h2>{{ catalog.name }}</h2> {{ 'catalog.detail.EMPTY_SEMESTER' | translate }}
</ion-label> </ion-label>
</ion-item> </div>
} </ion-col>
</ion-list> </ion-row>
} </ion-grid>
@if (!catalogs) {
<ion-list>
@for (skeleton of [].constructor(10); track skeleton) {
<stapps-skeleton-list-item> </stapps-skeleton-list-item>
}
</ion-list>
}
@if (catalogs && catalogs.length === 0) {
<ion-grid>
<ion-row>
<ion-col>
<div class="ion-text-center margin-top">
<ion-label>
{{ 'catalog.detail.EMPTY_SEMESTER' | translate }}
</ion-label>
</div>
</ion-col>
</ion-row>
</ion-grid>
}
</ion-content> </ion-content>

View File

@@ -15,7 +15,7 @@
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import {Client} from '@openstapps/api'; import {Client} from '@openstapps/api';
import {SCAppConfiguration, SCIndexResponse} from '@openstapps/core'; import {SCAppConfiguration, SCIndexResponse} from '@openstapps/core';
import {CORE_VERSION} from '@openstapps/core'; import packageInfo from '@openstapps/core/package.json';
import {NGXLogger} from 'ngx-logger'; import {NGXLogger} from 'ngx-logger';
import {environment} from '../../../environments/environment'; import {environment} from '../../../environments/environment';
import {StAppsWebHttpClient} from '../data/stapps-web-http-client.provider'; import {StAppsWebHttpClient} from '../data/stapps-web-http-client.provider';
@@ -55,7 +55,7 @@ export class ConfigProvider {
/** /**
* Version of the @openstapps/core package that app is using * Version of the @openstapps/core package that app is using
*/ */
scVersion = CORE_VERSION; scVersion = packageInfo.version;
/** /**
* First session indicator (config not found in storage) * First session indicator (config not found in storage)

View File

@@ -1,34 +1,32 @@
<!-- <!--
~ Copyright (C) 2023 StApps ~ Copyright (C) 2023 StApps
~ This program is free software: you can redistribute it and/or modify it ~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free ~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3. ~ Software Foundation, version 3.
~ ~
~ This program is distributed in the hope that it will be useful, but WITHOUT ~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details. ~ more details.
~ ~
~ You should have received a copy of the GNU General Public License along with ~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>. ~ this program. If not, see <https://www.gnu.org/licenses/>.
--> -->
<stapps-section [title]="'dashboard.favorites.title' | translate"> <stapps-section [title]="'dashboard.favorites.title' | translate">
<ion-button slot="button-end" fill="clear" color="medium" [routerLink]="['/favorites']"> <ion-button slot="button-end" fill="clear" color="medium" [routerLink]="['/favorites']">
<ion-icon slot="icon-only" name="search" [size]="24"></ion-icon> <ion-icon slot="icon-only" name="search" [size]="24"></ion-icon>
</ion-button> </ion-button>
@if (items | async; as items) { <simple-swiper *ngIf="items | async as items; else noItems" @fade>
<simple-swiper @fade> <stapps-data-list-item
@for (item of items; track item) { *ngFor="let item of items"
<stapps-data-list-item [hideThumbnail]="true"
[hideThumbnail]="true" [listItemEndInteraction]="false"
[listItemEndInteraction]="false" [item]="item"
[item]="item" appearance="square"
appearance="square" ></stapps-data-list-item>
></stapps-data-list-item> </simple-swiper>
} <ng-template #noItems>
</simple-swiper>
} @else {
<ion-item class="nothing-selected" lines="none"> <ion-item class="nothing-selected" lines="none">
<ion-label class="ion-text-wrap"> <ion-label class="ion-text-wrap">
{{ 'dashboard.favorites.no_favorite_prefix' | translate }} {{ 'dashboard.favorites.no_favorite_prefix' | translate }}
@@ -36,5 +34,5 @@
{{ 'dashboard.favorites.no_favorite_suffix' | translate }} {{ 'dashboard.favorites.no_favorite_suffix' | translate }}
</ion-label> </ion-label>
</ion-item> </ion-item>
} </ng-template>
</stapps-section> </stapps-section>

View File

@@ -1,44 +1,43 @@
<!-- <!--
~ Copyright (C) 2023 StApps ~ Copyright (C) 2023 StApps
~ This program is free software: you can redistribute it and/or modify it ~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free ~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3. ~ Software Foundation, version 3.
~ ~
~ This program is distributed in the hope that it will be useful, but WITHOUT ~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details. ~ more details.
~ ~
~ You should have received a copy of the GNU General Public License along with ~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>. ~ this program. If not, see <https://www.gnu.org/licenses/>.
--> -->
<stapps-section [title]="'dashboard.jobs.title' | translate"> <stapps-section [title]="'dashboard.jobs.title' | translate">
<ion-button slot="button-end" fill="clear" color="medium" [routerLink]="['/jobs']"> <ion-button slot="button-end" fill="clear" color="medium" [routerLink]="['/jobs']">
<ion-icon slot="icon-only" name="search" [size]="24"></ion-icon> <ion-icon slot="icon-only" name="search" [size]="24"></ion-icon>
</ion-button> </ion-button>
@if (jobs | async; as jobs) { <simple-swiper *ngIf="jobs | async as jobs; else noItems" @fade>
<simple-swiper @fade> <stapps-data-list-item
@for (item of jobs; track item) { *ngFor="let item of jobs"
<stapps-data-list-item [hideThumbnail]="true"
[hideThumbnail]="true" [item]="item"
[item]="item" appearance="square"
appearance="square" ></stapps-data-list-item>
></stapps-data-list-item> <ion-item [routerLink]="['/jobs']" class="more-jobs" lines="none">
} <ion-label>{{ 'dashboard.jobs.title' | translate | titlecase }}</ion-label>
<ion-item [routerLink]="['/jobs']" class="more-jobs" lines="none"> <ion-icon color="medium" name="read_more" [size]="40"></ion-icon>
<ion-label>{{ 'dashboard.jobs.title' | translate | titlecase }}</ion-label> </ion-item>
<ion-icon color="medium" name="read_more" [size]="40"></ion-icon> </simple-swiper>
</ion-item> <ng-template #noItems>
</simple-swiper>
} @else {
<ion-item class="nothing-selected" lines="none"> <ion-item class="nothing-selected" lines="none">
<ion-label class="ion-text-wrap"> <ion-label class="ion-text-wrap">
{{ 'dashboard.jobs.noJobs' | translate }} {{ 'dashboard.jobs.noJobs' | translate }}
</ion-label> </ion-label>
</ion-item> </ion-item>
<ion-button slot="button-end" fill="clear" color="medium" [routerLink]="['/jobs']"> <ion-button slot="button-end" fill="clear" color="medium" [routerLink]="['/jobs']">
<ion-icon slot="icon-only" name="search" [size]="24"></ion-icon> <ion-icon slot="icon-only" name="search" [size]="24"></ion-icon>
</ion-button> </ion-button>
} </ng-template>
</stapps-section> </stapps-section>

View File

@@ -1,37 +1,33 @@
<!-- <!--
~ Copyright (C) 2023 StApps ~ Copyright (C) 2023 StApps
~ This program is free software: you can redistribute it and/or modify it ~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free ~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3. ~ Software Foundation, version 3.
~ ~
~ This program is distributed in the hope that it will be useful, but WITHOUT ~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details. ~ more details.
~ ~
~ You should have received a copy of the GNU General Public License along with ~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>. ~ this program. If not, see <https://www.gnu.org/licenses/>.
--> -->
@if (dishes | async; as dishes) { <ng-container *ngIf="dishes | async as dishes; else loading">
@if (dishes.length > 0) { <simple-swiper *ngIf="dishes.length > 0" @fade>
<simple-swiper @fade> <stapps-data-list-item
@for (dish of dishes; track dish) { *ngFor="let dish of dishes"
<stapps-data-list-item [hideThumbnail]="true"
[hideThumbnail]="true" [item]="dish"
[item]="dish" appearance="square"
appearance="square" ></stapps-data-list-item>
></stapps-data-list-item> </simple-swiper>
} <ion-item class="no-dishes" *ngIf="!dishes || dishes.length === 0" lines="none">
</simple-swiper> <ion-label>
} {{ 'dashboard.canteens.no_dishes_available' | translate }}
@if (!dishes || dishes.length === 0) { </ion-label>
<ion-item class="no-dishes" lines="none"> </ion-item>
<ion-label> </ng-container>
{{ 'dashboard.canteens.no_dishes_available' | translate }} <ng-template #loading>
</ion-label>
</ion-item>
}
} @else {
<div class="placeholder"></div> <div class="placeholder"></div>
} </ng-template>

View File

@@ -1,21 +1,21 @@
<!-- <!--
~ Copyright (C) 2023 StApps ~ Copyright (C) 2023 StApps
~ This program is free software: you can redistribute it and/or modify it ~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free ~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3. ~ Software Foundation, version 3.
~ ~
~ This program is distributed in the hope that it will be useful, but WITHOUT ~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details. ~ more details.
~ ~
~ You should have received a copy of the GNU General Public License along with ~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>. ~ this program. If not, see <https://www.gnu.org/licenses/>.
--> -->
@if (items | async; as items) { <ng-container *ngIf="items | async as items">
@if (items.length !== 0) { <ng-container *ngIf="items.length !== 0; else nothingSelected">
@for (item of items; track item) { <ng-container *ngFor="let item of items">
<stapps-section @fade [item]="item" [title]="'name' | thingTranslate: item"> <stapps-section @fade [item]="item" [title]="'name' | thingTranslate: item">
<ion-button slot="button-end" fill="clear" color="medium" (click)="favoritesService.delete(item)"> <ion-button slot="button-end" fill="clear" color="medium" (click)="favoritesService.delete(item)">
<ion-icon slot="icon-only" name="delete" [size]="24"></ion-icon> <ion-icon slot="icon-only" name="delete" [size]="24"></ion-icon>
@@ -23,8 +23,9 @@
<stapps-opening-hours slot="subtitle" [openingHours]="$any(item).openingHours"></stapps-opening-hours> <stapps-opening-hours slot="subtitle" [openingHours]="$any(item).openingHours"></stapps-opening-hours>
<stapps-mensa-section-content [item]="item"></stapps-mensa-section-content> <stapps-mensa-section-content [item]="item"></stapps-mensa-section-content>
</stapps-section> </stapps-section>
} </ng-container>
} @else { </ng-container>
<ng-template #nothingSelected>
<stapps-section [title]="'dashboard.canteens.title' | translate"> <stapps-section [title]="'dashboard.canteens.title' | translate">
<ion-item class="nothing-selected" lines="none"> <ion-item class="nothing-selected" lines="none">
<ion-label class="ion-text-wrap"> <ion-label class="ion-text-wrap">
@@ -34,5 +35,5 @@
</ion-label> </ion-label>
</ion-item> </ion-item>
</stapps-section> </stapps-section>
} </ng-template>
} </ng-container>

View File

@@ -1,33 +1,29 @@
<!-- <!--
~ Copyright (C) 2023 StApps ~ Copyright (C) 2023 StApps
~ This program is free software: you can redistribute it and/or modify it ~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free ~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3. ~ Software Foundation, version 3.
~ ~
~ This program is distributed in the hope that it will be useful, but WITHOUT ~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details. ~ more details.
~ ~
~ You should have received a copy of the GNU General Public License along with ~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>. ~ this program. If not, see <https://www.gnu.org/licenses/>.
--> -->
<stapps-section [title]="'dashboard.news.title' | translate"> <stapps-section [title]="'dashboard.news.title' | translate">
<ion-button size="small" slot="button-end" fill="clear" color="medium" [routerLink]="['/news']"> <ion-button size="small" slot="button-end" fill="clear" color="medium" [routerLink]="['/news']">
<ion-icon slot="icon-only" name="read_more"></ion-icon> <ion-icon slot="icon-only" name="read_more"></ion-icon>
</ion-button> </ion-button>
@if (news | async; as news) { <simple-swiper class="news-swiper card-swiper" *ngIf="news | async as news" @fade>
<simple-swiper class="news-swiper card-swiper" @fade> <stapps-news-item *ngFor="let newsItem of news" [item]="newsItem"> </stapps-news-item>
@for (newsItem of news; track newsItem) { <ion-item [routerLink]="['/news']" class="more-news" lines="none">
<stapps-news-item [item]="newsItem"> </stapps-news-item> <ion-label>{{ 'dashboard.news.moreNews' | translate | titlecase }}</ion-label>
} <ion-thumbnail class="ion-margin-end">
<ion-item [routerLink]="['/news']" class="more-news" lines="none"> <ion-icon color="medium" name="read_more" [size]="150"></ion-icon>
<ion-label>{{ 'dashboard.news.moreNews' | translate | titlecase }}</ion-label> </ion-thumbnail>
<ion-thumbnail class="ion-margin-end"> </ion-item>
<ion-icon color="medium" name="read_more" [size]="150"></ion-icon> </simple-swiper>
</ion-thumbnail>
</ion-item>
</simple-swiper>
}
</stapps-section> </stapps-section>

View File

@@ -63,10 +63,10 @@ simple-swiper {
.title { .title {
overflow: hidden; overflow: hidden;
display: -webkit-box; display: -webkit-box;
-webkit-box-orient: vertical;
white-space: break-spaces; white-space: break-spaces;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3; -webkit-line-clamp: 3;
} }

View File

@@ -14,7 +14,7 @@
*/ */
import {AnimationController} from '@ionic/angular'; import {AnimationController} from '@ionic/angular';
import {AnimationOptions} from '@ionic/angular/common/providers/nav-controller'; import {AnimationOptions} from '@ionic/angular/providers/nav-controller';
/** /**
* *

View File

@@ -1,25 +1,19 @@
<!-- <!--
~ Copyright (C) 2023 StApps ~ Copyright (C) 2023 StApps
~ This program is free software: you can redistribute it and/or modify it ~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free ~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3. ~ Software Foundation, version 3.
~ ~
~ This program is distributed in the hope that it will be useful, but WITHOUT ~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details. ~ more details.
~ ~
~ You should have received a copy of the GNU General Public License along with ~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>. ~ this program. If not, see <https://www.gnu.org/licenses/>.
--> -->
@if (applicable.locate) { <stapps-locate-action-chip *ngIf="applicable.locate" [item]="item"></stapps-locate-action-chip>
<stapps-locate-action-chip [item]="item"></stapps-locate-action-chip> <stapps-navigate-action-chip *ngIf="applicable.navigate" [item]="$any(item)"></stapps-navigate-action-chip>
}
@if (applicable.navigate) {
<stapps-navigate-action-chip [item]="$any(item)"></stapps-navigate-action-chip>
}
<!-- Add Event Chip needs to load data and should be the last --> <!-- Add Event Chip needs to load data and should be the last -->
@if (applicable.event) { <stapps-add-event-action-chip *ngIf="applicable.event" [item]="item"></stapps-add-event-action-chip>
<stapps-add-event-action-chip [item]="item"></stapps-add-event-action-chip>
}

View File

@@ -1,57 +1,57 @@
<!-- <!--
~ Copyright (C) 2023 StApps ~ Copyright (C) 2023 StApps
~ This program is free software: you can redistribute it and/or modify it ~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free ~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3. ~ Software Foundation, version 3.
~ ~
~ This program is distributed in the hope that it will be useful, but WITHOUT ~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details. ~ more details.
~ ~
~ You should have received a copy of the GNU General Public License along with ~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>. ~ this program. If not, see <https://www.gnu.org/licenses/>.
--> -->
<div class="stack-children"> <div class="stack-children">
@if (associatedDateSeries | async; as associatedDateSeries) { <ion-chip
<ion-chip *ngIf="associatedDateSeries | async as associatedDateSeries; else loading"
@chipTransition @chipTransition
[disabled]="disabled" [disabled]="disabled"
(click)="$event.stopPropagation(); editModal.present()" (click)="$event.stopPropagation(); editModal.present()"
[color]="color" [color]="color"
[outline]="true" [outline]="true"
> >
<ion-icon [name]="icon" [fill]="iconFill"></ion-icon> <ion-icon [name]="icon" [fill]="iconFill"></ion-icon>
<ion-label>{{ label | translate }}</ion-label> <ion-label>{{ label | translate }}</ion-label>
<stapps-edit-modal #editModal (save)="selection.save()"> <stapps-edit-modal #editModal (save)="selection.save()">
<ng-template> <ng-template>
<ion-content parallax [parallaxSize]="160" class="ion-padding modal-content"> <ion-content parallax [parallaxSize]="160" class="ion-padding modal-content">
<stapps-edit-event-selection <stapps-edit-event-selection
#selection #selection
[items]="associatedDateSeries" [items]="associatedDateSeries"
(modified)="editModal.pendingChanges = true" (modified)="editModal.pendingChanges = true"
></stapps-edit-event-selection> ></stapps-edit-event-selection>
</ion-content> </ion-content>
<ion-footer mode="ios"> <ion-footer mode="ios">
<ion-toolbar color="light"> <ion-toolbar color="light">
<ion-button <ion-button
slot="end" slot="end"
fill="clear" fill="clear"
(click)="export()" (click)="export()"
[disabled]="!(selection.selection.indeterminate || selection.selection.checked)" [disabled]="!(selection.selection.indeterminate || selection.selection.checked)"
> >
{{ 'schedule.toCalendar.reviewModal.DOWNLOAD' | translate | titlecase }} {{ 'schedule.toCalendar.reviewModal.DOWNLOAD' | translate | titlecase }}
<ion-icon slot="end" name="download"></ion-icon> <ion-icon slot="end" name="download"></ion-icon>
</ion-button> </ion-button>
</ion-toolbar> </ion-toolbar>
</ion-footer> </ion-footer>
</ng-template> </ng-template>
</stapps-edit-modal> </stapps-edit-modal>
</ion-chip> </ion-chip>
} @else { <ng-template #loading>
<ion-chip @chipSkeletonTransition> <ion-chip @chipSkeletonTransition>
<ion-skeleton-text animated="true"></ion-skeleton-text> <ion-skeleton-text animated="true"></ion-skeleton-text>
</ion-chip> </ion-chip>
} </ng-template>
</div> </div>

Some files were not shown because too many files have changed in this diff Show More