Skip to content

Commit

Permalink
指摘していただいた部分の修正
Browse files Browse the repository at this point in the history
  • Loading branch information
mathsuky committed Sep 13, 2023
1 parent de401db commit 298dacc
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 152 deletions.
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"dependencies": {
"@cloudcmd/clipboard": "^2.0.0",
"axios": "^1.1.3",
"buffer": "^6.0.3",
"csv-parse": "^5.5.0",
"direct-vuex": "^0.12.1",
"highlight.js": "^11.6.0",
Expand All @@ -34,21 +33,21 @@
"@openapitools/openapi-generator-cli": "^2.4.26",
"@types/highlight.js": "^10.1.0",
"@types/markdown-it": "^12.2.3",
"@typescript-eslint/eslint-plugin": "^5.60.0",
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^5.60.0",
"@vitejs/plugin-vue2": "^2.2.0",
"@vue/eslint-config-prettier": "^7.1.0",
"@vue/eslint-config-standard": "^8.0.1",
"@vue/eslint-config-typescript": "^11.0.3",
"eslint": "^8.43.0",
"eslint-config-prettier": "^6.15.0",
"eslint-config-prettier": "^8.9.0",
"eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-vue": "^7.20.0",
"eslint-plugin-vue": "^9.16.1",
"husky": "^8.0.1",
"lint-staged": "^13.0.3",
"lint-staged": "^13.2.3",
"prettier": "2.8",
"sass": "~1.63",
"typescript": "5.1.3",
"typescript": "5.1.6",
"unplugin-vue-components": "^0.25.1",
"vite": "^4.3.9",
"vue-template-compiler": "^2.7.14"
Expand Down
77 changes: 42 additions & 35 deletions src/components/main/SidebarFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@
<v-row class="mx-4 mb-5" justify="space-between" align="center" dense>
<v-col>knoQ {{ version }}</v-col>
<v-col class="flex-grow-0">
<v-btn
v-if="isPrivilegedUser"
icon
title="workspaceRegistration"
target="_blank"
rel="noopener noreferer"
@click="showModal"
>
<v-icon>mdi-door-open</v-icon>
</v-btn>
<v-tooltip v-if="isPrivilegedUser" top>
<template #activator="{ on }">
<v-btn
icon
title="workspaceRegistration"
target="_blank"
rel="noopener noreferer"
@click="showModal"
v-on="on"
>
<v-icon color="#EF3530">mdi-door-open</v-icon>
</v-btn>
</template>
<span>進捗部屋を登録するためのフォームを表示します</span>
</v-tooltip>
</v-col>
<v-col class="flex-grow-0">
<v-btn
Expand Down Expand Up @@ -39,7 +44,7 @@
filled
:rules="$rules.verifiedRoom"
/>
<div v-show="showError" class="ErrorMessage" style="color: red">
<div v-show="showError" class="ErrorMessage" style="color: #ef5350">
データは6列で入力してください。
</div>
</v-card-text>
Expand All @@ -54,7 +59,6 @@

<script lang="ts">
import { parse } from 'csv-parse/browser/esm/sync'
export default {
data() {
return {
Expand All @@ -78,27 +82,39 @@ export default {
this.showError = false
this.inputData = ''
},
async saveData() {
const records = parse(this.inputData, {
isValidData(data: string): boolean {
const records = parse(data, {
delimiter: ',',
relax_column_count: true,
})
if (records.every(record => record.length === 6)) {
return records.every(record => record.length === 6)
},
async saveData() {
if (this.isValidData(this.inputData)) {
this.showError = false
try {
const response = await fetch('http://localhost:6006/api/rooms/all', {
//開発環境url
method: 'POST',
credentials: 'include',
headers: {
'Content-Type': 'text/csv',
},
body: records,
const records = parse(this.inputData, {
delimiter: ',',
relax_column_count: true,
})
if (!response.ok) {
throw new Error('Network response was not ok')
for (const record of records) {
const response = await fetch(
'http://localhost:6006/api/rooms/all',
{
//開発環境url
method: 'POST',
credentials: 'include',
headers: {
'Content-Type': 'text/csv',
},
body: record.join(','),
}
)
if (!response.ok) {
throw new Error('Network response was not ok')
}
console.log('データが正常に送信されました。', response)
}
console.log('データが正常に送信されました。', response)
this.inputData = ''
this.isVisible = false
} catch (error) {
Expand All @@ -112,13 +128,4 @@ export default {
},
},
}
// import Vue from 'vue'
// import { Component } from 'vue-property-decorator'
// @Component
// export default class SidebarFooter extends Vue {
// get version(): string {
// return import.meta.env.VITE_APP_VERSION
// }
// }
</script>
5 changes: 0 additions & 5 deletions src/components/main/SidebarNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ export default class SidebarNavigation extends Vue {
title: 'Calendar',
link: '/calendar',
},
{
icon: 'mdi-door-open',
title: 'Workspace',
link: '/workspace',
},
]
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import App from './App.vue'
import router from '@/router'
import store from '@/store'
import rules from '@/workers/rules'
import { Buffer } from 'buffer'

window.Buffer = window.Buffer || Buffer

Vue.config.productionTip = false
Vue.prototype.$rules = rules
Expand Down
95 changes: 0 additions & 95 deletions src/pages/VerifiedRoom.vue

This file was deleted.

7 changes: 0 additions & 7 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const EventSearch = () => import('@/pages/EventSearch.vue')
const EventDetail = () => import('@/pages/EventDetail.vue')
const EventNew = () => import('@/pages/EventNew.vue')
const EventEdit = () => import('@/pages/EventEdit.vue')
const Workspace = () => import('@/pages/VerifiedRoom.vue')
const GroupDetail = () => import('@/pages/GroupDetail.vue')
const GroupNew = () => import('@/pages/GroupNew.vue')
const GroupEdit = () => import('@/pages/GroupEdit.vue')
Expand Down Expand Up @@ -88,12 +87,6 @@ const router = new Router({
component: EventDetail,
meta: { headerTitle: 'Event detail' },
},
{
path: '/workspace',
name: 'Workspace',
component: Workspace,
meta: { headerTitle: 'Workspace' },
},
{
path: '/callback',
name: 'Callback',
Expand Down
8 changes: 7 additions & 1 deletion src/workers/rules.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import SidebarFooter from '@/components/main/SidebarFooter.vue'

const rules = {
groupName: [
(v: string) => !!v || 'グループ名は必須です',
Expand All @@ -22,7 +24,11 @@ const rules = {
(v: string) => v.length <= 32 || '場所名は32文字までです',
],
eventDate: [(v: string) => !!v || '日付は必須です'],
verifiedRoom: [(v: string) => !!v || '進捗部屋の情報を入力してください'],
verifiedRoom: [
(v: string) => !!v || '進捗部屋の情報を入力してください',
(v: string) =>
SidebarFooter.methods?.isValidData(v) || 'データは6列で入力してください',
],

eventTimeStart: (
endTime: string,
Expand Down

0 comments on commit 298dacc

Please sign in to comment.