Skip to content

Commit

Permalink
Save changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rexruan committed Nov 13, 2023
1 parent f1531f9 commit 3bc8b28
Show file tree
Hide file tree
Showing 23 changed files with 105 additions and 86 deletions.
1 change: 0 additions & 1 deletion frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ pnpm-debug.log*
*.sln
*.sw?

!lib/
6 changes: 3 additions & 3 deletions frontend/src/components/Common/TextSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export default {
this.options = filteredOptions;
},
async handleTextDeleteClick(textId) {
await axios.delete(`/api/delete_text/${textId}`);
await axios.delete(`/swegram/beta/api/delete_text/${textId}`);
this.textIDs = this.textIDs.filter((text) => text[0] !== textId);
this.chosenTextIds = this.chosenTextIds.filter((text) => text !== textId);
this.metaData = this.metaData.filter((meta) => meta[2] !== textId);
Expand All @@ -214,7 +214,7 @@ export default {
localStorage.setItem('metadata', JSON.stringify({ en: {}, sv: {} }));
}
axios
.put('/api/update_texts/', {
.put('/swegram/beta/api/update_texts/', {
texts: JSON.parse(localStorage.textList)[lang],
metadata: JSON.parse(localStorage.metadata)[lang],
})
Expand Down Expand Up @@ -255,7 +255,7 @@ export default {
.filter((textId) => textId[0] !== -10000)
.map((i) => [i[0], this.chosenTextIds.includes(i[0])]);
axios
.put('/api/update_states', {
.put('/swegram/beta/api/update_states', {
textStates: Object.fromEntries(entries),
texts: JSON.parse(localStorage.textList)[lang],
});
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/DownloadPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export default {
}
if (!this.downloadDisabled && this.tooltipDisabled) {
if (this.downloadType.includes('texts')) {
const textDownloadURL = '/download_text/';
const textDownloadURL = '/swegram/beta/download_text/';
axios({
method: 'post',
data: {
Expand All @@ -231,7 +231,7 @@ export default {
link.click();
});
} if (this.downloadType.includes('statistics')) {
const statsDownloadURL = '/download_stats/';
const statsDownloadURL = '/swegram/beta/download_stats/';
axios({
method: 'post',
data: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export default {
localStorage.setItem('textList', JSON.stringify({}));
}
const lang = this.$route.params.toolVersion;
const dataURL = `/${this.$props.category}/${this.$props.tagset}`;
const dataURL = `/swegram/beta/${this.$props.category}/${this.$props.tagset}`;
axios
.post(dataURL, {
texts: JSON.parse(localStorage.textList),
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Statistics/SnippetLengthPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export default {
}
const lang = this.$route.params.toolVersion;
axios
.post(`/${this.$props.category}/${this.$props.tagset}/`, {
.post(`/swegram/beta/${this.$props.category}/${this.$props.tagset}/`, {
texts: JSON.parse(localStorage.textList),
length: true,
lang,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default {
localStorage.setItem('textList', JSON.stringify({}));
}
const lang = this.$route.params.toolVersion;
const featsURL = `/features/${this.$props.level}/${this.currentPage}`;
const featsURL = `/swegram/beta/features/${this.$props.level}/${this.currentPage}`;
axios
.post(featsURL, {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Statistics/SnippetsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export default {
localStorage.setItem('textList', JSON.stringify({}));
}
const lang = this.$route.params.toolVersion;
const overviewURL = `/overview/${this.$props.level}`;
const overviewURL = `/swegram/beta/overview/${this.$props.level}`;
axios
.post(overviewURL, {
texts: JSON.parse(localStorage.textList),
Expand Down
58 changes: 29 additions & 29 deletions frontend/src/components/Statistics/StatisticsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,6 @@
type="border-card"
@tab-click="handleShowTagset"
>
<el-tab-pane
label="Frequency"
name="frequency"
>
<snippet-frequency-page
:tagset="tagset"
:category="category"
:texts-info="currentTextsStats()"
:display="showFrequency"
:initialized="initializeFrequency"
:initialize="handleInitialization"
/>
</el-tab-pane>

<el-tab-pane
label="Length"
name="length"
>
<snippet-length-page
:tagset="tagset"
:category="category"
:texts-info="currentTextsStats()"
:display="showLength"
:initialized="initializeLength"
@initialize="handleInitialization"
/>
</el-tab-pane>

<el-tab-pane
label="Linguistic features"
name="feature"
Expand Down Expand Up @@ -100,6 +72,34 @@
There is no valid text selected.
</div>
</el-tab-pane>

<el-tab-pane
label="Frequency"
name="frequency"
>
<snippet-frequency-page
:tagset="tagset"
:category="category"
:texts-info="currentTextsStats()"
:display="showFrequency"
:initialized="initializeFrequency"
:initialize="handleInitialization"
/>
</el-tab-pane>

<el-tab-pane
label="Length"
name="length"
>
<snippet-length-page
:tagset="tagset"
:category="category"
:texts-info="currentTextsStats()"
:display="showLength"
:initialized="initializeLength"
@initialize="handleInitialization"
/>
</el-tab-pane>
</el-tabs>
</el-main>
</el-container>
Expand Down Expand Up @@ -178,7 +178,7 @@ export default {
localStorage.setItem('textList', JSON.stringify({}));
}
const lang = this.$route.params.toolVersion;
const baseURL = '/get_text_stats/';
const baseURL = '/swegram/beta/get_text_stats/';
axios
.post(baseURL, {
textList: JSON.parse(localStorage.textList),
Expand Down
14 changes: 8 additions & 6 deletions frontend/src/components/TopNav/TopNavbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
:default-active="activeLink"
background-color="#F4DE48"
active-text-color="black"
text-color="black"
mode="horizontal"
router
>
Expand All @@ -17,12 +18,12 @@
<el-menu-item index="/sv/upload">
{{ $t('topNavbar.addText') }}
</el-menu-item>
<el-menu-item index="/sv/visualize">
{{ $t('topNavbar.visualize') }}
</el-menu-item>
<el-menu-item index="/sv/statistics">
{{ $t('topNavbar.statistics') }}
</el-menu-item>
<el-menu-item index="/sv/visualize">
{{ $t('topNavbar.visualize') }}
</el-menu-item>
<el-menu-item index="/sv/export">
<span>
Export
Expand All @@ -42,6 +43,7 @@
:default-active="activeLink"
background-color="#F2575F"
active-text-color="black"
text-color="black"
mode="horizontal"
router
>
Expand All @@ -51,12 +53,12 @@
<el-menu-item index="/en/upload">
{{ $t('topNavbar.addText') }}
</el-menu-item>
<el-menu-item index="/en/visualize">
{{ $t('topNavbar.visualize') }}
</el-menu-item>
<el-menu-item index="/en/statistics">
{{ $t('topNavbar.statistics') }}
</el-menu-item>
<el-menu-item index="/en/visualize">
{{ $t('topNavbar.visualize') }}
</el-menu-item>
<el-menu-item index="/en/export">
<span>
Export
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/components/Upload/UploadForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export default {
message: this.$t('uploadForm.uploadSuccessMsg'),
type: 'success',
});
this.$router.push(`/${this.$route.params.toolVersion}/visualize`);
this.$router.push(`/${this.$route.params.toolVersion}/visualize/`);
this.$emit('uploaded');
}
},
Expand Down Expand Up @@ -256,10 +256,11 @@ export default {
uploadURL() {
// const tokenization = this.formData.checkTokenize ? 'tokenized' : 'untokenized';
if (this.formData.annotated) {
return `/upload/${this.$route.params.toolVersion}`; // This uploads annotated file, lang needed to be modified
// return `/swegram/beta/api/upload_text/${this.$route.params.toolVersion}`;
return `/swegram/beta/upload/${this.$route.params.toolVersion}`; // This uploads annotated file, lang needed to be modified
}
return `/upload_annotate/${this.$route.params.toolVersion}`; // This actually means upload AND annotate
// return '/upload_annotate/'; // This actually means upload AND annotate
return `/swegram/beta/upload_annotate/${this.$route.params.toolVersion}`; // This actually means upload AND annotate
// return '/swegram/beta/upload_annotate/'; // This actually means upload AND annotate
},
},
};
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/components/Upload/UploadPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
v-show="!showTextForm"
id="upload_annotate_main"
>
{{ $tc('uploadPage.uploadMessage1', 0) }}
<div class="ui bulleted list">
{{ $t('uploadPage.uploadMessage1') }}
<!-- <div class="ui bulleted list">
<div class="item">
{{ $tc('uploadPage.uploadMessage1', 1) }}
</div>
<div class="item">
{{ $tc('uploadPage.uploadMessage1', 2) }}
</div>
</div>
</div> -->
<br><br>
{{ $tc('uploadPage.uploadMessage2', 0) }}
<i>{{ $tc('uploadPage.uploadMessage2', 1) }}</i>
{{ $tc('uploadPage.uploadMessage2', 2) }}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Visualize/VisualizePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default {
checkCurrentTextParsed(newValue) {
if (newValue !== '0' && newValue) {
axios
.get(`/api/get_text/${newValue}`)
.get(`/swegram/beta/api/get_text/${newValue}`)
.then((response) => {
this.currentTextParsed = JSON.parse(response.data)[0].fields.parsed;
})
Expand All @@ -93,7 +93,7 @@ export default {
if (this.currentText !== null && this.currentText !== '0') {
this.tokens = [];
axios
.get(`/visualise_text/${this.currentText}/${this.currentPage}/`)
.get(`/swegram/beta/visualise_text/${this.currentText}/${this.currentPage}/`)
.then((response) => {
const { data } = response;
this.currentSentences = data.current_sentences;
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/i18n/langs/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ const en = {
},
uploadPage: {
annotateNewText: 'Annotate a new text',
uploadMessage1: 'In order to annotate a new text, you can either | upload one or multiple (texts in format .doc, docx, .odt or .rtf, which are automatically converted into plain text), or | paste in a text.',
uploadMessage1: 'In order to annotate a new text, you can upload a plain text, or paste in a text.',
uploadMessage2: 'For more information how metadata is handled, see | help | in menu.',
textUploadButton: 'Upload a file',
textPasteButton: 'Paste in a text',
Expand All @@ -272,7 +272,7 @@ const en = {
uploadFailedMsg: 'An error occured\n{0}',
uploadErrNonText: 'Please upload text files only',
uploadErrFileTooBig: 'Please upload a file less than 100MB',
beforeUploadWarning: 'Upload a big file could take up to several hours, are you sure you want to continue?',
beforeUploadWarning: 'Uploading and processing a big file can take time.',
},
...elementEN,
};
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/i18n/langs/sv.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ const sv = {
},
uploadPage: {
annotateNewText: 'Annotera ny text',
uploadMessage1: 'För att annotera en ny text kan du antingen | ladda upp en eller flera textfiler (texter i format .doc, docx, .odt och .rtf konverteras automatiskt till ren text), eller | klistra in en text.',
uploadMessage1: 'För att annotera en ny text kan du ladda upp en klartext, eller klistra in en text.',
uploadMessage2: 'För information om hantering av metadata, se | hjälp | i menyn.',
textUploadButton: 'Ladda upp textfil',
textPasteButton: 'Klistra in text',
Expand All @@ -271,7 +271,7 @@ const sv = {
uploadFailedMsg: 'An error occured\n{0}',
uploadErrNonText: 'Please upload text files only',
uploadErrFileTooBig: 'Please upload a file less than 100MB',
beforeUploadWarning: 'Upload a big file could take up to several hours, are you sure you want to continue?',
beforeUploadWarning: 'Upploading och parsering en stor fil kan ta lång tid',
},
...elementSV,
};
Expand Down
6 changes: 4 additions & 2 deletions frontend/vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ const BundleTracker = require('webpack-bundle-tracker');

module.exports = {
// on Windows you might want to set publicPath: "http://127.0.0.1:8080/"
publicPath: 'http://0.0.0.0:8000/static/',
// ublicPath: 'http://0.0.0.0:8000/static/',
publicPath: 'http://0.0.0.0:8080/',
// publicPath: 'https://kasus.lingfil.uu.se/swegrambetastatic/',

outputDir: './dist/',

Expand All @@ -26,7 +28,7 @@ module.exports = {
// config.optimization.splitChunks(false);
config.optimization.splitChunks(false);

config.resolve.alias.set('__STATIC__', 'static');
config.resolve.alias.set('__STATIC__', 'swegrambetastatic');

config.devServer
// the first 3 lines of the following code have been added to the configuration
Expand Down
Loading

0 comments on commit 3bc8b28

Please sign in to comment.