Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
volga-app
Manage
Activity
Members
Labels
Plan
Issues
34
Issue boards
Milestones
Wiki
Code
Merge requests
3
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
fcdapps
volga-app
Commits
343ce0f4
Commit
343ce0f4
authored
8 months ago
by
Freedom Coder
Browse files
Options
Downloads
Plain Diff
Merge branch 'export-import-schedule' into 'dev'
Export/Import custom schedule See merge request
!47
parents
5bca8598
289299b6
Branches
dev
1 merge request
!47
Export/Import custom schedule
Pipeline
#156
passed with stages
in 50 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/i18n/en.json
+5
-1
5 additions, 1 deletion
src/i18n/en.json
src/i18n/ru.json
+5
-1
5 additions, 1 deletion
src/i18n/ru.json
src/routes/Settings.svelte
+55
-1
55 additions, 1 deletion
src/routes/Settings.svelte
with
65 additions
and
3 deletions
src/i18n/en.json
+
5
−
1
View file @
343ce0f4
...
...
@@ -19,7 +19,11 @@
"mySubgroupsDescription"
:
"Filter schedule for your subgroup"
,
"mySubgroupsChange"
:
"Change"
,
"autoScroll"
:
"Auto scroll today"
,
"autoScrollDescription"
:
"Scroll to today automatically"
"autoScrollDescription"
:
"Scroll to today automatically"
,
"customSchedule"
:
"Custom Schedule"
,
"customScheduleDescription"
:
"Export and import custom schedule"
,
"exportSchedule"
:
"Export"
,
"importSchedule"
:
"Import"
},
"info"
:
{
"nav"
:
"Info"
,
...
...
This diff is collapsed.
Click to expand it.
src/i18n/ru.json
+
5
−
1
View file @
343ce0f4
...
...
@@ -19,7 +19,11 @@
"mySubgroupsDescription"
:
"Фильтр расписания для вашей подгруппы"
,
"mySubgroupsChange"
:
"Изменить"
,
"autoScroll"
:
"Автопролистывание"
,
"autoScrollDescription"
:
"Автоматически пролистывать расписание до сегодняшнего дня"
"autoScrollDescription"
:
"Автоматически пролистывать расписание до сегодняшнего дня"
,
"customSchedule"
:
"Пользовательское расписание"
,
"customScheduleDescription"
:
"Экспорт и импорт пользовательского расписания"
,
"exportSchedule"
:
"Экспорт"
,
"importSchedule"
:
"Импорт"
},
"info"
:
{
"nav"
:
"Инфо"
,
...
...
This diff is collapsed.
Click to expand it.
src/routes/Settings.svelte
+
55
−
1
View file @
343ce0f4
...
...
@@ -6,7 +6,7 @@
import
UpdateMeButton
from
"
../components/UpdateMeButton.svelte
"
;
import
ThemePicker
from
"
../components/ThemePicker.svelte
"
;
import
MySubgroupModal
from
"
../components/MySubgroupModal.svelte
"
;
import
{
preferences
}
from
"
../stores.ts
"
;
import
{
preferences
,
customSchedule
}
from
"
../stores.ts
"
;
import
{
_icon_literal
}
from
"
../utils/icon.js
"
;
import
{
_
}
from
"
svelte-i18n
"
;
// import tg from "../res/telegram.svg";
...
...
@@ -14,6 +14,7 @@
const
__unused
=
_icon_literal
(
"
check
"
)
let
scheduleImporter
;
let
ip
;
let
error
=
null
;
let
submitting
=
false
;
...
...
@@ -29,6 +30,29 @@
}
}
function
exportSchedule
()
{
const
exporter
=
document
.
createElement
(
'
a
'
);
exporter
.
href
=
'
data:attachment/text,
'
+
encodeURI
(
JSON
.
stringify
(
$customSchedule
));
exporter
.
target
=
'
_blank
'
;
exporter
.
download
=
'
customSchedule.json
'
;
exporter
.
click
();
}
async
function
importSchedule
(
file
)
{
try
{
const
text
=
await
file
.
text
();
const
json
=
JSON
.
parse
(
text
);
if
(
!
Array
.
isArray
(
json
.
insertions
)
||
!
Array
.
isArray
(
json
.
deletions
))
{
throw
new
Error
(
"
Invalid schedule format: 'insertions' or 'deletions' not found
"
);
}
customSchedule
.
set
(
json
);
}
catch
(
error
)
{
console
.
error
(
error
);
}
}
const
dataPromise
=
apiGetStudentInfo
();
let
clientInfo
=
{};
clientInfo
[
$_
(
'
page.info.clientInfo.version
'
,
{
default
:
'
App version
'
})]
=
APP_VERSION
;
...
...
@@ -67,5 +91,35 @@
</button>
</nav>
</div>
<div
class=
"field"
style=
"height: max-content;"
>
<nav
class=
"no-padding"
>
<div
class=
"max"
>
<h6>
{
$_
(
'
page.settings.customSchedule
'
,
{
default
:
'
Custom Schedule
'
})
}
</h6>
<div>
{
$_
(
'
page.settings.customScheduleDescription
'
,
{
default
:
'
Export and import custom schedule
'
})
}
</div>
</div>
<div
class=
"row max wrap right-align"
>
<button
on:click=
{
exportSchedule
}
>
<MIcon>
download
</MIcon>
{
$_
(
'
page.settings.exportSchedule
'
,
{
default
:
'
Export
'
})
}
</button>
<button
on:click=
{
scheduleImporter
.
click
()
}
>
<MIcon>
upload_file
</MIcon>
{
$_
(
'
page.settings.importSchedule
'
,
{
default
:
'
Import
'
})
}
<input
type=
"file"
style=
"display: none;"
accept=
"application/json"
bind:this=
{
scheduleImporter
}
on:change=
{
(
event
)
=>
{
const
files
=
event
.
currentTarget
.
files
;
if
(
files
&&
files
.
length
>
0
)
importSchedule
(
files
.
item
(
0
));
scheduleImporter
.
value
=
""
;
}
}
/>
</button>
</div>
</nav>
</div>
</article>
</Navbar>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment