You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 26 kB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  1. <template>
  2. <div>
  3. <el-dialog
  4. :title="$t('notebook.createNewNotebook')"
  5. :visible.sync="dialogVisible"
  6. width="50%"
  7. :close-on-click-modal="false"
  8. @closed="handleClose"
  9. >
  10. <div class="wrapper" v-loading="loading" element-loading-spinner="el-icon-loading">
  11. <div style="text-align: center;padding-bottom: 12px;">
  12. <span class="text-tip">{{$t('notebook.tips')}}</span>
  13. </div>
  14. <div v-show="alertCb" class="ui message alert-info">
  15. <div style="display: flex;align-items: center;">
  16. <i class="ri-information-line" style="font-size: 35px;color: rgba(242, 113, 28, 1);;"></i>
  17. <div style="text-align: left;margin-left: 1rem;">
  18. <div style="font-weight: 600;line-height: 2;">{{$t('notebook.sameTaskTips1')}} <span style="color:rgba(242, 113, 28, 1);">{{$t('notebook.sameTaskTips2')}}</span> {{$t('notebook.sameTaskTips3')}}</div>
  19. <div style="color:#939393">{{$t('notebook.sameTaskTips4')}} “<a href="/cloudbrains" target="_blank">{{$t('notebook.sameTaskTips5')}} &gt; {{$t('notebook.sameTaskTips6')}}</a>” {{$t('notebook.sameTaskTips7')}}</div>
  20. </div>
  21. </div>
  22. </div>
  23. <div
  24. class="three-resource-type"
  25. :class="{ active: selectIndex == 0 }"
  26. @click="selectResource(0)"
  27. >
  28. <div class="resource-child-node">
  29. <div class="resource-type-icon background-C">
  30. <span class="text">C</span>
  31. </div>
  32. <div class="resource-type-detail">
  33. <div class="detail-title"><span>{{$t('notebook.cpuEnv')}}</span></div>
  34. <div class="detail-spec">
  35. <span>{{cpuSpec}}</span>
  36. </div>
  37. <div class="detail-spec">
  38. <span>{{$t('image')}}:{{notebookInfo.imageCpuDescription}}</span>
  39. </div>
  40. </div>
  41. <div class="resource-select">
  42. <i v-if="selectIndex===0" :class="{'slide-in-bottom': !slideActive && !initSelect }" class="ri-checkbox-circle-line green"></i>
  43. <i
  44. class="ri-checkbox-blank-circle-line gray"
  45. :class="{'fade-out':selectIndex===0}"
  46. ></i>
  47. </div>
  48. </div>
  49. </div>
  50. <div
  51. class="three-resource-type"
  52. :class="{ active: selectIndex == 2 }"
  53. @click="selectResource(2)"
  54. >
  55. <div class="resource-child-node">
  56. <div class="resource-type-icon background-N">
  57. <span class="text">N</span>
  58. </div>
  59. <div class="resource-type-detail">
  60. <div class="detail-title"><span>{{$t('notebook.npuEnv')}}</span></div>
  61. <div class="detail-spec">
  62. <span>{{npuSpec}}</span>
  63. </div>
  64. <div class="detail-spec">
  65. <span>{{$t('image')}}:{{notebookInfo.imageNpuDescription}}</span>
  66. </div>
  67. </div>
  68. <div class="resource-select">
  69. <i v-if="selectIndex===2" :class="[slideActive && !initSelect ?'slide-in-top':'slide-in-bottom']" class="ri-checkbox-circle-line green"></i>
  70. <i
  71. class="ri-checkbox-blank-circle-line gray"
  72. :class="{'fade-out':selectIndex===2}"
  73. ></i>
  74. </div>
  75. </div>
  76. </div>
  77. <div
  78. class="three-resource-type"
  79. :class="{ active: selectIndex == 1 }"
  80. @click="selectResource(1)"
  81. >
  82. <div class="resource-child-node">
  83. <div class="resource-type-icon background-G">
  84. <span class="text">G</span>
  85. </div>
  86. <div class="resource-type-detail">
  87. <div class="detail-title"><span>{{$t('notebook.gpuEnv')}}</span></div>
  88. <div class="detail-spec">
  89. <span>{{gpuSpec}}</span>
  90. </div>
  91. <div class="detail-spec">
  92. <span>{{$t('image')}}:{{notebookInfo.imageGpuDescription}}</span>
  93. </div>
  94. </div>
  95. <div class="resource-select">
  96. <i v-if="selectIndex===1 && !initSelect" :class="{'slide-in-top': slideActive && !initSelect}" class="ri-checkbox-circle-line green"></i>
  97. <i v-if="selectIndex===1 && initSelect" class="ri-checkbox-circle-line green"></i>
  98. <i
  99. class="ri-checkbox-blank-circle-line gray"
  100. :class="{'fade-out':selectIndex===1}"
  101. ></i>
  102. </div>
  103. </div>
  104. </div>
  105. <div class="resource-footer">
  106. <div class="resource-operate" v-if="selectIndex==0">
  107. <div v-if="btnStatus[0]===0">
  108. <button class="ui green small button" @click="createTask(0)"></i>{{$t('notebook.newTask')}}</button>
  109. <span v-if="notebookInfo.waitCountGpu==0" class="text">{{$t('notebook.noQuene')}}</span>
  110. <span v-else class="text">{{$t('notebook.queneTips1')}} <span style="color: red;">{{notebookInfo.waitCountGpu}}</span> {{$t('notebook.queneTips2')}}</span>
  111. </div>
  112. <div v-else-if="btnStatus[0]===1">
  113. <button class="ui disabled small button" style="background-color: #888;"><i class="loading spinner icon" style="color: #fff;"></i>{{$t('notebook.newTask')}}</button>
  114. <span class="text">{{$t('notebook.watiResource')}}</span>
  115. </div>
  116. <div v-else-if="btnStatus[0]===2">
  117. <button class="ui small button" style="background-color: #1684fc;">
  118. <a style="color:#fff" :href="deubgUrlGpu" target="_blank">{{$t('notebook.debug')}}</a>
  119. </button>
  120. <button class="ui small button" @click="stopDebug(0)">{{$t('notebook.stop')}}</button>
  121. <span class="text">{{$t('notebook.notebookRunning')}}</span>
  122. </div>
  123. <div v-else>
  124. <button class="ui disabled small button" style="background-color: #888;"><i class="loading spinner icon" style="color: #fff;"></i>{{$t('notebook.stopping')}}</button>
  125. </div>
  126. </div>
  127. <div class="resource-operate" v-if="selectIndex==2">
  128. <div v-if="btnStatus[2]===0">
  129. <button class="ui green small button" @click="createTask(2)"></i>{{$t('notebook.newTask')}}</button>
  130. <span v-if="notebookInfo.waitCountNpu==0" class="text">{{$t('notebook.noQuene')}}</span>
  131. <span v-else class="text">{{$t('notebook.queneTips1')}} <span style="color: red;">{{notebookInfo.waitCountNpu}}</span> {{$t('notebook.queneTips2')}}</span>
  132. </div>
  133. <div v-else-if="btnStatus[2]===1">
  134. <button class="ui disabled small button" style="background-color: #888;"><i class="loading spinner icon" style="color: #fff;"></i>{{$t('notebook.newTask')}}</button>
  135. <span class="text">{{$t('notebook.watiResource')}}</span>
  136. </div>
  137. <div v-else-if="btnStatus[2]===2">
  138. <button class="ui small button" style="background-color: #1684fc;">
  139. <a style="color:#fff" :href="deubgUrlNpu" target="_blank">{{$t('notebook.debug')}}</a>
  140. </button>
  141. <button class="ui small button" @click="stopDebug(2)">{{$t('notebook.stop')}}</button>
  142. <span class="text">{{$t('notebook.notebookRunning')}}</span>
  143. </div>
  144. <div v-else>
  145. <button class="ui disabled small button" style="background-color: #888;"><i class="loading spinner icon" style="color: #fff;"></i>{{$t('notebook.stopping')}}</button>
  146. </div>
  147. </div>
  148. <div class="resource-operate" v-if="selectIndex==1">
  149. <div v-if="btnStatus[1]===0">
  150. <button class="ui green small button" @click="createTask(1)"></i>{{$t('notebook.newTask')}}</button>
  151. <span v-if="notebookInfo.waitCountGpu==0" class="text">{{$t('notebook.noQuene')}}</span>
  152. <span v-else class="text">{{$t('notebook.queneTips1')}} <span style="color: red;">{{notebookInfo.waitCountGpu}}</span> {{$t('notebook.queneTips2')}}</span>
  153. </div>
  154. <div v-else-if="btnStatus[1]===1">
  155. <button class="ui disabled small button" style="background-color: #888;"><i class="loading spinner icon" style="color: #fff;"></i>{{$t('notebook.newTask')}}</button>
  156. <span class="text">{{$t('notebook.watiResource')}}</span>
  157. </div>
  158. <div v-else-if="btnStatus[1]===2">
  159. <button class="ui small button" style="background-color: #1684fc;">
  160. <a style="color:#fff" :href="deubgUrlGpu" target="_blank">{{$t('notebook.debug')}}</a>
  161. </button>
  162. <button class="ui small button" @click="stopDebug(1)">{{$t('notebook.stop')}}</button>
  163. <span class="text">{{$t('notebook.notebookRunning')}}</span>
  164. </div>
  165. <div v-else>
  166. <button class="ui disabled small button" style="background-color: #888;"><i class="loading spinner icon" style="color: #fff;"></i>{{$t('notebook.stopping')}}</button>
  167. </div>
  168. </div>
  169. </div>
  170. </div>
  171. </el-dialog>
  172. </div>
  173. </template>
  174. <script>
  175. import { getFileNotebook,createNotebook,getCb1Notebook,getCb2Notebook,getFileInfoNotebook,stopNotebook } from "~/apis/modules/notobook";
  176. import { Message } from "element-ui";
  177. let timerCb1,timerCb2,timerCb3
  178. let {AppSubUrl} = window.config
  179. const finalState = [
  180. "STOPPED",
  181. "CREATE_FAILED",
  182. "UNAVAILABLE",
  183. "DELETED",
  184. "RESIZE_FAILED",
  185. "SUCCEEDED",
  186. "IMAGE_FAILED",
  187. "SUBMIT_FAILED",
  188. "DELETE_FAILED",
  189. "KILLED",
  190. "COMPLETED",
  191. "FAILED",
  192. "CANCELED",
  193. "LOST",
  194. "START_FAILED",
  195. "SUBMIT_MODEL_FAILED",
  196. "DEPLOY_SERVICE_FAILED",
  197. "CHECK_FAILED",
  198. "STOPPING"
  199. ];
  200. export default {
  201. data() {
  202. return {
  203. dialogVisible: false,
  204. selectIndex: 0,
  205. slideActive:true,
  206. initSelect:true,
  207. notebookInfo:{specCpu:{acc_cards_num:0},specGpu:{acc_cards_num:0},specNpu:{acc_cards_num:0}},
  208. fileInfo:{
  209. file:'',
  210. branch_name:'',
  211. owner_name:'',
  212. project_name:'',
  213. sign_name:''
  214. },
  215. btnStatus:{0:0,1:0,2:0},
  216. alertCb:false,
  217. deubgUrlNpu:'',
  218. deubgUrlGpu:'',
  219. deubgUrlNpuStop:'',
  220. deubgUrlGpuStop:'',
  221. loading:false,
  222. activeLoadFirst:true
  223. };
  224. },
  225. methods: {
  226. handleClose(done) {
  227. this.initSelect = true
  228. this.alertCb = false
  229. },
  230. selectResource(index) {
  231. this.getNotebookInfo()
  232. if(index==this.selectIndex){
  233. return
  234. }
  235. if(index>this.selectIndex && this.selectIndex!==1){
  236. this.slideActive = true
  237. }else if(index<this.selectIndex && index==1){
  238. this.slideActive = true
  239. }else{
  240. this.slideActive = false
  241. }
  242. this.selectIndex = index;
  243. this.initSelect = false
  244. this.alertCb = false
  245. },
  246. getNotebookInfo(){
  247. if(this.activeLoadFirst){
  248. this.loading = true
  249. }
  250. getFileNotebook().then((res)=>{
  251. if(res.data.code==0){
  252. this.notebookInfo = res.data
  253. }else{
  254. Message.error(res.data.message)
  255. }
  256. this.loading = false
  257. this.activeLoadFirst = false
  258. }).catch((err)=>{
  259. Message.error(err)
  260. this.loading = false
  261. this.activeLoadFirst = false
  262. })
  263. },
  264. getCb1NotebookInfo(path,id,index,data){
  265. getCb1Notebook(path,id).then((res)=>{
  266. if(res.status===200){
  267. if(res.data.JobStatus==="RUNNING"){
  268. let fileData = {job_id:id,...data}
  269. timerCb3 = setInterval(() => {
  270. setTimeout(this.getFileInfoReadyNotebook(fileData,index), 0)
  271. }, 10000)
  272. clearInterval(timerCb1)
  273. }
  274. if(finalState.includes(res.data.JobStatus)){
  275. this.btnStatus[index] = 0
  276. clearInterval(timerCb1)
  277. }
  278. }
  279. }).catch((err)=>{
  280. this.btnStatus[index]=0
  281. clearInterval(timerCb1)
  282. Message.error(err)
  283. })
  284. },
  285. getCb2NotebookInfo(path,id,data){
  286. getCb2Notebook(path,id).then((res)=>{
  287. if(res.status===200){
  288. if(res.data.JobStatus==="RUNNING"){
  289. let fileData = {job_id:id,...data}
  290. timerCb3 = setInterval(() => {
  291. setTimeout(this.getFileInfoReadyNotebook(fileData,2), 0)
  292. }, 10000)
  293. // this.btnStatus[2]=2
  294. // this.deubgUrlNpu = `${AppSubUrl}/${this.fileInfo.sign_name}/${this.notebookInfo.projectName}/modelarts/notebook/${id}/debug`
  295. // this.deubgUrlNpuStop = `${AppSubUrl}/${this.fileInfo.sign_name}/${this.notebookInfo.projectName}/modelarts/notebook/${id}/stop`
  296. clearInterval(timerCb2)
  297. }
  298. if(finalState.includes(res.data.JobStatus)){
  299. this.btnStatus[2] = 0
  300. clearInterval(timerCb2)
  301. }
  302. }
  303. }).catch((err)=>{
  304. this.btnStatus[index]=0
  305. clearInterval(timerCb2)
  306. Message.error(err)
  307. })
  308. },
  309. getFileInfoReadyNotebook(data,index){
  310. getFileInfoNotebook(data).then((res)=>{
  311. console.log(res)
  312. if(res.data.code===0){
  313. if(index===2){
  314. this.btnStatus[2]=2
  315. this.deubgUrlNpu = `${AppSubUrl}/${this.fileInfo.sign_name}/${this.notebookInfo.projectName}/modelarts/notebook/${data.job_id}/debug?file=${this.fileInfo.owner_name}/${this.fileInfo.project_name}/${this.fileInfo.file}`
  316. this.deubgUrlNpuStop = `${AppSubUrl}/${this.fileInfo.sign_name}/${this.notebookInfo.projectName}/modelarts/notebook/${data.job_id}/stop`
  317. }else{
  318. this.btnStatus[index]=2
  319. this.deubgUrlGpu = `${AppSubUrl}/${this.fileInfo.sign_name}/${this.notebookInfo.projectName}/cloudbrain/${data.job_id}/debug?file=${this.fileInfo.owner_name}/${this.fileInfo.project_name}/${this.fileInfo.file}`
  320. this.deubgUrlGpuStop = `${AppSubUrl}/${this.fileInfo.sign_name}/${this.notebookInfo.projectName}/cloudbrain/${data.job_id}/stop`
  321. }
  322. clearInterval(timerCb3)
  323. }
  324. }).catch((err)=>{
  325. this.btnStatus[index]=0
  326. clearInterval(timerCb3)
  327. Message.error(err)
  328. })
  329. },
  330. stopDebug(index){
  331. this.btnStatus[index]=3
  332. let url = index===2 ? this.deubgUrlNpuStop :this.deubgUrlGpuStop
  333. stopNotebook(url).then((res)=>{
  334. if(res.data.result_code==='0'){
  335. this.btnStatus[index]=0
  336. Message.success(this.$t("notebook.stopSuccess"))
  337. }else{
  338. this.btnStatus[index]=0
  339. Message.error(res.data.error_msg)
  340. }
  341. }).catch((err)=>{
  342. this.btnStatus[index]=0
  343. Message.error(err)
  344. })
  345. },
  346. createTask(index){
  347. this.btnStatus[index]=1
  348. const data = {type:index,...this.fileInfo}
  349. let repoPath = `repos/${this.fileInfo.owner_name}/${this.fileInfo.project_name}`
  350. createNotebook(data).then((res)=>{
  351. if(res.data.code===0 && res.status===200){
  352. if(index===2){
  353. timerCb2 = setInterval(() => {
  354. setTimeout(this.getCb2NotebookInfo(repoPath,res.data.message,data), 0)
  355. }, 10000)
  356. }else{
  357. timerCb1 = setInterval(() => {
  358. setTimeout(this.getCb1NotebookInfo(repoPath,res.data.message,index,data), 0)
  359. }, 10000)
  360. }
  361. this.alertCb = false
  362. }else if(res.data.code==2){
  363. this.btnStatus[index]=0
  364. this.alertCb = true
  365. }else{
  366. this.btnStatus[index]=0
  367. Message.error(res.data.message)
  368. }
  369. }).catch((err)=>{
  370. if(err.response.status===403 && err.response.data.code===1 ){
  371. location.href=`${AppSubUrl}/authentication/wechat/bind`
  372. }
  373. if(err.response.status===401){
  374. location.href=`${AppSubUrl}/user/login?redirect_to=${location.origin}${location.pathname}?type=login`
  375. return
  376. }
  377. this.btnStatus[index]=0
  378. this.alertCb = false
  379. Message.error(err)
  380. })
  381. }
  382. },
  383. computed: {
  384. cpuSpec(){
  385. let cpu_spec = `${this.$t("notebook.specification")}:GPU: ${this.notebookInfo.specCpu.acc_cards_num}*${this.notebookInfo.specCpu.acc_card_type}, CPU: ${this.notebookInfo.specCpu.cpu_cores}`
  386. if(this.notebookInfo.specCpu.gpu_mem_gi_b!==0){
  387. cpu_spec += `, ${this.$t("notebook.graphicMemory")}: ${this.notebookInfo.specCpu.gpu_mem_gi_b}GB`
  388. }
  389. if(this.notebookInfo.specCpu.mem_gi_b!==0){
  390. cpu_spec += `, ${this.$t("notebook.memory")}: ${this.notebookInfo.specCpu.mem_gi_b}GB`
  391. }
  392. if(this.notebookInfo.specCpu.share_mem_gi_b!==0){
  393. cpu_spec += `, ${this.$t("notebook.sharedMemory")}: ${this.notebookInfo.specCpu.share_mem_gi_b}GB`
  394. }
  395. return cpu_spec
  396. },
  397. npuSpec(){
  398. let acc_card_type = ''
  399. if(this.notebookInfo.specNpu.acc_card_type==="ASCEND910"){
  400. acc_card_type = "Ascend 910"
  401. }
  402. let npu_spec = `${this.$t("notebook.specification")}:NPU: ${this.notebookInfo.specNpu.acc_cards_num}*${acc_card_type}, CPU: ${this.notebookInfo.specNpu.cpu_cores}`
  403. if(this.notebookInfo.specNpu.gpu_mem_gi_b!==0){
  404. npu_spec += `, ${this.$t("notebook.graphicMemory")}: ${this.notebookInfo.specNpu.gpu_mem_gi_b}GB`
  405. }
  406. if(this.notebookInfo.specNpu.mem_gi_b!==0){
  407. npu_spec += `, ${this.$t("notebook.memory")}: ${this.notebookInfo.specNpu.mem_gi_b}GB`
  408. }
  409. if(this.notebookInfo.specNpu.share_mem_gi_b!==0){
  410. npu_spec += `, ${this.$t("notebook.sharedMemory")}: ${this.notebookInfo.specNpu.share_mem_gi_b}GB`
  411. }
  412. return npu_spec
  413. },
  414. gpuSpec(){
  415. let gpu_spec = `${this.$t("notebook.specification")}:GPU: ${this.notebookInfo.specGpu.acc_cards_num}*${this.notebookInfo.specGpu.acc_card_type}, CPU: ${this.notebookInfo.specGpu.cpu_cores}`
  416. if(this.notebookInfo.specGpu.gpu_mem_gi_b!==0){
  417. gpu_spec += `, ${this.$t("notebook.graphicMemory")}: ${this.notebookInfo.specGpu.gpu_mem_gi_b}GB`
  418. }
  419. if(this.notebookInfo.specGpu.mem_gi_b!==0){
  420. gpu_spec += `, ${this.$t("notebook.memory")}: ${this.notebookInfo.specGpu.mem_gi_b}GB`
  421. }
  422. if(this.notebookInfo.specGpu.share_mem_gi_b!==0){
  423. gpu_spec += `, ${this.$t("notebook.sharedMemory")}: ${this.notebookInfo.specGpu.share_mem_gi_b}GB`
  424. }
  425. return gpu_spec
  426. }
  427. },
  428. beforeDestroy() {
  429. clearInterval(timerCb1)
  430. clearInterval(timerCb2)
  431. },
  432. mounted() {
  433. const selfData = document.querySelector('#__vue-self-data')
  434. this.fileInfo.file = selfData.getAttribute('data-file')
  435. this.fileInfo.branch_name = selfData.getAttribute('data-branch')
  436. this.fileInfo.owner_name = selfData.getAttribute('data-owner')
  437. this.fileInfo.project_name = selfData.getAttribute('data-project')
  438. this.fileInfo.sign_name = selfData.getAttribute('data-name')
  439. let that = this;
  440. if(new URLSearchParams(window.location.search).get("type")==='login'){
  441. that.getNotebookInfo()
  442. that.dialogVisible = true;
  443. }
  444. document
  445. .querySelector("#notebook-debug")
  446. .addEventListener("click", function () {
  447. that.getNotebookInfo()
  448. that.dialogVisible = true;
  449. });
  450. },
  451. };
  452. </script>
  453. <style scoped lang="less">
  454. /deep/ .el-dialog__header {
  455. text-align: left;
  456. height: 45px;
  457. background: rgb(240, 240, 240);
  458. border-radius: 5px 5px 0px 0px;
  459. border-bottom: 1px solid rgb(212, 212, 213);
  460. padding: 0 15px;
  461. display: flex;
  462. align-items: center;
  463. font-weight: 500;
  464. font-size: 16px;
  465. color: rgb(16, 16, 16);
  466. font-family: Roboto;
  467. .el-dialog__title {
  468. font-weight: 600;
  469. font-size: 15px;
  470. color: rgb(16, 16, 16);
  471. }
  472. .el-dialog__headerbtn {
  473. top: 15px;
  474. right: 15px;
  475. }
  476. }
  477. /deep/ .el-dialog__body {
  478. padding: 55px 15px 0 15px;
  479. }
  480. .wrapper {
  481. width: 100%;
  482. .active {
  483. background: linear-gradient(
  484. 269.2deg,
  485. rgba(183, 247, 255, 0.5) 0%,
  486. rgba(233, 233, 255, 0) 78.67%
  487. );
  488. border-radius: 5px 5px 0px 0px;
  489. }
  490. .text-tip{
  491. color: #888;
  492. font-size: 12px;
  493. }
  494. .text-tip::before{
  495. content: '*';
  496. color: #f2711c;
  497. }
  498. .alert-info{
  499. width: 70%;
  500. background-color: rgba(242, 113, 28, 0.05);
  501. border: 1px solid rgb(242, 113, 28);
  502. border-radius: 5px;
  503. margin: 0 auto;
  504. padding-bottom: 10px;
  505. }
  506. & >.three-resource-type:nth-child(2){
  507. border:none;
  508. }
  509. .three-resource-type {
  510. width: 70%;
  511. margin: 0 auto;
  512. display: flex;
  513. border-top: 1px solid rgba(16, 16, 16, 0.1);
  514. cursor: pointer;
  515. .resource-child-node {
  516. display: flex;
  517. align-items: center;
  518. width: 100%;
  519. height: 115px;
  520. .resource-type-icon {
  521. width: 50px;
  522. height: 50px;
  523. line-height: 20px;
  524. border-radius: 25px;
  525. text-align: center;
  526. display: flex;
  527. align-items: center;
  528. justify-content: center;
  529. flex-shrink: 0;
  530. .text {
  531. font-size: 26px;
  532. color: rgba(251, 251, 251, 1);
  533. font-family: ZKXiaoWeiLogo-regular;
  534. }
  535. }
  536. .background-C {
  537. background: linear-gradient(
  538. 134.2deg,
  539. rgba(130, 209, 246, 1) 0%,
  540. rgba(41, 182, 244, 1) 51.94%,
  541. rgba(0, 137, 205, 1) 102.83%
  542. );
  543. }
  544. .background-N {
  545. background: linear-gradient(
  546. 151.47deg,
  547. rgba(123, 50, 178, 1) 20.02%,
  548. rgba(64, 26, 93, 1) 100%
  549. );
  550. }
  551. .background-G {
  552. background: linear-gradient(
  553. -25.25deg,
  554. rgba(254, 86, 77, 1) 9.3%,
  555. rgba(251, 155, 54, 1) 38.86%,
  556. rgba(249, 202, 38, 1) 67.95%
  557. );
  558. }
  559. }
  560. .resource-type-detail {
  561. margin-left: 23px;
  562. .detail-title {
  563. font-family: SourceHanSansSC;
  564. font-weight: 500;
  565. font-size: 16px;
  566. color: rgb(16, 16, 16);
  567. font-style: normal;
  568. letter-spacing: 0px;
  569. line-height: 32px;
  570. text-decoration: none;
  571. }
  572. .detail-spec {
  573. font-family: SourceHanSansSC;
  574. font-weight: 400;
  575. font-size: 14px;
  576. color: rgba(136, 136, 136, 1);
  577. font-style: normal;
  578. letter-spacing: 0px;
  579. line-height: 24px;
  580. text-decoration: none;
  581. }
  582. }
  583. .resource-select {
  584. margin-left: auto;
  585. margin-right: 20px;
  586. font-size: 20px;
  587. height: 100%;
  588. display: flex;
  589. align-items: center;
  590. .green {
  591. color: green;
  592. }
  593. .gray {
  594. color: rgba(16, 16, 16, 0.1);
  595. }
  596. }
  597. }
  598. .resource-footer {
  599. margin-top: 40px;
  600. border-top: 1px solid rgba(16, 16, 16, 0.1);
  601. height: 71px;
  602. display: flex;
  603. align-items: center;
  604. .resource-operate {
  605. display: flex;
  606. align-items: center;
  607. .text{
  608. color: #101010;
  609. margin-left: 20px;
  610. }
  611. }
  612. }
  613. .slide-in-top {
  614. -webkit-animation: slide-in-top 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  615. animation: slide-in-top 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  616. }
  617. .slide-in-bottom {
  618. -webkit-animation: slide-in-bottom 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  619. animation: slide-in-bottom 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  620. }
  621. .fade-out {
  622. -webkit-animation: fade-in 1.2s cubic-bezier(0.39, 0.575, 0.565, 1) both;
  623. animation: fade-in 1.2s cubic-bezier(0.39, 0.575, 0.565, 1) both;
  624. position: absolute
  625. }
  626. @-webkit-keyframes slide-in-top {
  627. 0% {
  628. -webkit-transform: translateY(-50px);
  629. transform: translateY(-50px);
  630. opacity: 0;
  631. }
  632. 100% {
  633. -webkit-transform: translateY(0);
  634. transform: translateY(0);
  635. opacity: 1;
  636. }
  637. }
  638. @keyframes slide-in-top {
  639. 0% {
  640. -webkit-transform: translateY(-50px);
  641. transform: translateY(-50px);
  642. opacity: 0;
  643. }
  644. 100% {
  645. -webkit-transform: translateY(0);
  646. transform: translateY(0);
  647. opacity: 1;
  648. }
  649. }
  650. @-webkit-keyframes slide-in-bottom {
  651. 0% {
  652. -webkit-transform: translateY(50px);
  653. transform: translateY(50px);
  654. opacity: 0;
  655. }
  656. 100% {
  657. -webkit-transform: translateY(0);
  658. transform: translateY(0);
  659. opacity: 1;
  660. }
  661. }
  662. @keyframes slide-in-bottom {
  663. 0% {
  664. -webkit-transform: translateY(50px);
  665. transform: translateY(50px);
  666. opacity: 0;
  667. }
  668. 100% {
  669. -webkit-transform: translateY(0);
  670. transform: translateY(0);
  671. opacity: 1;
  672. }
  673. }
  674. @-webkit-keyframes fade-in {
  675. 0% {
  676. opacity: 1;
  677. }
  678. 100% {
  679. opacity: 0;
  680. }
  681. }
  682. @keyframes fade-in {
  683. 0% {
  684. opacity: 1;
  685. }
  686. 100% {
  687. opacity: 0;
  688. }
  689. }
  690. }
  691. </style>