id
int64
0
1.29M
original_id
stringlengths
32
32
swhid
stringlengths
100
170
sha1
stringlengths
40
40
repo_name
stringlengths
2
45
repo_group
stringclasses
12 values
filepath
stringlengths
5
153
name
stringlengths
1
14.9k
type
stringclasses
3 values
code
stringlengths
7
2.12M
15,200
ce6915d2d0f2ea80153d7f272afa3e4a
swh:1:cnt:0cc3bbb010e3346cfd9b6c445f52c1c38378abbf;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AntiSpoof.git;lines=18-31/
d5855993c041fbfa72d2cf435c2092cf2535e1e9
AntiSpoof
deployed
tests/phpunit/AntiSpoofPreAuthenticationProviderTest.php
AntiSpoofPreAuthenticationProviderTest::testGetAuthenticationRequests( $action, $params, bool $useUsername, $expectedReqs )
function
/** * @dataProvider provideGetAuthenticationRequests */ public function testGetAuthenticationRequests( $action, $params, bool $useUsername, $expectedReqs ) { $this->overrideConfigValue( 'AntiSpoofAccounts', false ); $provider = new AntiSpoofPreAuthenticationProvider( $this->getServiceContainer()->getPermiss...
15,201
f970bb1bc82a5a511b0a4af208c92d41
swh:1:cnt:0cc3bbb010e3346cfd9b6c445f52c1c38378abbf;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AntiSpoof.git;lines=33-44/
d5855993c041fbfa72d2cf435c2092cf2535e1e9
AntiSpoof
deployed
tests/phpunit/AntiSpoofPreAuthenticationProviderTest.php
AntiSpoofPreAuthenticationProviderTest::provideGetAuthenticationRequests()
function
public static function provideGetAuthenticationRequests() { return [ [ AuthManager::ACTION_LOGIN, [], false, [] ], [ AuthManager::ACTION_CREATE, [], false, [] ], [ AuthManager::ACTION_CREATE, [ 'antiSpoofAccounts' => true ], false, [] ], [ AuthManager::ACTION_CREATE, [], true, [] ], [ AuthManager::ACTI...
15,202
dc52520a2ace419f00e5d49fbf02b238
swh:1:cnt:0cc3bbb010e3346cfd9b6c445f52c1c38378abbf;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AntiSpoof.git;lines=46-77/
d5855993c041fbfa72d2cf435c2092cf2535e1e9
AntiSpoof
deployed
tests/phpunit/AntiSpoofPreAuthenticationProviderTest.php
AntiSpoofPreAuthenticationProviderTest::testTestForAccountCreation( $enabled, $isLegal, $conflicts, $creatorIsSysop, $reqs, $error )
function
/** * @dataProvider provideTestForAccountCreation */ public function testTestForAccountCreation( $enabled, $isLegal, $conflicts, $creatorIsSysop, $reqs, $error ) { $provider = $this->getMockBuilder( AntiSpoofPreAuthenticationProvider::class ) ->setConstructorArgs( [ $this->getServiceContainer()->getPer...
15,203
2272179763ba7e552f190da8795e91b5
swh:1:cnt:0cc3bbb010e3346cfd9b6c445f52c1c38378abbf;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AntiSpoof.git;lines=79-101/
d5855993c041fbfa72d2cf435c2092cf2535e1e9
AntiSpoof
deployed
tests/phpunit/AntiSpoofPreAuthenticationProviderTest.php
AntiSpoofPreAuthenticationProviderTest::provideTestForAccountCreation()
function
public static function provideTestForAccountCreation() { $noSkip = new AntiSpoofAuthenticationRequest(); $skip = new AntiSpoofAuthenticationRequest(); $skip->ignoreAntiSpoof = true; return [ // enabled, isLegal, conflicts, creatorIsSysop, reqs, error 'no spoofing' => [ true, true, [], false, [], null ],...
15,204
db8d8503fb336c40201da4da8a28a113
swh:1:cnt:3b9aadee79c65104b710da011e63e2db949eb32e;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AntiSpoof.git;lines=5-62/
70e8b07b0578cf81733cc630859fc36c8ff6aa35
AntiSpoof
deployed
tests/phpunit/AntiSpoofTest.php
AntiSpoofTest
type
/** * @covers \MediaWiki\Extension\AntiSpoof\AntiSpoof * @group AntiSpoof */ class AntiSpoofTest extends MediaWikiIntegrationTestCase { public static function providePositives() { return [ /** Format: username -> spoofing attempt */ [ 'Laura Fiorucci', 'Låura Fiorucci' ], [ 'Lucien leGrey', 'Lucien le6r...
15,205
7b1f24f8a3421427e054b11f237013c6
swh:1:cnt:3b9aadee79c65104b710da011e63e2db949eb32e;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AntiSpoof.git;lines=11-25/
70e8b07b0578cf81733cc630859fc36c8ff6aa35
AntiSpoof
deployed
tests/phpunit/AntiSpoofTest.php
AntiSpoofTest::providePositives()
function
public static function providePositives() { return [ /** Format: username -> spoofing attempt */ [ 'Laura Fiorucci', 'Låura Fiorucci' ], [ 'Lucien leGrey', 'Lucien le6rey' ], [ 'Poco a poco', 'Poco a ƿoco' ], [ 'Sabbut', 'ЅаЬЬцт' ], [ 'BetoCG', 'ВетоС6' ], [ 'Wanda', 'vv4ndá' ], [ 'Mario', 'rn...
15,206
ce1d9d035393ac23613c2d3a2c5e5fab
swh:1:cnt:3b9aadee79c65104b710da011e63e2db949eb32e;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AntiSpoof.git;lines=42-48/
70e8b07b0578cf81733cc630859fc36c8ff6aa35
AntiSpoof
deployed
tests/phpunit/AntiSpoofTest.php
AntiSpoofTest::provideMixedCharSets()
function
public static function provideMixedCharSets() { return [ /** Format: username -> spoofing attempt */ [ 'Recursive O Tester', 'Recursive Θ Tester' ], [ 'Recursive 0 Tester', 'Recursive Θ Tester' ], ]; }
15,207
4451e48a92bb8f16722d5e2a5c0c5716
swh:1:cnt:3b9aadee79c65104b710da011e63e2db949eb32e;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AntiSpoof.git;lines=50-61/
70e8b07b0578cf81733cc630859fc36c8ff6aa35
AntiSpoof
deployed
tests/phpunit/AntiSpoofTest.php
AntiSpoofTest::testCheckStringMixedCharSetFailure( $userName, $spooferName )
function
/** * Test mixed character set strings failure. * * @dataProvider provideMixedCharSets */ public function testCheckStringMixedCharSetFailure( $userName, $spooferName ) { $a = AntiSpoof::checkUnicodeStringStatus( $userName ); $b = AntiSpoof::checkUnicodeStringStatus( $spooferName ); $this->assertStatusOK...
15,208
4ac58fae7fa31439c8091d21d33e19c0
swh:1:cnt:3b9aadee79c65104b710da011e63e2db949eb32e;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AntiSpoof.git;lines=27-40/
70e8b07b0578cf81733cc630859fc36c8ff6aa35
AntiSpoof
deployed
tests/phpunit/AntiSpoofTest.php
AntiSpoofTest::testCheckUnicodeStringStatus( $userName, $spooferName )
function
/** * Some very basic normalization checks * * @dataProvider providePositives */ public function testCheckUnicodeStringStatus( $userName, $spooferName ) { $a = AntiSpoof::checkUnicodeStringStatus( $userName ); $b = AntiSpoof::checkUnicodeStringStatus( $spooferName ); $this->assertStatusOK( $a ); $this...
15,209
f5d182fca68242a59a991c0187c06860
swh:1:cnt:3cee3fa0f10bbc0aa0962a42f9a43730d7f3d438;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AntiSpoof.git;lines=6-79/
c81f259bfc0d24a0ea37023e6525c68807fb35a4
AntiSpoof
deployed
tests/phpunit/SpoofUserTest.php
SpoofUserTest
type
/** * @covers \MediaWiki\Extension\AntiSpoof\SpoofUser * @group Database */ class SpoofUserTest extends MediaWikiIntegrationTestCase { /** @var string[] */ private static $usernames = [ 'UserFoo', 'UserF00', 'FooBaz', 'FOOBAZ', 'F00BAZ', 'BazFoo', 'BAZFOO', 'BazF00', 'ILIKECAPSLOCKS', // Pre-e...
15,210
834f6dcc8901c21f789ada3dddcb9144
swh:1:cnt:3cee3fa0f10bbc0aa0962a42f9a43730d7f3d438;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AntiSpoof.git;lines=27-40/
c81f259bfc0d24a0ea37023e6525c68807fb35a4
AntiSpoof
deployed
tests/phpunit/SpoofUserTest.php
SpoofUserTest::setUp()
function
public function setUp(): void { parent::setUp(); // Put some stuff in the database foreach ( self::$usernames as $user ) { $s = new SpoofUser( $user ); $s->record(); $user = User::newFromName( $user ); $user->addToDatabase(); } $s = new SpoofUser( 'NotInTheUserTable' ); $s->record(); }
15,211
df447b8aad9eadc510de964a0b1723e2
swh:1:cnt:3cee3fa0f10bbc0aa0962a42f9a43730d7f3d438;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AntiSpoof.git;lines=51-57/
c81f259bfc0d24a0ea37023e6525c68807fb35a4
AntiSpoof
deployed
tests/phpunit/SpoofUserTest.php
SpoofUserTest::testGetConflicts( $user, $conflicts )
function
/** * @dataProvider provideGetConflicts */ public function testGetConflicts( $user, $conflicts ) { $s = new SpoofUser( $user ); $this->assertArrayEquals( $conflicts, $s->getConflicts() ); }
15,212
a8335f7a914e2e526684d079e78d102a
swh:1:cnt:3cee3fa0f10bbc0aa0962a42f9a43730d7f3d438;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AntiSpoof.git;lines=59-68/
c81f259bfc0d24a0ea37023e6525c68807fb35a4
AntiSpoof
deployed
tests/phpunit/SpoofUserTest.php
SpoofUserTest::provideGetConflicts()
function
public static function provideGetConflicts() { return [ [ 'UserFoo', [ 'UserF00', 'UserFoo' ] ], [ 'FooBaz', [ 'F00BAZ', 'FOOBAZ', 'FooBaz' ] ], [ 'ILIKECAPSLOCKS', [ 'ILIKECAPSLOCKS' ] ], [ 'NotInTheUserTable', [] ], [ 'UsErFoO', [ 'UserF00', 'UserFoo' ] ], [ '12345', [] ], ]; }
15,213
d9dfcbf01e8ebfd7ae96356a8b8463b0
swh:1:cnt:3cee3fa0f10bbc0aa0962a42f9a43730d7f3d438;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AntiSpoof.git;lines=70-78/
c81f259bfc0d24a0ea37023e6525c68807fb35a4
AntiSpoof
deployed
tests/phpunit/SpoofUserTest.php
SpoofUserTest::testUpdate()
function
public function testUpdate() { $user = User::newFromName( 'MyNewUserName' ); $user->addToDatabase(); $s = new SpoofUser( 'MyNewUserName' ); $s->update( 'BAZFOO' ); $this->assertArrayEquals( [ 'MyNewUserName' ], $s->getConflicts() ); $foobaz = new SpoofUser( 'BAZFOO' ); $this->assertArrayEquals( [ 'BazF00'...
15,214
f6ba33969b686c16c2a29404e81b3e42
swh:1:cnt:3cee3fa0f10bbc0aa0962a42f9a43730d7f3d438;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/AntiSpoof.git;lines=42-49/
c81f259bfc0d24a0ea37023e6525c68807fb35a4
AntiSpoof
deployed
tests/phpunit/SpoofUserTest.php
SpoofUserTest::testRecord()
function
public function testRecord() { $user = User::newFromName( 'SomeUsername' ); $user->addToDatabase(); $s = new SpoofUser( 'SomeUsername' ); $this->assertTrue( $s->record() ); // Check that it made it into the database $this->assertArrayEquals( [ 'SomeUsername' ], $s->getConflicts() ); }
15,215
bc68b58500ab505c8dfceef041399bc8
swh:1:cnt:ac47a68586c3192d44ed36b671710e189ed37e00;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=1-7/
9edd46800d1eac03cca2e4ae6a42ccef53157613
test-kitchen
analytics
errors/ApiError.js
ApiError
type
class ApiError extends Error { constructor(statusCode, message) { super(message); this.statusCode = statusCode; Error.captureStackTrace(this, this.constructor); } }
15,216
9a000ffc993ef93364a67efe5122aea6
swh:1:cnt:ac47a68586c3192d44ed36b671710e189ed37e00;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=2-6/
9edd46800d1eac03cca2e4ae6a42ccef53157613
test-kitchen
analytics
errors/ApiError.js
ApiError::constructor
function
constructor(statusCode, message) { super(message); this.statusCode = statusCode; Error.captureStackTrace(this, this.constructor); }
15,217
5ff012cb763d5937ce3ba55c55a77e07
swh:1:cnt:ff29ff1a033223ed84bcb2ad42cbda128a400ca6;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=28-45/
28dcf9e5c35fa35b2d091e22e63c3e04eab13aed
test-kitchen
analytics
frontend/vite.config.js
manualChunks
function
manualChunks(id) { if (!id.includes('node_modules')) { return; } if (id.includes('vue')) { return 'vendor-vue'; } if (id.includes('@wikimedia/codex')) { ...
15,218
3b560ec5b24c320b1a689efa6da087d1
swh:1:cnt:6d1c669edb89f2cd0c3d10f04c196f3bb04bb45e;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=4-20/
be3244eb75ed384c616d8018b47e0e4869936240
test-kitchen
analytics
frontend/src/composables/convertDates.js
convertDates
function
function convertDates() { const getFormattedDate = (date) => { return format(new UTCDate(date), 'yyyy-MM-dd'); }; function convertToSQLDateTime(jsDate) { const date = new UTCDate(jsDate); date.setUTCHours(14, 30, 0, 0); // Set time to 14:30:00 UTC return date.toISOString()....
15,219
1c746ed2df0f2fc3e07538edfa3632d3
swh:1:cnt:6d1c669edb89f2cd0c3d10f04c196f3bb04bb45e;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=10-14/
be3244eb75ed384c616d8018b47e0e4869936240
test-kitchen
analytics
frontend/src/composables/convertDates.js
convertDates::convertToSQLDateTime
function
function convertToSQLDateTime(jsDate) { const date = new UTCDate(jsDate); date.setUTCHours(14, 30, 0, 0); // Set time to 14:30:00 UTC return date.toISOString().slice(0, 19).replace('T', ' '); }
15,220
59b12728bfb0a11f4d1306181cbdb831
swh:1:cnt:ae703ae7bf2e26093795731d22680cfc551bdde0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=1-138/
0d8e8e0261c6c24fce08fb6b1ce55d27bfccd01b
test-kitchen
analytics
frontend/src/composables/utility.js
useUtility
function
function useUtility() { function getSlugFormatted(instrumentName) { return instrumentName .replace(/\s+/g, '-') .replace(/[^a-zA-Z0-9-_.]/g, '') .replace(/^[-_.]+|^_+/, '') .toLowerCase(); } function splitStringAttributes(input) { return (inp...
15,221
d88736db1c5c5a258127b66b9e54dfe0
swh:1:cnt:ae703ae7bf2e26093795731d22680cfc551bdde0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=32-40/
0d8e8e0261c6c24fce08fb6b1ce55d27bfccd01b
test-kitchen
analytics
frontend/src/composables/utility.js
useUtility::getKeyByValue
function
function getKeyByValue(object, value) { for (const prop in object) { if (object.hasOwnProperty(prop)) { if (object[prop] === value) { return prop; } } } }
15,222
0059b33d2ec894b66ec32038e70c4a11
swh:1:cnt:ae703ae7bf2e26093795731d22680cfc551bdde0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=11-13/
0d8e8e0261c6c24fce08fb6b1ce55d27bfccd01b
test-kitchen
analytics
frontend/src/composables/utility.js
useUtility::splitStringAttributes
function
function splitStringAttributes(input) { return (input ?? '').split(',').filter((x) => x.length > 0); }
15,223
9860967666c28d0708aec8b7ece605cf
swh:1:cnt:ae703ae7bf2e26093795731d22680cfc551bdde0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=15-30/
0d8e8e0261c6c24fce08fb6b1ce55d27bfccd01b
test-kitchen
analytics
frontend/src/composables/utility.js
useUtility::parseSampleRate
function
function parseSampleRate(sampleRate, wikiNames, type) { let output = ''; if (type === 'instrument') { output = `default: ${ sampleRate.default }<br/>`; } if (sampleRate.custom) { sampleRate.custom.forEach(({ wikis, rate }) => { const dbnames = Arr...
15,224
d0cf68e36e66c1d5083b15502d22cdb4
swh:1:cnt:ae703ae7bf2e26093795731d22680cfc551bdde0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=3-9/
0d8e8e0261c6c24fce08fb6b1ce55d27bfccd01b
test-kitchen
analytics
frontend/src/composables/utility.js
useUtility::getSlugFormatted
function
function getSlugFormatted(instrumentName) { return instrumentName .replace(/\s+/g, '-') .replace(/[^a-zA-Z0-9-_.]/g, '') .replace(/^[-_.]+|^_+/, '') .toLowerCase(); }
15,225
a456535e5a0849b0e33c37c0faf8a12f
swh:1:cnt:ae703ae7bf2e26093795731d22680cfc551bdde0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=42-44/
0d8e8e0261c6c24fce08fb6b1ce55d27bfccd01b
test-kitchen
analytics
frontend/src/composables/utility.js
useUtility::formatContextualAttributesOptions
function
function formatContextualAttributesOptions(data) { return data.map((e) => e.contextual_attribute_name); }
15,226
24458808ca05bf129bec6340e341463f
swh:1:cnt:ae703ae7bf2e26093795731d22680cfc551bdde0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=46-52/
0d8e8e0261c6c24fce08fb6b1ce55d27bfccd01b
test-kitchen
analytics
frontend/src/composables/utility.js
useUtility::formatContextualAttributeMap
function
function formatContextualAttributeMap(data) { const contextualAttributesMap = []; data.forEach((element) => { contextualAttributesMap[element.id] = element.contextual_attribute_name; }); return contextualAttributesMap; }
15,227
39509451ae4058de3d03a428d888a6bc
swh:1:cnt:ae703ae7bf2e26093795731d22680cfc551bdde0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=54-74/
0d8e8e0261c6c24fce08fb6b1ce55d27bfccd01b
test-kitchen
analytics
frontend/src/composables/utility.js
useUtility::transformSampleRateForUI
function
// sample_rate is stored like {"default": 0.1, "0.2": ["wiki", "wiki_3"], "0.3": ["wiki_2"]} // so shape that into what the forms need: { // default: 0.1, // custom: [ // { rate: 0.2, wikis: Array("wiki", "wiki_3") }, // { rate: 0.3, wikis: Array("wiki_2") } // ] // } // ...
15,228
d0d6ce0c37943a536cc1f844be002f45
swh:1:cnt:ae703ae7bf2e26093795731d22680cfc551bdde0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=76-99/
0d8e8e0261c6c24fce08fb6b1ce55d27bfccd01b
test-kitchen
analytics
frontend/src/composables/utility.js
useUtility::transformSampleRateForDB
function
// basically the opposite of the transformation above function transformSampleRateForDB(uiSampleRate, type) { const transformed = Object.assign( { default: type === 'A/B test' ? parseFloat(uiSampleRate.default / 100) : parseFloat(uiSampleRate.default) }, uiSampleRate.custom.reduce((b...
15,229
0c40e24f8bad686de9ea06dc9ebef742
swh:1:cnt:ae703ae7bf2e26093795731d22680cfc551bdde0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=101-125/
0d8e8e0261c6c24fce08fb6b1ce55d27bfccd01b
test-kitchen
analytics
frontend/src/composables/utility.js
useUtility::getAnalyticsUri
function
// Create the automated analytics link for an experiment if it is registered. // See T394527 and /util/experimentsRegistered.js function getAnalyticsUri(experimentName, userSegment) { const uriTemplate = 'https://superset.wikimedia.org/superset/dashboard/experiment-analytics/?native_filters=({native_fil...
15,230
7f345a32ba5c564f1ea1f20752d393e0
swh:1:cnt:98879e1cb16671326d93ab2d20e994fdb9cb79e9;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=27-68/
e5578e010bc9586f44470e68e81c9c1be80029c7
test-kitchen
analytics
frontend/src/stores/experiment.js
makeBlankExperiment
function
function makeBlankExperiment() { return { name: '', slug: '', description: '', owner: [], purpose: [], task: '', email_address: '', type: 'A/B test', utc_start_dt: '', utc_end_dt: '', risk_level: 'Risk assessment pending', ...
15,231
036f4606dd3c0613212cdefd2176788d
swh:1:cnt:98879e1cb16671326d93ab2d20e994fdb9cb79e9;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=70-87/
e5578e010bc9586f44470e68e81c9c1be80029c7
test-kitchen
analytics
frontend/src/stores/experiment.js
augmentExperiment
function
function augmentExperiment(data, registeredExperiments = []) { const wikiStore = useWikiStore(); let analyticsUri; // Set analytics uri for experiments. if (registeredExperiments.includes(data.slug)) { analyticsUri = getAnalyticsUri(data.slug, data.sample_unit); } return Object.assign(...
15,232
6d51688ea0f3202fa8b44c1de9b5e14c
swh:1:cnt:98879e1cb16671326d93ab2d20e994fdb9cb79e9;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=89-135/
e5578e010bc9586f44470e68e81c9c1be80029c7
test-kitchen
analytics
frontend/src/stores/experiment.js
prepareFormDataForSave
function
// prepare data for saving AB tests function prepareFormDataForSave(formData, map) { let contextualAttributesSelectedArray = (formData.contextual_attributes ?? '').split(','); // There are no selected contextual attributes. It's an A/B test. // We explicitly empty the array to avoid undefined value later in...
15,233
3c23c9f954ac16d90d34f7a3816f0e4b
swh:1:cnt:98879e1cb16671326d93ab2d20e994fdb9cb79e9;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=191-195/
e5578e010bc9586f44470e68e81c9c1be80029c7
test-kitchen
analytics
frontend/src/stores/experiment.js
clearSuccessMessage
function
// Action to clear the success message clearSuccessMessage() { const baseStore = useEntityStore(); baseStore.clearSuccessMessage(this); }
15,234
e4eef924827af5e0ef7a0bdb7ec1a9be
swh:1:cnt:98879e1cb16671326d93ab2d20e994fdb9cb79e9;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=232-239/
e5578e010bc9586f44470e68e81c9c1be80029c7
test-kitchen
analytics
frontend/src/stores/experiment.js
saveExperiment
function
// save an A/B test async saveExperiment(rawFormData) { validationSuite.reset(); const formData = prepareFormDataForSave(rawFormData, this.contextualAttributesMap); const baseStore = useEntityStore(); return await baseStore.saveInstrument(this, formData); ...
15,235
654a902f635138af8b28573ed06545b1
swh:1:cnt:98879e1cb16671326d93ab2d20e994fdb9cb79e9;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=240-246/
e5578e010bc9586f44470e68e81c9c1be80029c7
test-kitchen
analytics
frontend/src/stores/experiment.js
updateExperiment
function
// Update an A/B test async updateExperiment(rawFormData) { validationSuite.reset(); const formData = prepareFormDataForSave(rawFormData, this.contextualAttributesMap); const baseStore = useEntityStore(); return await baseStore.update(this, formData); }
15,236
17a95285f54c5d37a809dc41621686b5
swh:1:cnt:98879e1cb16671326d93ab2d20e994fdb9cb79e9;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=307-310/
e5578e010bc9586f44470e68e81c9c1be80029c7
test-kitchen
analytics
frontend/src/stores/experiment.js
refreshInlineValidation
function
refreshInlineValidation() { const baseStore = useEntityStore(); baseStore.refreshInlineValidation(this); }
15,237
d86a70ab20ac03fd2a1a3f68a0acdbd7
swh:1:cnt:98879e1cb16671326d93ab2d20e994fdb9cb79e9;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=311-314/
e5578e010bc9586f44470e68e81c9c1be80029c7
test-kitchen
analytics
frontend/src/stores/experiment.js
resetInlineValidation
function
resetInlineValidation() { const baseStore = useEntityStore(); baseStore.resetInlineValidation(this); }
15,238
8011dc4f367cfc9b554c0b139389d01f
swh:1:cnt:98879e1cb16671326d93ab2d20e994fdb9cb79e9;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=197-200/
e5578e010bc9586f44470e68e81c9c1be80029c7
test-kitchen
analytics
frontend/src/stores/experiment.js
setValidationMessage
function
setValidationMessage(message) { const baseStore = useEntityStore(); baseStore.setValidationMessage(this, message); }
15,239
c5f210460fb2330523de71197f98d5dd
swh:1:cnt:98879e1cb16671326d93ab2d20e994fdb9cb79e9;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=202-205/
e5578e010bc9586f44470e68e81c9c1be80029c7
test-kitchen
analytics
frontend/src/stores/experiment.js
clearValidationMessage
function
clearValidationMessage() { const baseStore = useEntityStore(); baseStore.clearValidationMessage(this); }
15,240
9e87e7b1f6a6987810d9260149198680
swh:1:cnt:98879e1cb16671326d93ab2d20e994fdb9cb79e9;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=248-253/
e5578e010bc9586f44470e68e81c9c1be80029c7
test-kitchen
analytics
frontend/src/stores/experiment.js
refresh
function
async refresh() { const baseStore = useEntityStore(); await baseStore.refresh(); await this.refreshRegisteredExperiments(); await this.setContextualAttributes(); }
15,241
fb31ab507ef5ff09770d4a7bd43752fe
swh:1:cnt:98879e1cb16671326d93ab2d20e994fdb9cb79e9;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=254-270/
e5578e010bc9586f44470e68e81c9c1be80029c7
test-kitchen
analytics
frontend/src/stores/experiment.js
refreshRegisteredExperiments
function
async refreshRegisteredExperiments() { try { const { data } = await tkAPI.get('/registered-experiments'); if (!(data instanceof Array)) { throw new Error('Unexpected response ' + JSON.stringify(data)); } this.registeredExpe...
15,242
5fc8c347db7d4c0051d72220e4a4300b
swh:1:cnt:98879e1cb16671326d93ab2d20e994fdb9cb79e9;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=271-294/
e5578e010bc9586f44470e68e81c9c1be80029c7
test-kitchen
analytics
frontend/src/stores/experiment.js
setContextualAttributes
function
async setContextualAttributes() { let requestUrl; if (['web', 'app'].includes(this.experiment.schema_type)) { requestUrl = `/contextual-attributes?schema-type=${ this.experiment.schema_type }`; } else { requestUrl = '/contextual-attributes'; ...
15,243
d30d6c1629fa6abf09728c2780680c8b
swh:1:cnt:98879e1cb16671326d93ab2d20e994fdb9cb79e9;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=295-298/
e5578e010bc9586f44470e68e81c9c1be80029c7
test-kitchen
analytics
frontend/src/stores/experiment.js
validateClientInlineField
function
validateClientInlineField(fieldName, event, currentData) { const baseStore = useEntityStore(); baseStore.validateClientInlineField(this, fieldName, event, this.experiment, currentData); }
15,244
67c573acea99b0c10921b813ecdf3262
swh:1:cnt:98879e1cb16671326d93ab2d20e994fdb9cb79e9;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=299-302/
e5578e010bc9586f44470e68e81c9c1be80029c7
test-kitchen
analytics
frontend/src/stores/experiment.js
updateErrorMessages
function
updateErrorMessages(fieldName) { const baseStore = useEntityStore(); baseStore.updateErrorMessages(this, fieldName); }
15,245
007f3b0f4ece5f787738ecab75986bfb
swh:1:cnt:98879e1cb16671326d93ab2d20e994fdb9cb79e9;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=303-306/
e5578e010bc9586f44470e68e81c9c1be80029c7
test-kitchen
analytics
frontend/src/stores/experiment.js
updateStatuses
function
updateStatuses(fieldName) { const baseStore = useEntityStore(); baseStore.updateStatuses(this, fieldName); }
15,246
62382659307a20791acea269b05bcc95
swh:1:cnt:98879e1cb16671326d93ab2d20e994fdb9cb79e9;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=185-189/
e5578e010bc9586f44470e68e81c9c1be80029c7
test-kitchen
analytics
frontend/src/stores/experiment.js
setSuccessMessage
function
// Action to set the success message setSuccessMessage(message) { const baseStore = useEntityStore(); baseStore.successMessage = message; }
15,247
5022fea055e6b0883c89708363ebbd03
swh:1:cnt:98879e1cb16671326d93ab2d20e994fdb9cb79e9;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=207-231/
e5578e010bc9586f44470e68e81c9c1be80029c7
test-kitchen
analytics
frontend/src/stores/experiment.js
setExperiment
function
// set an existing AB test async setExperiment(slug) { if (!slug) { this.experiment = augmentExperiment(makeBlankExperiment()); return; } try { const { data } = await tkAPI.get(`/instrument/${ slug }`); if (!(d...
15,248
ad6c1466568da8d9c22b32a9cabb567e
swh:1:cnt:2281f2579e1b5a329207cfe273e97be5d6215686;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=21-48/
313f3bdc9c58e6f1a94311ad3f0ab7bf7e7fb87f
test-kitchen
analytics
frontend/src/stores/instrument.js
makeBlankInstrument
function
function makeBlankInstrument() { return { name: '', slug: '', description: '', owner: [], purpose: [], task: '', email_address: '', type: 'instrument', utc_start_dt: '', utc_end_dt: '', risk_level: 'Risk assessment pending', ...
15,249
c75fdf3a84cd7326824ba79c6e390f9c
swh:1:cnt:2281f2579e1b5a329207cfe273e97be5d6215686;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=50-63/
313f3bdc9c58e6f1a94311ad3f0ab7bf7e7fb87f
test-kitchen
analytics
frontend/src/stores/instrument.js
augmentInstrument
function
function augmentInstrument(data) { const wikiStore = useWikiStore(); return Object.assign({}, data, { // TODO: this comes as a string, see if there's a way axios can decode it directly // sample_rate is transformed to percentage format only for experiments sample_rate: transformSampleRa...
15,250
b229e27b1c6284e90b249ff8d9dfc9f3
swh:1:cnt:2281f2579e1b5a329207cfe273e97be5d6215686;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=65-102/
313f3bdc9c58e6f1a94311ad3f0ab7bf7e7fb87f
test-kitchen
analytics
frontend/src/stores/instrument.js
prepareFormDataForSave
function
// prepare data for saving instruments/AB tests function prepareFormDataForSave(formData, map) { let contextualAttributesSelectedArray = (formData.contextual_attributes ?? '').split(','); // There is no selected contextual attributes. It's an A/B test. // We explicitly empty the array to avoid undefined val...
15,251
962fd052cd8a519ecaebf006da4261b4
swh:1:cnt:2281f2579e1b5a329207cfe273e97be5d6215686;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=165-189/
313f3bdc9c58e6f1a94311ad3f0ab7bf7e7fb87f
test-kitchen
analytics
frontend/src/stores/instrument.js
setInstrument
function
// Some very specific logic can be only in the specific store async setInstrument(slug) { if (!slug) { this.instrument = augmentInstrument(makeBlankInstrument()); return; } try { const { data } = await tkAPI.get(`/instrument/${...
15,252
007e26e2fad6a7b65502ab210220f134
swh:1:cnt:2281f2579e1b5a329207cfe273e97be5d6215686;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=204-212/
313f3bdc9c58e6f1a94311ad3f0ab7bf7e7fb87f
test-kitchen
analytics
frontend/src/stores/instrument.js
refresh
function
// refresh is always used in the Read view which is a view where everything is needed // baseStores.refresh() refreshes instruments + experiments. // Can be called from any store, specific or base one async refresh() { const baseStore = useEntityStore(); await baseStore.r...
15,253
ed722d563cb991d1269f396c1672f73f
swh:1:cnt:2281f2579e1b5a329207cfe273e97be5d6215686;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=213-237/
313f3bdc9c58e6f1a94311ad3f0ab7bf7e7fb87f
test-kitchen
analytics
frontend/src/stores/instrument.js
setContextualAttributes
function
// This function is fully specific for instruments async setContextualAttributes() { let requestUrl; if (['web', 'app'].includes(this.instrument.schema_type)) { requestUrl = `/contextual-attributes?schema-type=${ this.instrument.schema_type }`; } else { ...
15,254
8011dc4f367cfc9b554c0b139389d01f
swh:1:cnt:2281f2579e1b5a329207cfe273e97be5d6215686;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=155-158/
313f3bdc9c58e6f1a94311ad3f0ab7bf7e7fb87f
test-kitchen
analytics
frontend/src/stores/instrument.js
setValidationMessage
function
setValidationMessage(message) { const baseStore = useEntityStore(); baseStore.setValidationMessage(this, message); }
15,255
c5f210460fb2330523de71197f98d5dd
swh:1:cnt:2281f2579e1b5a329207cfe273e97be5d6215686;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=160-163/
313f3bdc9c58e6f1a94311ad3f0ab7bf7e7fb87f
test-kitchen
analytics
frontend/src/stores/instrument.js
clearValidationMessage
function
clearValidationMessage() { const baseStore = useEntityStore(); baseStore.clearValidationMessage(this); }
15,256
360d430317686d754891d1ec56aedf50
swh:1:cnt:2281f2579e1b5a329207cfe273e97be5d6215686;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=190-195/
313f3bdc9c58e6f1a94311ad3f0ab7bf7e7fb87f
test-kitchen
analytics
frontend/src/stores/instrument.js
saveInstrument
function
async saveInstrument(rawFormData) { validationSuite.reset(); const formData = prepareFormDataForSave(rawFormData, this.contextualAttributesMap); const baseStore = useEntityStore(); return await baseStore.saveInstrument(this, formData); }
15,257
098465f4702e0dce045199050237e936
swh:1:cnt:2281f2579e1b5a329207cfe273e97be5d6215686;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=238-241/
313f3bdc9c58e6f1a94311ad3f0ab7bf7e7fb87f
test-kitchen
analytics
frontend/src/stores/instrument.js
validateClientInlineField
function
validateClientInlineField(fieldName, event, currentData) { const baseStore = useEntityStore(); baseStore.validateClientInlineField(this, fieldName, event, this.instrument, currentData); }
15,258
67c573acea99b0c10921b813ecdf3262
swh:1:cnt:2281f2579e1b5a329207cfe273e97be5d6215686;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=242-245/
313f3bdc9c58e6f1a94311ad3f0ab7bf7e7fb87f
test-kitchen
analytics
frontend/src/stores/instrument.js
updateErrorMessages
function
updateErrorMessages(fieldName) { const baseStore = useEntityStore(); baseStore.updateErrorMessages(this, fieldName); }
15,259
007f3b0f4ece5f787738ecab75986bfb
swh:1:cnt:2281f2579e1b5a329207cfe273e97be5d6215686;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=246-249/
313f3bdc9c58e6f1a94311ad3f0ab7bf7e7fb87f
test-kitchen
analytics
frontend/src/stores/instrument.js
updateStatuses
function
updateStatuses(fieldName) { const baseStore = useEntityStore(); baseStore.updateStatuses(this, fieldName); }
15,260
17a95285f54c5d37a809dc41621686b5
swh:1:cnt:2281f2579e1b5a329207cfe273e97be5d6215686;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=250-253/
313f3bdc9c58e6f1a94311ad3f0ab7bf7e7fb87f
test-kitchen
analytics
frontend/src/stores/instrument.js
refreshInlineValidation
function
refreshInlineValidation() { const baseStore = useEntityStore(); baseStore.refreshInlineValidation(this); }
15,261
d86a70ab20ac03fd2a1a3f68a0acdbd7
swh:1:cnt:2281f2579e1b5a329207cfe273e97be5d6215686;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=254-257/
313f3bdc9c58e6f1a94311ad3f0ab7bf7e7fb87f
test-kitchen
analytics
frontend/src/stores/instrument.js
resetInlineValidation
function
resetInlineValidation() { const baseStore = useEntityStore(); baseStore.resetInlineValidation(this); }
15,262
3c23c9f954ac16d90d34f7a3816f0e4b
swh:1:cnt:2281f2579e1b5a329207cfe273e97be5d6215686;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=149-153/
313f3bdc9c58e6f1a94311ad3f0ab7bf7e7fb87f
test-kitchen
analytics
frontend/src/stores/instrument.js
clearSuccessMessage
function
// Action to clear the success message clearSuccessMessage() { const baseStore = useEntityStore(); baseStore.clearSuccessMessage(this); }
15,263
62382659307a20791acea269b05bcc95
swh:1:cnt:2281f2579e1b5a329207cfe273e97be5d6215686;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=143-147/
313f3bdc9c58e6f1a94311ad3f0ab7bf7e7fb87f
test-kitchen
analytics
frontend/src/stores/instrument.js
setSuccessMessage
function
// Action to set the success message setSuccessMessage(message) { const baseStore = useEntityStore(); baseStore.successMessage = message; }
15,264
6adbfe22f24b9e9a525763a15da1c4a9
swh:1:cnt:2281f2579e1b5a329207cfe273e97be5d6215686;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=196-203/
313f3bdc9c58e6f1a94311ad3f0ab7bf7e7fb87f
test-kitchen
analytics
frontend/src/stores/instrument.js
updateInstrument
function
// In some cases, the common part of a function can be in the base store and be called // passing the state and the required data async updateInstrument(rawFormData) { validationSuite.reset(); const formData = prepareFormDataForSave(rawFormData, this.contextualAttributesMap); ...
15,265
ccf349bd649c21f9b9fe34fb03a4fdeb
swh:1:cnt:c658a927eb70d7a4e4314a05c7e69e374b7c2700;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=16-36/
9074bf3ca85c30afb0377f3053e69e17d34bfdc2
test-kitchen
analytics
frontend/src/stores/okrs.js
refreshOKRs
function
async refreshOKRs() { try { const { data } = await actionAPI.get('/okrs'); if (!(data instanceof Object)) { throw new Error('Unexpected response ' + JSON.stringify(data)); } this.okrs = data; } catch (error) { ...
15,266
bc7428bf554bbcac8d9d61df353c0440
swh:1:cnt:a9e4ea13def71c6438a98c1f4644d630157f98eb;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=30-51/
d5d57e3032c84a75a94deaf958dc482574379d27
test-kitchen
analytics
frontend/src/stores/stream.js
refreshStreams
function
async refreshStreams() { try { const { data } = await actionAPI.get('/streams'); if (!(data instanceof Array)) { throw new Error('Unexpected response ' + JSON.stringify(data)); } this.streams = data; this.str...
15,267
120a7cc6c14c0b85f2f8d71def2a59b4
swh:1:cnt:e42377c7fc9ac9d2cb8b5a461ac07abf1b5bda40;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=99-120/
6ddabb46a9ea349d786ead281ff163e8e5be0944
test-kitchen
analytics
frontend/src/stores/useEntityStore.js
delete
function
// `delete` is a common function for instruments and experiments async delete(data) { try { const response = await tkAPI.delete(`instrument/${ data.id }`, data); return { data: response.data, success: true }; ...
15,268
c0ca0842d3922f6d7eb81dead843e3c2
swh:1:cnt:e42377c7fc9ac9d2cb8b5a461ac07abf1b5bda40;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=177-180/
6ddabb46a9ea349d786ead281ff163e8e5be0944
test-kitchen
analytics
frontend/src/stores/useEntityStore.js
clearSuccessMessage
function
// Action to clear the success message clearSuccessMessage(state) { state.successMessage = null; }
15,269
ea7311fec59211d4d8ff369e55394243
swh:1:cnt:e42377c7fc9ac9d2cb8b5a461ac07abf1b5bda40;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=43-64/
6ddabb46a9ea349d786ead281ff163e8e5be0944
test-kitchen
analytics
frontend/src/stores/useEntityStore.js
refresh
function
async refresh(search = '') { try { let request = '/instruments'; if (search !== '') { request += '?search=' + search; } const { data } = await tkAPI.get(request); if (!(data instanceof Array)) { ...
15,270
b7ddda0e0b4f6cb27f1f6a59f59770a3
swh:1:cnt:e42377c7fc9ac9d2cb8b5a461ac07abf1b5bda40;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=121-151/
6ddabb46a9ea349d786ead281ff163e8e5be0944
test-kitchen
analytics
frontend/src/stores/useEntityStore.js
saveInstrument
function
async saveInstrument(state, formData) { const requestHeaders = { headers: { 'Content-Type': 'application/json' } }; const baseUrl = 'instruments'; try { const response = await tkAPI.post(baseUrl, formData, requestHeaders); validationSuite.reset(); ...
15,271
8a0e5eec728c5c87c32123db5e351e17
swh:1:cnt:e42377c7fc9ac9d2cb8b5a461ac07abf1b5bda40;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=182-184/
6ddabb46a9ea349d786ead281ff163e8e5be0944
test-kitchen
analytics
frontend/src/stores/useEntityStore.js
setValidationMessage
function
setValidationMessage(state, message) { state.validationMessage = message; }
15,272
c654b8c276a6f5626c829d06c1581e4f
swh:1:cnt:e42377c7fc9ac9d2cb8b5a461ac07abf1b5bda40;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=186-188/
6ddabb46a9ea349d786ead281ff163e8e5be0944
test-kitchen
analytics
frontend/src/stores/useEntityStore.js
clearValidationMessage
function
clearValidationMessage(state) { state.validationMessage = null; }
15,273
6df7b675cb79f044477e9bffeac4ddfa
swh:1:cnt:e42377c7fc9ac9d2cb8b5a461ac07abf1b5bda40;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=190-203/
6ddabb46a9ea349d786ead281ff163e8e5be0944
test-kitchen
analytics
frontend/src/stores/useEntityStore.js
validateClientInlineField
function
validateClientInlineField(state, fieldName, event, entity, currentData) { // Run the validation for a specific field and event (`blur` or `update`) state.validationResult = validationSuite(entity, 'client', event, fieldName, null, currentData); state.updateErrorMessages(fieldName); ...
15,274
ee231e84422f70440dd7ef8eee67c627
swh:1:cnt:e42377c7fc9ac9d2cb8b5a461ac07abf1b5bda40;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=204-213/
6ddabb46a9ea349d786ead281ff163e8e5be0944
test-kitchen
analytics
frontend/src/stores/useEntityStore.js
updateErrorMessages
function
updateErrorMessages(state, fieldName) { state.messages[fieldName] = []; state.validationResult.getErrors(fieldName).forEach((errorMessage) => { state.messages[fieldName].push(errorMessage); }); if (state.validationResult.getErrors(fieldName).length === 0)...
15,275
b32b042cabd064f3e38911ecf610c6ea
swh:1:cnt:e42377c7fc9ac9d2cb8b5a461ac07abf1b5bda40;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=214-221/
6ddabb46a9ea349d786ead281ff163e8e5be0944
test-kitchen
analytics
frontend/src/stores/useEntityStore.js
updateStatuses
function
updateStatuses(state, fieldName) { // Set the status for the field that has been validated if (state.validationResult.getErrors(fieldName).length > 0) { state.statuses[fieldName] = 'error'; } else { state.statuses[fieldName] = 'success'; } ...
15,276
24d8e37f89e162ff4e05bbaa1889e571
swh:1:cnt:e42377c7fc9ac9d2cb8b5a461ac07abf1b5bda40;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=222-230/
6ddabb46a9ea349d786ead281ff163e8e5be0944
test-kitchen
analytics
frontend/src/stores/useEntityStore.js
refreshInlineValidation
function
refreshInlineValidation(state) { state.statuses = {}; state.messages = {}; state.validationResult.errors.forEach((item) => { state.statuses[item.fieldName] = 'error'; state.updateErrorMessages(item.fieldName); }); }
15,277
2506ee83b56c54213c37b84ffecef862
swh:1:cnt:e42377c7fc9ac9d2cb8b5a461ac07abf1b5bda40;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=66-97/
6ddabb46a9ea349d786ead281ff163e8e5be0944
test-kitchen
analytics
frontend/src/stores/useEntityStore.js
update
function
// Common part of `update` for instruments and experiments async update(state, formData) { const requestHeaders = { headers: { 'Content-Type': 'application/json' } }; const baseUrl = `instrument/${ formData.slug }`; try { const response = await tkAPI.put(base...
15,278
ada122e2efc33a6dfa6d33f99104184b
swh:1:cnt:e42377c7fc9ac9d2cb8b5a461ac07abf1b5bda40;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=152-170/
6ddabb46a9ea349d786ead281ff163e8e5be0944
test-kitchen
analytics
frontend/src/stores/useEntityStore.js
patchStatus
function
// activate/deactivate an entity. It's a common function for instruments and experiments async patchStatus(data) { try { const response = await tkAPI.patch(`instrument/${ data.id }`, data); return { data: response.data, success:...
15,279
698e83b6ef80e556bebc5cf0649dc5c0
swh:1:cnt:e42377c7fc9ac9d2cb8b5a461ac07abf1b5bda40;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=172-175/
6ddabb46a9ea349d786ead281ff163e8e5be0944
test-kitchen
analytics
frontend/src/stores/useEntityStore.js
setSuccessMessage
function
// Logic validation resides here, and it's called from specific stores setSuccessMessage(state, message) { state.successMessage = message; }
15,280
9f8b75ffe743936648cc4a7f4b8db8b6
swh:1:cnt:e42377c7fc9ac9d2cb8b5a461ac07abf1b5bda40;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=231-240/
6ddabb46a9ea349d786ead281ff163e8e5be0944
test-kitchen
analytics
frontend/src/stores/useEntityStore.js
resetInlineValidation
function
resetInlineValidation(state) { if (state.validationSuite) { state.validationSuite.reset(); } state.statuses = {}; state.messages = {}; state.alreadyValidated = []; state.clearValidationMessage(); }
15,281
c4db44cd54f2588517691fe863299759
swh:1:cnt:e42377c7fc9ac9d2cb8b5a461ac07abf1b5bda40;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=36-42/
6ddabb46a9ea349d786ead281ff163e8e5be0944
test-kitchen
analytics
frontend/src/stores/useEntityStore.js
setEntity
function
async setEntity(entity) { if (!entity) { this.entity = {}; return; } this.entity = entity; }
15,282
7ebc0f0b88fbb70d74fdf960d66e402e
swh:1:cnt:0f06763656295f0f57a228a8f521c57a7dc47c25;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=12-15/
4ec960244692a08126e3e70c99dc6a4f478e6fc7
test-kitchen
analytics
frontend/src/stores/userAuth.js
login
function
async function login(logUsername, logRole) { username.value = logUsername; role.value = logRole; }
15,283
1f0be709bffadc51ad924866be33a3eb
swh:1:cnt:0f06763656295f0f57a228a8f521c57a7dc47c25;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=17-20/
4ec960244692a08126e3e70c99dc6a4f478e6fc7
test-kitchen
analytics
frontend/src/stores/userAuth.js
logout
function
async function logout() { username.value = null; role.value = null; }
15,284
78d82f0fb77e2a1021ec8e8cd0ff3522
swh:1:cnt:a1b78d617ea068f9ba36a8d72f7997dc49334c03;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=16-36/
167b356f9ace304650193e4a2a1e27b42f4a0611
test-kitchen
analytics
frontend/src/stores/wiki.js
refreshWikis
function
async refreshWikis() { try { const { data } = await actionAPI.get('/wikis'); if (!(data instanceof Object)) { throw new Error('Unexpected response ' + JSON.stringify(data)); } this.wikis = data; } catch (error) {...
15,285
5f94ae351e7d2f26be6f2bf305c06519
swh:1:cnt:d62ed504c2c68749ae680c1c7f114c91f49899ea;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=4-52/
c3d03577d69331fef7d0ca55dc370f3499884cef
test-kitchen
analytics
frontend/test/pageobjects/list.page.js
ListPage
type
/** * sub page containing specific selectors and methods for a specific page */ class ListPage extends Page { /** * define selectors using getter methods */ get firstInstrumentName() { return $('table tr:first-child td:first-child'); } get lastInstrumentName() { return $('ta...
15,286
71465ce7427f3449a3b6a575471d756c
swh:1:cnt:d62ed504c2c68749ae680c1c7f114c91f49899ea;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=8-13/
c3d03577d69331fef7d0ca55dc370f3499884cef
test-kitchen
analytics
frontend/test/pageobjects/list.page.js
ListPage::firstInstrumentName
function
/** * define selectors using getter methods */ get firstInstrumentName() { return $('table tr:first-child td:first-child'); }
15,287
edbab7b3607d5d06c48da257a8840999
swh:1:cnt:d62ed504c2c68749ae680c1c7f114c91f49899ea;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=15-17/
c3d03577d69331fef7d0ca55dc370f3499884cef
test-kitchen
analytics
frontend/test/pageobjects/list.page.js
ListPage::lastInstrumentName
function
get lastInstrumentName() { return $('table tr:last-child td:first-child'); }
15,288
54ff734cceb3cdb47d488fade88286ad
swh:1:cnt:d62ed504c2c68749ae680c1c7f114c91f49899ea;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=23-25/
c3d03577d69331fef7d0ca55dc370f3499884cef
test-kitchen
analytics
frontend/test/pageobjects/list.page.js
ListPage::lastInstrumentActionMenu
function
get lastInstrumentActionMenu() { return $('table tr:last-child td:last-child'); }
15,289
67cc806f3ad2444ea03af03da89402b1
swh:1:cnt:d62ed504c2c68749ae680c1c7f114c91f49899ea;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=27-29/
c3d03577d69331fef7d0ca55dc370f3499884cef
test-kitchen
analytics
frontend/test/pageobjects/list.page.js
ListPage::dialogDelete
function
get dialogDelete() { return $('div[data-id="dialog-delete"]'); }
15,290
3612e719411516fa18ffcd4084518a61
swh:1:cnt:d62ed504c2c68749ae680c1c7f114c91f49899ea;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=19-21/
c3d03577d69331fef7d0ca55dc370f3499884cef
test-kitchen
analytics
frontend/test/pageobjects/list.page.js
ListPage::penultimateInstrumentName
function
get penultimateInstrumentName() { return $('table tr:last-child td::nth-last-child(2)'); }
15,291
89af2abce35113a6f785dce275afb31a
swh:1:cnt:d62ed504c2c68749ae680c1c7f114c91f49899ea;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=31-33/
c3d03577d69331fef7d0ca55dc370f3499884cef
test-kitchen
analytics
frontend/test/pageobjects/list.page.js
ListPage::dialogDeleteButton
function
get dialogDeleteButton() { return $('footer button:first-child'); }
15,292
0106dbe8b1f650c6ef81eebc3a5e4a01
swh:1:cnt:d62ed504c2c68749ae680c1c7f114c91f49899ea;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=35-39/
c3d03577d69331fef7d0ca55dc370f3499884cef
test-kitchen
analytics
frontend/test/pageobjects/list.page.js
ListPage::delete
function
async delete() { await this.lastInstrumentActionMenu.click(); await this.lastInstrumentActionMenu.$('ul.cdx-menu__listbox li:last-child').click(); await this.dialogDeleteButton.click(); }
15,293
d49f6a29776152ff0bc2e3863503a1b4
swh:1:cnt:d62ed504c2c68749ae680c1c7f114c91f49899ea;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=41-44/
c3d03577d69331fef7d0ca55dc370f3499884cef
test-kitchen
analytics
frontend/test/pageobjects/list.page.js
ListPage::edit
function
async edit() { await this.firstInstrumentName.click(); await this.firstInstrumentName.$('ul.cdx-menu__listbox li:first-child').click(); }
15,294
bab162c3011e5fbf7acf0042c555cf14
swh:1:cnt:d62ed504c2c68749ae680c1c7f114c91f49899ea;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=46-51/
c3d03577d69331fef7d0ca55dc370f3499884cef
test-kitchen
analytics
frontend/test/pageobjects/list.page.js
ListPage::open
function
/** * overwrite specific options to adapt it to page object */ open() { return super.open(''); }
15,295
25f3d9ff5029522d4ff0726bd3255dbe
swh:1:cnt:c72e0ffe174baaba6530cdd54ab94fdfcc9c6112;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=4-125/
d714179f7605f9be90294dfc0bb763c3ae00a6a3
test-kitchen
analytics
frontend/test/pageobjects/modify.page.js
ModifyPage
type
/** * sub page containing specific selectors and methods for a specific page */ class ModifyPage extends Page { /** * define selectors using getter methods */ get inputFunction() { return $('input[name="radio-group-instrument-function"][value="modify"]'); } get inputInstrumentName()...
15,296
69ffdeefa8b57abe3349bc412a88a0c5
swh:1:cnt:c72e0ffe174baaba6530cdd54ab94fdfcc9c6112;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=8-13/
d714179f7605f9be90294dfc0bb763c3ae00a6a3
test-kitchen
analytics
frontend/test/pageobjects/modify.page.js
ModifyPage::inputFunction
function
/** * define selectors using getter methods */ get inputFunction() { return $('input[name="radio-group-instrument-function"][value="modify"]'); }
15,297
18a002e4fa75a7d1aa6e8e4d67846e84
swh:1:cnt:c72e0ffe174baaba6530cdd54ab94fdfcc9c6112;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=27-29/
d714179f7605f9be90294dfc0bb763c3ae00a6a3
test-kitchen
analytics
frontend/test/pageobjects/modify.page.js
ModifyPage::inputPhabTicket
function
get inputPhabTicket() { return $('input[data-id="task"]'); }
15,298
7c0d4fe8ec694ab8677984a5b09f55a5
swh:1:cnt:c72e0ffe174baaba6530cdd54ab94fdfcc9c6112;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=23-25/
d714179f7605f9be90294dfc0bb763c3ae00a6a3
test-kitchen
analytics
frontend/test/pageobjects/modify.page.js
ModifyPage::inputSchemaType
function
get inputSchemaType() { return $('input[name="radio-group-schema-type"][value="web"]'); }
15,299
8e70120ad52cb2d89831b134cfac4f07
swh:1:cnt:c72e0ffe174baaba6530cdd54ab94fdfcc9c6112;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=19-21/
d714179f7605f9be90294dfc0bb763c3ae00a6a3
test-kitchen
analytics
frontend/test/pageobjects/modify.page.js
ModifyPage::inputDescription
function
get inputDescription() { return $('textarea[data-id="description"]'); }