Skip to content

Commit

Permalink
Merge pull request #242 from Support-pl/dev
Browse files Browse the repository at this point in the history
fixed minor bugs
  • Loading branch information
639852 authored Aug 3, 2023
2 parents 0addafe + 163efa4 commit 3e3c0cd
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default {
created() {
window.addEventListener('message', ({ data, origin }) => {
console.log(data, origin);
if (!origin.includes('8081')) return;
if (!origin.includes('https://api.')) return;
this.$store.commit("nocloud/auth/setToken", data.token);
sessionStorage.removeItem("user");
Expand Down
16 changes: 9 additions & 7 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import vuex from '@/store/index.js'
// const api = new Api();
const api = new Api(VUE_APP_BASE_URL);

api.axios.interceptors.response.use((response) => response, (error) => {
if (error.response && error.response?.data?.code === 7) {
console.log('credentials are not actual');
vuex.dispatch("nocloud/auth/logout")
}
return Promise.reject(error) // this is the important part
})
api.axios.interceptors.response.use(
(response) => response,
(error) => {
if (error.response && [2, 7].includes(error.response?.data?.code)) {
console.log('credentials are not actual');
vuex.dispatch("nocloud/auth/logout")
}
return Promise.reject(error) // this is the important part
})

export default api;
27 changes: 24 additions & 3 deletions src/components/appMain/appHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<a-icon type="left" />
</div>
<!-- {{$t(`headerTitle.${headerTitle}`)}} -->
{{ headerTitle }}
<span>{{ headerTitle }}</span>
</div>

<div class="header__right-side">
Expand Down Expand Up @@ -686,13 +686,26 @@ export default {
font-size: 1.1rem;
display: flex;
align-items: center;
margin-right: 5px;
overflow: hidden;
}
.header__title > span {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.header_back_btn {
font-size: 1.4rem;
margin-right: 20px;
}
.header__links {
display: flex;
align-items: center;
}
.header__links a {
color: #fff;
transition: color 0.2s ease, background-color 0.3s ease, opacity 0.2s ease;
Expand All @@ -715,9 +728,13 @@ export default {
}
.header__links a:last-child {
box-shadow: 0px 0px 0px 1px #fff;
border-radius: 5px;
max-width: 100px;
padding: 10px 15px;
border-radius: 5px;
line-height: 1;
overflow: hidden;
text-overflow: ellipsis;
box-shadow: 0px 0px 0px 1px #fff;
}
.header__links a:last-child:hover {
Expand Down Expand Up @@ -860,5 +877,9 @@ export default {
background: var(--main);
box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2);
}
.header__links a:not(:last-child) {
margin-right: 10px;
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,8 @@ export default {
return addons;
},
region() {
const location = this.locationId.split(' ').at(-1);
const { extra, title } = this.itemSP?.locations
.find(({ id }) => id === location) ?? {};
.find(({ id }) => id === this.locationId.includes(id)) ?? {};

if (!extra) return null;
return { value: extra.region, title };
Expand Down
27 changes: 23 additions & 4 deletions src/components/appMain/modules/ovh vps/createInstance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ export default {
plans: [],
allAddons: {},
addonsCodes: {},
price: {}
price: {},
catalog: {}
}),
methods: {
setAddons(plans) {
Expand Down Expand Up @@ -99,6 +100,25 @@ export default {
this.$emit('setData', { key: 'planCode', value, type: 'ovh' });
this.$emit('setData', { key: 'duration', value: plan.duration, type: 'ovh' });
this.$emit('setData', { key: 'pricingMode', value: plan.pricingMode, type: 'ovh' });
},
async filterImages(images) {
let response = null;
if (this.catalog.plans) {
response = { meta: { catalog: this.catalog } };
} else {
response = await this.$api.servicesProviders.action(
{ action: "get_plans", uuid: this.itemSP.uuid }
);
this.catalog = response.meta.catalog;
}
const { meta: { catalog } } = response;
const { configurations } = catalog.plans.find(
({ planCode }) => planCode.includes(this.planKey)
);
const os = configurations[1].values;
return images.filter((image) => os.includes(image));
}
},
created() {
Expand Down Expand Up @@ -162,9 +182,8 @@ export default {
return addons;
},
region() {
const location = this.locationId.split(' ').at(-1);
const { extra, title } = this.itemSP?.locations.find(
({ id }) => id === location
({ id }) => this.locationId.includes(id)
) || {};
if (!extra) return null;
Expand Down Expand Up @@ -207,7 +226,7 @@ export default {
const { os } = products[0][1].meta;
os.sort();
this.images = os.map((el) => ({ name: el, desc: el }));
this.images = this.filterImages(os).map((el) => ({ name: el, desc: el }));
this.images.forEach(({ name }, i, arr) => {
if (name.toLowerCase().includes('windows')) {
arr[i].prices = products.map(([key, { meta }]) => ({
Expand Down
21 changes: 15 additions & 6 deletions src/components/appMain/support/ticketchat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@

<div class="chat__footer">
<a-textarea
:disabled="status == 'Closed'"
allowClear
:autoSize="{ minRows: 1, maxRows: 2 }"
v-model="messageInput"
v-on:keyup.shift.enter.exact="newLine"
v-on:keydown.enter.exact.prevent="sendMessage"
type="text"
class="chat__input"
name="message"
id="message"
v-model="messageInput"
:disabled="status == 'Closed'"
:autoSize="{ minRows: 2, maxRows: 100 }"
:placeholder="$t('message') + '...'"
@keyup.shift.enter.exact="newLine"
@keydown.enter.exact.prevent="sendMessage"
>
</a-textarea>
<div class="chat__send" @click="sendMessage">
Expand Down Expand Up @@ -354,7 +354,7 @@ export default {
.chat__footer {
display: flex;
justify-content: center;
align-items: center;
align-items: end;
background-color: var(--bright_bg);
padding: 10px;
position: absolute;
Expand All @@ -372,6 +372,14 @@ export default {
padding: 7px 0;
}
.chat__input textarea {
max-height: calc(50vh - 34px) !important;
}
.chat__input .ant-input-textarea-clear-icon {
margin: 9px 2px 0 0;
}
.chat__send {
background-color: var(--main);
color: var(--bright_font);
Expand All @@ -382,6 +390,7 @@ export default {
justify-content: center;
align-items: center;
margin-left: 10px;
margin-bottom: 15px;
font-size: 1.2rem;
transition: filter 0.2s ease;
cursor: pointer;
Expand Down

0 comments on commit 3e3c0cd

Please sign in to comment.