-
+
+
+
+ {{mismatch.type}}
+
+
+ {{ this.$i18n('statement') }}
+
+
{{ this.$i18n('empty-value') }}
diff --git a/resources/js/Components/MismatchesTable.vue b/resources/js/Components/MismatchesTable.vue
index 5c4c095d..bea636f1 100644
--- a/resources/js/Components/MismatchesTable.vue
+++ b/resources/js/Components/MismatchesTable.vue
@@ -2,7 +2,8 @@
- {{$i18n('column-property')}}
+ {{$i18n('column-mismatch')}}
+ {{$i18n('column-type')}}
{{$i18n('column-wikidata-value')}}
{{$i18n('column-external-value')}}
{{$i18n('column-external-source')}}
@@ -45,10 +46,11 @@ export default Vue.extend({
diff --git a/resources/js/Pages/Layout.vue b/resources/js/Pages/Layout.vue
index 39aefe96..2b70eaf1 100644
--- a/resources/js/Pages/Layout.vue
+++ b/resources/js/Pages/Layout.vue
@@ -181,8 +181,15 @@ export default defineComponent({
@import '~@wmde/wikit-tokens/dist/_variables.scss';
.website {
+ box-sizing: border-box;
+ min-height: 100%;
+ display: flex;
+ flex-direction: column;
+
.content-wrap {
max-width: 1168px;
+ width: 100%;
+ flex-grow: 1;
}
.mismatch-finder-logo {
diff --git a/resources/sass/app.scss b/resources/sass/app.scss
index 30d46df6..ba5e83af 100644
--- a/resources/sass/app.scss
+++ b/resources/sass/app.scss
@@ -5,8 +5,13 @@
@import '~@wmde/wikit-tokens/dist/_variables.scss';
@import './_typography.scss';
+html {
+ height: 100%;
+}
+
body {
@include body-text;
+ height: 100%;
}
/**
diff --git a/resources/sass/noscript.scss b/resources/sass/noscript.scss
new file mode 100644
index 00000000..0b767961
--- /dev/null
+++ b/resources/sass/noscript.scss
@@ -0,0 +1,65 @@
+@import '~@wikimedia/codex/dist/codex.style.css';
+@import '~@wikimedia/codex/dist/codex.style-rtl.css';
+@import '~@wikimedia/codex-design-tokens/theme-wikimedia-ui.scss';
+
+$spacing-layout-50: 0.5rem;
+$spacing-layout-100: 1rem;
+$spacing-layout-150: 1.5rem;
+$spacing-layout-200: 2rem;
+$spacing-layout-900: 9rem;
+
+main {
+ font-size: $font-size-medium;
+ line-height: $line-height-medium;
+ font-family: $font-family-system-sans;
+ font-weight: $font-weight-normal;
+ color: $color-base;
+ padding: 10vw $spacing-layout-150 $spacing-layout-150 $spacing-layout-150;
+ max-width: 680px;
+
+ @media (min-width: $min-width-breakpoint-tablet) {
+ padding: 10vw $spacing-layout-200 $spacing-layout-200 $spacing-layout-200;
+ }
+ @media (min-width: $min-width-breakpoint-desktop) {
+ padding: $spacing-layout-900 0 $spacing-layout-150 0;
+ }
+ p {
+ margin-block-end: 0;
+ }
+ .h5 {
+ margin: $spacing-layout-150 0;
+ font-size: $font-size-medium;
+ line-height: $line-height-xxx-small;
+ font-family: $font-family-system-sans;
+ font-weight: $font-weight-bold;
+ color: $color-emphasized;
+ }
+ .message-wrapper {
+ padding: $spacing-layout-50 0;
+ @media (min-width: $min-width-breakpoint-tablet) {
+ padding: $spacing-layout-100 0;
+ }
+ }
+ .description {
+ padding-block-end: $spacing-layout-150;
+ }
+ header {
+ .logo-link {
+ width: $size-full;
+ }
+ .mismatch-finder-logo {
+ background-image: url('/images/mismatch-finder-logo_mobile.svg');
+ width: $size-full;
+ height: 24px;
+ background-size: contain;
+
+ @media (min-width: $min-width-breakpoint-tablet) {
+ background-image: url('/images/mismatch-finder-logo.svg');
+ max-width: 384px;
+ height: 24px;
+ }
+ }
+ justify-content: center;
+ }
+}
+
diff --git a/resources/views/app.blade.php b/resources/views/app.blade.php
index 6068057e..49ac1872 100644
--- a/resources/views/app.blade.php
+++ b/resources/views/app.blade.php
@@ -5,6 +5,10 @@
+
+
+ @include('noscript')
+
@inertia
diff --git a/resources/views/importStatus.blade.php b/resources/views/importStatus.blade.php
index babb65bb..0a6b38e2 100644
--- a/resources/views/importStatus.blade.php
+++ b/resources/views/importStatus.blade.php
@@ -4,7 +4,9 @@
@foreach ($imports as $import)
- {{__('store-layout.button:download-import-csv') }}
+ @if($import->status == 'completed')
+ {{__('store-layout.button:download-import-csv') }}
+ @endif
{{ __('import-status.item:status') }}
{{ __('import-status.item:status.' . $import->status) }}
diff --git a/resources/views/noscript.blade.php b/resources/views/noscript.blade.php
new file mode 100644
index 00000000..99c96fd5
--- /dev/null
+++ b/resources/views/noscript.blade.php
@@ -0,0 +1,20 @@
+Mismatch Finder
+
+
+
+
+
+
+
+
Your browser doesn’t support Wikidata’s Mismatch Finder.
+
In order to view and use this tool, you must switch to another browser or enable JavaScript. Learn how to do that in Chrome , Firefox , Safari , Edge or Opera .
+
+
+
+
+
About Mismatch Finder
+
Mismatch Finder shows you data in Wikidata that differs from the data in other databases, catalogs or websites. You can use this tool to review and correct said mismatches. More information
+
+
diff --git a/tests/Feature/CSVImportReaderTest.php b/tests/Feature/CSVImportReaderTest.php
index 33591f0e..969012fd 100644
--- a/tests/Feature/CSVImportReaderTest.php
+++ b/tests/Feature/CSVImportReaderTest.php
@@ -40,9 +40,9 @@ public function test_parses_mismatch_lines($data)
$fakeLines = [
["some-item-id","some-statement-guid","some-pid"
- ,"some-data","some-meta-data","more-data","a-url"],
+ ,"some-data","some-meta-data","more-data","a-url", "some-type"],
["another-item-id","another-statement-guid","another-pid"
- ,"another-data","another-meta-data","different-data","no-url"]
+ ,"another-data","another-meta-data","different-data","no-url", "another-type"]
];
$fakeCSVContent = join("\n", array_map(function (array $line) {
diff --git a/tests/Feature/ImportCSVTest.php b/tests/Feature/ImportCSVTest.php
index 0286ca41..0b262959 100644
--- a/tests/Feature/ImportCSVTest.php
+++ b/tests/Feature/ImportCSVTest.php
@@ -27,9 +27,9 @@ public function test_creates_mismatches(): void
$header = config('imports.upload.column_keys');
$lines = [
["Q184746","Q184746$7814880A-A6EF-40EC-885E-F46DD58C8DC5","P569","3 April 1934"
- ,"Q12138","1934-04-03","https://d-nb.info/gnd/119004453"],
+ ,"Q12138","1934-04-03","https://d-nb.info/gnd/119004453","statement"],
["Q184746","Q184746$7200D1AD-E4E8-401B-8D57-8C823810F11F","P21","Q6581072"
- ,"","nonbinary","https://www.imdb.com/name/nm0328762/"]
+ ,"","nonbinary","https://www.imdb.com/name/nm0328762/","statement"]
];
$content = join("\n", array_map(function (array $line) {
diff --git a/tests/Feature/ValidateCSVTest.php b/tests/Feature/ValidateCSVTest.php
index 5a685567..735cc804 100644
--- a/tests/Feature/ValidateCSVTest.php
+++ b/tests/Feature/ValidateCSVTest.php
@@ -34,7 +34,7 @@ public function invalidLineProvider(): iterable
function (array $config): array {
return [
',Q184746$7814880A-A6EF-40EC-885E-F46DD58C8DC5,P569' // Emulate missing item ID
- . ',3 April 1934,,1934-04-03,http://www.example.com', // Ensure correct columns
+ . ',3 April 1934,,1934-04-03,http://www.example.com,statement', // Ensure correct columns
__('validation.required', [
'attribute' => 'item id'
])
@@ -49,7 +49,7 @@ function (array $config, Generator $faker): array {
return [
$longQID // Emulate long item ID
. ',Q184746$7814880A-A6EF-40EC-885E-F46DD58C8DC5,P569' // Ensure correct columns
- . ',3 April 1934,,1934-04-03,http://www.example.com', // Ensure correct columns
+ . ',3 April 1934,,1934-04-03,http://www.example.com,', // Ensure correct columns
__('validation.max.string', [
'attribute' => 'item id',
'max' => $config['item_id']['max_length']
@@ -63,7 +63,7 @@ function (array $config): array {
return [
'q184746' // Emulate malformed item ID (must be initial-uppercase)
. ',Q184746$7814880A-A6EF-40EC-885E-F46DD58C8DC5,P569' // Ensure correct columns
- . ',3 April 1934,,1934-04-03,http://www.example.com', // Ensure correct columns
+ . ',3 April 1934,,1934-04-03,http://www.example.com,', // Ensure correct columns
__('validation.regex', [
'attribute' => 'item id'
])
@@ -75,7 +75,7 @@ function (array $config): array {
function (array $config): array {
return [
'Q184746,,' // Emulate missing guid
- . 'P569,3 April 1934,,1934-04-03,http://www.example.com',
+ . 'P569,3 April 1934,,1934-04-03,http://www.example.com,qualifier',
__('validation.required_with', [
'values' => 'wikidata value',
'attribute' => 'statement guid'
@@ -91,7 +91,7 @@ function (array $config, Generator $faker): array {
return [
'Q184746,'
. $longQID . '$' . $faker->uuid() . ',' // Emulate long guid
- . 'P569,3 April 1934,,1934-04-03,http://www.example.com', // Ensure correct columns
+ . 'P569,3 April 1934,,1934-04-03,http://www.example.com,statement', // Ensure correct columns
__('validation.max.string', [
'attribute' => 'statement guid',
'max' => $config['guid']['max_length']
@@ -105,7 +105,7 @@ function (array $config): array {
return [
'Q184746,'
. 'some-malformed-guid,' // Emulate malformed guid
- . 'P569,3 April 1934,,1934-04-03,http://www.example.com', // Ensure correct columns
+ . 'P569,3 April 1934,,1934-04-03,http://www.example.com,qualifier', // Ensure correct columns
__('validation.regex', [
'attribute' => 'statement guid'
])
@@ -117,7 +117,7 @@ function (array $config): array {
function (array $config): array {
return [
'Q91465763,Q184746$7814880A-A6EF-40EC-885E-F46DD58C8DC5,' // Emulate inconsistent data
- . 'P569,3 April 1934,,1934-04-03,http://www.example.com', // Ensure correct columns
+ . 'P569,3 April 1934,,1934-04-03,http://www.example.com,statement', // Ensure correct columns
__('validation.statement_guid')
];
}
@@ -127,7 +127,7 @@ function (array $config): array {
function (array $config): array {
return [
'Q184746,Q184746$7814880A-A6EF-40EC-885E-F46DD58C8DC5,,' // Emulate missing property id
- . '3 April 1934,,1934-04-03,http://www.example.com', // Ensure correct columns
+ . '3 April 1934,,1934-04-03,http://www.example.com,statement', // Ensure correct columns
__('validation.required', [
'attribute' => 'property id'
])
@@ -142,7 +142,7 @@ function (array $config, Generator $faker): array {
return [
'Q184746,Q184746$7814880A-A6EF-40EC-885E-F46DD58C8DC5,' // Ensure correct columns
. $longPID . ',' // Emulate long pid
- . '3 April 1934,,1934-04-03,http://www.example.com', // Ensure correct columns
+ . '3 April 1934,,1934-04-03,http://www.example.com,statement', // Ensure correct columns
__('validation.max.string', [
'attribute' => 'property id',
'max' => $config['pid']['max_length']
@@ -156,7 +156,7 @@ function (array $config): array {
return [
'Q184746,Q184746$7814880A-A6EF-40EC-885E-F46DD58C8DC5,' // Ensure correct columns
. 'some-malformed-pid,' // Emulate malformed pid
- . '3 April 1934,,1934-04-03,http://www.example.com', // Ensure correct columns
+ . '3 April 1934,,1934-04-03,http://www.example.com,statement', // Ensure correct columns
__('validation.regex', [
'attribute' => 'property id'
])
@@ -168,7 +168,7 @@ function (array $config): array {
function (array $config): array {
return [
'Q184746,Q184746$7814880A-A6EF-40EC-885E-F46DD58C8DC5,P569'
- . ',,,1934-04-03,http://www.example.com', // Emulate missing wikidata value
+ . ',,,1934-04-03,http://www.example.com,statement', // Emulate missing wikidata value
__('validation.required_with', [
'values' => 'statement guid',
'attribute' => 'wikidata value'
@@ -181,7 +181,8 @@ function (array $config): array {
function (array $config): array {
return [
'Q1462,Q1462$97120cf9-ff1b-37c9-8af6-89d0b44a1cf2,P5,' // Ensure correct columns
- . '634463875,Q123,516380568,http://www.example.com', // Emulate invalid meta wikidata value
+ . '634463875,Q123,516380568,' // Emulate invalid meta wikidata value
+ . 'http://www.example.com,statement',
__('validation.meta_wikidata_value')
];
}
@@ -191,7 +192,7 @@ function (array $config): array {
function (array $config): array {
return [
'Q1462,,P3150,'
- . ',Q12138,1879-03-14,http://www.example.com', // Emulate invalid meta wikidata value
+ . ',Q12138,1879-03-14,http://www.example.com,qualifier', // Emulate invalid meta wikidata value
__('validation.prohibited_if', [
'attribute' => 'meta wikidata value',
'other' => 'wikidata value',
@@ -207,7 +208,7 @@ function (array $config): array {
return [
'Q184746,Q184746$7814880A-A6EF-40EC-885E-F46DD58C8DC5,P569,' // Ensure correct columns
- . $longValue . ',,1934-04-03,http://www.example.com', // Emulate long wikidata value
+ . $longValue . ',,1934-04-03,http://www.example.com,statement', // Emulate long wikidata value
__('validation.max.string', [
'attribute' => 'wikidata value',
'max' => $config['wikidata_value']['max_length']
@@ -220,7 +221,7 @@ function (array $config): array {
function (array $config): array {
return [
'Q184746,Q184746$7814880A-A6EF-40EC-885E-F46DD58C8DC5,P569,3 April 1934' // Ensure correct columns
- . ',,,http://www.example.com', // Emulate missing external data
+ . ',,,http://www.example.com,statement', // Emulate missing external data
__('validation.required', [
'attribute' => 'external value'
])
@@ -234,7 +235,7 @@ function (array $config, Generator $faker): array {
return [
'Q184746,Q184746$7814880A-A6EF-40EC-885E-F46DD58C8DC5,P569,3 April 1934,,' // Ensure correct cols
- . $longValue . ',http://www.example.com', // Emulate long value
+ . $longValue . ',http://www.example.com,statement', // Emulate long value
__('validation.max.string', [
'attribute' => 'external value',
'max' => $config['external_value']['max_length']
@@ -250,7 +251,7 @@ function (array $config, Generator $faker): array {
return [
'Q184746,Q184746$7814880A-A6EF-40EC-885E-F46DD58C8DC5' // Ensure correct cols
. ',P569,3 April 1934,,1934-04-03,' // Ensure correct cols
- . $longURL, // Emulate long url
+ . $longURL . ',statement', // Emulate long url
__('validation.max.string', [
'attribute' => 'external url',
'max' => $config['external_url']['max_length']
@@ -264,13 +265,25 @@ function (array $config): array {
return [
'Q184746,Q184746$7814880A-A6EF-40EC-885E-F46DD58C8DC5' // Ensure correct cols
. ',P569,3 April 1934,,1934-04-03,' // Ensure correct cols
- . 'i-am-not-your-gurl',
+ . 'i-am-not-your-gurl,',
__('validation.url', [
'attribute' => 'external url'
])
];
}
];
+
+ yield 'invalid type value' => [
+ function (array $config): array {
+ return [
+ 'Q184746,Q184746$7814880A-A6EF-40EC-885E-F46DD58C8DC5,P569,' // Ensure correct columns
+ . '3 April 1934,,1934-04-03,http://www.example.com,potato', // Ensure correct columns
+ __('validation.in', [
+ 'attribute' => 'type'
+ ])
+ ];
+ }
+ ];
}
/**
@@ -301,7 +314,7 @@ public function test_does_not_throw_on_generic_uuid(): void
{
// Ensure correct columns
$line = 'Q4115189,Q4115189$ffa51229-4877-3135-a2e2-a22fe9b7039d' // Emulate non v4 UUID
- . ',P569,3 April 1934,,1934-04-03,http://www.example.com';
+ . ',P569,3 April 1934,,1934-04-03,http://www.example.com,statement';
// Emulate passed validation rule, as this is not the system under test
$this->partialMock(WikidataValue::class, function (MockInterface $mock) {
@@ -322,7 +335,7 @@ public function test_throws_on_malformed_wikidata_value(): void
{
// Ensure correct columns
$line = 'Q184746,Q184746$7814880A-A6EF-40EC-885E-F46DD58C8DC5,P569,invalid-wikidata-value,,'
- . '1934-04-03,http://www.example.com';
+ . '1934-04-03,http://www.example.com,statement';
$message = __('validation.wikidata_value', [
'attribute' => 'wikidata value'
]);
@@ -364,7 +377,7 @@ public function test_fails_on_thrown_exceptions(Closure $failSetup): void
// Ensure rows
$import = $this->createMockImport(
- 'some-item-id,some-guid,some-pid,some-value,some-meta-value,another-value,a-url'
+ 'some-item-id,some-guid,some-pid,some-value,some-meta-value,another-value,a-url,a-type'
);
try {
diff --git a/tests/Vue/Components/MismatchRow.spec.js b/tests/Vue/Components/MismatchRow.spec.js
index 8f44082b..9677741d 100644
--- a/tests/Vue/Components/MismatchRow.spec.js
+++ b/tests/Vue/Components/MismatchRow.spec.js
@@ -300,6 +300,34 @@ describe('MismatchesRow.vue', () => {
expect( wrapper.find( 'tr' ).text() ).toContain(mismatch.value_label);
});
+ it('shows "statement" in type column when value is empty (old database imports)', () => {
+ const mismatch = {
+ wikidata_value: 'Some value',
+ value_label: 'Some label',
+ type: '',
+ import_meta: {
+ user: {
+ username: 'some_user_name'
+ },
+ created_at: '2021-09-23'
+ },
+ };
+
+ const wrapper = mount(MismatchRow, {
+ propsData: { mismatch },
+ mocks: {
+ // Mock the banana-i18n plugin dependency
+ $i18n: key => key
+ }
+ });
+
+ const td = wrapper.findAll( 'td' ).filter(td => td.attributes('data-header') === 'column-type' ).at(0);
+ const statementText = td.find('span').text();
+
+ expect( wrapper.props().mismatch ).toBe( mismatch );
+ expect( statementText ).toContain('statement');
+ });
+
test.each(Object.values(ReviewDecision))
('shows a dropdown with the %s option', (currentStatus) => {
const mismatch = {
diff --git a/webpack.mix.js b/webpack.mix.js
index 88faf288..4b16bf8d 100644
--- a/webpack.mix.js
+++ b/webpack.mix.js
@@ -14,5 +14,6 @@ const mix = require('laravel-mix');
mix.ts('resources/js/app.ts', 'public/js')
.vue({ version: 2 })
.sass('resources/sass/app.scss', 'public/css')
+ .sass('resources/sass/noscript.scss', 'public/css')
.copyDirectory('resources/img', 'public/images')
.sourceMaps(false); // False prevents source maps in production