Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frontend: Fix errors for undefined variables #459

Merged
merged 3 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions swift_browser_ui_frontend/src/common/conv.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,10 @@ export function makeGetObjectsMetaURL(container, objects) {
}

export const taginputConfirmKeys = [",", ";", ":", ".", " ", "Tab", "Enter"];

export function truncate(value, length) {
if (!value) {
return "";
}
return value.length > length ? value.substr(0, length) + "..." : value;
}
4 changes: 2 additions & 2 deletions swift_browser_ui_frontend/src/common/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Vue.use(Vuex);
const store = new Vuex.Store({
state: {
projects: [],
active: undefined,
uname: undefined,
active: {},
uname: "",
multipleProjects: false,
isLoading: false,
isFullPage: true,
Expand Down
8 changes: 3 additions & 5 deletions swift_browser_ui_frontend/src/components/ObjectTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@
</template>

<script>
import { getHumanReadableSize } from "@/common/conv";
import { getHumanReadableSize, truncate } from "@/common/conv";
import debounce from "lodash/debounce";
import escapeRegExp from "lodash/escapeRegExp";
import ContainerDownloadLink from "@/components/ContainerDownloadLink";
Expand All @@ -344,10 +344,8 @@ export default {
ReplicateContainerButton,
DeleteObjectsButton,
},
filters:{
truncate(value, length) {
return value.length > length ? value.substr(0, length) + "..." : value;
},
filters: {
truncate,
},
data: function () {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@
</template>

<script>
import { truncate } from "@/common/conv";

import delay from "lodash/delay";

export default {
name: "ShareRequestsTable",
filters: {
truncate(value, length) {
return value.length > length ? value.substr(0, length) + "..." : value;
},
truncate,
},
data () {
return {
Expand Down
5 changes: 2 additions & 3 deletions swift_browser_ui_frontend/src/components/SharedTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
</template>

<script>
import { truncate } from "@/common/conv";
import delay from "lodash/delay";
import ContainerDownloadLink from "@/components/ContainerDownloadLink";
import ReplicateContainerButton from "@/components/ReplicateContainer";
Expand All @@ -130,9 +131,7 @@ export default {
ReplicateContainerButton,
},
filters: {
truncate(value, length) {
return value.length > length ? value.substr(0, length) + "..." : value;
},
truncate,
},
data: function () {
return {
Expand Down
14 changes: 14 additions & 0 deletions swift_browser_ui_frontend/src/entries/login.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
import Vue from "vue";
import App from "@/pages/LoginPage.vue";

import getLangCookie from "@/common/conv";
import translations from "@/common/lang";

// Import project css
import "@/css/prod.scss";

import VueI18n from "vue-i18n";

Vue.use(VueI18n);


const i18n = new VueI18n({
locale: getLangCookie(),
messages: translations,
});

new Vue ({
i18n,
data: {
formname: "Token id:",
loginformname: "Openstack account:",
Expand Down
2 changes: 1 addition & 1 deletion swift_browser_ui_frontend/src/entries/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ new Vue({
else {
retl.push({
alias: this.$t("message.containers")
+ this.$store.state.active.name,
+ this.$store.state.active.name || "",
address: {name: "ContainersView"},
});
}
Expand Down
6 changes: 3 additions & 3 deletions swift_browser_ui_frontend/src/pages/BrowserPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
</template>

<script>
import { truncate } from "@/common/conv";

export default {
name: "BrowserPage",
filters: {
truncate(value, length) {
return value.length > length ? value.substr(0, length) + "..." : value;
},
truncate,
},
};
</script>
Expand Down
6 changes: 2 additions & 4 deletions swift_browser_ui_frontend/src/views/Containers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@
</template>

<script>
import { getHumanReadableSize } from "@/common/conv";
import { getHumanReadableSize, truncate } from "@/common/conv";
import debounce from "lodash/debounce";
import escapeRegExp from "lodash/escapeRegExp";
import FolderUploadForm from "@/components/FolderUpload";
Expand All @@ -299,9 +299,7 @@ export default {
DeleteContainerButton,
},
filters:{
truncate(value, length) {
return value.length > length ? value.substr(0, length) + "..." : value;
},
truncate,
},
data: function () {
return {
Expand Down
3 changes: 2 additions & 1 deletion tests/cypress/integration/userInfo.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ describe("Retrieve User information", function () {
cy.contains('Buckets: 10')
cy.contains('wol')
cy.get('.navbar-dropdown').invoke('css', 'display', 'block')
.should('have.css', 'display', 'block')
.should('have.css', 'display', 'block')
cy.wait(2000)
cy.contains('what').click()
cy.wait(1000)
cy.url().should('eq', Cypress.config().baseUrl + '/browse/test_user_id')
cy.contains('.buttons > .button','Browser').click()
cy.wait(2000)
Expand Down